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