aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/apache/arrow/cpp/src/generated/Message_generated.h
blob: aaac55801e211b0a4cfb8b84c8ddb315a77575a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
// automatically generated by the FlatBuffers compiler, do not modify 
 
 
#ifndef FLATBUFFERS_GENERATED_MESSAGE_ORG_APACHE_ARROW_FLATBUF_H_ 
#define FLATBUFFERS_GENERATED_MESSAGE_ORG_APACHE_ARROW_FLATBUF_H_ 
 
#include "flatbuffers/flatbuffers.h" 
 
#include "Schema_generated.h" 
#include "SparseTensor_generated.h" 
#include "Tensor_generated.h" 
 
namespace org { 
namespace apache { 
namespace arrow { 
namespace flatbuf { 
 
struct FieldNode; 
 
struct BodyCompression; 
struct BodyCompressionBuilder; 
 
struct RecordBatch; 
struct RecordBatchBuilder; 
 
struct DictionaryBatch; 
struct DictionaryBatchBuilder; 
 
struct Message; 
struct MessageBuilder; 
 
enum class CompressionType : int8_t { 
  LZ4_FRAME = 0, 
  ZSTD = 1, 
  MIN = LZ4_FRAME, 
  MAX = ZSTD 
}; 
 
inline const CompressionType (&EnumValuesCompressionType())[2] { 
  static const CompressionType values[] = { 
    CompressionType::LZ4_FRAME, 
    CompressionType::ZSTD 
  }; 
  return values; 
} 
 
inline const char * const *EnumNamesCompressionType() { 
  static const char * const names[3] = { 
    "LZ4_FRAME", 
    "ZSTD", 
    nullptr 
  }; 
  return names; 
} 
 
inline const char *EnumNameCompressionType(CompressionType e) { 
  if (flatbuffers::IsOutRange(e, CompressionType::LZ4_FRAME, CompressionType::ZSTD)) return ""; 
  const size_t index = static_cast<size_t>(e); 
  return EnumNamesCompressionType()[index]; 
} 
 
/// Provided for forward compatibility in case we need to support different 
/// strategies for compressing the IPC message body (like whole-body 
/// compression rather than buffer-level) in the future 
enum class BodyCompressionMethod : int8_t { 
  /// Each constituent buffer is first compressed with the indicated 
  /// compressor, and then written with the uncompressed length in the first 8 
  /// bytes as a 64-bit little-endian signed integer followed by the compressed 
  /// buffer bytes (and then padding as required by the protocol). The 
  /// uncompressed length may be set to -1 to indicate that the data that 
  /// follows is not compressed, which can be useful for cases where 
  /// compression does not yield appreciable savings. 
  BUFFER = 0, 
  MIN = BUFFER, 
  MAX = BUFFER 
}; 
 
inline const BodyCompressionMethod (&EnumValuesBodyCompressionMethod())[1] { 
  static const BodyCompressionMethod values[] = { 
    BodyCompressionMethod::BUFFER 
  }; 
  return values; 
} 
 
inline const char * const *EnumNamesBodyCompressionMethod() { 
  static const char * const names[2] = { 
    "BUFFER", 
    nullptr 
  }; 
  return names; 
} 
 
inline const char *EnumNameBodyCompressionMethod(BodyCompressionMethod e) { 
  if (flatbuffers::IsOutRange(e, BodyCompressionMethod::BUFFER, BodyCompressionMethod::BUFFER)) return ""; 
  const size_t index = static_cast<size_t>(e); 
  return EnumNamesBodyCompressionMethod()[index]; 
} 
 
/// ---------------------------------------------------------------------- 
/// The root Message type 
/// This union enables us to easily send different message types without 
/// redundant storage, and in the future we can easily add new message types. 
/// 
/// Arrow implementations do not need to implement all of the message types, 
/// which may include experimental metadata types. For maximum compatibility, 
/// it is best to send data using RecordBatch 
enum class MessageHeader : uint8_t { 
  NONE = 0, 
  Schema = 1, 
  DictionaryBatch = 2, 
  RecordBatch = 3, 
  Tensor = 4, 
  SparseTensor = 5, 
  MIN = NONE, 
  MAX = SparseTensor 
}; 
 
inline const MessageHeader (&EnumValuesMessageHeader())[6] { 
  static const MessageHeader values[] = { 
    MessageHeader::NONE, 
    MessageHeader::Schema, 
    MessageHeader::DictionaryBatch, 
    MessageHeader::RecordBatch, 
    MessageHeader::Tensor, 
    MessageHeader::SparseTensor 
  }; 
  return values; 
} 
 
inline const char * const *EnumNamesMessageHeader() { 
  static const char * const names[7] = { 
    "NONE", 
    "Schema", 
    "DictionaryBatch", 
    "RecordBatch", 
    "Tensor", 
    "SparseTensor", 
    nullptr 
  }; 
  return names; 
} 
 
inline const char *EnumNameMessageHeader(MessageHeader e) { 
  if (flatbuffers::IsOutRange(e, MessageHeader::NONE, MessageHeader::SparseTensor)) return ""; 
  const size_t index = static_cast<size_t>(e); 
  return EnumNamesMessageHeader()[index]; 
} 
 
template<typename T> struct MessageHeaderTraits { 
  static const MessageHeader enum_value = MessageHeader::NONE; 
}; 
 
template<> struct MessageHeaderTraits<org::apache::arrow::flatbuf::Schema> { 
  static const MessageHeader enum_value = MessageHeader::Schema; 
}; 
 
template<> struct MessageHeaderTraits<org::apache::arrow::flatbuf::DictionaryBatch> { 
  static const MessageHeader enum_value = MessageHeader::DictionaryBatch; 
}; 
 
template<> struct MessageHeaderTraits<org::apache::arrow::flatbuf::RecordBatch> { 
  static const MessageHeader enum_value = MessageHeader::RecordBatch; 
}; 
 
template<> struct MessageHeaderTraits<org::apache::arrow::flatbuf::Tensor> { 
  static const MessageHeader enum_value = MessageHeader::Tensor; 
}; 
 
template<> struct MessageHeaderTraits<org::apache::arrow::flatbuf::SparseTensor> { 
  static const MessageHeader enum_value = MessageHeader::SparseTensor; 
}; 
 
bool VerifyMessageHeader(flatbuffers::Verifier &verifier, const void *obj, MessageHeader type); 
bool VerifyMessageHeaderVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types); 
 
/// ---------------------------------------------------------------------- 
/// Data structures for describing a table row batch (a collection of 
/// equal-length Arrow arrays) 
/// Metadata about a field at some level of a nested type tree (but not 
/// its children). 
/// 
/// For example, a List<Int16> with values [[1, 2, 3], null, [4], [5, 6], null] 
/// would have {length: 5, null_count: 2} for its List node, and {length: 6, 
/// null_count: 0} for its Int16 node, as separate FieldNode structs 
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) FieldNode FLATBUFFERS_FINAL_CLASS { 
 private: 
  int64_t length_; 
  int64_t null_count_; 
 
 public: 
  FieldNode() { 
    memset(static_cast<void *>(this), 0, sizeof(FieldNode)); 
  } 
  FieldNode(int64_t _length, int64_t _null_count) 
      : length_(flatbuffers::EndianScalar(_length)), 
        null_count_(flatbuffers::EndianScalar(_null_count)) { 
  } 
  /// The number of value slots in the Arrow array at this level of a nested 
  /// tree 
  int64_t length() const { 
    return flatbuffers::EndianScalar(length_); 
  } 
  /// The number of observed nulls. Fields with null_count == 0 may choose not 
  /// to write their physical validity bitmap out as a materialized buffer, 
  /// instead setting the length of the bitmap buffer to 0. 
  int64_t null_count() const { 
    return flatbuffers::EndianScalar(null_count_); 
  } 
}; 
FLATBUFFERS_STRUCT_END(FieldNode, 16); 
 
/// Optional compression for the memory buffers constituting IPC message 
/// bodies. Intended for use with RecordBatch but could be used for other 
/// message types 
struct BodyCompression FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 
  typedef BodyCompressionBuilder Builder; 
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { 
    VT_CODEC = 4, 
    VT_METHOD = 6 
  }; 
  /// Compressor library 
  org::apache::arrow::flatbuf::CompressionType codec() const { 
    return static_cast<org::apache::arrow::flatbuf::CompressionType>(GetField<int8_t>(VT_CODEC, 0)); 
  } 
  /// Indicates the way the record batch body was compressed 
  org::apache::arrow::flatbuf::BodyCompressionMethod method() const { 
    return static_cast<org::apache::arrow::flatbuf::BodyCompressionMethod>(GetField<int8_t>(VT_METHOD, 0)); 
  } 
  bool Verify(flatbuffers::Verifier &verifier) const { 
    return VerifyTableStart(verifier) && 
           VerifyField<int8_t>(verifier, VT_CODEC) && 
           VerifyField<int8_t>(verifier, VT_METHOD) && 
           verifier.EndTable(); 
  } 
}; 
 
struct BodyCompressionBuilder { 
  typedef BodyCompression Table; 
  flatbuffers::FlatBufferBuilder &fbb_; 
  flatbuffers::uoffset_t start_; 
  void add_codec(org::apache::arrow::flatbuf::CompressionType codec) { 
    fbb_.AddElement<int8_t>(BodyCompression::VT_CODEC, static_cast<int8_t>(codec), 0); 
  } 
  void add_method(org::apache::arrow::flatbuf::BodyCompressionMethod method) { 
    fbb_.AddElement<int8_t>(BodyCompression::VT_METHOD, static_cast<int8_t>(method), 0); 
  } 
  explicit BodyCompressionBuilder(flatbuffers::FlatBufferBuilder &_fbb) 
        : fbb_(_fbb) { 
    start_ = fbb_.StartTable(); 
  } 
  BodyCompressionBuilder &operator=(const BodyCompressionBuilder &); 
  flatbuffers::Offset<BodyCompression> Finish() { 
    const auto end = fbb_.EndTable(start_); 
    auto o = flatbuffers::Offset<BodyCompression>(end); 
    return o; 
  } 
}; 
 
inline flatbuffers::Offset<BodyCompression> CreateBodyCompression( 
    flatbuffers::FlatBufferBuilder &_fbb, 
    org::apache::arrow::flatbuf::CompressionType codec = org::apache::arrow::flatbuf::CompressionType::LZ4_FRAME, 
    org::apache::arrow::flatbuf::BodyCompressionMethod method = org::apache::arrow::flatbuf::BodyCompressionMethod::BUFFER) { 
  BodyCompressionBuilder builder_(_fbb); 
  builder_.add_method(method); 
  builder_.add_codec(codec); 
  return builder_.Finish(); 
} 
 
/// A data header describing the shared memory layout of a "record" or "row" 
/// batch. Some systems call this a "row batch" internally and others a "record 
/// batch". 
struct RecordBatch FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 
  typedef RecordBatchBuilder Builder; 
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { 
    VT_LENGTH = 4, 
    VT_NODES = 6, 
    VT_BUFFERS = 8, 
    VT_COMPRESSION = 10 
  }; 
  /// number of records / rows. The arrays in the batch should all have this 
  /// length 
  int64_t length() const { 
    return GetField<int64_t>(VT_LENGTH, 0); 
  } 
  /// Nodes correspond to the pre-ordered flattened logical schema 
  const flatbuffers::Vector<const org::apache::arrow::flatbuf::FieldNode *> *nodes() const { 
    return GetPointer<const flatbuffers::Vector<const org::apache::arrow::flatbuf::FieldNode *> *>(VT_NODES); 
  } 
  /// Buffers correspond to the pre-ordered flattened buffer tree 
  /// 
  /// The number of buffers appended to this list depends on the schema. For 
  /// example, most primitive arrays will have 2 buffers, 1 for the validity 
  /// bitmap and 1 for the values. For struct arrays, there will only be a 
  /// single buffer for the validity (nulls) bitmap 
  const flatbuffers::Vector<const org::apache::arrow::flatbuf::Buffer *> *buffers() const { 
    return GetPointer<const flatbuffers::Vector<const org::apache::arrow::flatbuf::Buffer *> *>(VT_BUFFERS); 
  } 
  /// Optional compression of the message body 
  const org::apache::arrow::flatbuf::BodyCompression *compression() const { 
    return GetPointer<const org::apache::arrow::flatbuf::BodyCompression *>(VT_COMPRESSION); 
  } 
  bool Verify(flatbuffers::Verifier &verifier) const { 
    return VerifyTableStart(verifier) && 
           VerifyField<int64_t>(verifier, VT_LENGTH) && 
           VerifyOffset(verifier, VT_NODES) && 
           verifier.VerifyVector(nodes()) && 
           VerifyOffset(verifier, VT_BUFFERS) && 
           verifier.VerifyVector(buffers()) && 
           VerifyOffset(verifier, VT_COMPRESSION) && 
           verifier.VerifyTable(compression()) && 
           verifier.EndTable(); 
  } 
}; 
 
