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