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 #ifndef INCLUDE_PERFETTO_TRACING_CORE_COMMIT_DATA_REQUEST_H_
29 #define INCLUDE_PERFETTO_TRACING_CORE_COMMIT_DATA_REQUEST_H_
30 
31 #include <stdint.h>
32 #include <string>
33 #include <type_traits>
34 #include <vector>
35 
36 #include "perfetto/base/export.h"
37 
38 // Forward declarations for protobuf types.
39 namespace perfetto {
40 namespace protos {
41 class CommitDataRequest;
42 class CommitDataRequest_ChunksToMove;
43 class CommitDataRequest_ChunkToPatch;
44 class CommitDataRequest_ChunkToPatch_Patch;
45 }  // namespace protos
46 }  // namespace perfetto
47 
48 namespace perfetto {
49 
50 class PERFETTO_EXPORT CommitDataRequest {
51  public:
52   class PERFETTO_EXPORT ChunksToMove {
53    public:
54     ChunksToMove();
55     ~ChunksToMove();
56     ChunksToMove(ChunksToMove&&) noexcept;
57     ChunksToMove& operator=(ChunksToMove&&);
58     ChunksToMove(const ChunksToMove&);
59     ChunksToMove& operator=(const ChunksToMove&);
60     bool operator==(const ChunksToMove&) const;
61     bool operator!=(const ChunksToMove& other) const {
62       return !(*this == other);
63     }
64 
65     // Conversion methods from/to the corresponding protobuf types.
66     void FromProto(const perfetto::protos::CommitDataRequest_ChunksToMove&);
67     void ToProto(perfetto::protos::CommitDataRequest_ChunksToMove*) const;
68 
page()69     uint32_t page() const { return page_; }
set_page(uint32_t value)70     void set_page(uint32_t value) { page_ = value; }
71 
chunk()72     uint32_t chunk() const { return chunk_; }
set_chunk(uint32_t value)73     void set_chunk(uint32_t value) { chunk_ = value; }
74 
target_buffer()75     uint32_t target_buffer() const { return target_buffer_; }
set_target_buffer(uint32_t value)76     void set_target_buffer(uint32_t value) { target_buffer_ = value; }
77 
78    private:
79     uint32_t page_ = {};
80     uint32_t chunk_ = {};
81     uint32_t target_buffer_ = {};
82 
83     // Allows to preserve unknown protobuf fields for compatibility
84     // with future versions of .proto files.
85     std::string unknown_fields_;
86   };
87 
88   class PERFETTO_EXPORT ChunkToPatch {
89    public:
90     class PERFETTO_EXPORT Patch {
91      public:
92       Patch();
93       ~Patch();
94       Patch(Patch&&) noexcept;
95       Patch& operator=(Patch&&);
96       Patch(const Patch&);
97       Patch& operator=(const Patch&);
98       bool operator==(const Patch&) const;
99       bool operator!=(const Patch& other) const { return !(*this == other); }
100 
101       // Conversion methods from/to the corresponding protobuf types.
102       void FromProto(
103           const perfetto::protos::CommitDataRequest_ChunkToPatch_Patch&);
104       void ToProto(
105           perfetto::protos::CommitDataRequest_ChunkToPatch_Patch*) const;
106 
offset()107       uint32_t offset() const { return offset_; }
set_offset(uint32_t value)108       void set_offset(uint32_t value) { offset_ = value; }
109 
data()110       const std::string& data() const { return data_; }
set_data(const std::string & value)111       void set_data(const std::string& value) { data_ = value; }
set_data(const void * p,size_t s)112       void set_data(const void* p, size_t s) {
113         data_.assign(reinterpret_cast<const char*>(p), s);
114       }
115 
116      private:
117       uint32_t offset_ = {};
118       std::string data_ = {};
119 
120       // Allows to preserve unknown protobuf fields for compatibility
121       // with future versions of .proto files.
122       std::string unknown_fields_;
123     };
124 
125     ChunkToPatch();
126     ~ChunkToPatch();
127     ChunkToPatch(ChunkToPatch&&) noexcept;
128     ChunkToPatch& operator=(ChunkToPatch&&);
129     ChunkToPatch(const ChunkToPatch&);
130     ChunkToPatch& operator=(const ChunkToPatch&);
131     bool operator==(const ChunkToPatch&) const;
132     bool operator!=(const ChunkToPatch& other) const {
133       return !(*this == other);
134     }
135 
136     // Conversion methods from/to the corresponding protobuf types.
137     void FromProto(const perfetto::protos::CommitDataRequest_ChunkToPatch&);
138     void ToProto(perfetto::protos::CommitDataRequest_ChunkToPatch*) const;
139 
target_buffer()140     uint32_t target_buffer() const { return target_buffer_; }
set_target_buffer(uint32_t value)141     void set_target_buffer(uint32_t value) { target_buffer_ = value; }
142 
writer_id()143     uint32_t writer_id() const { return writer_id_; }
set_writer_id(uint32_t value)144     void set_writer_id(uint32_t value) { writer_id_ = value; }
145 
chunk_id()146     uint32_t chunk_id() const { return chunk_id_; }
set_chunk_id(uint32_t value)147     void set_chunk_id(uint32_t value) { chunk_id_ = value; }
148 
patches_size()149     int patches_size() const { return static_cast<int>(patches_.size()); }
patches()150     const std::vector<Patch>& patches() const { return patches_; }
mutable_patches()151     std::vector<Patch>* mutable_patches() { return &patches_; }
clear_patches()152     void clear_patches() { patches_.clear(); }
add_patches()153     Patch* add_patches() {
154       patches_.emplace_back();
155       return &patches_.back();
156     }
157 
has_more_patches()158     bool has_more_patches() const { return has_more_patches_; }
set_has_more_patches(bool value)159     void set_has_more_patches(bool value) { has_more_patches_ = value; }
160 
161    private:
162     uint32_t target_buffer_ = {};
163     uint32_t writer_id_ = {};
164     uint32_t chunk_id_ = {};
165     std::vector<Patch> patches_;
166     bool has_more_patches_ = {};
167 
168     // Allows to preserve unknown protobuf fields for compatibility
169     // with future versions of .proto files.
170     std::string unknown_fields_;
171   };
172 
173   CommitDataRequest();
174   ~CommitDataRequest();
175   CommitDataRequest(CommitDataRequest&&) noexcept;
176   CommitDataRequest& operator=(CommitDataRequest&&);
177   CommitDataRequest(const CommitDataRequest&);
178   CommitDataRequest& operator=(const CommitDataRequest&);
179   bool operator==(const CommitDataRequest&) const;
180   bool operator!=(const CommitDataRequest& other) const {
181     return !(*this == other);
182   }
183 
184   // Conversion methods from/to the corresponding protobuf types.
185   void FromProto(const perfetto::protos::CommitDataRequest&);
186   void ToProto(perfetto::protos::CommitDataRequest*) const;
187 
chunks_to_move_size()188   int chunks_to_move_size() const {
189     return static_cast<int>(chunks_to_move_.size());
190   }
chunks_to_move()191   const std::vector<ChunksToMove>& chunks_to_move() const {
192     return chunks_to_move_;
193   }
mutable_chunks_to_move()194   std::vector<ChunksToMove>* mutable_chunks_to_move() {
195     return &chunks_to_move_;
196   }
clear_chunks_to_move()197   void clear_chunks_to_move() { chunks_to_move_.clear(); }
add_chunks_to_move()198   ChunksToMove* add_chunks_to_move() {
199     chunks_to_move_.emplace_back();
200     return &chunks_to_move_.back();
201   }
202 
chunks_to_patch_size()203   int chunks_to_patch_size() const {
204     return static_cast<int>(chunks_to_patch_.size());
205   }
chunks_to_patch()206   const std::vector<ChunkToPatch>& chunks_to_patch() const {
207     return chunks_to_patch_;
208   }
mutable_chunks_to_patch()209   std::vector<ChunkToPatch>* mutable_chunks_to_patch() {
210     return &chunks_to_patch_;
211   }
clear_chunks_to_patch()212   void clear_chunks_to_patch() { chunks_to_patch_.clear(); }
add_chunks_to_patch()213   ChunkToPatch* add_chunks_to_patch() {
214     chunks_to_patch_.emplace_back();
215     return &chunks_to_patch_.back();
216   }
217 
flush_request_id()218   uint64_t flush_request_id() const { return flush_request_id_; }
set_flush_request_id(uint64_t value)219   void set_flush_request_id(uint64_t value) { flush_request_id_ = value; }
220 
221  private:
222   std::vector<ChunksToMove> chunks_to_move_;
223   std::vector<ChunkToPatch> chunks_to_patch_;
224   uint64_t flush_request_id_ = {};
225 
226   // Allows to preserve unknown protobuf fields for compatibility
227   // with future versions of .proto files.
228   std::string unknown_fields_;
229 };
230 
231 }  // namespace perfetto
232 
233 #endif  // INCLUDE_PERFETTO_TRACING_CORE_COMMIT_DATA_REQUEST_H_
234