Home | History | Annotate | Download | only in core
      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 #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 
     61     // Conversion methods from/to the corresponding protobuf types.
     62     void FromProto(const perfetto::protos::CommitDataRequest_ChunksToMove&);
     63     void ToProto(perfetto::protos::CommitDataRequest_ChunksToMove*) const;
     64 
     65     uint32_t page() const { return page_; }
     66     void set_page(uint32_t value) { page_ = value; }
     67 
     68     uint32_t chunk() const { return chunk_; }
     69     void set_chunk(uint32_t value) { chunk_ = value; }
     70 
     71     uint32_t target_buffer() const { return target_buffer_; }
     72     void set_target_buffer(uint32_t value) { target_buffer_ = value; }
     73 
     74    private:
     75     uint32_t page_ = {};
     76     uint32_t chunk_ = {};
     77     uint32_t target_buffer_ = {};
     78 
     79     // Allows to preserve unknown protobuf fields for compatibility
     80     // with future versions of .proto files.
     81     std::string unknown_fields_;
     82   };
     83 
     84   class PERFETTO_EXPORT ChunkToPatch {
     85    public:
     86     class PERFETTO_EXPORT Patch {
     87      public:
     88       Patch();
     89       ~Patch();
     90       Patch(Patch&&) noexcept;
     91       Patch& operator=(Patch&&);
     92       Patch(const Patch&);
     93       Patch& operator=(const Patch&);
     94 
     95       // Conversion methods from/to the corresponding protobuf types.
     96       void FromProto(
     97           const perfetto::protos::CommitDataRequest_ChunkToPatch_Patch&);
     98       void ToProto(
     99           perfetto::protos::CommitDataRequest_ChunkToPatch_Patch*) const;
    100 
    101       uint32_t offset() const { return offset_; }
    102       void set_offset(uint32_t value) { offset_ = value; }
    103 
    104       const std::string& data() const { return data_; }
    105       void set_data(const std::string& value) { data_ = value; }
    106       void set_data(const void* p, size_t s) {
    107         data_.assign(reinterpret_cast<const char*>(p), s);
    108       }
    109 
    110      private:
    111       uint32_t offset_ = {};
    112       std::string data_ = {};
    113 
    114       // Allows to preserve unknown protobuf fields for compatibility
    115       // with future versions of .proto files.
    116       std::string unknown_fields_;
    117     };
    118 
    119     ChunkToPatch();
    120     ~ChunkToPatch();
    121     ChunkToPatch(ChunkToPatch&&) noexcept;
    122     ChunkToPatch& operator=(ChunkToPatch&&);
    123     ChunkToPatch(const ChunkToPatch&);
    124     ChunkToPatch& operator=(const ChunkToPatch&);
    125 
    126     // Conversion methods from/to the corresponding protobuf types.
    127     void FromProto(const perfetto::protos::CommitDataRequest_ChunkToPatch&);
    128     void ToProto(perfetto::protos::CommitDataRequest_ChunkToPatch*) const;
    129 
    130     uint32_t target_buffer() const { return target_buffer_; }
    131     void set_target_buffer(uint32_t value) { target_buffer_ = value; }
    132 
    133     uint32_t writer_id() const { return writer_id_; }
    134     void set_writer_id(uint32_t value) { writer_id_ = value; }
    135 
    136     uint32_t chunk_id() const { return chunk_id_; }
    137     void set_chunk_id(uint32_t value) { chunk_id_ = value; }
    138 
    139     int patches_size() const { return static_cast<int>(patches_.size()); }
    140     const std::vector<Patch>& patches() const { return patches_; }
    141     Patch* add_patches() {
    142       patches_.emplace_back();
    143       return &patches_.back();
    144     }
    145 
    146     bool has_more_patches() const { return has_more_patches_; }
    147     void set_has_more_patches(bool value) { has_more_patches_ = value; }
    148 
    149    private:
    150     uint32_t target_buffer_ = {};
    151     uint32_t writer_id_ = {};
    152     uint32_t chunk_id_ = {};
    153     std::vector<Patch> patches_;
    154     bool has_more_patches_ = {};
    155 
    156     // Allows to preserve unknown protobuf fields for compatibility
    157     // with future versions of .proto files.
    158     std::string unknown_fields_;
    159   };
    160 
    161   CommitDataRequest();
    162   ~CommitDataRequest();
    163   CommitDataRequest(CommitDataRequest&&) noexcept;
    164   CommitDataRequest& operator=(CommitDataRequest&&);
    165   CommitDataRequest(const CommitDataRequest&);
    166   CommitDataRequest& operator=(const CommitDataRequest&);
    167 
    168   // Conversion methods from/to the corresponding protobuf types.
    169   void FromProto(const perfetto::protos::CommitDataRequest&);
    170   void ToProto(perfetto::protos::CommitDataRequest*) const;
    171 
    172   int chunks_to_move_size() const {
    173     return static_cast<int>(chunks_to_move_.size());
    174   }
    175   const std::vector<ChunksToMove>& chunks_to_move() const {
    176     return chunks_to_move_;
    177   }
    178   ChunksToMove* add_chunks_to_move() {
    179     chunks_to_move_.emplace_back();
    180     return &chunks_to_move_.back();
    181   }
    182 
    183   int chunks_to_patch_size() const {
    184     return static_cast<int>(chunks_to_patch_.size());
    185   }
    186   const std::vector<ChunkToPatch>& chunks_to_patch() const {
    187     return chunks_to_patch_;
    188   }
    189   ChunkToPatch* add_chunks_to_patch() {
    190     chunks_to_patch_.emplace_back();
    191     return &chunks_to_patch_.back();
    192   }
    193 
    194   uint64_t flush_request_id() const { return flush_request_id_; }
    195   void set_flush_request_id(uint64_t value) { flush_request_id_ = value; }
    196 
    197  private:
    198   std::vector<ChunksToMove> chunks_to_move_;
    199   std::vector<ChunkToPatch> chunks_to_patch_;
    200   uint64_t flush_request_id_ = {};
    201 
    202   // Allows to preserve unknown protobuf fields for compatibility
    203   // with future versions of .proto files.
    204   std::string unknown_fields_;
    205 };
    206 
    207 }  // namespace perfetto
    208 #endif  // INCLUDE_PERFETTO_TRACING_CORE_COMMIT_DATA_REQUEST_H_
    209