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