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