struct RecordBatchBuilder { 
  typedef RecordBatch Table; 
  flatbuffers::FlatBufferBuilder &fbb_; 
  flatbuffers::uoffset_t start_; 
  void add_length(int64_t length) { 
    fbb_.AddElement<int64_t>(RecordBatch::VT_LENGTH, length, 0); 
  } 
  void add_nodes(flatbuffers::Offset<flatbuffers::Vector<const org::apache::arrow::flatbuf::FieldNode *>> nodes) { 
    fbb_.AddOffset(RecordBatch::VT_NODES, nodes); 
  } 
  void add_buffers(flatbuffers::Offset<flatbuffers::Vector<const org::apache::arrow::flatbuf::Buffer *>> buffers) { 
    fbb_.AddOffset(RecordBatch::VT_BUFFERS, buffers); 
  } 
  void add_compression(flatbuffers::Offset<org::apache::arrow::flatbuf::BodyCompression> compression) { 
    fbb_.AddOffset(RecordBatch::VT_COMPRESSION, compression); 
  } 
  explicit RecordBatchBuilder(flatbuffers::FlatBufferBuilder &_fbb) 
        : fbb_(_fbb) { 
    start_ = fbb_.StartTable(); 
  } 
  RecordBatchBuilder &operator=(const RecordBatchBuilder &); 
  flatbuffers::Offset<RecordBatch> Finish() { 
    const auto end = fbb_.EndTable(start_); 
    auto o = flatbuffers::Offset<RecordBatch>(end); 
    return o; 
  } 
}; 
 
