xref: /aosp_15_r20/external/federated-compute/fcp/tracing/tools/testdata/TableWithNamespace.baseline (revision 14675a029014e728ec732f129a32e299b2da0601)
1*14675a02SAndroid Build Coastguard Worker============== TableWithNamespace.fbs ============
2*14675a02SAndroid Build Coastguard Workerinclude "${DIR}/tracing_schema_common.fbs";
3*14675a02SAndroid Build Coastguard Workernamespace foo.bar;
4*14675a02SAndroid Build Coastguard Worker
5*14675a02SAndroid Build Coastguard Workerenum Color : int { Red = 0, Green = 1, Blue = 2 }
6*14675a02SAndroid Build Coastguard Worker
7*14675a02SAndroid Build Coastguard Workertable TestTable (tag: "TETB", span) {
8*14675a02SAndroid Build Coastguard Worker  id: int;
9*14675a02SAndroid Build Coastguard Worker  color: Color;
10*14675a02SAndroid Build Coastguard Worker}
11*14675a02SAndroid Build Coastguard Worker
12*14675a02SAndroid Build Coastguard Worker============== diagnosis ============
13*14675a02SAndroid Build Coastguard Worker
14*14675a02SAndroid Build Coastguard Worker============== result ============
15*14675a02SAndroid Build Coastguard Worker// Autogenerated by tracing_traits_generator, do not edit
16*14675a02SAndroid Build Coastguard Worker
17*14675a02SAndroid Build Coastguard Worker#ifndef THIRD_PARTY_FCP_TRACING_TOOLS_TESTDATA_TABLEWITHNAMESPACE_H
18*14675a02SAndroid Build Coastguard Worker#define THIRD_PARTY_FCP_TRACING_TOOLS_TESTDATA_TABLEWITHNAMESPACE_H
19*14675a02SAndroid Build Coastguard Worker
20*14675a02SAndroid Build Coastguard Worker#ifdef FLATBUFFERS_GENERATED_TRACINGSCHEMA_H_
21*14675a02SAndroid Build Coastguard Worker#undef FLATBUFFERS_GENERATED_TRACINGSCHEMA_H_
22*14675a02SAndroid Build Coastguard Worker#endif
23*14675a02SAndroid Build Coastguard Worker#include "${DIR}/tools/testdata/TableWithNamespace_generated.h"
24*14675a02SAndroid Build Coastguard Worker#include "absl/strings/string_view.h"
25*14675a02SAndroid Build Coastguard Worker#include "${DIR}/tracing_severity.h"
26*14675a02SAndroid Build Coastguard Worker#include "${DIR}/tracing_traits.h"
27*14675a02SAndroid Build Coastguard Worker#include "flatbuffers/minireflect.h"
28*14675a02SAndroid Build Coastguard Worker#include "flatbuffers/idl.h"
29*14675a02SAndroid Build Coastguard Worker#include "${BASE}/platform.h"
30*14675a02SAndroid Build Coastguard Worker
31*14675a02SAndroid Build Coastguard Workernamespace fcp {
32*14675a02SAndroid Build Coastguard Worker
33*14675a02SAndroid Build Coastguard Workertemplate<> class TracingTraits<foo::bar::TestTable>: public TracingTraitsBase {
34*14675a02SAndroid Build Coastguard Worker public:
35*14675a02SAndroid Build Coastguard Worker  static constexpr TracingTag kTag = TracingTag("TETB");
36*14675a02SAndroid Build Coastguard Worker  static constexpr TracingSeverity kSeverity = fcp::TracingSeverity::kInfo;
37*14675a02SAndroid Build Coastguard Worker  static constexpr bool kIsSpan = true;
38*14675a02SAndroid Build Coastguard Worker  const char* Name() const override { return "foo::bar::TestTable"; }
39*14675a02SAndroid Build Coastguard Worker  TracingSeverity Severity() const override {
40*14675a02SAndroid Build Coastguard Worker    return fcp::TracingSeverity::kInfo;
41*14675a02SAndroid Build Coastguard Worker  }
42*14675a02SAndroid Build Coastguard Worker  std::string TextFormat(const flatbuffers::DetachedBuffer& buf) const override {
43*14675a02SAndroid Build Coastguard Worker    return flatbuffers::FlatBufferToString(buf.data(), foo::bar::TestTableTypeTable());
44*14675a02SAndroid Build Coastguard Worker  }
45*14675a02SAndroid Build Coastguard Worker  std::string JsonStringFormat(const uint8_t* flatbuf_bytes) const override {
46*14675a02SAndroid Build Coastguard Worker    flatbuffers::Parser parser;
47*14675a02SAndroid Build Coastguard Worker    std::string schema_file;
48*14675a02SAndroid Build Coastguard Worker    std::string fbs_file = "${RUNFILE_PATH}/tools/testdata/TableWithNamespace.fbs";
49*14675a02SAndroid Build Coastguard Worker    flatbuffers::LoadFile(GetDataPath(fbs_file).c_str(), true, &schema_file);
50*14675a02SAndroid Build Coastguard Worker    std::string schema_path_common = GetDataPath("${DIR}/tracing_schema_common.fbs");
51*14675a02SAndroid Build Coastguard Worker    std::string directory_common = schema_path_common.substr(0, schema_path_common.find("${DIR}/tracing_schema_common.fbs"));
52*14675a02SAndroid Build Coastguard Worker    const char *include_directories[] = {
53*14675a02SAndroid Build Coastguard Worker                 directory_common.c_str(), nullptr};
54*14675a02SAndroid Build Coastguard Worker    parser.Parse(schema_file.c_str(), include_directories);
55*14675a02SAndroid Build Coastguard Worker    std::string jsongen;
56*14675a02SAndroid Build Coastguard Worker    parser.SetRootType("foo::bar::TestTable");
57*14675a02SAndroid Build Coastguard Worker    GenerateText(parser, flatbuf_bytes, &jsongen);
58*14675a02SAndroid Build Coastguard Worker    return jsongen;
59*14675a02SAndroid Build Coastguard Worker  }
60*14675a02SAndroid Build Coastguard Worker  static flatbuffers::Offset<foo::bar::TestTable> Create(std::int32_t id, foo::bar::Color color, flatbuffers::FlatBufferBuilder* fbb) {
61*14675a02SAndroid Build Coastguard Worker    return foo::bar::CreateTestTable(*fbb, id, color);
62*14675a02SAndroid Build Coastguard Worker  }
63*14675a02SAndroid Build Coastguard Worker  using TupleType = std::tuple<std::int32_t, foo::bar::Color>;
64*14675a02SAndroid Build Coastguard Worker  static TupleType MakeTuple(const foo::bar::TestTable* table) {
65*14675a02SAndroid Build Coastguard Worker    return std::make_tuple(table->id(), table->color());
66*14675a02SAndroid Build Coastguard Worker  }
67*14675a02SAndroid Build Coastguard Worker};
68*14675a02SAndroid Build Coastguard Workerstatic internal::TracingTraitsRegistrar<foo::bar::TestTable> registrar_TestTable;
69*14675a02SAndroid Build Coastguard Worker} // namespace fcp
70*14675a02SAndroid Build Coastguard Worker
71*14675a02SAndroid Build Coastguard Worker#endif  // THIRD_PARTY_FCP_TRACING_TOOLS_TESTDATA_TABLEWITHNAMESPACE_H
72*14675a02SAndroid Build Coastguard Worker
73