blob: 3b2e6ebb1d654d4f4979c13cb450e89f90321fa3 [file] [log] [blame]
// Autogenerated by the ProtoZero compiler plugin. DO NOT EDIT.
#ifndef PERFETTO_PROTOS_PROTOS_PERFETTO_CONFIG_TEST_CONFIG_PROTO_H_
#define PERFETTO_PROTOS_PROTOS_PERFETTO_CONFIG_TEST_CONFIG_PROTO_H_
#include <stddef.h>
#include <stdint.h>
#include "perfetto/protozero/field_writer.h"
#include "perfetto/protozero/message.h"
#include "perfetto/protozero/packed_repeated_fields.h"
#include "perfetto/protozero/proto_decoder.h"
#include "perfetto/protozero/proto_utils.h"
namespace perfetto {
namespace protos {
namespace pbzero {
class TestConfig_DummyFields;
class TestConfig_Decoder : public ::protozero::TypedProtoDecoder</*MAX_FIELD_ID=*/6, /*HAS_NONPACKED_REPEATED_FIELDS=*/false> {
public:
TestConfig_Decoder(const uint8_t* data, size_t len) : TypedProtoDecoder(data, len) {}
explicit TestConfig_Decoder(const std::string& raw) : TypedProtoDecoder(reinterpret_cast<const uint8_t*>(raw.data()), raw.size()) {}
explicit TestConfig_Decoder(const ::protozero::ConstBytes& raw) : TypedProtoDecoder(raw.data, raw.size) {}
bool has_message_count() const { return at<1>().valid(); }
uint32_t message_count() const { return at<1>().as_uint32(); }
bool has_max_messages_per_second() const { return at<2>().valid(); }
uint32_t max_messages_per_second() const { return at<2>().as_uint32(); }
bool has_seed() const { return at<3>().valid(); }
uint32_t seed() const { return at<3>().as_uint32(); }
bool has_message_size() const { return at<4>().valid(); }
uint32_t message_size() const { return at<4>().as_uint32(); }
bool has_send_batch_on_register() const { return at<5>().valid(); }
bool send_batch_on_register() const { return at<5>().as_bool(); }
bool has_dummy_fields() const { return at<6>().valid(); }
::protozero::ConstBytes dummy_fields() const { return at<6>().as_bytes(); }
};
class TestConfig : public ::protozero::Message {
public:
using Decoder = TestConfig_Decoder;
enum : int32_t {
kMessageCountFieldNumber = 1,
kMaxMessagesPerSecondFieldNumber = 2,
kSeedFieldNumber = 3,
kMessageSizeFieldNumber = 4,
kSendBatchOnRegisterFieldNumber = 5,
kDummyFieldsFieldNumber = 6,
};
using DummyFields = ::perfetto::protos::pbzero::TestConfig_DummyFields;
using FieldMetadata_MessageCount =
::protozero::proto_utils::FieldMetadata<
1,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kUint32,
uint32_t,
TestConfig>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_MessageCount kMessageCount() { return {}; }
void set_message_count(uint32_t value) {
static constexpr uint32_t field_id = FieldMetadata_MessageCount::kFieldId;
// Call the appropriate protozero::Message::Append(field_id, ...)
// method based on the type of the field.
::protozero::internal::FieldWriter<
::protozero::proto_utils::ProtoSchemaType::kUint32>
::Append(*this, field_id, value);
}
using FieldMetadata_MaxMessagesPerSecond =
::protozero::proto_utils::FieldMetadata<
2,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kUint32,
uint32_t,
TestConfig>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_MaxMessagesPerSecond kMaxMessagesPerSecond() { return {}; }
void set_max_messages_per_second(uint32_t value) {
static constexpr uint32_t field_id = FieldMetadata_MaxMessagesPerSecond::kFieldId;
// Call the appropriate protozero::Message::Append(field_id, ...)
// method based on the type of the field.
::protozero::internal::FieldWriter<
::protozero::proto_utils::ProtoSchemaType::kUint32>
::Append(*this, field_id, value);
}
using FieldMetadata_Seed =
::protozero::proto_utils::FieldMetadata<
3,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kUint32,
uint32_t,
TestConfig>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_Seed kSeed() { return {}; }
void set_seed(uint32_t value) {
static constexpr uint32_t field_id = FieldMetadata_Seed::kFieldId;
// Call the appropriate protozero::Message::Append(field_id, ...)
// method based on the type of the field.
::protozero::internal::FieldWriter<
::protozero::proto_utils::ProtoSchemaType::kUint32>
::Append(*this, field_id, value);
}
using FieldMetadata_MessageSize =
::protozero::proto_utils::FieldMetadata<
4,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kUint32,
uint32_t,
TestConfig>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_MessageSize kMessageSize() { return {}; }
void set_message_size(uint32_t value) {
static constexpr uint32_t field_id = FieldMetadata_MessageSize::kFieldId;
// Call the appropriate protozero::Message::Append(field_id, ...)
// method based on the type of the field.
::protozero::internal::FieldWriter<
::protozero::proto_utils::ProtoSchemaType::kUint32>
::Append(*this, field_id, value);
}
using FieldMetadata_SendBatchOnRegister =
::protozero::proto_utils::FieldMetadata<
5,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kBool,
bool,
TestConfig>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_SendBatchOnRegister kSendBatchOnRegister() { return {}; }
void set_send_batch_on_register(bool value) {
static constexpr uint32_t field_id = FieldMetadata_SendBatchOnRegister::kFieldId;
// Call the appropriate protozero::Message::Append(field_id, ...)
// method based on the type of the field.
::protozero::internal::FieldWriter<
::protozero::proto_utils::ProtoSchemaType::kBool>
::Append(*this, field_id, value);
}
using FieldMetadata_DummyFields =
::protozero::proto_utils::FieldMetadata<
6,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kMessage,
TestConfig_DummyFields,
TestConfig>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_DummyFields kDummyFields() { return {}; }
template <typename T = TestConfig_DummyFields> T* set_dummy_fields() {
return BeginNestedMessage<T>(6);
}
};
class TestConfig_DummyFields_Decoder : public ::protozero::TypedProtoDecoder</*MAX_FIELD_ID=*/14, /*HAS_NONPACKED_REPEATED_FIELDS=*/false> {
public:
TestConfig_DummyFields_Decoder(const uint8_t* data, size_t len) : TypedProtoDecoder(data, len) {}
explicit TestConfig_DummyFields_Decoder(const std::string& raw) : TypedProtoDecoder(reinterpret_cast<const uint8_t*>(raw.data()), raw.size()) {}
explicit TestConfig_DummyFields_Decoder(const ::protozero::ConstBytes& raw) : TypedProtoDecoder(raw.data, raw.size) {}
bool has_field_uint32() const { return at<1>().valid(); }
uint32_t field_uint32() const { return at<1>().as_uint32(); }
bool has_field_int32() const { return at<2>().valid(); }
int32_t field_int32() const { return at<2>().as_int32(); }
bool has_field_uint64() const { return at<3>().valid(); }
uint64_t field_uint64() const { return at<3>().as_uint64(); }
bool has_field_int64() const { return at<4>().valid(); }
int64_t field_int64() const { return at<4>().as_int64(); }
bool has_field_fixed64() const { return at<5>().valid(); }
uint64_t field_fixed64() const { return at<5>().as_uint64(); }
bool has_field_sfixed64() const { return at<6>().valid(); }
int64_t field_sfixed64() const { return at<6>().as_int64(); }
bool has_field_fixed32() const { return at<7>().valid(); }
uint32_t field_fixed32() const { return at<7>().as_uint32(); }
bool has_field_sfixed32() const { return at<8>().valid(); }
int32_t field_sfixed32() const { return at<8>().as_int32(); }
bool has_field_double() const { return at<9>().valid(); }
double field_double() const { return at<9>().as_double(); }
bool has_field_float() const { return at<10>().valid(); }
float field_float() const { return at<10>().as_float(); }
bool has_field_sint64() const { return at<11>().valid(); }
int64_t field_sint64() const { return at<11>().as_int64(); }
bool has_field_sint32() const { return at<12>().valid(); }
int32_t field_sint32() const { return at<12>().as_int32(); }
bool has_field_string() const { return at<13>().valid(); }
::protozero::ConstChars field_string() const { return at<13>().as_string(); }
bool has_field_bytes() const { return at<14>().valid(); }
::protozero::ConstBytes field_bytes() const { return at<14>().as_bytes(); }
};
class TestConfig_DummyFields : public ::protozero::Message {
public:
using Decoder = TestConfig_DummyFields_Decoder;
enum : int32_t {
kFieldUint32FieldNumber = 1,
kFieldInt32FieldNumber = 2,
kFieldUint64FieldNumber = 3,
kFieldInt64FieldNumber = 4,
kFieldFixed64FieldNumber = 5,
kFieldSfixed64FieldNumber = 6,
kFieldFixed32FieldNumber = 7,
kFieldSfixed32FieldNumber = 8,
kFieldDoubleFieldNumber = 9,
kFieldFloatFieldNumber = 10,
kFieldSint64FieldNumber = 11,
kFieldSint32FieldNumber = 12,
kFieldStringFieldNumber = 13,
kFieldBytesFieldNumber = 14,
};
using FieldMetadata_FieldUint32 =
::protozero::proto_utils::FieldMetadata<
1,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kUint32,
uint32_t,
TestConfig_DummyFields>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_FieldUint32 kFieldUint32() { return {}; }
void set_field_uint32(uint32_t value) {
static constexpr uint32_t field_id = FieldMetadata_FieldUint32::kFieldId;
// Call the appropriate protozero::Message::Append(field_id, ...)
// method based on the type of the field.
::protozero::internal::FieldWriter<
::protozero::proto_utils::ProtoSchemaType::kUint32>
::Append(*this, field_id, value);
}
using FieldMetadata_FieldInt32 =
::protozero::proto_utils::FieldMetadata<
2,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kInt32,
int32_t,
TestConfig_DummyFields>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_FieldInt32 kFieldInt32() { return {}; }
void set_field_int32(int32_t value) {
static constexpr uint32_t field_id = FieldMetadata_FieldInt32::kFieldId;
// Call the appropriate protozero::Message::Append(field_id, ...)
// method based on the type of the field.
::protozero::internal::FieldWriter<
::protozero::proto_utils::ProtoSchemaType::kInt32>
::Append(*this, field_id, value);
}
using FieldMetadata_FieldUint64 =
::protozero::proto_utils::FieldMetadata<
3,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kUint64,
uint64_t,
TestConfig_DummyFields>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_FieldUint64 kFieldUint64() { return {}; }
void set_field_uint64(uint64_t value) {
static constexpr uint32_t field_id = FieldMetadata_FieldUint64::kFieldId;
// Call the appropriate protozero::Message::Append(field_id, ...)
// method based on the type of the field.
::protozero::internal::FieldWriter<
::protozero::proto_utils::ProtoSchemaType::kUint64>
::Append(*this, field_id, value);
}
using FieldMetadata_FieldInt64 =
::protozero::proto_utils::FieldMetadata<
4,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kInt64,
int64_t,
TestConfig_DummyFields>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_FieldInt64 kFieldInt64() { return {}; }
void set_field_int64(int64_t value) {
static constexpr uint32_t field_id = FieldMetadata_FieldInt64::kFieldId;
// Call the appropriate protozero::Message::Append(field_id, ...)
// method based on the type of the field.
::protozero::internal::FieldWriter<
::protozero::proto_utils::ProtoSchemaType::kInt64>
::Append(*this, field_id, value);
}
using FieldMetadata_FieldFixed64 =
::protozero::proto_utils::FieldMetadata<
5,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kFixed64,
uint64_t,
TestConfig_DummyFields>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_FieldFixed64 kFieldFixed64() { return {}; }
void set_field_fixed64(uint64_t value) {
static constexpr uint32_t field_id = FieldMetadata_FieldFixed64::kFieldId;
// Call the appropriate protozero::Message::Append(field_id, ...)
// method based on the type of the field.
::protozero::internal::FieldWriter<
::protozero::proto_utils::ProtoSchemaType::kFixed64>
::Append(*this, field_id, value);
}
using FieldMetadata_FieldSfixed64 =
::protozero::proto_utils::FieldMetadata<
6,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kSfixed64,
int64_t,
TestConfig_DummyFields>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_FieldSfixed64 kFieldSfixed64() { return {}; }
void set_field_sfixed64(int64_t value) {
static constexpr uint32_t field_id = FieldMetadata_FieldSfixed64::kFieldId;
// Call the appropriate protozero::Message::Append(field_id, ...)
// method based on the type of the field.
::protozero::internal::FieldWriter<
::protozero::proto_utils::ProtoSchemaType::kSfixed64>
::Append(*this, field_id, value);
}
using FieldMetadata_FieldFixed32 =
::protozero::proto_utils::FieldMetadata<
7,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kFixed32,
uint32_t,
TestConfig_DummyFields>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_FieldFixed32 kFieldFixed32() { return {}; }
void set_field_fixed32(uint32_t value) {
static constexpr uint32_t field_id = FieldMetadata_FieldFixed32::kFieldId;
// Call the appropriate protozero::Message::Append(field_id, ...)
// method based on the type of the field.
::protozero::internal::FieldWriter<
::protozero::proto_utils::ProtoSchemaType::kFixed32>
::Append(*this, field_id, value);
}
using FieldMetadata_FieldSfixed32 =
::protozero::proto_utils::FieldMetadata<
8,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kSfixed32,
int32_t,
TestConfig_DummyFields>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_FieldSfixed32 kFieldSfixed32() { return {}; }
void set_field_sfixed32(int32_t value) {
static constexpr uint32_t field_id = FieldMetadata_FieldSfixed32::kFieldId;
// Call the appropriate protozero::Message::Append(field_id, ...)
// method based on the type of the field.
::protozero::internal::FieldWriter<
::protozero::proto_utils::ProtoSchemaType::kSfixed32>
::Append(*this, field_id, value);
}
using FieldMetadata_FieldDouble =
::protozero::proto_utils::FieldMetadata<
9,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kDouble,
double,
TestConfig_DummyFields>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_FieldDouble kFieldDouble() { return {}; }
void set_field_double(double value) {
static constexpr uint32_t field_id = FieldMetadata_FieldDouble::kFieldId;
// Call the appropriate protozero::Message::Append(field_id, ...)
// method based on the type of the field.
::protozero::internal::FieldWriter<
::protozero::proto_utils::ProtoSchemaType::kDouble>
::Append(*this, field_id, value);
}
using FieldMetadata_FieldFloat =
::protozero::proto_utils::FieldMetadata<
10,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kFloat,
float,
TestConfig_DummyFields>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_FieldFloat kFieldFloat() { return {}; }
void set_field_float(float value) {
static constexpr uint32_t field_id = FieldMetadata_FieldFloat::kFieldId;
// Call the appropriate protozero::Message::Append(field_id, ...)
// method based on the type of the field.
::protozero::internal::FieldWriter<
::protozero::proto_utils::ProtoSchemaType::kFloat>
::Append(*this, field_id, value);
}
using FieldMetadata_FieldSint64 =
::protozero::proto_utils::FieldMetadata<
11,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kSint64,
int64_t,
TestConfig_DummyFields>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_FieldSint64 kFieldSint64() { return {}; }
void set_field_sint64(int64_t value) {
static constexpr uint32_t field_id = FieldMetadata_FieldSint64::kFieldId;
// Call the appropriate protozero::Message::Append(field_id, ...)
// method based on the type of the field.
::protozero::internal::FieldWriter<
::protozero::proto_utils::ProtoSchemaType::kSint64>
::Append(*this, field_id, value);
}
using FieldMetadata_FieldSint32 =
::protozero::proto_utils::FieldMetadata<
12,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kSint32,
int32_t,
TestConfig_DummyFields>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_FieldSint32 kFieldSint32() { return {}; }
void set_field_sint32(int32_t value) {
static constexpr uint32_t field_id = FieldMetadata_FieldSint32::kFieldId;
// Call the appropriate protozero::Message::Append(field_id, ...)
// method based on the type of the field.
::protozero::internal::FieldWriter<
::protozero::proto_utils::ProtoSchemaType::kSint32>
::Append(*this, field_id, value);
}
using FieldMetadata_FieldString =
::protozero::proto_utils::FieldMetadata<
13,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kString,
std::string,
TestConfig_DummyFields>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_FieldString kFieldString() { return {}; }
void set_field_string(const char* data, size_t size) {
AppendBytes(FieldMetadata_FieldString::kFieldId, data, size);
}
void set_field_string(std::string value) {
static constexpr uint32_t field_id = FieldMetadata_FieldString::kFieldId;
// Call the appropriate protozero::Message::Append(field_id, ...)
// method based on the type of the field.
::protozero::internal::FieldWriter<
::protozero::proto_utils::ProtoSchemaType::kString>
::Append(*this, field_id, value);
}
using FieldMetadata_FieldBytes =
::protozero::proto_utils::FieldMetadata<
14,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kBytes,
std::string,
TestConfig_DummyFields>;
// Ceci n'est pas une pipe.
// This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
// type (and users are expected to use it as such, hence kCamelCase name).
// It is declared as a function to keep protozero bindings header-only as
// inline constexpr variables are not available until C++17 (while inline
// functions are).
// TODO(altimin): Use inline variable instead after adopting C++17.
static constexpr FieldMetadata_FieldBytes kFieldBytes() { return {}; }
void set_field_bytes(const uint8_t* data, size_t size) {
AppendBytes(FieldMetadata_FieldBytes::kFieldId, data, size);
}
void set_field_bytes(std::string value) {
static constexpr uint32_t field_id = FieldMetadata_FieldBytes::kFieldId;
// Call the appropriate protozero::Message::Append(field_id, ...)
// method based on the type of the field.
::protozero::internal::FieldWriter<
::protozero::proto_utils::ProtoSchemaType::kBytes>
::Append(*this, field_id, value);
}
};
} // Namespace.
} // Namespace.
} // Namespace.
#endif // Include guard.