inline flatbuffers::Offset<RecordBatch> CreateRecordBatch( 
    flatbuffers::FlatBufferBuilder &_fbb, 
    int64_t length = 0, 
    flatbuffers::Offset<flatbuffers::Vector<const org::apache::arrow::flatbuf::FieldNode *>> nodes = 0, 
    flatbuffers::Offset<flatbuffers::Vector<const org::apache::arrow::flatbuf::Buffer *>> buffers = 0, 
    flatbuffers::Offset<org::apache::arrow::flatbuf::BodyCompression> compression = 0) { 
  RecordBatchBuilder builder_(_fbb); 
  builder_.add_length(length); 
  builder_.add_compression(compression); 
  builder_.add_buffers(buffers); 
  builder_.add_nodes(nodes); 
  return builder_.Finish(); 
} 
 
inline flatbuffers::Offset<RecordBatch> CreateRecordBatchDirect( 
    flatbuffers::FlatBufferBuilder &_fbb, 
    int64_t length = 0, 
    const std::vector<org::apache::arrow::flatbuf::FieldNode> *nodes = nullptr, 
    const std::vector<org::apache::arrow::flatbuf::Buffer> *buffers = nullptr, 
    flatbuffers::Offset<org::apache::arrow::flatbuf::BodyCompression> compression = 0) { 
  auto nodes__ = nodes ? _fbb.CreateVectorOfStructs<org::apache::arrow::flatbuf::FieldNode>(*nodes) : 0; 
  auto buffers__ = buffers ? _fbb.CreateVectorOfStructs<org::apache::arrow::flatbuf::Buffer>(*buffers) : 0; 
  return org::apache::arrow::flatbuf::CreateRecordBatch( 
      _fbb, 
      length, 
      nodes__, 
      buffers__, 
      compression); 
} 
 
