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