]>
Commit | Line | Data |
---|---|---|
1d09f67e TL |
1 | // automatically generated by the FlatBuffers compiler, do not modify |
2 | ||
3 | ||
4 | #ifndef FLATBUFFERS_GENERATED_TENSOR_ORG_APACHE_ARROW_FLATBUF_H_ | |
5 | #define FLATBUFFERS_GENERATED_TENSOR_ORG_APACHE_ARROW_FLATBUF_H_ | |
6 | ||
7 | #include "flatbuffers/flatbuffers.h" | |
8 | ||
9 | #include "Schema_generated.h" | |
10 | ||
11 | namespace org { | |
12 | namespace apache { | |
13 | namespace arrow { | |
14 | namespace flatbuf { | |
15 | ||
16 | struct TensorDim; | |
17 | struct TensorDimBuilder; | |
18 | ||
19 | struct Tensor; | |
20 | struct TensorBuilder; | |
21 | ||
22 | /// ---------------------------------------------------------------------- | |
23 | /// Data structures for dense tensors | |
24 | /// Shape data for a single axis in a tensor | |
25 | struct TensorDim FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { | |
26 | typedef TensorDimBuilder Builder; | |
27 | enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { | |
28 | VT_SIZE = 4, | |
29 | VT_NAME = 6 | |
30 | }; | |
31 | /// Length of dimension | |
32 | int64_t size() const { | |
33 | return GetField<int64_t>(VT_SIZE, 0); | |
34 | } | |
35 | /// Name of the dimension, optional | |
36 | const flatbuffers::String *name() const { | |
37 | return GetPointer<const flatbuffers::String *>(VT_NAME); | |
38 | } | |
39 | bool Verify(flatbuffers::Verifier &verifier) const { | |
40 | return VerifyTableStart(verifier) && | |
41 | VerifyField<int64_t>(verifier, VT_SIZE) && | |
42 | VerifyOffset(verifier, VT_NAME) && | |
43 | verifier.VerifyString(name()) && | |
44 | verifier.EndTable(); | |
45 | } | |
46 | }; | |
47 | ||
48 | struct TensorDimBuilder { | |
49 | typedef TensorDim Table; | |
50 | flatbuffers::FlatBufferBuilder &fbb_; | |
51 | flatbuffers::uoffset_t start_; | |
52 | void add_size(int64_t size) { | |
53 | fbb_.AddElement<int64_t>(TensorDim::VT_SIZE, size, 0); | |
54 | } | |
55 | void add_name(flatbuffers::Offset<flatbuffers::String> name) { | |
56 | fbb_.AddOffset(TensorDim::VT_NAME, name); | |
57 | } | |
58 | explicit TensorDimBuilder(flatbuffers::FlatBufferBuilder &_fbb) | |
59 | : fbb_(_fbb) { | |
60 | start_ = fbb_.StartTable(); | |
61 | } | |
62 | TensorDimBuilder &operator=(const TensorDimBuilder &); | |
63 | flatbuffers::Offset<TensorDim> Finish() { | |
64 | const auto end = fbb_.EndTable(start_); | |
65 | auto o = flatbuffers::Offset<TensorDim>(end); | |
66 | return o; | |
67 | } | |
68 | }; | |
69 | ||
70 | inline flatbuffers::Offset<TensorDim> CreateTensorDim( | |
71 | flatbuffers::FlatBufferBuilder &_fbb, | |
72 | int64_t size = 0, | |
73 | flatbuffers::Offset<flatbuffers::String> name = 0) { | |
74 | TensorDimBuilder builder_(_fbb); | |
75 | builder_.add_size(size); | |
76 | builder_.add_name(name); | |
77 | return builder_.Finish(); | |
78 | } | |
79 | ||
80 | inline flatbuffers::Offset<TensorDim> CreateTensorDimDirect( | |
81 | flatbuffers::FlatBufferBuilder &_fbb, | |
82 | int64_t size = 0, | |
83 | const char *name = nullptr) { | |
84 | auto name__ = name ? _fbb.CreateString(name) : 0; | |
85 | return org::apache::arrow::flatbuf::CreateTensorDim( | |
86 | _fbb, | |
87 | size, | |
88 | name__); | |
89 | } | |
90 | ||
91 | struct Tensor FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { | |
92 | typedef TensorBuilder Builder; | |
93 | enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { | |
94 | VT_TYPE_TYPE = 4, | |
95 | VT_TYPE = 6, | |
96 | VT_SHAPE = 8, | |
97 | VT_STRIDES = 10, | |
98 | VT_DATA = 12 | |
99 | }; | |
100 | org::apache::arrow::flatbuf::Type type_type() const { | |
101 | return static_cast<org::apache::arrow::flatbuf::Type>(GetField<uint8_t>(VT_TYPE_TYPE, 0)); | |
102 | } | |
103 | /// The type of data contained in a value cell. Currently only fixed-width | |
104 | /// value types are supported, no strings or nested types | |
105 | const void *type() const { | |
106 | return GetPointer<const void *>(VT_TYPE); | |
107 | } | |
108 | template<typename T> const T *type_as() const; | |
109 | const org::apache::arrow::flatbuf::Null *type_as_Null() const { | |
110 | return type_type() == org::apache::arrow::flatbuf::Type::Null ? static_cast<const org::apache::arrow::flatbuf::Null *>(type()) : nullptr; | |
111 | } | |
112 | const org::apache::arrow::flatbuf::Int *type_as_Int() const { | |
113 | return type_type() == org::apache::arrow::flatbuf::Type::Int ? static_cast<const org::apache::arrow::flatbuf::Int *>(type()) : nullptr; | |
114 | } | |
115 | const org::apache::arrow::flatbuf::FloatingPoint *type_as_FloatingPoint() const { | |
116 | return type_type() == org::apache::arrow::flatbuf::Type::FloatingPoint ? static_cast<const org::apache::arrow::flatbuf::FloatingPoint *>(type()) : nullptr; | |
117 | } | |
118 | const org::apache::arrow::flatbuf::Binary *type_as_Binary() const { | |
119 | return type_type() == org::apache::arrow::flatbuf::Type::Binary ? static_cast<const org::apache::arrow::flatbuf::Binary *>(type()) : nullptr; | |
120 | } | |
121 | const org::apache::arrow::flatbuf::Utf8 *type_as_Utf8() const { | |
122 | return type_type() == org::apache::arrow::flatbuf::Type::Utf8 ? static_cast<const org::apache::arrow::flatbuf::Utf8 *>(type()) : nullptr; | |
123 | } | |
124 | const org::apache::arrow::flatbuf::Bool *type_as_Bool() const { | |
125 | return type_type() == org::apache::arrow::flatbuf::Type::Bool ? static_cast<const org::apache::arrow::flatbuf::Bool *>(type()) : nullptr; | |
126 | } | |
127 | const org::apache::arrow::flatbuf::Decimal *type_as_Decimal() const { | |
128 | return type_type() == org::apache::arrow::flatbuf::Type::Decimal ? static_cast<const org::apache::arrow::flatbuf::Decimal *>(type()) : nullptr; | |
129 | } | |
130 | const org::apache::arrow::flatbuf::Date *type_as_Date() const { | |
131 | return type_type() == org::apache::arrow::flatbuf::Type::Date ? static_cast<const org::apache::arrow::flatbuf::Date *>(type()) : nullptr; | |
132 | } | |
133 | const org::apache::arrow::flatbuf::Time *type_as_Time() const { | |
134 | return type_type() == org::apache::arrow::flatbuf::Type::Time ? static_cast<const org::apache::arrow::flatbuf::Time *>(type()) : nullptr; | |
135 | } | |
136 | const org::apache::arrow::flatbuf::Timestamp *type_as_Timestamp() const { | |
137 | return type_type() == org::apache::arrow::flatbuf::Type::Timestamp ? static_cast<const org::apache::arrow::flatbuf::Timestamp *>(type()) : nullptr; | |
138 | } | |
139 | const org::apache::arrow::flatbuf::Interval *type_as_Interval() const { | |
140 | return type_type() == org::apache::arrow::flatbuf::Type::Interval ? static_cast<const org::apache::arrow::flatbuf::Interval *>(type()) : nullptr; | |
141 | } | |
142 | const org::apache::arrow::flatbuf::List *type_as_List() const { | |
143 | return type_type() == org::apache::arrow::flatbuf::Type::List ? static_cast<const org::apache::arrow::flatbuf::List *>(type()) : nullptr; | |
144 | } | |
145 | const org::apache::arrow::flatbuf::Struct_ *type_as_Struct_() const { | |
146 | return type_type() == org::apache::arrow::flatbuf::Type::Struct_ ? static_cast<const org::apache::arrow::flatbuf::Struct_ *>(type()) : nullptr; | |
147 | } | |
148 | const org::apache::arrow::flatbuf::Union *type_as_Union() const { | |
149 | return type_type() == org::apache::arrow::flatbuf::Type::Union ? static_cast<const org::apache::arrow::flatbuf::Union *>(type()) : nullptr; | |
150 | } | |
151 | const org::apache::arrow::flatbuf::FixedSizeBinary *type_as_FixedSizeBinary() const { | |
152 | return type_type() == org::apache::arrow::flatbuf::Type::FixedSizeBinary ? static_cast<const org::apache::arrow::flatbuf::FixedSizeBinary *>(type()) : nullptr; | |
153 | } | |
154 | const org::apache::arrow::flatbuf::FixedSizeList *type_as_FixedSizeList() const { | |
155 | return type_type() == org::apache::arrow::flatbuf::Type::FixedSizeList ? static_cast<const org::apache::arrow::flatbuf::FixedSizeList *>(type()) : nullptr; | |
156 | } | |
157 | const org::apache::arrow::flatbuf::Map *type_as_Map() const { | |
158 | return type_type() == org::apache::arrow::flatbuf::Type::Map ? static_cast<const org::apache::arrow::flatbuf::Map *>(type()) : nullptr; | |
159 | } | |
160 | const org::apache::arrow::flatbuf::Duration *type_as_Duration() const { | |
161 | return type_type() == org::apache::arrow::flatbuf::Type::Duration ? static_cast<const org::apache::arrow::flatbuf::Duration *>(type()) : nullptr; | |
162 | } | |
163 | const org::apache::arrow::flatbuf::LargeBinary *type_as_LargeBinary() const { | |
164 | return type_type() == org::apache::arrow::flatbuf::Type::LargeBinary ? static_cast<const org::apache::arrow::flatbuf::LargeBinary *>(type()) : nullptr; | |
165 | } | |
166 | const org::apache::arrow::flatbuf::LargeUtf8 *type_as_LargeUtf8() const { | |
167 | return type_type() == org::apache::arrow::flatbuf::Type::LargeUtf8 ? static_cast<const org::apache::arrow::flatbuf::LargeUtf8 *>(type()) : nullptr; | |
168 | } | |
169 | const org::apache::arrow::flatbuf::LargeList *type_as_LargeList() const { | |
170 | return type_type() == org::apache::arrow::flatbuf::Type::LargeList ? static_cast<const org::apache::arrow::flatbuf::LargeList *>(type()) : nullptr; | |
171 | } | |
172 | /// The dimensions of the tensor, optionally named | |
173 | const flatbuffers::Vector<flatbuffers::Offset<org::apache::arrow::flatbuf::TensorDim>> *shape() const { | |
174 | return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<org::apache::arrow::flatbuf::TensorDim>> *>(VT_SHAPE); | |
175 | } | |
176 | /// Non-negative byte offsets to advance one value cell along each dimension | |
177 | /// If omitted, default to row-major order (C-like). | |
178 | const flatbuffers::Vector<int64_t> *strides() const { | |
179 | return GetPointer<const flatbuffers::Vector<int64_t> *>(VT_STRIDES); | |
180 | } | |
181 | /// The location and size of the tensor's data | |
182 | const org::apache::arrow::flatbuf::Buffer *data() const { | |
183 | return GetStruct<const org::apache::arrow::flatbuf::Buffer *>(VT_DATA); | |
184 | } | |
185 | bool Verify(flatbuffers::Verifier &verifier) const { | |
186 | return VerifyTableStart(verifier) && | |
187 | VerifyField<uint8_t>(verifier, VT_TYPE_TYPE) && | |
188 | VerifyOffsetRequired(verifier, VT_TYPE) && | |
189 | VerifyType(verifier, type(), type_type()) && | |
190 | VerifyOffsetRequired(verifier, VT_SHAPE) && | |
191 | verifier.VerifyVector(shape()) && | |
192 | verifier.VerifyVectorOfTables(shape()) && | |
193 | VerifyOffset(verifier, VT_STRIDES) && | |
194 | verifier.VerifyVector(strides()) && | |
195 | VerifyFieldRequired<org::apache::arrow::flatbuf::Buffer>(verifier, VT_DATA) && | |
196 | verifier.EndTable(); | |
197 | } | |
198 | }; | |
199 | ||
200 | template<> inline const org::apache::arrow::flatbuf::Null *Tensor::type_as<org::apache::arrow::flatbuf::Null>() const { | |
201 | return type_as_Null(); | |
202 | } | |
203 | ||
204 | template<> inline const org::apache::arrow::flatbuf::Int *Tensor::type_as<org::apache::arrow::flatbuf::Int>() const { | |
205 | return type_as_Int(); | |
206 | } | |
207 | ||
208 | template<> inline const org::apache::arrow::flatbuf::FloatingPoint *Tensor::type_as<org::apache::arrow::flatbuf::FloatingPoint>() const { | |
209 | return type_as_FloatingPoint(); | |
210 | } | |
211 | ||
212 | template<> inline const org::apache::arrow::flatbuf::Binary *Tensor::type_as<org::apache::arrow::flatbuf::Binary>() const { | |
213 | return type_as_Binary(); | |
214 | } | |
215 | ||
216 | template<> inline const org::apache::arrow::flatbuf::Utf8 *Tensor::type_as<org::apache::arrow::flatbuf::Utf8>() const { | |
217 | return type_as_Utf8(); | |
218 | } | |
219 | ||
220 | template<> inline const org::apache::arrow::flatbuf::Bool *Tensor::type_as<org::apache::arrow::flatbuf::Bool>() const { | |
221 | return type_as_Bool(); | |
222 | } | |
223 | ||
224 | template<> inline const org::apache::arrow::flatbuf::Decimal *Tensor::type_as<org::apache::arrow::flatbuf::Decimal>() const { | |
225 | return type_as_Decimal(); | |
226 | } | |
227 | ||
228 | template<> inline const org::apache::arrow::flatbuf::Date *Tensor::type_as<org::apache::arrow::flatbuf::Date>() const { | |
229 | return type_as_Date(); | |
230 | } | |
231 | ||
232 | template<> inline const org::apache::arrow::flatbuf::Time *Tensor::type_as<org::apache::arrow::flatbuf::Time>() const { | |
233 | return type_as_Time(); | |
234 | } | |
235 | ||
236 | template<> inline const org::apache::arrow::flatbuf::Timestamp *Tensor::type_as<org::apache::arrow::flatbuf::Timestamp>() const { | |
237 | return type_as_Timestamp(); | |
238 | } | |
239 | ||
240 | template<> inline const org::apache::arrow::flatbuf::Interval *Tensor::type_as<org::apache::arrow::flatbuf::Interval>() const { | |
241 | return type_as_Interval(); | |
242 | } | |
243 | ||
244 | template<> inline const org::apache::arrow::flatbuf::List *Tensor::type_as<org::apache::arrow::flatbuf::List>() const { | |
245 | return type_as_List(); | |
246 | } | |
247 | ||
248 | template<> inline const org::apache::arrow::flatbuf::Struct_ *Tensor::type_as<org::apache::arrow::flatbuf::Struct_>() const { | |
249 | return type_as_Struct_(); | |
250 | } | |
251 | ||
252 | template<> inline const org::apache::arrow::flatbuf::Union *Tensor::type_as<org::apache::arrow::flatbuf::Union>() const { | |
253 | return type_as_Union(); | |
254 | } | |
255 | ||
256 | template<> inline const org::apache::arrow::flatbuf::FixedSizeBinary *Tensor::type_as<org::apache::arrow::flatbuf::FixedSizeBinary>() const { | |
257 | return type_as_FixedSizeBinary(); | |
258 | } | |
259 | ||
260 | template<> inline const org::apache::arrow::flatbuf::FixedSizeList *Tensor::type_as<org::apache::arrow::flatbuf::FixedSizeList>() const { | |
261 | return type_as_FixedSizeList(); | |
262 | } | |
263 | ||
264 | template<> inline const org::apache::arrow::flatbuf::Map *Tensor::type_as<org::apache::arrow::flatbuf::Map>() const { | |
265 | return type_as_Map(); | |
266 | } | |
267 | ||
268 | template<> inline const org::apache::arrow::flatbuf::Duration *Tensor::type_as<org::apache::arrow::flatbuf::Duration>() const { | |
269 | return type_as_Duration(); | |
270 | } | |
271 | ||
272 | template<> inline const org::apache::arrow::flatbuf::LargeBinary *Tensor::type_as<org::apache::arrow::flatbuf::LargeBinary>() const { | |
273 | return type_as_LargeBinary(); | |
274 | } | |
275 | ||
276 | template<> inline const org::apache::arrow::flatbuf::LargeUtf8 *Tensor::type_as<org::apache::arrow::flatbuf::LargeUtf8>() const { | |
277 | return type_as_LargeUtf8(); | |
278 | } | |
279 | ||
280 | template<> inline const org::apache::arrow::flatbuf::LargeList *Tensor::type_as<org::apache::arrow::flatbuf::LargeList>() const { | |
281 | return type_as_LargeList(); | |
282 | } | |
283 | ||
284 | struct TensorBuilder { | |
285 | typedef Tensor Table; | |
286 | flatbuffers::FlatBufferBuilder &fbb_; | |
287 | flatbuffers::uoffset_t start_; | |
288 | void add_type_type(org::apache::arrow::flatbuf::Type type_type) { | |
289 | fbb_.AddElement<uint8_t>(Tensor::VT_TYPE_TYPE, static_cast<uint8_t>(type_type), 0); | |
290 | } | |
291 | void add_type(flatbuffers::Offset<void> type) { | |
292 | fbb_.AddOffset(Tensor::VT_TYPE, type); | |
293 | } | |
294 | void add_shape(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<org::apache::arrow::flatbuf::TensorDim>>> shape) { | |
295 | fbb_.AddOffset(Tensor::VT_SHAPE, shape); | |
296 | } | |
297 | void add_strides(flatbuffers::Offset<flatbuffers::Vector<int64_t>> strides) { | |
298 | fbb_.AddOffset(Tensor::VT_STRIDES, strides); | |
299 | } | |
300 | void add_data(const org::apache::arrow::flatbuf::Buffer *data) { | |
301 | fbb_.AddStruct(Tensor::VT_DATA, data); | |
302 | } | |
303 | explicit TensorBuilder(flatbuffers::FlatBufferBuilder &_fbb) | |
304 | : fbb_(_fbb) { | |
305 | start_ = fbb_.StartTable(); | |
306 | } | |
307 | TensorBuilder &operator=(const TensorBuilder &); | |
308 | flatbuffers::Offset<Tensor> Finish() { | |
309 | const auto end = fbb_.EndTable(start_); | |
310 | auto o = flatbuffers::Offset<Tensor>(end); | |
311 | fbb_.Required(o, Tensor::VT_TYPE); | |
312 | fbb_.Required(o, Tensor::VT_SHAPE); | |
313 | fbb_.Required(o, Tensor::VT_DATA); | |
314 | return o; | |
315 | } | |
316 | }; | |
317 | ||
318 | inline flatbuffers::Offset<Tensor> CreateTensor( | |
319 | flatbuffers::FlatBufferBuilder &_fbb, | |
320 | org::apache::arrow::flatbuf::Type type_type = org::apache::arrow::flatbuf::Type::NONE, | |
321 | flatbuffers::Offset<void> type = 0, | |
322 | flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<org::apache::arrow::flatbuf::TensorDim>>> shape = 0, | |
323 | flatbuffers::Offset<flatbuffers::Vector<int64_t>> strides = 0, | |
324 | const org::apache::arrow::flatbuf::Buffer *data = 0) { | |
325 | TensorBuilder builder_(_fbb); | |
326 | builder_.add_data(data); | |
327 | builder_.add_strides(strides); | |
328 | builder_.add_shape(shape); | |
329 | builder_.add_type(type); | |
330 | builder_.add_type_type(type_type); | |
331 | return builder_.Finish(); | |
332 | } | |
333 | ||
334 | inline flatbuffers::Offset<Tensor> CreateTensorDirect( | |
335 | flatbuffers::FlatBufferBuilder &_fbb, | |
336 | org::apache::arrow::flatbuf::Type type_type = org::apache::arrow::flatbuf::Type::NONE, | |
337 | flatbuffers::Offset<void> type = 0, | |
338 | const std::vector<flatbuffers::Offset<org::apache::arrow::flatbuf::TensorDim>> *shape = nullptr, | |
339 | const std::vector<int64_t> *strides = nullptr, | |
340 | const org::apache::arrow::flatbuf::Buffer *data = 0) { | |
341 | auto shape__ = shape ? _fbb.CreateVector<flatbuffers::Offset<org::apache::arrow::flatbuf::TensorDim>>(*shape) : 0; | |
342 | auto strides__ = strides ? _fbb.CreateVector<int64_t>(*strides) : 0; | |
343 | return org::apache::arrow::flatbuf::CreateTensor( | |
344 | _fbb, | |
345 | type_type, | |
346 | type, | |
347 | shape__, | |
348 | strides__, | |
349 | data); | |
350 | } | |
351 | ||
352 | inline const org::apache::arrow::flatbuf::Tensor *GetTensor(const void *buf) { | |
353 | return flatbuffers::GetRoot<org::apache::arrow::flatbuf::Tensor>(buf); | |
354 | } | |
355 | ||
356 | inline const org::apache::arrow::flatbuf::Tensor *GetSizePrefixedTensor(const void *buf) { | |
357 | return flatbuffers::GetSizePrefixedRoot<org::apache::arrow::flatbuf::Tensor>(buf); | |
358 | } | |
359 | ||
360 | inline bool VerifyTensorBuffer( | |
361 | flatbuffers::Verifier &verifier) { | |
362 | return verifier.VerifyBuffer<org::apache::arrow::flatbuf::Tensor>(nullptr); | |
363 | } | |
364 | ||
365 | inline bool VerifySizePrefixedTensorBuffer( | |
366 | flatbuffers::Verifier &verifier) { | |
367 | return verifier.VerifySizePrefixedBuffer<org::apache::arrow::flatbuf::Tensor>(nullptr); | |
368 | } | |
369 | ||
370 | inline void FinishTensorBuffer( | |
371 | flatbuffers::FlatBufferBuilder &fbb, | |
372 | flatbuffers::Offset<org::apache::arrow::flatbuf::Tensor> root) { | |
373 | fbb.Finish(root); | |
374 | } | |
375 | ||
376 | inline void FinishSizePrefixedTensorBuffer( | |
377 | flatbuffers::FlatBufferBuilder &fbb, | |
378 | flatbuffers::Offset<org::apache::arrow::flatbuf::Tensor> root) { | |
379 | fbb.FinishSizePrefixed(root); | |
380 | } | |
381 | ||
382 | } // namespace flatbuf | |
383 | } // namespace arrow | |
384 | } // namespace apache | |
385 | } // namespace org | |
386 | ||
387 | #endif // FLATBUFFERS_GENERATED_TENSOR_ORG_APACHE_ARROW_FLATBUF_H_ |