/// For sending dictionary encoding information. Any Field can be 
/// dictionary-encoded, but in this case none of its children may be 
/// dictionary-encoded. 
/// There is one vector / column per dictionary, but that vector / column 
/// may be spread across multiple dictionary batches by using the isDelta 
/// flag 
struct DictionaryBatch FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 
  typedef DictionaryBatchBuilder Builder; 
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { 
    VT_ID = 4, 
    VT_DATA = 6, 
    VT_ISDELTA = 8 
  }; 
  int64_t id() const { 
    return GetField<int64_t>(VT_ID, 0); 
  } 
  const org::apache::arrow::flatbuf::RecordBatch *data() const { 
    return GetPointer<const org::apache::arrow::flatbuf::RecordBatch *>(VT_DATA); 
  } 
  /// If isDelta is true the values in the dictionary are to be appended to a 
  /// dictionary with the indicated id. If isDelta is false this dictionary 
  /// should replace the existing dictionary. 
  bool isDelta() const { 
    return GetField<uint8_t>(VT_ISDELTA, 0) != 0; 
  } 
  bool Verify(flatbuffers::Verifier &verifier) const { 
    return VerifyTableStart(verifier) && 
           VerifyField<int64_t>(verifier, VT_ID) && 
           VerifyOffset(verifier, VT_DATA) && 
           verifier.VerifyTable(data()) && 
           VerifyField<uint8_t>(verifier, VT_ISDELTA) && 
           verifier.EndTable(); 
  } 
}; 
 
