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