• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // automatically generated by the FlatBuffers compiler, do not modify
2 
3 
4 #ifndef FLATBUFFERS_GENERATED_EVOLUTIONV1_EVOLUTION_V1_H_
5 #define FLATBUFFERS_GENERATED_EVOLUTIONV1_EVOLUTION_V1_H_
6 
7 #include "flatbuffers/flatbuffers.h"
8 
9 namespace Evolution {
10 namespace V1 {
11 
12 struct TableA;
13 struct TableABuilder;
14 
15 struct TableB;
16 struct TableBBuilder;
17 
18 struct Struct;
19 
20 struct Root;
21 struct RootBuilder;
22 
23 enum class Enum : int8_t {
24   King = 0,
25   Queen = 1,
26   MIN = King,
27   MAX = Queen
28 };
29 
EnumValuesEnum()30 inline const Enum (&EnumValuesEnum())[2] {
31   static const Enum values[] = {
32     Enum::King,
33     Enum::Queen
34   };
35   return values;
36 }
37 
EnumNamesEnum()38 inline const char * const *EnumNamesEnum() {
39   static const char * const names[3] = {
40     "King",
41     "Queen",
42     nullptr
43   };
44   return names;
45 }
46 
EnumNameEnum(Enum e)47 inline const char *EnumNameEnum(Enum e) {
48   if (flatbuffers::IsOutRange(e, Enum::King, Enum::Queen)) return "";
49   const size_t index = static_cast<size_t>(e);
50   return EnumNamesEnum()[index];
51 }
52 
53 enum class Union : uint8_t {
54   NONE = 0,
55   TableA = 1,
56   TableB = 2,
57   MIN = NONE,
58   MAX = TableB
59 };
60 
EnumValuesUnion()61 inline const Union (&EnumValuesUnion())[3] {
62   static const Union values[] = {
63     Union::NONE,
64     Union::TableA,
65     Union::TableB
66   };
67   return values;
68 }
69 
EnumNamesUnion()70 inline const char * const *EnumNamesUnion() {
71   static const char * const names[4] = {
72     "NONE",
73     "TableA",
74     "TableB",
75     nullptr
76   };
77   return names;
78 }
79 
EnumNameUnion(Union e)80 inline const char *EnumNameUnion(Union e) {
81   if (flatbuffers::IsOutRange(e, Union::NONE, Union::TableB)) return "";
82   const size_t index = static_cast<size_t>(e);
83   return EnumNamesUnion()[index];
84 }
85 
86 template<typename T> struct UnionTraits {
87   static const Union enum_value = Union::NONE;
88 };
89 
90 template<> struct UnionTraits<Evolution::V1::TableA> {
91   static const Union enum_value = Union::TableA;
92 };
93 
94 template<> struct UnionTraits<Evolution::V1::TableB> {
95   static const Union enum_value = Union::TableB;
96 };
97 
98 bool VerifyUnion(flatbuffers::Verifier &verifier, const void *obj, Union type);
99 bool VerifyUnionVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
100 
101 FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Struct FLATBUFFERS_FINAL_CLASS {
102  private:
103   int32_t a_;
104   int32_t padding0__;
105   double b_;
106 
107  public:
108   Struct()
109       : a_(0),
110         padding0__(0),
111         b_(0) {
112     (void)padding0__;
113   }
114   Struct(int32_t _a, double _b)
115       : a_(flatbuffers::EndianScalar(_a)),
116         padding0__(0),
117         b_(flatbuffers::EndianScalar(_b)) {
118     (void)padding0__;
119   }
120   int32_t a() const {
121     return flatbuffers::EndianScalar(a_);
122   }
123   double b() const {
124     return flatbuffers::EndianScalar(b_);
125   }
126 };
127 FLATBUFFERS_STRUCT_END(Struct, 16);
128 
129 inline bool operator==(const Struct &lhs, const Struct &rhs) {
130   return
131       (lhs.a() == rhs.a()) &&
132       (lhs.b() == rhs.b());
133 }
134 
135 inline bool operator!=(const Struct &lhs, const Struct &rhs) {
136     return !(lhs == rhs);
137 }
138 
139 
140 struct TableA FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
141   typedef TableABuilder Builder;
142   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
143     VT_A = 4,
144     VT_B = 6
145   };
146   float a() const {
147     return GetField<float>(VT_A, 0.0f);
148   }
149   int32_t b() const {
150     return GetField<int32_t>(VT_B, 0);
151   }
152   bool Verify(flatbuffers::Verifier &verifier) const {
153     return VerifyTableStart(verifier) &&
154            VerifyField<float>(verifier, VT_A) &&
155            VerifyField<int32_t>(verifier, VT_B) &&
156            verifier.EndTable();
157   }
158 };
159 
160 struct TableABuilder {
161   typedef TableA Table;
162   flatbuffers::FlatBufferBuilder &fbb_;
163   flatbuffers::uoffset_t start_;
164   void add_a(float a) {
165     fbb_.AddElement<float>(TableA::VT_A, a, 0.0f);
166   }
167   void add_b(int32_t b) {
168     fbb_.AddElement<int32_t>(TableA::VT_B, b, 0);
169   }
170   explicit TableABuilder(flatbuffers::FlatBufferBuilder &_fbb)
171         : fbb_(_fbb) {
172     start_ = fbb_.StartTable();
173   }
174   flatbuffers::Offset<TableA> Finish() {
175     const auto end = fbb_.EndTable(start_);
176     auto o = flatbuffers::Offset<TableA>(end);
177     return o;
178   }
179 };
180 
181 inline flatbuffers::Offset<TableA> CreateTableA(
182     flatbuffers::FlatBufferBuilder &_fbb,
183     float a = 0.0f,
184     int32_t b = 0) {
185   TableABuilder builder_(_fbb);
186   builder_.add_b(b);
187   builder_.add_a(a);
188   return builder_.Finish();
189 }
190 
191 struct TableB FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
192   typedef TableBBuilder Builder;
193   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
194     VT_A = 4
195   };
196   int32_t a() const {
197     return GetField<int32_t>(VT_A, 0);
198   }
199   bool Verify(flatbuffers::Verifier &verifier) const {
200     return VerifyTableStart(verifier) &&
201            VerifyField<int32_t>(verifier, VT_A) &&
202            verifier.EndTable();
203   }
204 };
205 
206 struct TableBBuilder {
207   typedef TableB Table;
208   flatbuffers::FlatBufferBuilder &fbb_;
209   flatbuffers::uoffset_t start_;
210   void add_a(int32_t a) {
211     fbb_.AddElement<int32_t>(TableB::VT_A, a, 0);
212   }
213   explicit TableBBuilder(flatbuffers::FlatBufferBuilder &_fbb)
214         : fbb_(_fbb) {
215     start_ = fbb_.StartTable();
216   }
217   flatbuffers::Offset<TableB> Finish() {
218     const auto end = fbb_.EndTable(start_);
219     auto o = flatbuffers::Offset<TableB>(end);
220     return o;
221   }
222 };
223 
224 inline flatbuffers::Offset<TableB> CreateTableB(
225     flatbuffers::FlatBufferBuilder &_fbb,
226     int32_t a = 0) {
227   TableBBuilder builder_(_fbb);
228   builder_.add_a(a);
229   return builder_.Finish();
230 }
231 
232 struct Root FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
233   typedef RootBuilder Builder;
234   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
235     VT_A = 4,
236     VT_B = 6,
237     VT_C_TYPE = 8,
238     VT_C = 10,
239     VT_D = 12,
240     VT_E = 14,
241     VT_F = 16,
242     VT_G = 18,
243     VT_H = 20,
244     VT_I = 22,
245     VT_J_TYPE = 24,
246     VT_J = 26
247   };
248   int32_t a() const {
249     return GetField<int32_t>(VT_A, 0);
250   }
251   bool b() const {
252     return GetField<uint8_t>(VT_B, 0) != 0;
253   }
254   Evolution::V1::Union c_type() const {
255     return static_cast<Evolution::V1::Union>(GetField<uint8_t>(VT_C_TYPE, 0));
256   }
257   const void *c() const {
258     return GetPointer<const void *>(VT_C);
259   }
260   template<typename T> const T *c_as() const;
261   const Evolution::V1::TableA *c_as_TableA() const {
262     return c_type() == Evolution::V1::Union::TableA ? static_cast<const Evolution::V1::TableA *>(c()) : nullptr;
263   }
264   const Evolution::V1::TableB *c_as_TableB() const {
265     return c_type() == Evolution::V1::Union::TableB ? static_cast<const Evolution::V1::TableB *>(c()) : nullptr;
266   }
267   Evolution::V1::Enum d() const {
268     return static_cast<Evolution::V1::Enum>(GetField<int8_t>(VT_D, 0));
269   }
270   const Evolution::V1::TableA *e() const {
271     return GetPointer<const Evolution::V1::TableA *>(VT_E);
272   }
273   const Evolution::V1::Struct *f() const {
274     return GetStruct<const Evolution::V1::Struct *>(VT_F);
275   }
276   const flatbuffers::Vector<int32_t> *g() const {
277     return GetPointer<const flatbuffers::Vector<int32_t> *>(VT_G);
278   }
279   const flatbuffers::Vector<flatbuffers::Offset<Evolution::V1::TableB>> *h() const {
280     return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<Evolution::V1::TableB>> *>(VT_H);
281   }
282   int32_t i() const {
283     return GetField<int32_t>(VT_I, 1234);
284   }
285   Evolution::V1::Union j_type() const {
286     return static_cast<Evolution::V1::Union>(GetField<uint8_t>(VT_J_TYPE, 0));
287   }
288   const void *j() const {
289     return GetPointer<const void *>(VT_J);
290   }
291   template<typename T> const T *j_as() const;
292   const Evolution::V1::TableA *j_as_TableA() const {
293     return j_type() == Evolution::V1::Union::TableA ? static_cast<const Evolution::V1::TableA *>(j()) : nullptr;
294   }
295   const Evolution::V1::TableB *j_as_TableB() const {
296     return j_type() == Evolution::V1::Union::TableB ? static_cast<const Evolution::V1::TableB *>(j()) : nullptr;
297   }
298   bool Verify(flatbuffers::Verifier &verifier) const {
299     return VerifyTableStart(verifier) &&
300            VerifyField<int32_t>(verifier, VT_A) &&
301            VerifyField<uint8_t>(verifier, VT_B) &&
302            VerifyField<uint8_t>(verifier, VT_C_TYPE) &&
303            VerifyOffset(verifier, VT_C) &&
304            VerifyUnion(verifier, c(), c_type()) &&
305            VerifyField<int8_t>(verifier, VT_D) &&
306            VerifyOffset(verifier, VT_E) &&
307            verifier.VerifyTable(e()) &&
308            VerifyField<Evolution::V1::Struct>(verifier, VT_F) &&
309            VerifyOffset(verifier, VT_G) &&
310            verifier.VerifyVector(g()) &&
311            VerifyOffset(verifier, VT_H) &&
312            verifier.VerifyVector(h()) &&
313            verifier.VerifyVectorOfTables(h()) &&
314            VerifyField<int32_t>(verifier, VT_I) &&
315            VerifyField<uint8_t>(verifier, VT_J_TYPE) &&
316            VerifyOffset(verifier, VT_J) &&
317            VerifyUnion(verifier, j(), j_type()) &&
318            verifier.EndTable();
319   }
320 };
321 
322 template<> inline const Evolution::V1::TableA *Root::c_as<Evolution::V1::TableA>() const {
323   return c_as_TableA();
324 }
325 
326 template<> inline const Evolution::V1::TableB *Root::c_as<Evolution::V1::TableB>() const {
327   return c_as_TableB();
328 }
329 
330 template<> inline const Evolution::V1::TableA *Root::j_as<Evolution::V1::TableA>() const {
331   return j_as_TableA();
332 }
333 
334 template<> inline const Evolution::V1::TableB *Root::j_as<Evolution::V1::TableB>() const {
335   return j_as_TableB();
336 }
337 
338 struct RootBuilder {
339   typedef Root Table;
340   flatbuffers::FlatBufferBuilder &fbb_;
341   flatbuffers::uoffset_t start_;
342   void add_a(int32_t a) {
343     fbb_.AddElement<int32_t>(Root::VT_A, a, 0);
344   }
345   void add_b(bool b) {
346     fbb_.AddElement<uint8_t>(Root::VT_B, static_cast<uint8_t>(b), 0);
347   }
348   void add_c_type(Evolution::V1::Union c_type) {
349     fbb_.AddElement<uint8_t>(Root::VT_C_TYPE, static_cast<uint8_t>(c_type), 0);
350   }
351   void add_c(flatbuffers::Offset<void> c) {
352     fbb_.AddOffset(Root::VT_C, c);
353   }
354   void add_d(Evolution::V1::Enum d) {
355     fbb_.AddElement<int8_t>(Root::VT_D, static_cast<int8_t>(d), 0);
356   }
357   void add_e(flatbuffers::Offset<Evolution::V1::TableA> e) {
358     fbb_.AddOffset(Root::VT_E, e);
359   }
360   void add_f(const Evolution::V1::Struct *f) {
361     fbb_.AddStruct(Root::VT_F, f);
362   }
363   void add_g(flatbuffers::Offset<flatbuffers::Vector<int32_t>> g) {
364     fbb_.AddOffset(Root::VT_G, g);
365   }
366   void add_h(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Evolution::V1::TableB>>> h) {
367     fbb_.AddOffset(Root::VT_H, h);
368   }
369   void add_i(int32_t i) {
370     fbb_.AddElement<int32_t>(Root::VT_I, i, 1234);
371   }
372   void add_j_type(Evolution::V1::Union j_type) {
373     fbb_.AddElement<uint8_t>(Root::VT_J_TYPE, static_cast<uint8_t>(j_type), 0);
374   }
375   void add_j(flatbuffers::Offset<void> j) {
376     fbb_.AddOffset(Root::VT_J, j);
377   }
378   explicit RootBuilder(flatbuffers::FlatBufferBuilder &_fbb)
379         : fbb_(_fbb) {
380     start_ = fbb_.StartTable();
381   }
382   flatbuffers::Offset<Root> Finish() {
383     const auto end = fbb_.EndTable(start_);
384     auto o = flatbuffers::Offset<Root>(end);
385     return o;
386   }
387 };
388 
389 inline flatbuffers::Offset<Root> CreateRoot(
390     flatbuffers::FlatBufferBuilder &_fbb,
391     int32_t a = 0,
392     bool b = false,
393     Evolution::V1::Union c_type = Evolution::V1::Union::NONE,
394     flatbuffers::Offset<void> c = 0,
395     Evolution::V1::Enum d = Evolution::V1::Enum::King,
396     flatbuffers::Offset<Evolution::V1::TableA> e = 0,
397     const Evolution::V1::Struct *f = 0,
398     flatbuffers::Offset<flatbuffers::Vector<int32_t>> g = 0,
399     flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Evolution::V1::TableB>>> h = 0,
400     int32_t i = 1234,
401     Evolution::V1::Union j_type = Evolution::V1::Union::NONE,
402     flatbuffers::Offset<void> j = 0) {
403   RootBuilder builder_(_fbb);
404   builder_.add_j(j);
405   builder_.add_i(i);
406   builder_.add_h(h);
407   builder_.add_g(g);
408   builder_.add_f(f);
409   builder_.add_e(e);
410   builder_.add_c(c);
411   builder_.add_a(a);
412   builder_.add_j_type(j_type);
413   builder_.add_d(d);
414   builder_.add_c_type(c_type);
415   builder_.add_b(b);
416   return builder_.Finish();
417 }
418 
419 inline flatbuffers::Offset<Root> CreateRootDirect(
420     flatbuffers::FlatBufferBuilder &_fbb,
421     int32_t a = 0,
422     bool b = false,
423     Evolution::V1::Union c_type = Evolution::V1::Union::NONE,
424     flatbuffers::Offset<void> c = 0,
425     Evolution::V1::Enum d = Evolution::V1::Enum::King,
426     flatbuffers::Offset<Evolution::V1::TableA> e = 0,
427     const Evolution::V1::Struct *f = 0,
428     const std::vector<int32_t> *g = nullptr,
429     const std::vector<flatbuffers::Offset<Evolution::V1::TableB>> *h = nullptr,
430     int32_t i = 1234,
431     Evolution::V1::Union j_type = Evolution::V1::Union::NONE,
432     flatbuffers::Offset<void> j = 0) {
433   auto g__ = g ? _fbb.CreateVector<int32_t>(*g) : 0;
434   auto h__ = h ? _fbb.CreateVector<flatbuffers::Offset<Evolution::V1::TableB>>(*h) : 0;
435   return Evolution::V1::CreateRoot(
436       _fbb,
437       a,
438       b,
439       c_type,
440       c,
441       d,
442       e,
443       f,
444       g__,
445       h__,
446       i,
447       j_type,
448       j);
449 }
450 
451 inline bool VerifyUnion(flatbuffers::Verifier &verifier, const void *obj, Union type) {
452   switch (type) {
453     case Union::NONE: {
454       return true;
455     }
456     case Union::TableA: {
457       auto ptr = reinterpret_cast<const Evolution::V1::TableA *>(obj);
458       return verifier.VerifyTable(ptr);
459     }
460     case Union::TableB: {
461       auto ptr = reinterpret_cast<const Evolution::V1::TableB *>(obj);
462       return verifier.VerifyTable(ptr);
463     }
464     default: return true;
465   }
466 }
467 
468 inline bool VerifyUnionVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types) {
469   if (!values || !types) return !values && !types;
470   if (values->size() != types->size()) return false;
471   for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
472     if (!VerifyUnion(
473         verifier,  values->Get(i), types->GetEnum<Union>(i))) {
474       return false;
475     }
476   }
477   return true;
478 }
479 
480 inline const Evolution::V1::Root *GetRoot(const void *buf) {
481   return flatbuffers::GetRoot<Evolution::V1::Root>(buf);
482 }
483 
484 inline const Evolution::V1::Root *GetSizePrefixedRoot(const void *buf) {
485   return flatbuffers::GetSizePrefixedRoot<Evolution::V1::Root>(buf);
486 }
487 
488 inline bool VerifyRootBuffer(
489     flatbuffers::Verifier &verifier) {
490   return verifier.VerifyBuffer<Evolution::V1::Root>(nullptr);
491 }
492 
493 inline bool VerifySizePrefixedRootBuffer(
494     flatbuffers::Verifier &verifier) {
495   return verifier.VerifySizePrefixedBuffer<Evolution::V1::Root>(nullptr);
496 }
497 
498 inline void FinishRootBuffer(
499     flatbuffers::FlatBufferBuilder &fbb,
500     flatbuffers::Offset<Evolution::V1::Root> root) {
501   fbb.Finish(root);
502 }
503 
504 inline void FinishSizePrefixedRootBuffer(
505     flatbuffers::FlatBufferBuilder &fbb,
506     flatbuffers::Offset<Evolution::V1::Root> root) {
507   fbb.FinishSizePrefixed(root);
508 }
509 
510 }  // namespace V1
511 }  // namespace Evolution
512 
513 #endif  // FLATBUFFERS_GENERATED_EVOLUTIONV1_EVOLUTION_V1_H_
514