struct DictionaryBatchBuilder { 
  typedef DictionaryBatch Table; 
  flatbuffers::FlatBufferBuilder &fbb_; 
  flatbuffers::uoffset_t start_; 
  void add_id(int64_t id) { 
    fbb_.AddElement<int64_t>(DictionaryBatch::VT_ID, id, 0); 
  } 
  void add_data(flatbuffers::Offset<org::apache::arrow::flatbuf::RecordBatch> data) { 
    fbb_.AddOffset(DictionaryBatch::VT_DATA, data); 
  } 
  void add_isDelta(bool isDelta) { 
    fbb_.AddElement<uint8_t>(DictionaryBatch::VT_ISDELTA, static_cast<uint8_t>(isDelta), 0); 
  } 
  explicit DictionaryBatchBuilder(flatbuffers::FlatBufferBuilder &_fbb) 
        : fbb_(_fbb) { 
    start_ = fbb_.StartTable(); 
  } 
  DictionaryBatchBuilder &operator=(const DictionaryBatchBuilder &); 
  flatbuffers::Offset<DictionaryBatch> Finish() { 
    const auto end = fbb_.EndTable(start_); 
    auto o = flatbuffers::Offset<DictionaryBatch>(end); 
    return o; 
  } 
}; 
 
inline flatbuffers::Offset<DictionaryBatch> CreateDictionaryBatch( 
    flatbuffers::FlatBufferBuilder &_fbb, 
    int64_t id = 0, 
    flatbuffers::Offset<org::apache::arrow::flatbuf::RecordBatch> data = 0, 
    bool isDelta = false) { 
  DictionaryBatchBuilder builder_(_fbb); 
  builder_.add_id(id); 
  builder_.add_data(data); 
  builder_.add_isDelta(isDelta); 
  return builder_.Finish(); 
} 
 
