1 // Autogenerated by the ProtoZero compiler plugin. DO NOT EDIT. 2 3 #ifndef PERFETTO_PROTO_PROTOS_THIRD_PARTY_STATSD_SHELL_DATA_PROTO_H_ 4 #define PERFETTO_PROTO_PROTOS_THIRD_PARTY_STATSD_SHELL_DATA_PROTO_H_ 5 6 #include <stddef.h> 7 #include <stdint.h> 8 9 #include "perfetto/protozero/field_writer.h" 10 #include "perfetto/protozero/message.h" 11 #include "perfetto/protozero/packed_repeated_fields.h" 12 #include "perfetto/protozero/proto_decoder.h" 13 #include "perfetto/protozero/proto_utils.h" 14 15 16 namespace perfetto { 17 namespace proto { 18 namespace pbzero { 19 20 class ShellData_Decoder : public ::protozero::TypedProtoDecoder</*MAX_FIELD_ID=*/2, /*HAS_NONPACKED_REPEATED_FIELDS=*/true> { 21 public: ShellData_Decoder(const uint8_t * data,size_t len)22 ShellData_Decoder(const uint8_t* data, size_t len) : TypedProtoDecoder(data, len) {} ShellData_Decoder(const std::string & raw)23 explicit ShellData_Decoder(const std::string& raw) : TypedProtoDecoder(reinterpret_cast<const uint8_t*>(raw.data()), raw.size()) {} ShellData_Decoder(const::protozero::ConstBytes & raw)24 explicit ShellData_Decoder(const ::protozero::ConstBytes& raw) : TypedProtoDecoder(raw.data, raw.size) {} has_atom()25 bool has_atom() const { return at<1>().valid(); } atom()26 ::protozero::RepeatedFieldIterator<::protozero::ConstBytes> atom() const { return GetRepeated<::protozero::ConstBytes>(1); } has_timestamp_nanos()27 bool has_timestamp_nanos() const { return at<2>().valid(); } timestamp_nanos()28 ::protozero::RepeatedFieldIterator<int64_t> timestamp_nanos() const { return GetRepeated<int64_t>(2); } 29 }; 30 31 class ShellData : public ::protozero::Message { 32 public: 33 using Decoder = ShellData_Decoder; 34 enum : int32_t { 35 kAtomFieldNumber = 1, 36 kTimestampNanosFieldNumber = 2, 37 }; GetName()38 static constexpr const char* GetName() { return ".perfetto.proto.ShellData"; } 39 40 41 using FieldMetadata_Atom = 42 ::protozero::proto_utils::FieldMetadata< 43 1, 44 ::protozero::proto_utils::RepetitionType::kRepeatedNotPacked, 45 ::protozero::proto_utils::ProtoSchemaType::kBytes, 46 std::string, 47 ShellData>; 48 49 static constexpr FieldMetadata_Atom kAtom{}; add_atom(const uint8_t * data,size_t size)50 void add_atom(const uint8_t* data, size_t size) { 51 AppendBytes(FieldMetadata_Atom::kFieldId, data, size); 52 } add_atom(::protozero::ConstBytes bytes)53 void add_atom(::protozero::ConstBytes bytes) { 54 AppendBytes(FieldMetadata_Atom::kFieldId, bytes.data, bytes.size); 55 } add_atom(std::string value)56 void add_atom(std::string value) { 57 static constexpr uint32_t field_id = FieldMetadata_Atom::kFieldId; 58 // Call the appropriate protozero::Message::Append(field_id, ...) 59 // method based on the type of the field. 60 ::protozero::internal::FieldWriter< 61 ::protozero::proto_utils::ProtoSchemaType::kBytes> 62 ::Append(*this, field_id, value); 63 } 64 65 using FieldMetadata_TimestampNanos = 66 ::protozero::proto_utils::FieldMetadata< 67 2, 68 ::protozero::proto_utils::RepetitionType::kRepeatedNotPacked, 69 ::protozero::proto_utils::ProtoSchemaType::kInt64, 70 int64_t, 71 ShellData>; 72 73 static constexpr FieldMetadata_TimestampNanos kTimestampNanos{}; add_timestamp_nanos(int64_t value)74 void add_timestamp_nanos(int64_t value) { 75 static constexpr uint32_t field_id = FieldMetadata_TimestampNanos::kFieldId; 76 // Call the appropriate protozero::Message::Append(field_id, ...) 77 // method based on the type of the field. 78 ::protozero::internal::FieldWriter< 79 ::protozero::proto_utils::ProtoSchemaType::kInt64> 80 ::Append(*this, field_id, value); 81 } 82 }; 83 84 } // Namespace. 85 } // Namespace. 86 } // Namespace. 87 #endif // Include guard. 88