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/commit_data_request.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/commit_data_request.h"
29 
30 #include "perfetto/common/commit_data_request.pb.h"
31 
32 namespace perfetto {
33 
34 CommitDataRequest::CommitDataRequest() = default;
35 CommitDataRequest::~CommitDataRequest() = default;
36 CommitDataRequest::CommitDataRequest(const CommitDataRequest&) = default;
37 CommitDataRequest& CommitDataRequest::operator=(const CommitDataRequest&) =
38     default;
39 CommitDataRequest::CommitDataRequest(CommitDataRequest&&) noexcept = default;
40 CommitDataRequest& CommitDataRequest::operator=(CommitDataRequest&&) = default;
41 
42 #pragma GCC diagnostic push
43 #pragma GCC diagnostic ignored "-Wfloat-equal"
operator ==(const CommitDataRequest & other) const44 bool CommitDataRequest::operator==(const CommitDataRequest& other) const {
45   return (chunks_to_move_ == other.chunks_to_move_) &&
46          (chunks_to_patch_ == other.chunks_to_patch_) &&
47          (flush_request_id_ == other.flush_request_id_);
48 }
49 #pragma GCC diagnostic pop
50 
FromProto(const perfetto::protos::CommitDataRequest & proto)51 void CommitDataRequest::FromProto(
52     const perfetto::protos::CommitDataRequest& proto) {
53   chunks_to_move_.clear();
54   for (const auto& field : proto.chunks_to_move()) {
55     chunks_to_move_.emplace_back();
56     chunks_to_move_.back().FromProto(field);
57   }
58 
59   chunks_to_patch_.clear();
60   for (const auto& field : proto.chunks_to_patch()) {
61     chunks_to_patch_.emplace_back();
62     chunks_to_patch_.back().FromProto(field);
63   }
64 
65   static_assert(sizeof(flush_request_id_) == sizeof(proto.flush_request_id()),
66                 "size mismatch");
67   flush_request_id_ =
68       static_cast<decltype(flush_request_id_)>(proto.flush_request_id());
69   unknown_fields_ = proto.unknown_fields();
70 }
71 
ToProto(perfetto::protos::CommitDataRequest * proto) const72 void CommitDataRequest::ToProto(
73     perfetto::protos::CommitDataRequest* proto) const {
74   proto->Clear();
75 
76   for (const auto& it : chunks_to_move_) {
77     auto* entry = proto->add_chunks_to_move();
78     it.ToProto(entry);
79   }
80 
81   for (const auto& it : chunks_to_patch_) {
82     auto* entry = proto->add_chunks_to_patch();
83     it.ToProto(entry);
84   }
85 
86   static_assert(sizeof(flush_request_id_) == sizeof(proto->flush_request_id()),
87                 "size mismatch");
88   proto->set_flush_request_id(
89       static_cast<decltype(proto->flush_request_id())>(flush_request_id_));
90   *(proto->mutable_unknown_fields()) = unknown_fields_;
91 }
92 
93 CommitDataRequest::ChunksToMove::ChunksToMove() = default;
94 CommitDataRequest::ChunksToMove::~ChunksToMove() = default;
95 CommitDataRequest::ChunksToMove::ChunksToMove(
96     const CommitDataRequest::ChunksToMove&) = default;
97 CommitDataRequest::ChunksToMove& CommitDataRequest::ChunksToMove::operator=(
98     const CommitDataRequest::ChunksToMove&) = default;
99 CommitDataRequest::ChunksToMove::ChunksToMove(
100     CommitDataRequest::ChunksToMove&&) noexcept = default;
101 CommitDataRequest::ChunksToMove& CommitDataRequest::ChunksToMove::operator=(
102     CommitDataRequest::ChunksToMove&&) = default;
103 
104 #pragma GCC diagnostic push
105 #pragma GCC diagnostic ignored "-Wfloat-equal"
operator ==(const CommitDataRequest::ChunksToMove & other) const106 bool CommitDataRequest::ChunksToMove::operator==(
107     const CommitDataRequest::ChunksToMove& other) const {
108   return (page_ == other.page_) && (chunk_ == other.chunk_) &&
109          (target_buffer_ == other.target_buffer_);
110 }
111 #pragma GCC diagnostic pop
112 
FromProto(const perfetto::protos::CommitDataRequest_ChunksToMove & proto)113 void CommitDataRequest::ChunksToMove::FromProto(
114     const perfetto::protos::CommitDataRequest_ChunksToMove& proto) {
115   static_assert(sizeof(page_) == sizeof(proto.page()), "size mismatch");
116   page_ = static_cast<decltype(page_)>(proto.page());
117 
118   static_assert(sizeof(chunk_) == sizeof(proto.chunk()), "size mismatch");
119   chunk_ = static_cast<decltype(chunk_)>(proto.chunk());
120 
121   static_assert(sizeof(target_buffer_) == sizeof(proto.target_buffer()),
122                 "size mismatch");
123   target_buffer_ = static_cast<decltype(target_buffer_)>(proto.target_buffer());
124   unknown_fields_ = proto.unknown_fields();
125 }
126 
ToProto(perfetto::protos::CommitDataRequest_ChunksToMove * proto) const127 void CommitDataRequest::ChunksToMove::ToProto(
128     perfetto::protos::CommitDataRequest_ChunksToMove* proto) const {
129   proto->Clear();
130 
131   static_assert(sizeof(page_) == sizeof(proto->page()), "size mismatch");
132   proto->set_page(static_cast<decltype(proto->page())>(page_));
133 
134   static_assert(sizeof(chunk_) == sizeof(proto->chunk()), "size mismatch");
135   proto->set_chunk(static_cast<decltype(proto->chunk())>(chunk_));
136 
137   static_assert(sizeof(target_buffer_) == sizeof(proto->target_buffer()),
138                 "size mismatch");
139   proto->set_target_buffer(
140       static_cast<decltype(proto->target_buffer())>(target_buffer_));
141   *(proto->mutable_unknown_fields()) = unknown_fields_;
142 }
143 
144 CommitDataRequest::ChunkToPatch::ChunkToPatch() = default;
145 CommitDataRequest::ChunkToPatch::~ChunkToPatch() = default;
146 CommitDataRequest::ChunkToPatch::ChunkToPatch(
147     const CommitDataRequest::ChunkToPatch&) = default;
148 CommitDataRequest::ChunkToPatch& CommitDataRequest::ChunkToPatch::operator=(
149     const CommitDataRequest::ChunkToPatch&) = default;
150 CommitDataRequest::ChunkToPatch::ChunkToPatch(
151     CommitDataRequest::ChunkToPatch&&) noexcept = default;
152 CommitDataRequest::ChunkToPatch& CommitDataRequest::ChunkToPatch::operator=(
153     CommitDataRequest::ChunkToPatch&&) = default;
154 
155 #pragma GCC diagnostic push
156 #pragma GCC diagnostic ignored "-Wfloat-equal"
operator ==(const CommitDataRequest::ChunkToPatch & other) const157 bool CommitDataRequest::ChunkToPatch::operator==(
158     const CommitDataRequest::ChunkToPatch& other) const {
159   return (target_buffer_ == other.target_buffer_) &&
160          (writer_id_ == other.writer_id_) && (chunk_id_ == other.chunk_id_) &&
161          (patches_ == other.patches_) &&
162          (has_more_patches_ == other.has_more_patches_);
163 }
164 #pragma GCC diagnostic pop
165 
FromProto(const perfetto::protos::CommitDataRequest_ChunkToPatch & proto)166 void CommitDataRequest::ChunkToPatch::FromProto(
167     const perfetto::protos::CommitDataRequest_ChunkToPatch& proto) {
168   static_assert(sizeof(target_buffer_) == sizeof(proto.target_buffer()),
169                 "size mismatch");
170   target_buffer_ = static_cast<decltype(target_buffer_)>(proto.target_buffer());
171 
172   static_assert(sizeof(writer_id_) == sizeof(proto.writer_id()),
173                 "size mismatch");
174   writer_id_ = static_cast<decltype(writer_id_)>(proto.writer_id());
175 
176   static_assert(sizeof(chunk_id_) == sizeof(proto.chunk_id()), "size mismatch");
177   chunk_id_ = static_cast<decltype(chunk_id_)>(proto.chunk_id());
178 
179   patches_.clear();
180   for (const auto& field : proto.patches()) {
181     patches_.emplace_back();
182     patches_.back().FromProto(field);
183   }
184 
185   static_assert(sizeof(has_more_patches_) == sizeof(proto.has_more_patches()),
186                 "size mismatch");
187   has_more_patches_ =
188       static_cast<decltype(has_more_patches_)>(proto.has_more_patches());
189   unknown_fields_ = proto.unknown_fields();
190 }
191 
ToProto(perfetto::protos::CommitDataRequest_ChunkToPatch * proto) const192 void CommitDataRequest::ChunkToPatch::ToProto(
193     perfetto::protos::CommitDataRequest_ChunkToPatch* proto) const {
194   proto->Clear();
195 
196   static_assert(sizeof(target_buffer_) == sizeof(proto->target_buffer()),
197                 "size mismatch");
198   proto->set_target_buffer(
199       static_cast<decltype(proto->target_buffer())>(target_buffer_));
200 
201   static_assert(sizeof(writer_id_) == sizeof(proto->writer_id()),
202                 "size mismatch");
203   proto->set_writer_id(static_cast<decltype(proto->writer_id())>(writer_id_));
204 
205   static_assert(sizeof(chunk_id_) == sizeof(proto->chunk_id()),
206                 "size mismatch");
207   proto->set_chunk_id(static_cast<decltype(proto->chunk_id())>(chunk_id_));
208 
209   for (const auto& it : patches_) {
210     auto* entry = proto->add_patches();
211     it.ToProto(entry);
212   }
213 
214   static_assert(sizeof(has_more_patches_) == sizeof(proto->has_more_patches()),
215                 "size mismatch");
216   proto->set_has_more_patches(
217       static_cast<decltype(proto->has_more_patches())>(has_more_patches_));
218   *(proto->mutable_unknown_fields()) = unknown_fields_;
219 }
220 
221 CommitDataRequest::ChunkToPatch::Patch::Patch() = default;
222 CommitDataRequest::ChunkToPatch::Patch::~Patch() = default;
223 CommitDataRequest::ChunkToPatch::Patch::Patch(
224     const CommitDataRequest::ChunkToPatch::Patch&) = default;
225 CommitDataRequest::ChunkToPatch::Patch& CommitDataRequest::ChunkToPatch::Patch::
226 operator=(const CommitDataRequest::ChunkToPatch::Patch&) = default;
227 CommitDataRequest::ChunkToPatch::Patch::Patch(
228     CommitDataRequest::ChunkToPatch::Patch&&) noexcept = default;
229 CommitDataRequest::ChunkToPatch::Patch& CommitDataRequest::ChunkToPatch::Patch::
230 operator=(CommitDataRequest::ChunkToPatch::Patch&&) = default;
231 
232 #pragma GCC diagnostic push
233 #pragma GCC diagnostic ignored "-Wfloat-equal"
operator ==(const CommitDataRequest::ChunkToPatch::Patch & other) const234 bool CommitDataRequest::ChunkToPatch::Patch::operator==(
235     const CommitDataRequest::ChunkToPatch::Patch& other) const {
236   return (offset_ == other.offset_) && (data_ == other.data_);
237 }
238 #pragma GCC diagnostic pop
239 
FromProto(const perfetto::protos::CommitDataRequest_ChunkToPatch_Patch & proto)240 void CommitDataRequest::ChunkToPatch::Patch::FromProto(
241     const perfetto::protos::CommitDataRequest_ChunkToPatch_Patch& proto) {
242   static_assert(sizeof(offset_) == sizeof(proto.offset()), "size mismatch");
243   offset_ = static_cast<decltype(offset_)>(proto.offset());
244 
245   static_assert(sizeof(data_) == sizeof(proto.data()), "size mismatch");
246   data_ = static_cast<decltype(data_)>(proto.data());
247   unknown_fields_ = proto.unknown_fields();
248 }
249 
ToProto(perfetto::protos::CommitDataRequest_ChunkToPatch_Patch * proto) const250 void CommitDataRequest::ChunkToPatch::Patch::ToProto(
251     perfetto::protos::CommitDataRequest_ChunkToPatch_Patch* proto) const {
252   proto->Clear();
253 
254   static_assert(sizeof(offset_) == sizeof(proto->offset()), "size mismatch");
255   proto->set_offset(static_cast<decltype(proto->offset())>(offset_));
256 
257   static_assert(sizeof(data_) == sizeof(proto->data()), "size mismatch");
258   proto->set_data(static_cast<decltype(proto->data())>(data_));
259   *(proto->mutable_unknown_fields()) = unknown_fields_;
260 }
261 
262 }  // namespace perfetto
263