struct Message FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 
  typedef MessageBuilder Builder; 
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { 
    VT_VERSION = 4, 
    VT_HEADER_TYPE = 6, 
    VT_HEADER = 8, 
    VT_BODYLENGTH = 10, 
    VT_CUSTOM_METADATA = 12 
  }; 
  org::apache::arrow::flatbuf::MetadataVersion version() const { 
    return static_cast<org::apache::arrow::flatbuf::MetadataVersion>(GetField<int16_t>(VT_VERSION, 0)); 
  } 
  org::apache::arrow::flatbuf::MessageHeader header_type() const { 
    return static_cast<org::apache::arrow::flatbuf::MessageHeader>(GetField<uint8_t>(VT_HEADER_TYPE, 0)); 
  } 
  const void *header() const { 
    return GetPointer<const void *>(VT_HEADER); 
  } 
  template<typename T> const T *header_as() const; 
  const org::apache::arrow::flatbuf::Schema *header_as_Schema() const { 
    return header_type() == org::apache::arrow::flatbuf::MessageHeader::Schema ? static_cast<const org::apache::arrow::flatbuf::Schema *>(header()) : nullptr; 
  } 
  const org::apache::arrow::flatbuf::DictionaryBatch *header_as_DictionaryBatch() const { 
    return header_type() == org::apache::arrow::flatbuf::MessageHeader::DictionaryBatch ? static_cast<const org::apache::arrow::flatbuf::DictionaryBatch *>(header()) : nullptr; 
  } 
  const org::apache::arrow::flatbuf::RecordBatch *header_as_RecordBatch() const { 
    return header_type() == org::apache::arrow::flatbuf::MessageHeader::RecordBatch ? static_cast<const org::apache::arrow::flatbuf::RecordBatch *>(header()) : nullptr; 
  } 
  const org::apache::arrow::flatbuf::Tensor *header_as_Tensor() const { 
    return header_type() == org::apache::arrow::flatbuf::MessageHeader::Tensor ? static_cast<const org::apache::arrow::flatbuf::Tensor *>(header()) : nullptr; 
  } 
  const org::apache::arrow::flatbuf::SparseTensor *header_as_SparseTensor() const { 
    return header_type() == org::apache::arrow::flatbuf::MessageHeader::SparseTensor ? static_cast<const org::apache::arrow::flatbuf::SparseTensor *>(header()) : nullptr; 
  } 
  int64_t bodyLength() const { 
    return GetField<int64_t>(VT_BODYLENGTH, 0); 
  } 
  const flatbuffers::Vector<flatbuffers::Offset<org::apache::arrow::flatbuf::KeyValue>> *custom_metadata() const { 
    return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<org::apache::arrow::flatbuf::KeyValue>> *>(VT_CUSTOM_METADATA); 
  } 
  bool Verify(flatbuffers::Verifier &verifier) const { 
    return VerifyTableStart(verifier) && 
           VerifyField<int16_t>(verifier, VT_VERSION) && 
           VerifyField<uint8_t>(verifier, VT_HEADER_TYPE) && 
           VerifyOffset(verifier, VT_HEADER) && 
           VerifyMessageHeader(verifier, header(), header_type()) && 
           VerifyField<int64_t>(verifier, VT_BODYLENGTH) && 
           VerifyOffset(verifier, VT_CUSTOM_METADATA) && 
           verifier.VerifyVector(custom_metadata()) && 
           verifier.VerifyVectorOfTables(custom_metadata()) && 
           verifier.EndTable(); 
  } 
}; 
 
