1 /*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 /*******************************************************************************
18 * AUTOGENERATED - DO NOT EDIT
19 *******************************************************************************
20 * This file has been generated from the protobuf message
21 * perfetto/common/observable_events.proto
22 * by
23 * ../../tools/proto_to_cpp/proto_to_cpp.cc.
24 * If you need to make changes here, change the .proto file and then run
25 * ./tools/gen_tracing_cpp_headers_from_protos
26 */
27
28 #include "perfetto/tracing/core/observable_events.h"
29
30 #include "perfetto/common/observable_events.pb.h"
31
32 namespace perfetto {
33
34 ObservableEvents::ObservableEvents() = default;
35 ObservableEvents::~ObservableEvents() = default;
36 ObservableEvents::ObservableEvents(const ObservableEvents&) = default;
37 ObservableEvents& ObservableEvents::operator=(const ObservableEvents&) =
38 default;
39 ObservableEvents::ObservableEvents(ObservableEvents&&) noexcept = default;
40 ObservableEvents& ObservableEvents::operator=(ObservableEvents&&) = default;
41
42 #pragma GCC diagnostic push
43 #pragma GCC diagnostic ignored "-Wfloat-equal"
operator ==(const ObservableEvents & other) const44 bool ObservableEvents::operator==(const ObservableEvents& other) const {
45 return (instance_state_changes_ == other.instance_state_changes_);
46 }
47 #pragma GCC diagnostic pop
48
FromProto(const perfetto::protos::ObservableEvents & proto)49 void ObservableEvents::FromProto(
50 const perfetto::protos::ObservableEvents& proto) {
51 instance_state_changes_.clear();
52 for (const auto& field : proto.instance_state_changes()) {
53 instance_state_changes_.emplace_back();
54 instance_state_changes_.back().FromProto(field);
55 }
56 unknown_fields_ = proto.unknown_fields();
57 }
58
ToProto(perfetto::protos::ObservableEvents * proto) const59 void ObservableEvents::ToProto(
60 perfetto::protos::ObservableEvents* proto) const {
61 proto->Clear();
62
63 for (const auto& it : instance_state_changes_) {
64 auto* entry = proto->add_instance_state_changes();
65 it.ToProto(entry);
66 }
67 *(proto->mutable_unknown_fields()) = unknown_fields_;
68 }
69
70 ObservableEvents::DataSourceInstanceStateChange::
71 DataSourceInstanceStateChange() = default;
72 ObservableEvents::DataSourceInstanceStateChange::
73 ~DataSourceInstanceStateChange() = default;
74 ObservableEvents::DataSourceInstanceStateChange::DataSourceInstanceStateChange(
75 const ObservableEvents::DataSourceInstanceStateChange&) = default;
76 ObservableEvents::DataSourceInstanceStateChange&
77 ObservableEvents::DataSourceInstanceStateChange::operator=(
78 const ObservableEvents::DataSourceInstanceStateChange&) = default;
79 ObservableEvents::DataSourceInstanceStateChange::DataSourceInstanceStateChange(
80 ObservableEvents::DataSourceInstanceStateChange&&) noexcept = default;
81 ObservableEvents::DataSourceInstanceStateChange&
82 ObservableEvents::DataSourceInstanceStateChange::operator=(
83 ObservableEvents::DataSourceInstanceStateChange&&) = default;
84
85 #pragma GCC diagnostic push
86 #pragma GCC diagnostic ignored "-Wfloat-equal"
operator ==(const ObservableEvents::DataSourceInstanceStateChange & other) const87 bool ObservableEvents::DataSourceInstanceStateChange::operator==(
88 const ObservableEvents::DataSourceInstanceStateChange& other) const {
89 return (producer_name_ == other.producer_name_) &&
90 (data_source_name_ == other.data_source_name_) &&
91 (state_ == other.state_);
92 }
93 #pragma GCC diagnostic pop
94
FromProto(const perfetto::protos::ObservableEvents_DataSourceInstanceStateChange & proto)95 void ObservableEvents::DataSourceInstanceStateChange::FromProto(
96 const perfetto::protos::ObservableEvents_DataSourceInstanceStateChange&
97 proto) {
98 static_assert(sizeof(producer_name_) == sizeof(proto.producer_name()),
99 "size mismatch");
100 producer_name_ = static_cast<decltype(producer_name_)>(proto.producer_name());
101
102 static_assert(sizeof(data_source_name_) == sizeof(proto.data_source_name()),
103 "size mismatch");
104 data_source_name_ =
105 static_cast<decltype(data_source_name_)>(proto.data_source_name());
106
107 static_assert(sizeof(state_) == sizeof(proto.state()), "size mismatch");
108 state_ = static_cast<decltype(state_)>(proto.state());
109 unknown_fields_ = proto.unknown_fields();
110 }
111
ToProto(perfetto::protos::ObservableEvents_DataSourceInstanceStateChange * proto) const112 void ObservableEvents::DataSourceInstanceStateChange::ToProto(
113 perfetto::protos::ObservableEvents_DataSourceInstanceStateChange* proto)
114 const {
115 proto->Clear();
116
117 static_assert(sizeof(producer_name_) == sizeof(proto->producer_name()),
118 "size mismatch");
119 proto->set_producer_name(
120 static_cast<decltype(proto->producer_name())>(producer_name_));
121
122 static_assert(sizeof(data_source_name_) == sizeof(proto->data_source_name()),
123 "size mismatch");
124 proto->set_data_source_name(
125 static_cast<decltype(proto->data_source_name())>(data_source_name_));
126
127 static_assert(sizeof(state_) == sizeof(proto->state()), "size mismatch");
128 proto->set_state(static_cast<decltype(proto->state())>(state_));
129 *(proto->mutable_unknown_fields()) = unknown_fields_;
130 }
131
132 } // namespace perfetto
133