blob: f749601b5bec9a2203e96856952b0320f243bcea [file] [log] [blame]
// Autogenerated by the ProtoZero compiler plugin. DO NOT EDIT.
#ifndef PERFETTO_PROTOS_PROTOS_PERFETTO_TRACE_TEST_EXTENSIONS_PROTO_H_
#define PERFETTO_PROTOS_PROTOS_PERFETTO_TRACE_TEST_EXTENSIONS_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"
#include "protos/perfetto/trace/track_event/track_event.pbzero.h"
namespace perfetto {
namespace protos {
namespace pbzero {
class TestExtensionChild_Decoder : public ::protozero::TypedProtoDecoder</*MAX_FIELD_ID=*/1, /*HAS_NONPACKED_REPEATED_FIELDS=*/false> {
public:
TestExtensionChild_Decoder(const uint8_t* data, size_t len) : TypedProtoDecoder(data, len) {}
explicit TestExtensionChild_Decoder(const std::string& raw) : TypedProtoDecoder(reinterpret_cast<const uint8_t*>(raw.data()), raw.size()) {}
explicit TestExtensionChild_Decoder(const ::protozero::ConstBytes& raw) : TypedProtoDecoder(raw.data, raw.size) {}
bool has_child_field_for_testing() const { return at<1>().valid(); }
::protozero::ConstChars child_field_for_testing() const { return at<1>().as_string(); }
};
class TestExtensionChild : public ::protozero::Message {
public:
using Decoder = TestExtensionChild_Decoder;
enum : int32_t {
kChildFieldForTestingFieldNumber = 1,
};
using FieldMetadata_ChildFieldForTesting =
::protozero::proto_utils::FieldMetadata<
1,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kString,
std::string,
TestExtensionChild>;
// 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_ChildFieldForTesting kChildFieldForTesting() { return {}; }
void set_child_field_for_testing(const char* data, size_t size) {
AppendBytes(FieldMetadata_ChildFieldForTesting::kFieldId, data, size);
}
void set_child_field_for_testing(std::string value) {
static constexpr uint32_t field_id = FieldMetadata_ChildFieldForTesting::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);
}
};
class TestExtension : public ::perfetto::protos::pbzero::TrackEvent {
public:
using FieldMetadata_StringExtensionForTesting =
::protozero::proto_utils::FieldMetadata<
9900,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kString,
std::string,
TestExtension>;
// 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_StringExtensionForTesting kStringExtensionForTesting() { return {}; }
void set_string_extension_for_testing(const char* data, size_t size) {
AppendBytes(FieldMetadata_StringExtensionForTesting::kFieldId, data, size);
}
void set_string_extension_for_testing(std::string value) {
static constexpr uint32_t field_id = FieldMetadata_StringExtensionForTesting::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_IntExtensionForTesting =
::protozero::proto_utils::FieldMetadata<
9901,
::protozero::proto_utils::RepetitionType::kRepeatedNotPacked,
::protozero::proto_utils::ProtoSchemaType::kInt32,
int32_t,
TestExtension>;
// 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_IntExtensionForTesting kIntExtensionForTesting() { return {}; }
void add_int_extension_for_testing(int32_t value) {
static constexpr uint32_t field_id = FieldMetadata_IntExtensionForTesting::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_OmittedExtensionForTesting =
::protozero::proto_utils::FieldMetadata<
9902,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kString,
std::string,
TestExtension>;
// 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_OmittedExtensionForTesting kOmittedExtensionForTesting() { return {}; }
void set_omitted_extension_for_testing(const char* data, size_t size) {
AppendBytes(FieldMetadata_OmittedExtensionForTesting::kFieldId, data, size);
}
void set_omitted_extension_for_testing(std::string value) {
static constexpr uint32_t field_id = FieldMetadata_OmittedExtensionForTesting::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_NestedMessageExtensionForTesting =
::protozero::proto_utils::FieldMetadata<
9903,
::protozero::proto_utils::RepetitionType::kNotRepeated,
::protozero::proto_utils::ProtoSchemaType::kMessage,
TestExtensionChild,
TestExtension>;
// 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_NestedMessageExtensionForTesting kNestedMessageExtensionForTesting() { return {}; }
template <typename T = TestExtensionChild> T* set_nested_message_extension_for_testing() {
return BeginNestedMessage<T>(9903);
}
};
} // Namespace.
} // Namespace.
} // Namespace.
#endif // Include guard.