template<> inline const org::apache::arrow::flatbuf::Schema *Message::header_as<org::apache::arrow::flatbuf::Schema>() const { 
  return header_as_Schema(); 
} 
 
template<> inline const org::apache::arrow::flatbuf::DictionaryBatch *Message::header_as<org::apache::arrow::flatbuf::DictionaryBatch>() const { 
  return header_as_DictionaryBatch(); 
} 
 
template<> inline const org::apache::arrow::flatbuf::RecordBatch *Message::header_as<org::apache::arrow::flatbuf::RecordBatch>() const { 
  return header_as_RecordBatch(); 
} 
 
template<> inline const org::apache::arrow::flatbuf::Tensor *Message::header_as<org::apache::arrow::flatbuf::Tensor>() const { 
  return header_as_Tensor(); 
} 
 
template<> inline const org::apache::arrow::flatbuf::SparseTensor *Message::header_as<org::apache::arrow::flatbuf::SparseTensor>() const { 
  return header_as_SparseTensor(); 
} 
 
struct MessageBuilder { 
  typedef Message Table; 
  flatbuffers::FlatBufferBuilder &fbb_; 
  flatbuffers::uoffset_t start_; 
  void add_version(org::apache::arrow::flatbuf::MetadataVersion version) { 
    fbb_.AddElement<int16_t>(Message::VT_VERSION, static_cast<int16_t>(version), 0); 
  } 
  void add_header_type(org::apache::arrow::flatbuf::MessageHeader header_type) { 
    fbb_.AddElement<uint8_t>(Message::VT_HEADER_TYPE, static_cast<uint8_t>(header_type), 0); 
  } 
  void add_header(flatbuffers::Offset<void> header) { 
    fbb_.AddOffset(Message::VT_HEADER, header); 
  } 
  void add_bodyLength(int64_t bodyLength) { 
    fbb_.AddElement<int64_t>(Message::VT_BODYLENGTH, bodyLength, 0); 
  } 
  void add_custom_metadata(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<org::apache::arrow::flatbuf::KeyValue>>> custom_metadata) { 
    fbb_.AddOffset(Message::VT_CUSTOM_METADATA, custom_metadata); 
  } 
  explicit MessageBuilder(flatbuffers::FlatBufferBuilder &_fbb) 
        : fbb_(_fbb) { 
    start_ = fbb_.StartTable(); 
  } 
  MessageBuilder &operator=(const MessageBuilder &); 
  flatbuffers::Offset<Message> Finish() { 
    const auto end = fbb_.EndTable(start_); 
    auto o = flatbuffers::Offset<Message>(end); 
    return o; 
  } 
}; 
 
inline flatbuffers::Offset<Message> CreateMessage( 
    flatbuffers::FlatBufferBuilder &_fbb, 
    org::apache::arrow::flatbuf::MetadataVersion version = org::apache::arrow::flatbuf::MetadataVersion::V1, 
    org::apache::arrow::flatbuf::MessageHeader header_type = org::apache::arrow::flatbuf::MessageHeader::NONE, 
    flatbuffers::Offset<void> header = 0, 
    int64_t bodyLength = 0, 
    flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<org::apache::arrow::flatbuf::KeyValue>>> custom_metadata = 0) { 
  MessageBuilder builder_(_fbb); 
  builder_.add_bodyLength(bodyLength); 
  builder_.add_custom_metadata(custom_metadata); 
  builder_.add_header(header); 
  builder_.add_version(version); 
  builder_.add_header_type(header_type); 
  return builder_.Finish(); 
} 
 
