xref: /aosp_15_r20/external/federated-compute/fcp/base/tracing_schema.h (revision 14675a029014e728ec732f129a32e299b2da0601)
1 // Autogenerated by tracing_traits_generator, do not edit
2 
3 #ifndef FCP_BASE_TRACING_SCHEMA_H
4 #define FCP_BASE_TRACING_SCHEMA_H
5 
6 #ifdef FLATBUFFERS_GENERATED_TRACINGSCHEMA_H_
7 #undef FLATBUFFERS_GENERATED_TRACINGSCHEMA_H_
8 #endif
9 #include "fcp/base/tracing_schema_generated.h"
10 #include "absl/strings/string_view.h"
11 #include "fcp/tracing/tracing_severity.h"
12 #include "fcp/tracing/tracing_traits.h"
13 #include "flatbuffers/minireflect.h"
14 #include "flatbuffers/idl.h"
15 #include "fcp/base/platform.h"
16 
17 namespace fcp {
18 
19 template<> class TracingTraits<ProtoParseFailure>: public TracingTraitsBase {
20  public:
21   static constexpr TracingTag kTag = TracingTag("PRPR");
22   static constexpr TracingSeverity kSeverity = fcp::TracingSeverity::kError;
23   static constexpr bool kIsSpan = false;
Name()24   const char* Name() const override { return "ProtoParseFailure"; }
Severity()25   TracingSeverity Severity() const override {
26     return fcp::TracingSeverity::kError;
27   }
TextFormat(const flatbuffers::DetachedBuffer & buf)28   std::string TextFormat(const flatbuffers::DetachedBuffer& buf) const override {
29     return flatbuffers::FlatBufferToString(buf.data(), ProtoParseFailureTypeTable());
30   }
JsonStringFormat(const uint8_t * flatbuf_bytes)31   std::string JsonStringFormat(const uint8_t* flatbuf_bytes) const override {
32     flatbuffers::Parser parser;
33     std::string schema_file;
34     std::string fbs_file = "fcp/base/tracing_schema.fbs";
35     flatbuffers::LoadFile(GetDataPath(fbs_file).c_str(), true, &schema_file);
36     std::string schema_path_common = GetDataPath("fcp/tracing/tracing_schema_common.fbs");
37     std::string directory_common = schema_path_common.substr(0, schema_path_common.find("fcp/tracing/tracing_schema_common.fbs"));
38     const char *include_directories[] = {
39                  directory_common.c_str(), nullptr};
40     parser.Parse(schema_file.c_str(), include_directories);
41     std::string jsongen;
42     parser.SetRootType("ProtoParseFailure");
43     GenerateText(parser, flatbuf_bytes, &jsongen);
44     return jsongen;
45   }
Create(absl::string_view type,flatbuffers::FlatBufferBuilder * fbb)46   static flatbuffers::Offset<ProtoParseFailure> Create(absl::string_view type, flatbuffers::FlatBufferBuilder* fbb) {
47     auto type__ = fbb->CreateString(type.data(), type.size());
48     return CreateProtoParseFailure(*fbb, type__);
49   }
50   using TupleType = std::tuple<std::string>;
MakeTuple(const ProtoParseFailure * table)51   static TupleType MakeTuple(const ProtoParseFailure* table) {
52     return std::make_tuple(table->type()->str());
53   }
54 };
55 static internal::TracingTraitsRegistrar<ProtoParseFailure> registrar_ProtoParseFailure;
56 template<> class TracingTraits<ResultExpectError>: public TracingTraitsBase {
57  public:
58   static constexpr TracingTag kTag = TracingTag("!EXP");
59   static constexpr TracingSeverity kSeverity = fcp::TracingSeverity::kError;
60   static constexpr bool kIsSpan = false;
Name()61   const char* Name() const override { return "ResultExpectError"; }
Severity()62   TracingSeverity Severity() const override {
63     return fcp::TracingSeverity::kError;
64   }
TextFormat(const flatbuffers::DetachedBuffer & buf)65   std::string TextFormat(const flatbuffers::DetachedBuffer& buf) const override {
66     return flatbuffers::FlatBufferToString(buf.data(), ResultExpectErrorTypeTable());
67   }
JsonStringFormat(const uint8_t * flatbuf_bytes)68   std::string JsonStringFormat(const uint8_t* flatbuf_bytes) const override {
69     flatbuffers::Parser parser;
70     std::string schema_file;
71     std::string fbs_file = "fcp/base/tracing_schema.fbs";
72     flatbuffers::LoadFile(GetDataPath(fbs_file).c_str(), true, &schema_file);
73     std::string schema_path_common = GetDataPath("fcp/tracing/tracing_schema_common.fbs");
74     std::string directory_common = schema_path_common.substr(0, schema_path_common.find("fcp/tracing/tracing_schema_common.fbs"));
75     const char *include_directories[] = {
76                  directory_common.c_str(), nullptr};
77     parser.Parse(schema_file.c_str(), include_directories);
78     std::string jsongen;
79     parser.SetRootType("ResultExpectError");
80     GenerateText(parser, flatbuf_bytes, &jsongen);
81     return jsongen;
82   }
Create(absl::string_view expectation,absl::string_view file_name,std::int32_t line,flatbuffers::FlatBufferBuilder * fbb)83   static flatbuffers::Offset<ResultExpectError> Create(absl::string_view expectation, absl::string_view file_name, std::int32_t line, flatbuffers::FlatBufferBuilder* fbb) {
84     auto expectation__ = fbb->CreateString(expectation.data(), expectation.size());
85     auto file_name__ = fbb->CreateString(file_name.data(), file_name.size());
86     return CreateResultExpectError(*fbb, expectation__, file_name__, line);
87   }
88   using TupleType = std::tuple<std::string, std::string, std::int32_t>;
MakeTuple(const ResultExpectError * table)89   static TupleType MakeTuple(const ResultExpectError* table) {
90     return std::make_tuple(table->expectation()->str(), table->file_name()->str(), table->line());
91   }
92 };
93 static internal::TracingTraitsRegistrar<ResultExpectError> registrar_ResultExpectError;
94 template<> class TracingTraits<ResultExpectStatusError>: public TracingTraitsBase {
95  public:
96   static constexpr TracingTag kTag = TracingTag("STAT");
97   static constexpr TracingSeverity kSeverity = fcp::TracingSeverity::kError;
98   static constexpr bool kIsSpan = false;
Name()99   const char* Name() const override { return "ResultExpectStatusError"; }
Severity()100   TracingSeverity Severity() const override {
101     return fcp::TracingSeverity::kError;
102   }
TextFormat(const flatbuffers::DetachedBuffer & buf)103   std::string TextFormat(const flatbuffers::DetachedBuffer& buf) const override {
104     return flatbuffers::FlatBufferToString(buf.data(), ResultExpectStatusErrorTypeTable());
105   }
JsonStringFormat(const uint8_t * flatbuf_bytes)106   std::string JsonStringFormat(const uint8_t* flatbuf_bytes) const override {
107     flatbuffers::Parser parser;
108     std::string schema_file;
109     std::string fbs_file = "fcp/base/tracing_schema.fbs";
110     flatbuffers::LoadFile(GetDataPath(fbs_file).c_str(), true, &schema_file);
111     std::string schema_path_common = GetDataPath("fcp/tracing/tracing_schema_common.fbs");
112     std::string directory_common = schema_path_common.substr(0, schema_path_common.find("fcp/tracing/tracing_schema_common.fbs"));
113     const char *include_directories[] = {
114                  directory_common.c_str(), nullptr};
115     parser.Parse(schema_file.c_str(), include_directories);
116     std::string jsongen;
117     parser.SetRootType("ResultExpectStatusError");
118     GenerateText(parser, flatbuf_bytes, &jsongen);
119     return jsongen;
120   }
Create(TracingStatusCode expected_code,TracingStatusCode actual_code,absl::string_view message,absl::string_view file_name,std::int32_t line,flatbuffers::FlatBufferBuilder * fbb)121   static flatbuffers::Offset<ResultExpectStatusError> Create(TracingStatusCode expected_code, TracingStatusCode actual_code, absl::string_view message, absl::string_view file_name, std::int32_t line, flatbuffers::FlatBufferBuilder* fbb) {
122     auto message__ = fbb->CreateString(message.data(), message.size());
123     auto file_name__ = fbb->CreateString(file_name.data(), file_name.size());
124     return CreateResultExpectStatusError(*fbb, expected_code, actual_code, message__, file_name__, line);
125   }
126   using TupleType = std::tuple<TracingStatusCode, TracingStatusCode, std::string, std::string, std::int32_t>;
MakeTuple(const ResultExpectStatusError * table)127   static TupleType MakeTuple(const ResultExpectStatusError* table) {
128     return std::make_tuple(table->expected_code(), table->actual_code(), table->message()->str(), table->file_name()->str(), table->line());
129   }
130 };
131 static internal::TracingTraitsRegistrar<ResultExpectStatusError> registrar_ResultExpectStatusError;
132 } // namespace fcp
133 
134 #endif  // FCP_BASE_TRACING_SCHEMA_H