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.py
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
FromProto(const perfetto::protos::CommitDataRequest & proto)42 void CommitDataRequest::FromProto(
43 const perfetto::protos::CommitDataRequest& proto) {
44 chunks_to_move_.clear();
45 for (const auto& field : proto.chunks_to_move()) {
46 chunks_to_move_.emplace_back();
47 chunks_to_move_.back().FromProto(field);
48 }
49
50 chunks_to_patch_.clear();
51 for (const auto& field : proto.chunks_to_patch()) {
52 chunks_to_patch_.emplace_back();
53 chunks_to_patch_.back().FromProto(field);
54 }
55
56 static_assert(sizeof(flush_request_id_) == sizeof(proto.flush_request_id()),
57 "size mismatch");
58 flush_request_id_ =
59 static_cast<decltype(flush_request_id_)>(proto.flush_request_id());
60 unknown_fields_ = proto.unknown_fields();
61 }
62
ToProto(perfetto::protos::CommitDataRequest * proto) const63 void CommitDataRequest::ToProto(
64 perfetto::protos::CommitDataRequest* proto) const {
65 proto->Clear();
66
67 for (const auto& it : chunks_to_move_) {
68 auto* entry = proto->add_chunks_to_move();
69 it.ToProto(entry);
70 }
71
72 for (const auto& it : chunks_to_patch_) {
73 auto* entry = proto->add_chunks_to_patch();
74 it.ToProto(entry);
75 }
76
77 static_assert(sizeof(flush_request_id_) == sizeof(proto->flush_request_id()),
78 "size mismatch");
79 proto->set_flush_request_id(
80 static_cast<decltype(proto->flush_request_id())>(flush_request_id_));
81 *(proto->mutable_unknown_fields()) = unknown_fields_;
82 }
83
84 CommitDataRequest::ChunksToMove::ChunksToMove() = default;
85 CommitDataRequest::ChunksToMove::~ChunksToMove() = default;
86 CommitDataRequest::ChunksToMove::ChunksToMove(
87 const CommitDataRequest::ChunksToMove&) = default;
88 CommitDataRequest::ChunksToMove& CommitDataRequest::ChunksToMove::operator=(
89 const CommitDataRequest::ChunksToMove&) = default;
90 CommitDataRequest::ChunksToMove::ChunksToMove(
91 CommitDataRequest::ChunksToMove&&) noexcept = default;
92 CommitDataRequest::ChunksToMove& CommitDataRequest::ChunksToMove::operator=(
93 CommitDataRequest::ChunksToMove&&) = default;
94
FromProto(const perfetto::protos::CommitDataRequest_ChunksToMove & proto)95 void CommitDataRequest::ChunksToMove::FromProto(
96 const perfetto::protos::CommitDataRequest_ChunksToMove& proto) {
97 static_assert(sizeof(page_) == sizeof(proto.page()), "size mismatch");
98 page_ = static_cast<decltype(page_)>(proto.page());
99
100 static_assert(sizeof(chunk_) == sizeof(proto.chunk()), "size mismatch");
101 chunk_ = static_cast<decltype(chunk_)>(proto.chunk());
102
103 static_assert(sizeof(target_buffer_) == sizeof(proto.target_buffer()),
104 "size mismatch");
105 target_buffer_ = static_cast<decltype(target_buffer_)>(proto.target_buffer());
106 unknown_fields_ = proto.unknown_fields();
107 }
108
ToProto(perfetto::protos::CommitDataRequest_ChunksToMove * proto) const109 void CommitDataRequest::ChunksToMove::ToProto(
110 perfetto::protos::CommitDataRequest_ChunksToMove* proto) const {
111 proto->Clear();
112
113 static_assert(sizeof(page_) == sizeof(proto->page()), "size mismatch");
114 proto->set_page(static_cast<decltype(proto->page())>(page_));
115
116 static_assert(sizeof(chunk_) == sizeof(proto->chunk()), "size mismatch");
117 proto->set_chunk(static_cast<decltype(proto->chunk())>(chunk_));
118
119 static_assert(sizeof(target_buffer_) == sizeof(proto->target_buffer()),
120 "size mismatch");
121 proto->set_target_buffer(
122 static_cast<decltype(proto->target_buffer())>(target_buffer_));
123 *(proto->mutable_unknown_fields()) = unknown_fields_;
124 }
125
126 CommitDataRequest::ChunkToPatch::ChunkToPatch() = default;
127 CommitDataRequest::ChunkToPatch::~ChunkToPatch() = default;
128 CommitDataRequest::ChunkToPatch::ChunkToPatch(
129 const CommitDataRequest::ChunkToPatch&) = default;
130 CommitDataRequest::ChunkToPatch& CommitDataRequest::ChunkToPatch::operator=(
131 const CommitDataRequest::ChunkToPatch&) = default;
132 CommitDataRequest::ChunkToPatch::ChunkToPatch(
133 CommitDataRequest::ChunkToPatch&&) noexcept = default;
134 CommitDataRequest::ChunkToPatch& CommitDataRequest::ChunkToPatch::operator=(
135 CommitDataRequest::ChunkToPatch&&) = default;
136
FromProto(const perfetto::protos::CommitDataRequest_ChunkToPatch & proto)137 void CommitDataRequest::ChunkToPatch::FromProto(
138 const perfetto::protos::CommitDataRequest_ChunkToPatch& proto) {
139 static_assert(sizeof(target_buffer_) == sizeof(proto.target_buffer()),
140 "size mismatch");
141 target_buffer_ = static_cast<decltype(target_buffer_)>(proto.target_buffer());
142
143 static_assert(sizeof(writer_id_) == sizeof(proto.writer_id()),
144 "size mismatch");
145 writer_id_ = static_cast<decltype(writer_id_)>(proto.writer_id());
146
147 static_assert(sizeof(chunk_id_) == sizeof(proto.chunk_id()), "size mismatch");
148 chunk_id_ = static_cast<decltype(chunk_id_)>(proto.chunk_id());
149
150 patches_.clear();
151 for (const auto& field : proto.patches()) {
152 patches_.emplace_back();
153 patches_.back().FromProto(field);
154 }
155
156 static_assert(sizeof(has_more_patches_) == sizeof(proto.has_more_patches()),
157 "size mismatch");
158 has_more_patches_ =
159 static_cast<decltype(has_more_patches_)>(proto.has_more_patches());
160 unknown_fields_ = proto.unknown_fields();
161 }
162
ToProto(perfetto::protos::CommitDataRequest_ChunkToPatch * proto) const163 void CommitDataRequest::ChunkToPatch::ToProto(
164 perfetto::protos::CommitDataRequest_ChunkToPatch* proto) const {
165 proto->Clear();
166
167 static_assert(sizeof(target_buffer_) == sizeof(proto->target_buffer()),
168 "size mismatch");
169 proto->set_target_buffer(
170 static_cast<decltype(proto->target_buffer())>(target_buffer_));
171
172 static_assert(sizeof(writer_id_) == sizeof(proto->writer_id()),
173 "size mismatch");
174 proto->set_writer_id(static_cast<decltype(proto->writer_id())>(writer_id_));
175
176 static_assert(sizeof(chunk_id_) == sizeof(proto->chunk_id()),
177 "size mismatch");
178 proto->set_chunk_id(static_cast<decltype(proto->chunk_id())>(chunk_id_));
179
180 for (const auto& it : patches_) {
181 auto* entry = proto->add_patches();
182 it.ToProto(entry);
183 }
184
185 static_assert(sizeof(has_more_patches_) == sizeof(proto->has_more_patches()),
186 "size mismatch");
187 proto->set_has_more_patches(
188 static_cast<decltype(proto->has_more_patches())>(has_more_patches_));
189 *(proto->mutable_unknown_fields()) = unknown_fields_;
190 }
191
192 CommitDataRequest::ChunkToPatch::Patch::Patch() = default;
193 CommitDataRequest::ChunkToPatch::Patch::~Patch() = default;
194 CommitDataRequest::ChunkToPatch::Patch::Patch(
195 const CommitDataRequest::ChunkToPatch::Patch&) = default;
196 CommitDataRequest::ChunkToPatch::Patch& CommitDataRequest::ChunkToPatch::Patch::
197 operator=(const CommitDataRequest::ChunkToPatch::Patch&) = default;
198 CommitDataRequest::ChunkToPatch::Patch::Patch(
199 CommitDataRequest::ChunkToPatch::Patch&&) noexcept = default;
200 CommitDataRequest::ChunkToPatch::Patch& CommitDataRequest::ChunkToPatch::Patch::
201 operator=(CommitDataRequest::ChunkToPatch::Patch&&) = default;
202
FromProto(const perfetto::protos::CommitDataRequest_ChunkToPatch_Patch & proto)203 void CommitDataRequest::ChunkToPatch::Patch::FromProto(
204 const perfetto::protos::CommitDataRequest_ChunkToPatch_Patch& proto) {
205 static_assert(sizeof(offset_) == sizeof(proto.offset()), "size mismatch");
206 offset_ = static_cast<decltype(offset_)>(proto.offset());
207
208 static_assert(sizeof(data_) == sizeof(proto.data()), "size mismatch");
209 data_ = static_cast<decltype(data_)>(proto.data());
210 unknown_fields_ = proto.unknown_fields();
211 }
212
ToProto(perfetto::protos::CommitDataRequest_ChunkToPatch_Patch * proto) const213 void CommitDataRequest::ChunkToPatch::Patch::ToProto(
214 perfetto::protos::CommitDataRequest_ChunkToPatch_Patch* proto) const {
215 proto->Clear();
216
217 static_assert(sizeof(offset_) == sizeof(proto->offset()), "size mismatch");
218 proto->set_offset(static_cast<decltype(proto->offset())>(offset_));
219
220 static_assert(sizeof(data_) == sizeof(proto->data()), "size mismatch");
221 proto->set_data(static_cast<decltype(proto->data())>(data_));
222 *(proto->mutable_unknown_fields()) = unknown_fields_;
223 }
224
225 } // namespace perfetto
226