inline flatbuffers::Offset<Message> CreateMessageDirect( 
    flatbuffers::FlatBufferBuilder &_fbb, 
    org::apache::arrow::flatbuf::MetadataVersion version = org::apache::arrow::flatbuf::MetadataVersion::V1, 
    org::apache::arrow::flatbuf::MessageHeader header_type = org::apache::arrow::flatbuf::MessageHeader::NONE, 
    flatbuffers::Offset<void> header = 0, 
    int64_t bodyLength = 0, 
    const std::vector<flatbuffers::Offset<org::apache::arrow::flatbuf::KeyValue>> *custom_metadata = nullptr) { 
  auto custom_metadata__ = custom_metadata ? _fbb.CreateVector<flatbuffers::Offset<org::apache::arrow::flatbuf::KeyValue>>(*custom_metadata) : 0; 
  return org::apache::arrow::flatbuf::CreateMessage( 
      _fbb, 
      version, 
      header_type, 
      header, 
      bodyLength, 
      custom_metadata__); 
} 
 
inline bool VerifyMessageHeader(flatbuffers::Verifier &verifier, const void *obj, MessageHeader type) { 
  switch (type) { 
    case MessageHeader::NONE: { 
      return true; 
    } 
    case MessageHeader::Schema: { 
      auto ptr = reinterpret_cast<const org::apache::arrow::flatbuf::Schema *>(obj); 
      return verifier.VerifyTable(ptr); 
    } 
    case MessageHeader::DictionaryBatch: { 
      auto ptr = reinterpret_cast<const org::apache::arrow::flatbuf::DictionaryBatch *>(obj); 
      return verifier.VerifyTable(ptr); 
    } 
    case MessageHeader::RecordBatch: { 
      auto ptr = reinterpret_cast<const org::apache::arrow::flatbuf::RecordBatch *>(obj); 
      return verifier.VerifyTable(ptr); 
    } 
    case MessageHeader::Tensor: { 
      auto ptr = reinterpret_cast<const org::apache::arrow::flatbuf::Tensor *>(obj); 
      return verifier.VerifyTable(ptr); 
    } 
    case MessageHeader::SparseTensor: { 
      auto ptr = reinterpret_cast<const org::apache::arrow::flatbuf::SparseTensor *>(obj); 
      return verifier.VerifyTable(ptr); 
    } 
    default: return true; 
  } 
} 
 
inline bool VerifyMessageHeaderVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types) { 
  if (!values || !types) return !values && !types; 
  if (values->size() != types->size()) return false; 
  for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) { 
    if (!VerifyMessageHeader( 
        verifier,  values->Get(i), types->GetEnum<MessageHeader>(i))) { 
      return false; 
    } 
  } 
  return true; 
} 
 
inline const org::apache::arrow::flatbuf::Message *GetMessage(const void *buf) { 
  return flatbuffers::GetRoot<org::apache::arrow::flatbuf::Message>(buf); 
} 
 
inline const org::apache::arrow::flatbuf::Message *GetSizePrefixedMessage(const void *buf) { 
  return flatbuffers::GetSizePrefixedRoot<org::apache::arrow::flatbuf::Message>(buf); 
} 
 
inline bool VerifyMessageBuffer( 
    flatbuffers::Verifier &verifier) { 
  return verifier.VerifyBuffer<org::apache::arrow::flatbuf::Message>(nullptr); 
} 
 
inline bool VerifySizePrefixedMessageBuffer( 
    flatbuffers::Verifier &verifier) { 
  return verifier.VerifySizePrefixedBuffer<org::apache::arrow::flatbuf::Message>(nullptr); 
} 
 
inline void FinishMessageBuffer( 
    flatbuffers::FlatBufferBuilder &fbb, 
    flatbuffers::Offset<org::apache::arrow::flatbuf::Message> root) { 
  fbb.Finish(root); 
} 
 
inline void FinishSizePrefixedMessageBuffer( 
    flatbuffers::FlatBufferBuilder &fbb, 
    flatbuffers::Offset<org::apache::arrow::flatbuf::Message> root) { 
  fbb.FinishSizePrefixed(root); 
} 
 
}  // namespace flatbuf 
}  // namespace arrow 
}  // namespace apache 
}  // namespace org 
 
#endif  // FLATBUFFERS_GENERATED_MESSAGE_ORG_APACHE_ARROW_FLATBUF_H_