From 3b79104a84ba30d3eb4c54985a163f5e378f9fa6 Mon Sep 17 00:00:00 2001 From: Cocoa Date: Wed, 12 Feb 2025 16:16:06 +0100 Subject: [PATCH 1/7] WIP Signed-off-by: Cocoa --- .gitignore | 1 + 3rd_party/nanoarrow/flatcc.c | 3247 ++ 3rd_party/nanoarrow/flatcc/flatcc_accessors.h | 106 + 3rd_party/nanoarrow/flatcc/flatcc_alloc.h | 128 + 3rd_party/nanoarrow/flatcc/flatcc_assert.h | 45 + 3rd_party/nanoarrow/flatcc/flatcc_builder.h | 1911 + 3rd_party/nanoarrow/flatcc/flatcc_emitter.h | 215 + 3rd_party/nanoarrow/flatcc/flatcc_endian.h | 125 + 3rd_party/nanoarrow/flatcc/flatcc_epilogue.h | 7 + .../nanoarrow/flatcc/flatcc_flatbuffers.h | 57 + .../nanoarrow/flatcc/flatcc_identifier.h | 148 + 3rd_party/nanoarrow/flatcc/flatcc_iov.h | 31 + 3rd_party/nanoarrow/flatcc/flatcc_portable.h | 14 + 3rd_party/nanoarrow/flatcc/flatcc_prologue.h | 8 + 3rd_party/nanoarrow/flatcc/flatcc_refmap.h | 144 + 3rd_party/nanoarrow/flatcc/flatcc_rtconfig.h | 171 + 3rd_party/nanoarrow/flatcc/flatcc_types.h | 97 + 3rd_party/nanoarrow/flatcc/flatcc_verifier.h | 267 + .../flatcc/portable/paligned_alloc.h | 213 + .../nanoarrow/flatcc/portable/pattributes.h | 84 + .../nanoarrow/flatcc/portable/pdiagnostic.h | 84 + .../flatcc/portable/pdiagnostic_pop.h | 20 + .../flatcc/portable/pdiagnostic_push.h | 51 + 3rd_party/nanoarrow/flatcc/portable/pendian.h | 206 + .../flatcc/portable/pendian_detect.h | 118 + 3rd_party/nanoarrow/flatcc/portable/pinline.h | 19 + .../nanoarrow/flatcc/portable/pinttypes.h | 52 + .../nanoarrow/flatcc/portable/pmemaccess.h | 232 + .../nanoarrow/flatcc/portable/portable.h | 2 + .../flatcc/portable/portable_basic.h | 27 + .../nanoarrow/flatcc/portable/prestrict.h | 39 + .../flatcc/portable/pstatic_assert.h | 67 + .../nanoarrow/flatcc/portable/pstdalign.h | 162 + 3rd_party/nanoarrow/flatcc/portable/pstdint.h | 898 + .../nanoarrow/flatcc/portable/punaligned.h | 190 + .../nanoarrow/flatcc/portable/pversion.h | 6 + .../nanoarrow/flatcc/portable/pwarnings.h | 52 + 3rd_party/nanoarrow/nanoarrow.c | 3872 ++ 3rd_party/nanoarrow/nanoarrow/nanoarrow.h | 4279 +++ 3rd_party/nanoarrow/nanoarrow/nanoarrow.hpp | 932 + 3rd_party/nanoarrow/nanoarrow/nanoarrow_ipc.h | 698 + .../nanoarrow/nanoarrow/nanoarrow_ipc.hpp | 168 + 3rd_party/nanoarrow/nanoarrow_ipc.c | 29229 ++++++++++++++++ CMakeLists.txt | 8 +- Makefile | 2 + UPDATE.md | 20 + c_src/adbc_nif.cpp | 183 +- c_src/nif_utils.cpp | 6 + c_src/nif_utils.hpp | 1 + lib/adbc_error.ex | 4 +- lib/adbc_ipc.ex | 45 + lib/adbc_nif.ex | 4 + mix.exs | 10 +- test/adbc_ipc_test.exs | 34 + test/invalid.arrows | Bin 0 -> 280 bytes test/schema-valid.arrows | Bin 0 -> 280 bytes test/simple.arrows | Bin 0 -> 432 bytes 57 files changed, 48730 insertions(+), 9 deletions(-) create mode 100644 3rd_party/nanoarrow/flatcc.c create mode 100644 3rd_party/nanoarrow/flatcc/flatcc_accessors.h create mode 100644 3rd_party/nanoarrow/flatcc/flatcc_alloc.h create mode 100644 3rd_party/nanoarrow/flatcc/flatcc_assert.h create mode 100644 3rd_party/nanoarrow/flatcc/flatcc_builder.h create mode 100644 3rd_party/nanoarrow/flatcc/flatcc_emitter.h create mode 100644 3rd_party/nanoarrow/flatcc/flatcc_endian.h create mode 100644 3rd_party/nanoarrow/flatcc/flatcc_epilogue.h create mode 100644 3rd_party/nanoarrow/flatcc/flatcc_flatbuffers.h create mode 100644 3rd_party/nanoarrow/flatcc/flatcc_identifier.h create mode 100644 3rd_party/nanoarrow/flatcc/flatcc_iov.h create mode 100644 3rd_party/nanoarrow/flatcc/flatcc_portable.h create mode 100644 3rd_party/nanoarrow/flatcc/flatcc_prologue.h create mode 100644 3rd_party/nanoarrow/flatcc/flatcc_refmap.h create mode 100644 3rd_party/nanoarrow/flatcc/flatcc_rtconfig.h create mode 100644 3rd_party/nanoarrow/flatcc/flatcc_types.h create mode 100644 3rd_party/nanoarrow/flatcc/flatcc_verifier.h create mode 100644 3rd_party/nanoarrow/flatcc/portable/paligned_alloc.h create mode 100644 3rd_party/nanoarrow/flatcc/portable/pattributes.h create mode 100644 3rd_party/nanoarrow/flatcc/portable/pdiagnostic.h create mode 100644 3rd_party/nanoarrow/flatcc/portable/pdiagnostic_pop.h create mode 100644 3rd_party/nanoarrow/flatcc/portable/pdiagnostic_push.h create mode 100644 3rd_party/nanoarrow/flatcc/portable/pendian.h create mode 100644 3rd_party/nanoarrow/flatcc/portable/pendian_detect.h create mode 100644 3rd_party/nanoarrow/flatcc/portable/pinline.h create mode 100644 3rd_party/nanoarrow/flatcc/portable/pinttypes.h create mode 100644 3rd_party/nanoarrow/flatcc/portable/pmemaccess.h create mode 100644 3rd_party/nanoarrow/flatcc/portable/portable.h create mode 100644 3rd_party/nanoarrow/flatcc/portable/portable_basic.h create mode 100644 3rd_party/nanoarrow/flatcc/portable/prestrict.h create mode 100644 3rd_party/nanoarrow/flatcc/portable/pstatic_assert.h create mode 100644 3rd_party/nanoarrow/flatcc/portable/pstdalign.h create mode 100644 3rd_party/nanoarrow/flatcc/portable/pstdint.h create mode 100644 3rd_party/nanoarrow/flatcc/portable/punaligned.h create mode 100644 3rd_party/nanoarrow/flatcc/portable/pversion.h create mode 100644 3rd_party/nanoarrow/flatcc/portable/pwarnings.h create mode 100644 3rd_party/nanoarrow/nanoarrow.c create mode 100644 3rd_party/nanoarrow/nanoarrow/nanoarrow.h create mode 100644 3rd_party/nanoarrow/nanoarrow/nanoarrow.hpp create mode 100644 3rd_party/nanoarrow/nanoarrow/nanoarrow_ipc.h create mode 100644 3rd_party/nanoarrow/nanoarrow/nanoarrow_ipc.hpp create mode 100644 3rd_party/nanoarrow/nanoarrow_ipc.c create mode 100644 UPDATE.md create mode 100644 lib/adbc_ipc.ex create mode 100644 test/adbc_ipc_test.exs create mode 100644 test/invalid.arrows create mode 100644 test/schema-valid.arrows create mode 100644 test/simple.arrows diff --git a/.gitignore b/.gitignore index 8fbb164..a6cb191 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ adbc-*.tar # cache 3rd_party/cache +arrow-nanoarrow/ # checksum checksum.exs diff --git a/3rd_party/nanoarrow/flatcc.c b/3rd_party/nanoarrow/flatcc.c new file mode 100644 index 0000000..a08754a --- /dev/null +++ b/3rd_party/nanoarrow/flatcc.c @@ -0,0 +1,3247 @@ +/* + * Codegenerator for C, building FlatBuffers. + * + * There are several approaches, some light, some requiring a library, + * some with vectored I/O etc. + * + * Here we focus on a reasonable balance of light code and efficiency. + * + * Builder code is generated to a separate file that includes the + * generated read-only code. + * + * Mutable buffers are not supported in this version. + * + */ + +#include +#include + +#include "flatcc/flatcc_builder.h" +#include "flatcc/flatcc_emitter.h" + +/* + * `check` is designed to handle incorrect use errors that can be + * ignored in production of a tested product. + * + * `check_error` fails if condition is false and is designed to return an + * error code in production. + */ + +#if FLATCC_BUILDER_ASSERT_ON_ERROR +#define check(cond, reason) FLATCC_BUILDER_ASSERT(cond, reason) +#else +#define check(cond, reason) ((void)0) +#endif + +#if FLATCC_BUILDER_SKIP_CHECKS +#define check_error(cond, err, reason) ((void)0) +#else +#define check_error(cond, err, reason) if (!(cond)) { check(cond, reason); return err; } +#endif + +/* `strnlen` not widely supported. */ +static inline size_t pstrnlen(const char *s, size_t max_len) +{ + const char *end = memchr(s, 0, max_len); + return end ? (size_t)(end - s) : max_len; +} +#undef strnlen +#define strnlen pstrnlen + +/* Padding can be up to 255 zeroes, and 1 zero string termination byte. + * When two paddings are combined at nested buffers, we need twice that. + * Visible to emitter so it can test for zero padding in iov. */ +const uint8_t flatcc_builder_padding_base[512] = { 0 }; +#define _pad flatcc_builder_padding_base + +#define uoffset_t flatbuffers_uoffset_t +#define soffset_t flatbuffers_soffset_t +#define voffset_t flatbuffers_voffset_t +#define utype_t flatbuffers_utype_t + +#define write_uoffset __flatbuffers_uoffset_write_to_pe +#define write_voffset __flatbuffers_voffset_write_to_pe +#define write_identifier __flatbuffers_uoffset_write_to_pe +#define write_utype __flatbuffers_utype_write_to_pe + +#define field_size sizeof(uoffset_t) +#define max_offset_count FLATBUFFERS_COUNT_MAX(field_size) +#define union_size sizeof(flatcc_builder_union_ref_t) +#define max_union_count FLATBUFFERS_COUNT_MAX(union_size) +#define utype_size sizeof(utype_t) +#define max_utype_count FLATBUFFERS_COUNT_MAX(utype_size) + +#define max_string_len FLATBUFFERS_COUNT_MAX(1) +#define identifier_size FLATBUFFERS_IDENTIFIER_SIZE + + +#define iovec_t flatcc_iovec_t +#define frame_size sizeof(__flatcc_builder_frame_t) +#define frame(x) (B->frame[0].x) + + +/* `align` must be a power of 2. */ +static inline uoffset_t alignup_uoffset(uoffset_t x, size_t align) +{ + return (x + (uoffset_t)align - 1u) & ~((uoffset_t)align - 1u); +} + +static inline size_t alignup_size(size_t x, size_t align) +{ + return (x + align - 1u) & ~(align - 1u); +} + + +typedef struct vtable_descriptor vtable_descriptor_t; +struct vtable_descriptor { + /* Where the vtable is emitted. */ + flatcc_builder_ref_t vt_ref; + /* Which buffer it was emitted to. */ + uoffset_t nest_id; + /* Where the vtable is cached. */ + uoffset_t vb_start; + /* Hash table collision chain. */ + uoffset_t next; +}; + +typedef struct flatcc_iov_state flatcc_iov_state_t; +struct flatcc_iov_state { + size_t len; + int count; + flatcc_iovec_t iov[FLATCC_IOV_COUNT_MAX]; +}; + +#define iov_state_t flatcc_iov_state_t + +/* This assumes `iov_state_t iov;` has been declared in scope */ +#define push_iov_cond(base, size, cond) if ((size) > 0 && (cond)) { iov.len += size;\ + iov.iov[iov.count].iov_base = (void *)(base); iov.iov[iov.count].iov_len = (size); ++iov.count; } +#define push_iov(base, size) push_iov_cond(base, size, 1) +#define init_iov() { iov.len = 0; iov.count = 0; } + + +int flatcc_builder_default_alloc(void *alloc_context, iovec_t *b, size_t request, int zero_fill, int hint) +{ + void *p; + size_t n; + + (void)alloc_context; + + if (request == 0) { + if (b->iov_base) { + FLATCC_BUILDER_FREE(b->iov_base); + b->iov_base = 0; + b->iov_len = 0; + } + return 0; + } + switch (hint) { + case flatcc_builder_alloc_ds: + n = 256; + break; + case flatcc_builder_alloc_ht: + /* Should be exact size, or space size is just wasted. */ + n = request; + break; + case flatcc_builder_alloc_fs: + n = sizeof(__flatcc_builder_frame_t) * 8; + break; + case flatcc_builder_alloc_us: + n = 64; + break; + default: + /* + * We have many small structures - vs stack for tables with few + * elements, and few offset fields in patch log. No need to + * overallocate in case of busy small messages. + */ + n = 32; + break; + } + while (n < request) { + n *= 2; + } + if (request <= b->iov_len && b->iov_len / 2 >= n) { + /* Add hysteresis to shrink. */ + return 0; + } + if (!(p = FLATCC_BUILDER_REALLOC(b->iov_base, n))) { + return -1; + } + /* Realloc might also shrink. */ + if (zero_fill && b->iov_len < n) { + memset((uint8_t *)p + b->iov_len, 0, n - b->iov_len); + } + b->iov_base = p; + b->iov_len = n; + return 0; +} + +#define T_ptr(base, pos) ((void *)((size_t)(base) + (size_t)(pos))) +#define ds_ptr(pos) (T_ptr(B->buffers[flatcc_builder_alloc_ds].iov_base, (pos))) +#define vs_ptr(pos) (T_ptr(B->buffers[flatcc_builder_alloc_vs].iov_base, (pos))) +#define pl_ptr(pos) (T_ptr(B->buffers[flatcc_builder_alloc_pl].iov_base, (pos))) +#define us_ptr(pos) (T_ptr(B->buffers[flatcc_builder_alloc_us].iov_base, (pos))) +#define vd_ptr(pos) (T_ptr(B->buffers[flatcc_builder_alloc_vd].iov_base, (pos))) +#define vb_ptr(pos) (T_ptr(B->buffers[flatcc_builder_alloc_vb].iov_base, (pos))) +#define vs_offset(ptr) ((uoffset_t)((size_t)(ptr) - (size_t)B->buffers[flatcc_builder_alloc_vs].iov_base)) +#define pl_offset(ptr) ((uoffset_t)((size_t)(ptr) - (size_t)B->buffers[flatcc_builder_alloc_pl].iov_base)) +#define us_offset(ptr) ((uoffset_t)((size_t)(ptr) - (size_t)B->buffers[flatcc_builder_alloc_us].iov_base)) + +#define table_limit (FLATBUFFERS_VOFFSET_MAX - field_size + 1) +#define data_limit (FLATBUFFERS_UOFFSET_MAX - field_size + 1) + +#define set_identifier(id) memcpy(&B->identifier, (id) ? (void *)(id) : (void *)_pad, identifier_size) + +/* Must also return true when no buffer has been started. */ +#define is_top_buffer(B) (B->nest_id == 0) + +/* + * Tables use a stack represention better suited for quickly adding + * fields to tables, but it must occasionally be refreshed following + * reallocation or reentry from child frame. + */ +static inline void refresh_ds(flatcc_builder_t *B, uoffset_t type_limit) +{ + iovec_t *buf = B->buffers + flatcc_builder_alloc_ds; + + B->ds = ds_ptr(B->ds_first); + B->ds_limit = (uoffset_t)buf->iov_len - B->ds_first; + /* + * So we don't allocate outside tables representation size, nor our + * current buffer size. + */ + if (B->ds_limit > type_limit) { + B->ds_limit = type_limit; + } + /* So exit frame can refresh fast. */ + frame(type_limit) = type_limit; +} + +static int reserve_ds(flatcc_builder_t *B, size_t need, uoffset_t limit) +{ + iovec_t *buf = B->buffers + flatcc_builder_alloc_ds; + + if (B->alloc(B->alloc_context, buf, B->ds_first + need, 1, flatcc_builder_alloc_ds)) { + return -1; + } + refresh_ds(B, limit); + return 0; +} + +/* + * Make sure there is always an extra zero termination on stack + * even if it isn't emitted such that string updates may count + * on zero termination being present always. + */ +static inline void *push_ds(flatcc_builder_t *B, uoffset_t size) +{ + size_t offset; + + offset = B->ds_offset; + if ((B->ds_offset += size) >= B->ds_limit) { + if (reserve_ds(B, B->ds_offset + 1, data_limit)) { + return 0; + } + } + return B->ds + offset; +} + +static inline void unpush_ds(flatcc_builder_t *B, uoffset_t size) +{ + B->ds_offset -= size; + memset(B->ds + B->ds_offset, 0, size); +} + +static inline void *push_ds_copy(flatcc_builder_t *B, const void *data, uoffset_t size) +{ + void *p; + + if (!(p = push_ds(B, size))) { + return 0; + } + memcpy(p, data, size); + return p; +} + +static inline void *push_ds_field(flatcc_builder_t *B, uoffset_t size, uint16_t align, voffset_t id) +{ + uoffset_t offset; + + /* + * We calculate table field alignment relative to first entry, not + * header field with vtable offset. + * + * Note: >= comparison handles special case where B->ds is not + * allocated yet and size is 0 so the return value would be mistaken + * for an error. + */ + offset = alignup_uoffset(B->ds_offset, align); + if ((B->ds_offset = offset + size) >= B->ds_limit) { + if (reserve_ds(B, B->ds_offset + 1, table_limit)) { + return 0; + } + } + B->vs[id] = (voffset_t)(offset + field_size); + if (id >= B->id_end) { + B->id_end = id + 1u; + } + return B->ds + offset; +} + +static inline void *push_ds_offset_field(flatcc_builder_t *B, voffset_t id) +{ + uoffset_t offset; + + offset = alignup_uoffset(B->ds_offset, field_size); + if ((B->ds_offset = offset + field_size) > B->ds_limit) { + if (reserve_ds(B, B->ds_offset, table_limit)) { + return 0; + } + } + B->vs[id] = (voffset_t)(offset + field_size); + if (id >= B->id_end) { + B->id_end = id + 1u; + } + *B->pl++ = (flatbuffers_voffset_t)offset; + return B->ds + offset; +} + +static inline void *reserve_buffer(flatcc_builder_t *B, int alloc_type, size_t used, size_t need, int zero_init) +{ + iovec_t *buf = B->buffers + alloc_type; + + if (used + need > buf->iov_len) { + if (B->alloc(B->alloc_context, buf, used + need, zero_init, alloc_type)) { + check(0, "memory allocation failed"); + return 0; + } + } + return (void *)((size_t)buf->iov_base + used); +} + +static inline int reserve_fields(flatcc_builder_t *B, int count) +{ + size_t used, need; + + /* Provide faster stack operations for common table operations. */ + used = frame(container.table.vs_end) + frame(container.table.id_end) * sizeof(voffset_t); + need = (size_t)(count + 2) * sizeof(voffset_t); + if (!(B->vs = reserve_buffer(B, flatcc_builder_alloc_vs, used, need, 1))) { + return -1; + } + /* Move past header for convenience. */ + B->vs += 2; + used = frame(container.table.pl_end); + /* Add one to handle special case of first table being empty. */ + need = (size_t)count * sizeof(*(B->pl)) + 1; + if (!(B->pl = reserve_buffer(B, flatcc_builder_alloc_pl, used, need, 0))) { + return -1; + } + return 0; +} + +static int alloc_ht(flatcc_builder_t *B) +{ + iovec_t *buf = B->buffers + flatcc_builder_alloc_ht; + + size_t size, k; + /* Allocate null entry so we can check for return errors. */ + FLATCC_ASSERT(B->vd_end == 0); + if (!reserve_buffer(B, flatcc_builder_alloc_vd, B->vd_end, sizeof(vtable_descriptor_t), 0)) { + return -1; + } + B->vd_end = sizeof(vtable_descriptor_t); + size = field_size * FLATCC_BUILDER_MIN_HASH_COUNT; + if (B->alloc(B->alloc_context, buf, size, 1, flatcc_builder_alloc_ht)) { + return -1; + } + while (size * 2 <= buf->iov_len) { + size *= 2; + } + size /= field_size; + for (k = 0; (((size_t)1) << k) < size; ++k) { + } + B->ht_width = k; + return 0; +} + +static inline uoffset_t *lookup_ht(flatcc_builder_t *B, uint32_t hash) +{ + uoffset_t *T; + + if (B->ht_width == 0) { + if (alloc_ht(B)) { + return 0; + } + } + T = B->buffers[flatcc_builder_alloc_ht].iov_base; + + return &T[FLATCC_BUILDER_BUCKET_VT_HASH(hash, B->ht_width)]; +} + +void flatcc_builder_flush_vtable_cache(flatcc_builder_t *B) +{ + iovec_t *buf = B->buffers + flatcc_builder_alloc_ht; + + if (B->ht_width == 0) { + return; + } + memset(buf->iov_base, 0, buf->iov_len); + /* Reserve the null entry. */ + B->vd_end = sizeof(vtable_descriptor_t); + B->vb_end = 0; +} + +int flatcc_builder_custom_init(flatcc_builder_t *B, + flatcc_builder_emit_fun *emit, void *emit_context, + flatcc_builder_alloc_fun *alloc, void *alloc_context) +{ + /* + * Do not allocate anything here. Only the required buffers will be + * allocated. For simple struct buffers, no allocation is required + * at all. + */ + memset(B, 0, sizeof(*B)); + + if (emit == 0) { + B->is_default_emitter = 1; + emit = flatcc_emitter; + emit_context = &B->default_emit_context; + } + if (alloc == 0) { + alloc = flatcc_builder_default_alloc; + } + B->alloc_context = alloc_context; + B->alloc = alloc; + B->emit_context = emit_context; + B->emit = emit; + return 0; +} + +int flatcc_builder_init(flatcc_builder_t *B) +{ + return flatcc_builder_custom_init(B, 0, 0, 0, 0); +} + +int flatcc_builder_custom_reset(flatcc_builder_t *B, int set_defaults, int reduce_buffers) +{ + iovec_t *buf; + int i; + + for (i = 0; i < FLATCC_BUILDER_ALLOC_BUFFER_COUNT; ++i) { + buf = B->buffers + i; + if (buf->iov_base) { + /* Don't try to reduce the hash table. */ + if (i != flatcc_builder_alloc_ht && + reduce_buffers && B->alloc(B->alloc_context, buf, 1, 1, i)) { + return -1; + } + memset(buf->iov_base, 0, buf->iov_len); + } else { + FLATCC_ASSERT(buf->iov_len == 0); + } + } + B->vb_end = 0; + if (B->vd_end > 0) { + /* Reset past null entry. */ + B->vd_end = sizeof(vtable_descriptor_t); + } + B->min_align = 0; + B->emit_start = 0; + B->emit_end = 0; + B->level = 0; + B->limit_level = 0; + B->ds_offset = 0; + B->ds_limit = 0; + B->nest_count = 0; + B->nest_id = 0; + /* Needed for correct offset calculation. */ + B->ds = B->buffers[flatcc_builder_alloc_ds].iov_base; + B->pl = B->buffers[flatcc_builder_alloc_pl].iov_base; + B->vs = B->buffers[flatcc_builder_alloc_vs].iov_base; + B->frame = 0; + if (set_defaults) { + B->vb_flush_limit = 0; + B->max_level = 0; + B->disable_vt_clustering = 0; + } + if (B->is_default_emitter) { + flatcc_emitter_reset(&B->default_emit_context); + } + if (B->refmap) { + flatcc_refmap_reset(B->refmap); + } + return 0; +} + +int flatcc_builder_reset(flatcc_builder_t *B) +{ + return flatcc_builder_custom_reset(B, 0, 0); +} + +void flatcc_builder_clear(flatcc_builder_t *B) +{ + iovec_t *buf; + int i; + + for (i = 0; i < FLATCC_BUILDER_ALLOC_BUFFER_COUNT; ++i) { + buf = B->buffers + i; + B->alloc(B->alloc_context, buf, 0, 0, i); + } + if (B->is_default_emitter) { + flatcc_emitter_clear(&B->default_emit_context); + } + if (B->refmap) { + flatcc_refmap_clear(B->refmap); + } + memset(B, 0, sizeof(*B)); +} + +static inline void set_min_align(flatcc_builder_t *B, uint16_t align) +{ + if (B->min_align < align) { + B->min_align = align; + } +} + +/* + * It's a max, but the minimum viable alignment is the largest observed + * alignment requirement, but no larger. + */ +static inline void get_min_align(uint16_t *align, uint16_t b) +{ + if (*align < b) { + *align = b; + } +} + +void *flatcc_builder_enter_user_frame_ptr(flatcc_builder_t *B, size_t size) +{ + size_t *frame; + + size = alignup_size(size, sizeof(size_t)) + sizeof(size_t); + + if (!(frame = reserve_buffer(B, flatcc_builder_alloc_us, B->user_frame_end, size, 0))) { + return 0; + } + memset(frame, 0, size); + *frame++ = B->user_frame_offset; + B->user_frame_offset = B->user_frame_end + sizeof(size_t); + B->user_frame_end += size; + return frame; +} + +size_t flatcc_builder_enter_user_frame(flatcc_builder_t *B, size_t size) +{ + size_t *frame; + + size = alignup_size(size, sizeof(size_t)) + sizeof(size_t); + + if (!(frame = reserve_buffer(B, flatcc_builder_alloc_us, B->user_frame_end, size, 0))) { + return 0; + } + memset(frame, 0, size); + *frame++ = B->user_frame_offset; + B->user_frame_offset = B->user_frame_end + sizeof(size_t); + B->user_frame_end += size; + return B->user_frame_offset; +} + + +size_t flatcc_builder_exit_user_frame(flatcc_builder_t *B) +{ + size_t *hdr; + + FLATCC_ASSERT(B->user_frame_offset > 0); + + hdr = us_ptr(B->user_frame_offset); + B->user_frame_end = B->user_frame_offset - sizeof(size_t); + return B->user_frame_offset = hdr[-1]; +} + +size_t flatcc_builder_exit_user_frame_at(flatcc_builder_t *B, size_t handle) +{ + FLATCC_ASSERT(B->user_frame_offset >= handle); + + B->user_frame_offset = handle; + return flatcc_builder_exit_user_frame(B); +} + +size_t flatcc_builder_get_current_user_frame(flatcc_builder_t *B) +{ + return B->user_frame_offset; +} + +void *flatcc_builder_get_user_frame_ptr(flatcc_builder_t *B, size_t handle) +{ + return us_ptr(handle); +} + +static int enter_frame(flatcc_builder_t *B, uint16_t align) +{ + if (++B->level > B->limit_level) { + if (B->max_level > 0 && B->level > B->max_level) { + return -1; + } + if (!(B->frame = reserve_buffer(B, flatcc_builder_alloc_fs, + (size_t)(B->level - 1) * frame_size, frame_size, 0))) { + return -1; + } + B->limit_level = (int)(B->buffers[flatcc_builder_alloc_fs].iov_len / frame_size); + if (B->max_level > 0 && B->max_level < B->limit_level) { + B->limit_level = B->max_level; + } + } else { + ++B->frame; + } + frame(ds_offset) = B->ds_offset; + frame(align) = B->align; + B->align = align; + /* Note: do not assume padding before first has been allocated! */ + frame(ds_first) = B->ds_first; + frame(type_limit) = data_limit; + B->ds_first = alignup_uoffset(B->ds_first + B->ds_offset, 8); + B->ds_offset = 0; + return 0; +} + +static inline void exit_frame(flatcc_builder_t *B) +{ + memset(B->ds, 0, B->ds_offset); + B->ds_offset = frame(ds_offset); + B->ds_first = frame(ds_first); + refresh_ds(B, frame(type_limit)); + + /* + * Restore local alignment: e.g. a table should not change alignment + * because a child table was just created elsewhere in the buffer, + * but the overall alignment (min align), should be aware of it. + * Each buffer has its own min align that then migrates up without + * being affected by sibling or child buffers. + */ + set_min_align(B, B->align); + B->align = frame(align); + + --B->frame; + --B->level; +} + +static inline uoffset_t front_pad(flatcc_builder_t *B, uoffset_t size, uint16_t align) +{ + return (uoffset_t)(B->emit_start - (flatcc_builder_ref_t)size) & (align - 1u); +} + +static inline uoffset_t back_pad(flatcc_builder_t *B, uint16_t align) +{ + return (uoffset_t)(B->emit_end) & (align - 1u); +} + +static inline flatcc_builder_ref_t emit_front(flatcc_builder_t *B, iov_state_t *iov) +{ + flatcc_builder_ref_t ref; + + /* + * We might have overflow when including headers, but without + * headers we should have checks to prevent overflow in the + * uoffset_t range, hence we subtract 16 to be safe. With that + * guarantee we can also make a safe check on the soffset_t range. + * + * We only allow buffers half the theoritical size of + * FLATBUFFERS_UOFFSET_MAX so we can safely use signed references. + * + * NOTE: vtables vt_offset field is signed, and the check in create + * table only ensures the signed limit. The check would fail if the + * total buffer size could grow beyond UOFFSET_MAX, and we prevent + * that by limiting the lower end to SOFFSET_MIN, and the upper end + * at emit_back to SOFFSET_MAX. + */ + ref = B->emit_start - (flatcc_builder_ref_t)iov->len; + if ((iov->len > 16 && iov->len - 16 > FLATBUFFERS_UOFFSET_MAX) || ref >= B->emit_start) { + check(0, "buffer too large to represent"); + return 0; + } + if (B->emit(B->emit_context, iov->iov, iov->count, ref, iov->len)) { + check(0, "emitter rejected buffer content"); + return 0; + } + return B->emit_start = ref; +} + +static inline flatcc_builder_ref_t emit_back(flatcc_builder_t *B, iov_state_t *iov) +{ + flatcc_builder_ref_t ref; + + ref = B->emit_end; + B->emit_end = ref + (flatcc_builder_ref_t)iov->len; + /* + * Similar to emit_front check, but since we only emit vtables and + * padding at the back, we are not concerned with iov->len overflow, + * only total buffer overflow. + * + * With this check, vtable soffset references at table header can + * still overflow in extreme cases, so this must be checked + * separately. + */ + if (B->emit_end < ref) { + check(0, "buffer too large to represent"); + return 0; + } + if (B->emit(B->emit_context, iov->iov, iov->count, ref, iov->len)) { + check(0, "emitter rejected buffer content"); + return 0; + } + /* + * Back references always return ref + 1 because ref == 0 is valid and + * should not be mistaken for error. vtables understand this. + */ + return ref + 1; +} + +/* If nested we cannot pad the end of the buffer without moving the entire buffer, so we don't. */ +static int align_buffer_end(flatcc_builder_t *B, uint16_t *align, uint16_t block_align, int is_nested) +{ + size_t end_pad; + iov_state_t iov; + + block_align = block_align ? block_align : B->block_align ? B->block_align : 1; + get_min_align(align, field_size); + get_min_align(align, block_align); + /* Pad end of buffer to multiple. */ + if (!is_nested) { + end_pad = back_pad(B, *align); + if (end_pad) { + init_iov(); + push_iov(_pad, end_pad); + if (0 == emit_back(B, &iov)) { + check(0, "emitter rejected buffer content"); + return -1; + } + } + } + return 0; +} + +flatcc_builder_ref_t flatcc_builder_embed_buffer(flatcc_builder_t *B, + uint16_t block_align, + const void *data, size_t size, uint16_t align, flatcc_builder_buffer_flags_t flags) +{ + uoffset_t size_field, pad; + iov_state_t iov; + int with_size = (flags & flatcc_builder_with_size) != 0; + + if (align_buffer_end(B, &align, block_align, !is_top_buffer(B))) { + return 0; + } + pad = front_pad(B, (uoffset_t)(size + (with_size ? field_size : 0)), align); + write_uoffset(&size_field, (uoffset_t)size + pad); + init_iov(); + /* Add ubyte vector size header if nested buffer. */ + push_iov_cond(&size_field, field_size, !is_top_buffer(B)); + push_iov(data, size); + push_iov(_pad, pad); + return emit_front(B, &iov); +} + +flatcc_builder_ref_t flatcc_builder_create_buffer(flatcc_builder_t *B, + const char identifier[identifier_size], uint16_t block_align, + flatcc_builder_ref_t object_ref, uint16_t align, flatcc_builder_buffer_flags_t flags) +{ + flatcc_builder_ref_t buffer_ref; + uoffset_t header_pad, id_size = 0; + uoffset_t object_offset, buffer_size, buffer_base; + iov_state_t iov; + flatcc_builder_identifier_t id_out = 0; + int is_nested = (flags & flatcc_builder_is_nested) != 0; + int with_size = (flags & flatcc_builder_with_size) != 0; + + if (align_buffer_end(B, &align, block_align, is_nested)) { + return 0; + } + set_min_align(B, align); + if (identifier) { + FLATCC_ASSERT(sizeof(flatcc_builder_identifier_t) == identifier_size); + FLATCC_ASSERT(sizeof(flatcc_builder_identifier_t) == field_size); + memcpy(&id_out, identifier, identifier_size); + id_out = __flatbuffers_thash_read_from_le(&id_out); + write_identifier(&id_out, id_out); + } + id_size = id_out ? identifier_size : 0; + header_pad = front_pad(B, field_size + id_size + (uoffset_t)(with_size ? field_size : 0), align); + init_iov(); + /* ubyte vectors size field wrapping nested buffer. */ + push_iov_cond(&buffer_size, field_size, is_nested || with_size); + push_iov(&object_offset, field_size); + /* Identifiers are not always present in buffer. */ + push_iov(&id_out, id_size); + push_iov(_pad, header_pad); + buffer_base = (uoffset_t)B->emit_start - (uoffset_t)iov.len + (uoffset_t)((is_nested || with_size) ? field_size : 0); + if (is_nested) { + write_uoffset(&buffer_size, (uoffset_t)B->buffer_mark - buffer_base); + } else { + /* Also include clustered vtables. */ + write_uoffset(&buffer_size, (uoffset_t)B->emit_end - buffer_base); + } + write_uoffset(&object_offset, (uoffset_t)object_ref - buffer_base); + if (0 == (buffer_ref = emit_front(B, &iov))) { + check(0, "emitter rejected buffer content"); + return 0; + } + return buffer_ref; +} + +flatcc_builder_ref_t flatcc_builder_create_struct(flatcc_builder_t *B, const void *data, size_t size, uint16_t align) +{ + size_t pad; + iov_state_t iov; + + check(align >= 1, "align cannot be 0"); + set_min_align(B, align); + pad = front_pad(B, (uoffset_t)size, align); + init_iov(); + push_iov(data, size); + /* + * Normally structs will already be a multiple of their alignment, + * so this padding will not likely be emitted. + */ + push_iov(_pad, pad); + return emit_front(B, &iov); +} + +int flatcc_builder_start_buffer(flatcc_builder_t *B, + const char identifier[identifier_size], uint16_t block_align, flatcc_builder_buffer_flags_t flags) +{ + /* + * This saves the parent `min_align` in the align field since we + * shouldn't use that for the current buffer. `exit_frame` + * automatically aggregates align up, so it is updated when the + * buffer frame exits. + */ + if (enter_frame(B, B->min_align)) { + return -1; + } + /* B->align now has parent min_align, and child frames will save it. */ + /* Since we allow objects to be created before the buffer at top level, + we need to respect min_align in that case. */ + if (!is_top_buffer(B) || B->min_align == 0) { + B->min_align = 1; + } + /* Save the parent block align, and set proper defaults for this buffer. */ + frame(container.buffer.block_align) = B->block_align; + B->block_align = block_align; + frame(container.buffer.flags = B->buffer_flags); + B->buffer_flags = (uint16_t)flags; + frame(container.buffer.mark) = B->buffer_mark; + frame(container.buffer.nest_id) = B->nest_id; + /* + * End of buffer when nested. Not defined for top-level because we + * here (on only here) permit strings etc. to be created before buffer start and + * because top-level buffer vtables can be clustered. + */ + B->buffer_mark = B->emit_start; + /* Must be 0 before and after entering top-level buffer, and unique otherwise. */ + B->nest_id = B->nest_count++; + frame(container.buffer.identifier) = B->identifier; + set_identifier(identifier); + frame(type) = flatcc_builder_buffer; + return 0; +} + +flatcc_builder_ref_t flatcc_builder_end_buffer(flatcc_builder_t *B, flatcc_builder_ref_t root) +{ + flatcc_builder_ref_t buffer_ref; + flatcc_builder_buffer_flags_t flags; + + flags = (flatcc_builder_buffer_flags_t)B->buffer_flags & flatcc_builder_with_size; + flags |= is_top_buffer(B) ? 0 : flatcc_builder_is_nested; + check(frame(type) == flatcc_builder_buffer, "expected buffer frame"); + set_min_align(B, B->block_align); + if (0 == (buffer_ref = flatcc_builder_create_buffer(B, (void *)&B->identifier, + B->block_align, root, B->min_align, flags))) { + return 0; + } + B->buffer_mark = frame(container.buffer.mark); + B->nest_id = frame(container.buffer.nest_id); + B->identifier = frame(container.buffer.identifier); + B->buffer_flags = frame(container.buffer.flags); + B->block_align = frame(container.buffer.block_align); + + exit_frame(B); + return buffer_ref; +} + +void *flatcc_builder_start_struct(flatcc_builder_t *B, size_t size, uint16_t align) +{ + /* Allocate space for the struct on the ds stack. */ + if (enter_frame(B, align)) { + return 0; + } + frame(type) = flatcc_builder_struct; + refresh_ds(B, data_limit); + return push_ds(B, (uoffset_t)size); +} + +void *flatcc_builder_struct_edit(flatcc_builder_t *B) +{ + return B->ds; +} + +flatcc_builder_ref_t flatcc_builder_end_struct(flatcc_builder_t *B) +{ + flatcc_builder_ref_t object_ref; + + check(frame(type) == flatcc_builder_struct, "expected struct frame"); + if (0 == (object_ref = flatcc_builder_create_struct(B, B->ds, B->ds_offset, B->align))) { + return 0; + } + exit_frame(B); + return object_ref; +} + +static inline int vector_count_add(flatcc_builder_t *B, uoffset_t count, uoffset_t max_count) +{ + uoffset_t n, n1; + n = frame(container.vector.count); + n1 = n + count; + /* + * This prevents elem_size * count from overflowing iff max_vector + * has been set sensible. Without this check we might allocate to + * little on the ds stack and return a buffer the user thinks is + * much larger which of course is bad even though the buffer eventually + * would fail anyway. + */ + check_error(n <= n1 && n1 <= max_count, -1, "vector too large to represent"); + frame(container.vector.count) = n1; + return 0; +} + +void *flatcc_builder_extend_vector(flatcc_builder_t *B, size_t count) +{ + if (vector_count_add(B, (uoffset_t)count, frame(container.vector.max_count))) { + return 0; + } + return push_ds(B, frame(container.vector.elem_size) * (uoffset_t)count); +} + +void *flatcc_builder_vector_push(flatcc_builder_t *B, const void *data) +{ + check(frame(type) == flatcc_builder_vector, "expected vector frame"); + check_error(frame(container.vector.count) <= frame(container.vector.max_count), 0, "vector max count exceeded"); + frame(container.vector.count) += 1; + return push_ds_copy(B, data, frame(container.vector.elem_size)); +} + +void *flatcc_builder_append_vector(flatcc_builder_t *B, const void *data, size_t count) +{ + check(frame(type) == flatcc_builder_vector, "expected vector frame"); + if (vector_count_add(B, (uoffset_t)count, frame(container.vector.max_count))) { + return 0; + } + return push_ds_copy(B, data, frame(container.vector.elem_size) * (uoffset_t)count); +} + +flatcc_builder_ref_t *flatcc_builder_extend_offset_vector(flatcc_builder_t *B, size_t count) +{ + if (vector_count_add(B, (uoffset_t)count, max_offset_count)) { + return 0; + } + return push_ds(B, (uoffset_t)(field_size * count)); +} + +flatcc_builder_ref_t *flatcc_builder_offset_vector_push(flatcc_builder_t *B, flatcc_builder_ref_t ref) +{ + flatcc_builder_ref_t *p; + + check(frame(type) == flatcc_builder_offset_vector, "expected offset vector frame"); + if (frame(container.vector.count) == max_offset_count) { + return 0; + } + frame(container.vector.count) += 1; + if (0 == (p = push_ds(B, field_size))) { + return 0; + } + *p = ref; + return p; +} + +flatcc_builder_ref_t *flatcc_builder_append_offset_vector(flatcc_builder_t *B, const flatcc_builder_ref_t *refs, size_t count) +{ + check(frame(type) == flatcc_builder_offset_vector, "expected offset vector frame"); + if (vector_count_add(B, (uoffset_t)count, max_offset_count)) { + return 0; + } + return push_ds_copy(B, refs, (uoffset_t)(field_size * count)); +} + +char *flatcc_builder_extend_string(flatcc_builder_t *B, size_t len) +{ + check(frame(type) == flatcc_builder_string, "expected string frame"); + if (vector_count_add(B, (uoffset_t)len, max_string_len)) { + return 0; + } + return push_ds(B, (uoffset_t)len); +} + +char *flatcc_builder_append_string(flatcc_builder_t *B, const char *s, size_t len) +{ + check(frame(type) == flatcc_builder_string, "expected string frame"); + if (vector_count_add(B, (uoffset_t)len, max_string_len)) { + return 0; + } + return push_ds_copy(B, s, (uoffset_t)len); +} + +char *flatcc_builder_append_string_str(flatcc_builder_t *B, const char *s) +{ + return flatcc_builder_append_string(B, s, strlen(s)); +} + +char *flatcc_builder_append_string_strn(flatcc_builder_t *B, const char *s, size_t max_len) +{ + return flatcc_builder_append_string(B, s, strnlen(s, max_len)); +} + +int flatcc_builder_truncate_vector(flatcc_builder_t *B, size_t count) +{ + check(frame(type) == flatcc_builder_vector, "expected vector frame"); + check_error(frame(container.vector.count) >= count, -1, "cannot truncate vector past empty"); + frame(container.vector.count) -= (uoffset_t)count; + unpush_ds(B, frame(container.vector.elem_size) * (uoffset_t)count); + return 0; +} + +int flatcc_builder_truncate_offset_vector(flatcc_builder_t *B, size_t count) +{ + check(frame(type) == flatcc_builder_offset_vector, "expected offset vector frame"); + check_error(frame(container.vector.count) >= (uoffset_t)count, -1, "cannot truncate vector past empty"); + frame(container.vector.count) -= (uoffset_t)count; + unpush_ds(B, frame(container.vector.elem_size) * (uoffset_t)count); + return 0; +} + +int flatcc_builder_truncate_string(flatcc_builder_t *B, size_t len) +{ + check(frame(type) == flatcc_builder_string, "expected string frame"); + check_error(frame(container.vector.count) >= len, -1, "cannot truncate string past empty"); + frame(container.vector.count) -= (uoffset_t)len; + unpush_ds(B, (uoffset_t)len); + return 0; +} + +int flatcc_builder_start_vector(flatcc_builder_t *B, size_t elem_size, uint16_t align, size_t max_count) +{ + get_min_align(&align, field_size); + if (enter_frame(B, align)) { + return -1; + } + frame(container.vector.elem_size) = (uoffset_t)elem_size; + frame(container.vector.count) = 0; + frame(container.vector.max_count) = (uoffset_t)max_count; + frame(type) = flatcc_builder_vector; + refresh_ds(B, data_limit); + return 0; +} + +int flatcc_builder_start_offset_vector(flatcc_builder_t *B) +{ + if (enter_frame(B, field_size)) { + return -1; + } + frame(container.vector.elem_size) = field_size; + frame(container.vector.count) = 0; + frame(type) = flatcc_builder_offset_vector; + refresh_ds(B, data_limit); + return 0; +} + +flatcc_builder_ref_t flatcc_builder_create_offset_vector(flatcc_builder_t *B, + const flatcc_builder_ref_t *vec, size_t count) +{ + flatcc_builder_ref_t *_vec; + + if (flatcc_builder_start_offset_vector(B)) { + return 0; + } + if (!(_vec = flatcc_builder_extend_offset_vector(B, count))) { + return 0; + } + memcpy(_vec, vec, count * field_size); + return flatcc_builder_end_offset_vector(B); +} + +int flatcc_builder_start_string(flatcc_builder_t *B) +{ + if (enter_frame(B, 1)) { + return -1; + } + frame(container.vector.elem_size) = 1; + frame(container.vector.count) = 0; + frame(type) = flatcc_builder_string; + refresh_ds(B, data_limit); + return 0; +} + +int flatcc_builder_reserve_table(flatcc_builder_t *B, int count) +{ + check(count >= 0, "cannot reserve negative count"); + return reserve_fields(B, count); +} + +int flatcc_builder_start_table(flatcc_builder_t *B, int count) +{ + if (enter_frame(B, field_size)) { + return -1; + } + frame(container.table.vs_end) = vs_offset(B->vs); + frame(container.table.pl_end) = pl_offset(B->pl); + frame(container.table.vt_hash) = B->vt_hash; + frame(container.table.id_end) = B->id_end; + B->vt_hash = 0; + FLATCC_BUILDER_INIT_VT_HASH(B->vt_hash); + B->id_end = 0; + frame(type) = flatcc_builder_table; + if (reserve_fields(B, count)) { + return -1; + } + refresh_ds(B, table_limit); + return 0; +} + +flatcc_builder_vt_ref_t flatcc_builder_create_vtable(flatcc_builder_t *B, + const voffset_t *vt, voffset_t vt_size) +{ + flatcc_builder_vt_ref_t vt_ref; + iov_state_t iov; + voffset_t *vt_; + size_t i; + + /* + * Only top-level buffer can cluster vtables because only it can + * extend beyond the end. + * + * We write the vtable after the referencing table to maintain + * the construction invariant that any offset reference has + * valid emitted data at a higher address, and also that any + * issued negative emit address represents an offset reference + * to some flatbuffer object or vector (or possibly a root + * struct). + * + * The vt_ref is stored as the reference + 1 to avoid having 0 as a + * valid reference (which usally means error). It also idententifies + * vtable references as the only uneven references, and the only + * references that can be used multiple times in the same buffer. + * + * We do the vtable conversion here so cached vtables can be built + * hashed and compared more efficiently, and so end users with + * direct vtable construction don't have to worry about endianness. + * This also ensures the hash function works the same wrt. + * collision frequency. + */ + + if (!flatbuffers_is_native_pe()) { + /* Make space in vtable cache for temporary endian conversion. */ + if (!(vt_ = reserve_buffer(B, flatcc_builder_alloc_vb, B->vb_end, vt_size, 0))) { + return 0; + } + for (i = 0; i < vt_size / sizeof(voffset_t); ++i) { + write_voffset(&vt_[i], vt[i]); + } + vt = vt_; + /* We don't need to free the reservation since we don't advance any base pointer. */ + } + + init_iov(); + push_iov(vt, vt_size); + if (is_top_buffer(B) && !B->disable_vt_clustering) { + /* Note that `emit_back` already returns ref + 1 as we require for vtables. */ + if (0 == (vt_ref = emit_back(B, &iov))) { + return 0; + } + } else { + if (0 == (vt_ref = emit_front(B, &iov))) { + return 0; + } + /* + * We don't have a valid 0 ref here, but to be consistent with + * clustered vtables we offset by one. This cannot be zero + * either. + */ + vt_ref += 1; + } + return vt_ref; +} + +flatcc_builder_vt_ref_t flatcc_builder_create_cached_vtable(flatcc_builder_t *B, + const voffset_t *vt, voffset_t vt_size, uint32_t vt_hash) +{ + vtable_descriptor_t *vd, *vd2; + uoffset_t *pvd, *pvd_head; + uoffset_t next; + voffset_t *vt_; + + /* This just gets the hash table slot, we still have to inspect it. */ + if (!(pvd_head = lookup_ht(B, vt_hash))) { + return 0; + } + pvd = pvd_head; + next = *pvd; + /* Tracks if there already is a cached copy. */ + vd2 = 0; + while (next) { + vd = vd_ptr(next); + vt_ = vb_ptr(vd->vb_start); + if (vt_[0] != vt_size || 0 != memcmp(vt, vt_, vt_size)) { + pvd = &vd->next; + next = vd->next; + continue; + } + /* Can't share emitted vtables between buffers, */ + if (vd->nest_id != B->nest_id) { + /* but we don't have to resubmit to cache. */ + vd2 = vd; + /* See if there is a better match. */ + pvd = &vd->next; + next = vd->next; + continue; + } + /* Move to front hash strategy. */ + if (pvd != pvd_head) { + *pvd = vd->next; + vd->next = *pvd_head; + *pvd_head = next; + } + /* vtable exists and has been emitted within current buffer. */ + return vd->vt_ref; + } + /* Allocate new descriptor. */ + if (!(vd = reserve_buffer(B, flatcc_builder_alloc_vd, B->vd_end, sizeof(vtable_descriptor_t), 0))) { + return 0; + } + next = B->vd_end; + B->vd_end += (uoffset_t)sizeof(vtable_descriptor_t); + + /* Identify the buffer this vtable descriptor belongs to. */ + vd->nest_id = B->nest_id; + + /* Move to front hash strategy. */ + vd->next = *pvd_head; + *pvd_head = next; + if (0 == (vd->vt_ref = flatcc_builder_create_vtable(B, vt, vt_size))) { + return 0; + } + if (vd2) { + /* Reuse cached copy. */ + vd->vb_start = vd2->vb_start; + } else { + if (B->vb_flush_limit && B->vb_flush_limit < B->vb_end + vt_size) { + flatcc_builder_flush_vtable_cache(B); + } else { + /* Make space in vtable cache. */ + if (!(vt_ = reserve_buffer(B, flatcc_builder_alloc_vb, B->vb_end, vt_size, 0))) { + return -1; + } + vd->vb_start = B->vb_end; + B->vb_end += vt_size; + memcpy(vt_, vt, vt_size); + } + } + return vd->vt_ref; +} + +flatcc_builder_ref_t flatcc_builder_create_table(flatcc_builder_t *B, const void *data, size_t size, uint16_t align, + flatbuffers_voffset_t *offsets, int offset_count, flatcc_builder_vt_ref_t vt_ref) +{ + int i; + uoffset_t pad, vt_offset, vt_offset_field, vt_base, base, offset, *offset_field; + iov_state_t iov; + + check(offset_count >= 0, "expected non-negative offset_count"); + /* + * vtable references are offset by 1 to avoid confusion with + * 0 as an error reference. It also uniquely identifies them + * as vtables being the only uneven reference type. + */ + check(vt_ref & 1, "invalid vtable referenc"); + get_min_align(&align, field_size); + set_min_align(B, align); + /* Alignment is calculated for the first element, not the header. */ + pad = front_pad(B, (uoffset_t)size, align); + base = (uoffset_t)B->emit_start - (uoffset_t)(pad + size + field_size); + /* Adjust by 1 to get unencoded vtable reference. */ + vt_base = (uoffset_t)(vt_ref - 1); + vt_offset = base - vt_base; + /* Avoid overflow. */ + if (base - vt_offset != vt_base) { + return -1; + } + /* Protocol endian encoding. */ + write_uoffset(&vt_offset_field, vt_offset); + for (i = 0; i < offset_count; ++i) { + offset_field = (uoffset_t *)((size_t)data + offsets[i]); + offset = *offset_field - base - offsets[i] - (uoffset_t)field_size; + write_uoffset(offset_field, offset); + } + init_iov(); + push_iov(&vt_offset_field, field_size); + push_iov(data, size); + push_iov(_pad, pad); + return emit_front(B, &iov); +} + +int flatcc_builder_check_required_field(flatcc_builder_t *B, flatbuffers_voffset_t id) +{ + check(frame(type) == flatcc_builder_table, "expected table frame"); + + return id < B->id_end && B->vs[id] != 0; +} + +int flatcc_builder_check_union_field(flatcc_builder_t *B, flatbuffers_voffset_t id) +{ + check(frame(type) == flatcc_builder_table, "expected table frame"); + + if (id == 0 || id >= B->id_end) { + return 0; + } + if (B->vs[id - 1] == 0) { + return B->vs[id] == 0; + } + if (*(uint8_t *)(B->ds + B->vs[id - 1])) { + return B->vs[id] != 0; + } + return B->vs[id] == 0; +} + +int flatcc_builder_check_required(flatcc_builder_t *B, const flatbuffers_voffset_t *required, int count) +{ + int i; + + check(frame(type) == flatcc_builder_table, "expected table frame"); + + if (B->id_end < count) { + return 0; + } + for (i = 0; i < count; ++i) { + if (B->vs[required[i]] == 0) { + return 0; + } + } + return 1; +} + +flatcc_builder_ref_t flatcc_builder_end_table(flatcc_builder_t *B) +{ + voffset_t *vt, vt_size; + flatcc_builder_ref_t table_ref, vt_ref; + int pl_count; + voffset_t *pl; + size_t tsize; + + check(frame(type) == flatcc_builder_table, "expected table frame"); + + /* We have `ds_limit`, so we should not have to check for overflow here. */ + + vt = B->vs - 2; + vt_size = (voffset_t)(sizeof(voffset_t) * (B->id_end + 2u)); + /* Update vtable header fields, first vtable size, then object table size. */ + vt[0] = vt_size; + /* + * The `ds` buffer is always at least `field_size` aligned but excludes the + * initial vtable offset field. Therefore `field_size` is added here + * to the total table size in the vtable. + */ + tsize = (size_t)(B->ds_offset + field_size); + /* + * Tables are limited to 64K in standard FlatBuffers format due to the voffset + * 16 bit size, but we must also be able to store the table size, so the + * table payload has to be slightly less than that. + */ + check(tsize <= FLATBUFFERS_VOFFSET_MAX, "table too large"); + vt[1] = (voffset_t)tsize; + FLATCC_BUILDER_UPDATE_VT_HASH(B->vt_hash, (uint32_t)vt[0], (uint32_t)vt[1]); + /* Find already emitted vtable, or emit a new one. */ + if (!(vt_ref = flatcc_builder_create_cached_vtable(B, vt, vt_size, B->vt_hash))) { + return 0; + } + /* Clear vs stack so it is ready for the next vtable (ds stack is cleared by exit frame). */ + memset(vt, 0, vt_size); + + pl = pl_ptr(frame(container.table.pl_end)); + pl_count = (int)(B->pl - pl); + if (0 == (table_ref = flatcc_builder_create_table(B, B->ds, B->ds_offset, B->align, pl, pl_count, vt_ref))) { + return 0; + } + B->vt_hash = frame(container.table.vt_hash); + B->id_end = frame(container.table.id_end); + B->vs = vs_ptr(frame(container.table.vs_end)); + B->pl = pl_ptr(frame(container.table.pl_end)); + exit_frame(B); + return table_ref; +} + +flatcc_builder_ref_t flatcc_builder_create_vector(flatcc_builder_t *B, + const void *data, size_t count, size_t elem_size, uint16_t align, size_t max_count) +{ + /* + * Note: it is important that vec_size is uoffset not size_t + * in case sizeof(uoffset_t) > sizeof(size_t) because max_count is + * defined in terms of uoffset_t representation size, and also + * because we risk accepting too large a vector even if max_count is + * not violated. + */ + uoffset_t vec_size, vec_pad, length_prefix; + iov_state_t iov; + + check_error(count <= max_count, 0, "vector max_count violated"); + get_min_align(&align, field_size); + set_min_align(B, align); + vec_size = (uoffset_t)count * (uoffset_t)elem_size; + /* + * That can happen on 32 bit systems when uoffset_t is defined as 64-bit. + * `emit_front/back` captures overflow, but not if our size type wraps first. + */ +#if FLATBUFFERS_UOFFSET_MAX > SIZE_MAX + check_error(vec_size < SIZE_MAX, 0, "vector larger than address space"); +#endif + write_uoffset(&length_prefix, (uoffset_t)count); + /* Alignment is calculated for the first element, not the header. */ + vec_pad = front_pad(B, vec_size, align); + init_iov(); + push_iov(&length_prefix, field_size); + push_iov(data, vec_size); + push_iov(_pad, vec_pad); + return emit_front(B, &iov); +} + +/* + * Note: FlatBuffers official documentation states that the size field of a + * vector is a 32-bit element count. It is not quite clear if the + * intention is to have the size field be of type uoffset_t since tables + * also have a uoffset_t sized header, or if the vector size should + * remain unchanged if uoffset is changed to 16- or 64-bits + * respectively. Since it makes most sense to have a vector compatible + * with the addressable space, we choose to use uoffset_t as size field, + * which remains compatible with the default 32-bit version of uoffset_t. + */ +flatcc_builder_ref_t flatcc_builder_end_vector(flatcc_builder_t *B) +{ + flatcc_builder_ref_t vector_ref; + + check(frame(type) == flatcc_builder_vector, "expected vector frame"); + + if (0 == (vector_ref = flatcc_builder_create_vector(B, B->ds, + frame(container.vector.count), frame(container.vector.elem_size), + B->align, frame(container.vector.max_count)))) { + return 0; + } + exit_frame(B); + return vector_ref; +} + +size_t flatcc_builder_vector_count(flatcc_builder_t *B) +{ + return frame(container.vector.count); +} + +void *flatcc_builder_vector_edit(flatcc_builder_t *B) +{ + return B->ds; +} + +/* This function destroys the source content but avoids stack allocation. */ +static flatcc_builder_ref_t _create_offset_vector_direct(flatcc_builder_t *B, + flatcc_builder_ref_t *vec, size_t count, const utype_t *types) +{ + uoffset_t vec_size, vec_pad; + uoffset_t length_prefix, offset; + uoffset_t i; + soffset_t base; + iov_state_t iov; + + if ((uoffset_t)count > max_offset_count) { + return 0; + } + set_min_align(B, field_size); + vec_size = (uoffset_t)(count * field_size); + write_uoffset(&length_prefix, (uoffset_t)count); + /* Alignment is calculated for the first element, not the header. */ + vec_pad = front_pad(B, vec_size, field_size); + init_iov(); + push_iov(&length_prefix, field_size); + push_iov(vec, vec_size); + push_iov(_pad, vec_pad); + base = B->emit_start - (soffset_t)iov.len; + for (i = 0; i < (uoffset_t)count; ++i) { + /* + * 0 is either end of buffer, start of vtables, or start of + * buffer depending on the direction in which the buffer is + * built. None of these can create a valid 0 reference but it + * is easy to create by mistake when manually building offset + * vectors. + * + * Unions do permit nulls, but only when the type is NONE. + */ + if (vec[i] != 0) { + offset = (uoffset_t) + (vec[i] - base - (soffset_t)(i * field_size) - (soffset_t)field_size); + write_uoffset(&vec[i], offset); + if (types) { + check(types[i] != 0, "union vector cannot have non-null element with type NONE"); + } + } else { + if (types) { + check(types[i] == 0, "union vector cannot have null element without type NONE"); + } else { + check(0, "offset vector cannot have null element"); + } + } + } + return emit_front(B, &iov); +} + +flatcc_builder_ref_t flatcc_builder_create_offset_vector_direct(flatcc_builder_t *B, + flatcc_builder_ref_t *vec, size_t count) +{ + return _create_offset_vector_direct(B, vec, count, 0); +} + +flatcc_builder_ref_t flatcc_builder_end_offset_vector(flatcc_builder_t *B) +{ + flatcc_builder_ref_t vector_ref; + + check(frame(type) == flatcc_builder_offset_vector, "expected offset vector frame"); + if (0 == (vector_ref = flatcc_builder_create_offset_vector_direct(B, + (flatcc_builder_ref_t *)B->ds, frame(container.vector.count)))) { + return 0; + } + exit_frame(B); + return vector_ref; +} + +flatcc_builder_ref_t flatcc_builder_end_offset_vector_for_unions(flatcc_builder_t *B, const utype_t *types) +{ + flatcc_builder_ref_t vector_ref; + + check(frame(type) == flatcc_builder_offset_vector, "expected offset vector frame"); + if (0 == (vector_ref = _create_offset_vector_direct(B, + (flatcc_builder_ref_t *)B->ds, frame(container.vector.count), types))) { + return 0; + } + exit_frame(B); + return vector_ref; +} + +void *flatcc_builder_offset_vector_edit(flatcc_builder_t *B) +{ + return B->ds; +} + +size_t flatcc_builder_offset_vector_count(flatcc_builder_t *B) +{ + return frame(container.vector.count); +} + +int flatcc_builder_table_add_union(flatcc_builder_t *B, int id, + flatcc_builder_union_ref_t uref) +{ + flatcc_builder_ref_t *pref; + flatcc_builder_utype_t *putype; + + check(frame(type) == flatcc_builder_table, "expected table frame"); + check_error(uref.type != 0 || uref.value == 0, -1, "expected null value for type NONE"); + if (uref.value != 0) { + pref = flatcc_builder_table_add_offset(B, id); + check_error(pref != 0, -1, "unable to add union value"); + *pref = uref.value; + } + putype = flatcc_builder_table_add(B, id - 1, utype_size, utype_size); + check_error(putype != 0, -1, "unable to add union type"); + write_utype(putype, uref.type); + return 0; +} + +int flatcc_builder_table_add_union_vector(flatcc_builder_t *B, int id, + flatcc_builder_union_vec_ref_t uvref) +{ + flatcc_builder_ref_t *pref; + + check(frame(type) == flatcc_builder_table, "expected table frame"); + check_error((uvref.type == 0) == (uvref.value == 0), -1, "expected both type and value vector, or neither"); + if (uvref.type != 0) { + pref = flatcc_builder_table_add_offset(B, id - 1); + check_error(pref != 0, -1, "unable to add union member"); + *pref = uvref.type; + + pref = flatcc_builder_table_add_offset(B, id); + check_error(pref != 0, -1, "unable to add union member"); + *pref = uvref.value; + } + return 0; +} + +flatcc_builder_union_vec_ref_t flatcc_builder_create_union_vector(flatcc_builder_t *B, + const flatcc_builder_union_ref_t *urefs, size_t count) +{ + flatcc_builder_union_vec_ref_t uvref = { 0, 0 }; + flatcc_builder_utype_t *types; + flatcc_builder_ref_t *refs; + size_t i; + + if (flatcc_builder_start_offset_vector(B)) { + return uvref; + } + if (0 == flatcc_builder_extend_offset_vector(B, count)) { + return uvref; + } + if (0 == (types = push_ds(B, (uoffset_t)(utype_size * count)))) { + return uvref; + } + + /* Safe even if push_ds caused stack reallocation. */ + refs = flatcc_builder_offset_vector_edit(B); + + for (i = 0; i < count; ++i) { + types[i] = urefs[i].type; + refs[i] = urefs[i].value; + } + uvref = flatcc_builder_create_union_vector_direct(B, + types, refs, count); + /* No need to clean up after out temporary types vector. */ + exit_frame(B); + return uvref; +} + +flatcc_builder_union_vec_ref_t flatcc_builder_create_union_vector_direct(flatcc_builder_t *B, + const flatcc_builder_utype_t *types, flatcc_builder_ref_t *data, size_t count) +{ + flatcc_builder_union_vec_ref_t uvref = { 0, 0 }; + + if (0 == (uvref.value = _create_offset_vector_direct(B, data, count, types))) { + return uvref; + } + if (0 == (uvref.type = flatcc_builder_create_type_vector(B, types, count))) { + return uvref; + } + return uvref; +} + +flatcc_builder_ref_t flatcc_builder_create_type_vector(flatcc_builder_t *B, + const flatcc_builder_utype_t *types, size_t count) +{ + return flatcc_builder_create_vector(B, types, count, + utype_size, utype_size, max_utype_count); +} + +int flatcc_builder_start_union_vector(flatcc_builder_t *B) +{ + if (enter_frame(B, field_size)) { + return -1; + } + frame(container.vector.elem_size) = union_size; + frame(container.vector.count) = 0; + frame(type) = flatcc_builder_union_vector; + refresh_ds(B, data_limit); + return 0; +} + +flatcc_builder_union_vec_ref_t flatcc_builder_end_union_vector(flatcc_builder_t *B) +{ + flatcc_builder_union_vec_ref_t uvref = { 0, 0 }; + flatcc_builder_utype_t *types; + flatcc_builder_union_ref_t *urefs; + flatcc_builder_ref_t *refs; + size_t i, count; + + check(frame(type) == flatcc_builder_union_vector, "expected union vector frame"); + + /* + * We could split the union vector in-place, but then we would have + * to deal with strict pointer aliasing rules which is not worthwhile + * so we create a new offset and type vector on the stack. + * + * We assume the stack is sufficiently aligned as is. + */ + count = flatcc_builder_union_vector_count(B); + if (0 == (refs = push_ds(B, (uoffset_t)(count * (utype_size + field_size))))) { + return uvref; + } + types = (flatcc_builder_utype_t *)(refs + count); + + /* Safe even if push_ds caused stack reallocation. */ + urefs = flatcc_builder_union_vector_edit(B); + + for (i = 0; i < count; ++i) { + types[i] = urefs[i].type; + refs[i] = urefs[i].value; + } + uvref = flatcc_builder_create_union_vector_direct(B, types, refs, count); + /* No need to clean up after out temporary types vector. */ + exit_frame(B); + return uvref; +} + +void *flatcc_builder_union_vector_edit(flatcc_builder_t *B) +{ + return B->ds; +} + +size_t flatcc_builder_union_vector_count(flatcc_builder_t *B) +{ + return frame(container.vector.count); +} + +flatcc_builder_union_ref_t *flatcc_builder_extend_union_vector(flatcc_builder_t *B, size_t count) +{ + if (vector_count_add(B, (uoffset_t)count, max_union_count)) { + return 0; + } + return push_ds(B, (uoffset_t)(union_size * count)); +} + +int flatcc_builder_truncate_union_vector(flatcc_builder_t *B, size_t count) +{ + check(frame(type) == flatcc_builder_union_vector, "expected union vector frame"); + check_error(frame(container.vector.count) >= (uoffset_t)count, -1, "cannot truncate vector past empty"); + frame(container.vector.count) -= (uoffset_t)count; + unpush_ds(B, frame(container.vector.elem_size) * (uoffset_t)count); + return 0; +} + +flatcc_builder_union_ref_t *flatcc_builder_union_vector_push(flatcc_builder_t *B, + flatcc_builder_union_ref_t uref) +{ + flatcc_builder_union_ref_t *p; + + check(frame(type) == flatcc_builder_union_vector, "expected union vector frame"); + if (frame(container.vector.count) == max_union_count) { + return 0; + } + frame(container.vector.count) += 1; + if (0 == (p = push_ds(B, union_size))) { + return 0; + } + *p = uref; + return p; +} + +flatcc_builder_union_ref_t *flatcc_builder_append_union_vector(flatcc_builder_t *B, + const flatcc_builder_union_ref_t *urefs, size_t count) +{ + check(frame(type) == flatcc_builder_union_vector, "expected union vector frame"); + if (vector_count_add(B, (uoffset_t)count, max_union_count)) { + return 0; + } + return push_ds_copy(B, urefs, (uoffset_t)(union_size * count)); +} + +flatcc_builder_ref_t flatcc_builder_create_string(flatcc_builder_t *B, const char *s, size_t len) +{ + uoffset_t s_pad; + uoffset_t length_prefix; + iov_state_t iov; + + if (len > max_string_len) { + return 0; + } + write_uoffset(&length_prefix, (uoffset_t)len); + /* Add 1 for zero termination. */ + s_pad = front_pad(B, (uoffset_t)len + 1, field_size) + 1; + init_iov(); + push_iov(&length_prefix, field_size); + push_iov(s, len); + push_iov(_pad, s_pad); + return emit_front(B, &iov); +} + +flatcc_builder_ref_t flatcc_builder_create_string_str(flatcc_builder_t *B, const char *s) +{ + return flatcc_builder_create_string(B, s, strlen(s)); +} + +flatcc_builder_ref_t flatcc_builder_create_string_strn(flatcc_builder_t *B, const char *s, size_t max_len) +{ + return flatcc_builder_create_string(B, s, strnlen(s, max_len)); +} + +flatcc_builder_ref_t flatcc_builder_end_string(flatcc_builder_t *B) +{ + flatcc_builder_ref_t string_ref; + + check(frame(type) == flatcc_builder_string, "expected string frame"); + FLATCC_ASSERT(frame(container.vector.count) == B->ds_offset); + if (0 == (string_ref = flatcc_builder_create_string(B, + (const char *)B->ds, B->ds_offset))) { + return 0; + } + exit_frame(B); + return string_ref; +} + +char *flatcc_builder_string_edit(flatcc_builder_t *B) +{ + return (char *)B->ds; +} + +size_t flatcc_builder_string_len(flatcc_builder_t *B) +{ + return frame(container.vector.count); +} + +void *flatcc_builder_table_add(flatcc_builder_t *B, int id, size_t size, uint16_t align) +{ + /* + * We align the offset relative to the first table field, excluding + * the header holding the vtable reference. On the stack, `ds_first` + * is aligned to 8 bytes thanks to the `enter_frame` logic, and this + * provides a safe way to update the fields on the stack, but here + * we are concerned with the target buffer alignment. + * + * We could also have aligned relative to the end of the table which + * would allow us to emit each field immediately, but it would be a + * confusing user experience wrt. field ordering, and it would add + * more variability to vtable layouts, thus reducing reuse, and + * frequent emissions to external emitter interface would be + * sub-optimal. Also, with that appoach, the vtable offsets would + * have to be adjusted at table end. + * + * As we have it, each emit occur at table end, vector end, string + * end, or buffer end, which might be helpful to various backend + * processors. + */ + check(frame(type) == flatcc_builder_table, "expected table frame"); + check(id >= 0 && id <= (int)FLATBUFFERS_ID_MAX, "table id out of range"); + if (align > B->align) { + B->align = align; + } +#if FLATCC_BUILDER_ALLOW_REPEAT_TABLE_ADD + if (B->vs[id] != 0) { + return B->ds + B->vs[id] - field_size; + } +#else + if (B->vs[id] != 0) { + check(0, "table field already set"); + return 0; + } +#endif + FLATCC_BUILDER_UPDATE_VT_HASH(B->vt_hash, (uint32_t)id, (uint32_t)size); + return push_ds_field(B, (uoffset_t)size, align, (voffset_t)id); +} + +void *flatcc_builder_table_edit(flatcc_builder_t *B, size_t size) +{ + check(frame(type) == flatcc_builder_table, "expected table frame"); + + return B->ds + B->ds_offset - size; +} + +void *flatcc_builder_table_add_copy(flatcc_builder_t *B, int id, const void *data, size_t size, uint16_t align) +{ + void *p; + + if ((p = flatcc_builder_table_add(B, id, size, align))) { + memcpy(p, data, size); + } + return p; +} + +flatcc_builder_ref_t *flatcc_builder_table_add_offset(flatcc_builder_t *B, int id) +{ + check(frame(type) == flatcc_builder_table, "expected table frame"); + check(id >= 0 && id <= (int)FLATBUFFERS_ID_MAX, "table id out of range"); +#if FLATCC_BUILDER_ALLOW_REPEAT_TABLE_ADD + if (B->vs[id] != 0) { + return B->ds + B->vs[id] - field_size; + } +#else + if (B->vs[id] != 0) { + check(0, "table field already set"); + return 0; + } +#endif + FLATCC_BUILDER_UPDATE_VT_HASH(B->vt_hash, (uint32_t)id, (uint32_t)field_size); + return push_ds_offset_field(B, (voffset_t)id); +} + +uint16_t flatcc_builder_push_buffer_alignment(flatcc_builder_t *B) +{ + uint16_t old_min_align = B->min_align; + + B->min_align = field_size; + return old_min_align; +} + +void flatcc_builder_pop_buffer_alignment(flatcc_builder_t *B, uint16_t pushed_align) +{ + set_min_align(B, pushed_align); +} + +uint16_t flatcc_builder_get_buffer_alignment(flatcc_builder_t *B) +{ + return B->min_align; +} + +void flatcc_builder_set_vtable_clustering(flatcc_builder_t *B, int enable) +{ + /* Inverted because we zero all memory in B on init. */ + B->disable_vt_clustering = !enable; +} + +void flatcc_builder_set_block_align(flatcc_builder_t *B, uint16_t align) +{ + B->block_align = align; +} + +int flatcc_builder_get_level(flatcc_builder_t *B) +{ + return B->level; +} + +void flatcc_builder_set_max_level(flatcc_builder_t *B, int max_level) +{ + B->max_level = max_level; + if (B->limit_level < B->max_level) { + B->limit_level = B->max_level; + } +} + +size_t flatcc_builder_get_buffer_size(flatcc_builder_t *B) +{ + return (size_t)(B->emit_end - B->emit_start); +} + +flatcc_builder_ref_t flatcc_builder_get_buffer_start(flatcc_builder_t *B) +{ + return B->emit_start; +} + +flatcc_builder_ref_t flatcc_builder_get_buffer_end(flatcc_builder_t *B) +{ + return B->emit_end; +} + +void flatcc_builder_set_vtable_cache_limit(flatcc_builder_t *B, size_t size) +{ + B->vb_flush_limit = size; +} + +void flatcc_builder_set_identifier(flatcc_builder_t *B, const char identifier[identifier_size]) +{ + set_identifier(identifier); +} + +enum flatcc_builder_type flatcc_builder_get_type(flatcc_builder_t *B) +{ + return B->frame ? frame(type) : flatcc_builder_empty; +} + +enum flatcc_builder_type flatcc_builder_get_type_at(flatcc_builder_t *B, int level) +{ + if (level < 1 || level > B->level) { + return flatcc_builder_empty; + } + return B->frame[level - B->level].type; +} + +void *flatcc_builder_get_direct_buffer(flatcc_builder_t *B, size_t *size_out) +{ + if (B->is_default_emitter) { + return flatcc_emitter_get_direct_buffer(&B->default_emit_context, size_out); + } else { + if (size_out) { + *size_out = 0; + } + } + return 0; +} + +void *flatcc_builder_copy_buffer(flatcc_builder_t *B, void *buffer, size_t size) +{ + /* User is allowed to call tentatively to see if there is support. */ + if (!B->is_default_emitter) { + return 0; + } + buffer = flatcc_emitter_copy_buffer(&B->default_emit_context, buffer, size); + check(buffer, "default emitter declined to copy buffer"); + return buffer; +} + +void *flatcc_builder_finalize_buffer(flatcc_builder_t *B, size_t *size_out) +{ + void * buffer; + size_t size; + + size = flatcc_builder_get_buffer_size(B); + + if (size_out) { + *size_out = size; + } + + buffer = FLATCC_BUILDER_ALLOC(size); + + if (!buffer) { + check(0, "failed to allocated memory for finalized buffer"); + goto done; + } + if (!flatcc_builder_copy_buffer(B, buffer, size)) { + check(0, "default emitter declined to copy buffer"); + FLATCC_BUILDER_FREE(buffer); + buffer = 0; + } +done: + if (!buffer && size_out) { + *size_out = 0; + } + return buffer; +} + +void *flatcc_builder_finalize_aligned_buffer(flatcc_builder_t *B, size_t *size_out) +{ + void * buffer; + size_t align; + size_t size; + + size = flatcc_builder_get_buffer_size(B); + + if (size_out) { + *size_out = size; + } + align = flatcc_builder_get_buffer_alignment(B); + + size = (size + align - 1) & ~(align - 1); + buffer = FLATCC_BUILDER_ALIGNED_ALLOC(align, size); + + if (!buffer) { + goto done; + } + if (!flatcc_builder_copy_buffer(B, buffer, size)) { + FLATCC_BUILDER_ALIGNED_FREE(buffer); + buffer = 0; + goto done; + } +done: + if (!buffer && size_out) { + *size_out = 0; + } + return buffer; +} + +void *flatcc_builder_aligned_alloc(size_t alignment, size_t size) +{ + return FLATCC_BUILDER_ALIGNED_ALLOC(alignment, size); +} + +void flatcc_builder_aligned_free(void *p) +{ + FLATCC_BUILDER_ALIGNED_FREE(p); +} + +void *flatcc_builder_alloc(size_t size) +{ + return FLATCC_BUILDER_ALLOC(size); +} + +void flatcc_builder_free(void *p) +{ + FLATCC_BUILDER_FREE(p); +} + +void *flatcc_builder_get_emit_context(flatcc_builder_t *B) +{ + return B->emit_context; +} +#include + +#include "flatcc/flatcc_rtconfig.h" +#include "flatcc/flatcc_emitter.h" + +static int advance_front(flatcc_emitter_t *E) +{ + flatcc_emitter_page_t *p = 0; + + if (E->front && E->front->prev != E->back) { + E->front->prev->page_offset = E->front->page_offset - FLATCC_EMITTER_PAGE_SIZE; + E->front = E->front->prev; + goto done; + } + if (!(p = FLATCC_EMITTER_ALLOC(sizeof(flatcc_emitter_page_t)))) { + return -1; + } + E->capacity += FLATCC_EMITTER_PAGE_SIZE; + if (E->front) { + p->prev = E->back; + p->next = E->front; + E->front->prev = p; + E->back->next = p; + E->front = p; + goto done; + } + /* + * The first page is shared between front and back to avoid + * double unecessary extra allocation. + */ + E->front = p; + E->back = p; + p->next = p; + p->prev = p; + E->front_cursor = E->front->page + FLATCC_EMITTER_PAGE_SIZE / 2; + E->back_cursor = E->front_cursor; + E->front_left = FLATCC_EMITTER_PAGE_SIZE / 2; + E->back_left = FLATCC_EMITTER_PAGE_SIZE - E->front_left; + p->page_offset = -(flatbuffers_soffset_t)E->front_left; + return 0; +done: + E->front_cursor = E->front->page + FLATCC_EMITTER_PAGE_SIZE; + E->front_left = FLATCC_EMITTER_PAGE_SIZE; + E->front->page_offset = E->front->next->page_offset - FLATCC_EMITTER_PAGE_SIZE; + return 0; +} + +static int advance_back(flatcc_emitter_t *E) +{ + flatcc_emitter_page_t *p = 0; + + if (E->back && E->back->next != E->front) { + E->back = E->back->next; + goto done; + } + if (!(p = FLATCC_EMITTER_ALLOC(sizeof(flatcc_emitter_page_t)))) { + return -1; + } + E->capacity += FLATCC_EMITTER_PAGE_SIZE; + if (E->back) { + p->prev = E->back; + p->next = E->front; + E->front->prev = p; + E->back->next = p; + E->back = p; + goto done; + } + /* + * The first page is shared between front and back to avoid + * double unecessary extra allocation. + */ + E->front = p; + E->back = p; + p->next = p; + p->prev = p; + E->front_cursor = E->front->page + FLATCC_EMITTER_PAGE_SIZE / 2; + E->back_cursor = E->front_cursor; + E->front_left = FLATCC_EMITTER_PAGE_SIZE / 2; + E->back_left = FLATCC_EMITTER_PAGE_SIZE - E->front_left; + p->page_offset = -(flatbuffers_soffset_t)E->front_left; + return 0; +done: + E->back_cursor = E->back->page; + E->back_left = FLATCC_EMITTER_PAGE_SIZE; + E->back->page_offset = E->back->prev->page_offset + FLATCC_EMITTER_PAGE_SIZE; + return 0; +} + +static int copy_front(flatcc_emitter_t *E, uint8_t *data, size_t size) +{ + size_t k; + + data += size; + while (size) { + k = size; + if (k > E->front_left) { + k = E->front_left; + if (k == 0) { + if (advance_front(E)) { + return -1; + } + continue; + } + } + E->front_cursor -= k; + E->front_left -= k; + data -= k; + size -= k; + memcpy(E->front_cursor, data, k); + }; + return 0; +} + +static int copy_back(flatcc_emitter_t *E, uint8_t *data, size_t size) +{ + size_t k; + + while (size) { + k = size; + if (k > E->back_left) { + k = E->back_left; + if (k == 0) { + if (advance_back(E)) { + return -1; + } + continue; + } + } + memcpy(E->back_cursor, data, k); + size -= k; + data += k; + E->back_cursor += k; + E->back_left -= k; + } + return 0; +} + +int flatcc_emitter_recycle_page(flatcc_emitter_t *E, flatcc_emitter_page_t *p) +{ + if (p == E->front || p == E->back) { + return -1; + } + p->next->prev = p->prev; + p->prev->next = p->next; + p->prev = E->front->prev; + p->next = E->front; + p->prev->next = p; + p->next->prev = p; + return 0; +} + +void flatcc_emitter_reset(flatcc_emitter_t *E) +{ + flatcc_emitter_page_t *p = E->front; // NOLINT(clang-analyzer-deadcode.DeadStores) + + if (!E->front) { + return; + } + E->back = E->front; + E->front_cursor = E->front->page + FLATCC_EMITTER_PAGE_SIZE / 2; + E->back_cursor = E->front_cursor; + E->front_left = FLATCC_EMITTER_PAGE_SIZE / 2; + E->back_left = FLATCC_EMITTER_PAGE_SIZE - FLATCC_EMITTER_PAGE_SIZE / 2; + E->front->page_offset = -(flatbuffers_soffset_t)E->front_left; + /* Heuristic to reduce peak allocation over time. */ + if (E->used_average == 0) { + E->used_average = E->used; + } + E->used_average = E->used_average * 3 / 4 + E->used / 4; + E->used = 0; + while (E->used_average * 2 < E->capacity && E->back->next != E->front) { + /* We deallocate the page after back since it is less likely to be hot in cache. */ + p = E->back->next; + E->back->next = p->next; + p->next->prev = E->back; + FLATCC_EMITTER_FREE(p); + E->capacity -= FLATCC_EMITTER_PAGE_SIZE; + } +} + +void flatcc_emitter_clear(flatcc_emitter_t *E) +{ + flatcc_emitter_page_t *p = E->front; + + if (!p) { + return; + } + p->prev->next = 0; + while (p->next) { + p = p->next; + FLATCC_EMITTER_FREE(p->prev); + } + FLATCC_EMITTER_FREE(p); + memset(E, 0, sizeof(*E)); +} + +int flatcc_emitter(void *emit_context, + const flatcc_iovec_t *iov, int iov_count, + flatbuffers_soffset_t offset, size_t len) +{ + flatcc_emitter_t *E = emit_context; + uint8_t *p; + + E->used += len; + if (offset < 0) { + if (len <= E->front_left) { + E->front_cursor -= len; + E->front_left -= len; + p = E->front_cursor; + goto copy; + } + iov += iov_count; + while (iov_count--) { + --iov; + if (copy_front(E, iov->iov_base, iov->iov_len)) { + return -1; + } + } + } else { + if (len <= E->back_left) { + p = E->back_cursor; + E->back_cursor += len; + E->back_left -= len; + goto copy; + } + while (iov_count--) { + if (copy_back(E, iov->iov_base, iov->iov_len)) { + return -1; + } + ++iov; + } + } + return 0; +copy: + while (iov_count--) { + memcpy(p, iov->iov_base, iov->iov_len); + p += iov->iov_len; + ++iov; + } + return 0; +} + +void *flatcc_emitter_copy_buffer(flatcc_emitter_t *E, void *buf, size_t size) +{ + flatcc_emitter_page_t *p; + size_t len; + + if (size < E->used) { + return 0; + } + if (!E->front) { + return 0; + } + if (E->front == E->back) { + memcpy(buf, E->front_cursor, E->used); + return buf; + } + len = FLATCC_EMITTER_PAGE_SIZE - E->front_left; + memcpy(buf, E->front_cursor, len); + buf = (uint8_t *)buf + len; + p = E->front->next; + while (p != E->back) { + memcpy(buf, p->page, FLATCC_EMITTER_PAGE_SIZE); + buf = (uint8_t *)buf + FLATCC_EMITTER_PAGE_SIZE; + p = p->next; + } + memcpy(buf, p->page, FLATCC_EMITTER_PAGE_SIZE - E->back_left); + return buf; +} +/* + * Runtime support for verifying flatbuffers. + * + * Depends mutually on generated verifier functions for table types that + * call into this library. + */ +#include + +#include "flatcc/flatcc_rtconfig.h" +#include "flatcc/flatcc_flatbuffers.h" +#include "flatcc/flatcc_verifier.h" +#include "flatcc/flatcc_identifier.h" + +/* Customization for testing. */ +#if FLATCC_DEBUG_VERIFY +#define FLATCC_VERIFIER_ASSERT_ON_ERROR 1 +#include +#define FLATCC_VERIFIER_ASSERT(cond, reason) \ + if (!(cond)) { fprintf(stderr, "verifier assert: %s\n", \ + flatcc_verify_error_string(reason)); FLATCC_ASSERT(0); return reason; } +#endif + +#if FLATCC_TRACE_VERIFY +#include +#define trace_verify(s, p) \ + fprintf(stderr, "trace verify: %s: 0x%02x\n", (s), (unsigned)(size_t)(p)); +#else +#define trace_verify(s, p) ((void)0) +#endif + +/* The runtime library does not use the global config file. */ + +/* This is a guideline, not an exact measure. */ +#ifndef FLATCC_VERIFIER_MAX_LEVELS +#define FLATCC_VERIFIER_MAX_LEVELS 100 +#endif + +#ifndef FLATCC_VERIFIER_ASSERT_ON_ERROR +#define FLATCC_VERIFIER_ASSERT_ON_ERROR 0 +#endif + +/* + * Generally a check should tell if a buffer is valid or not such + * that runtime can take appropriate actions rather than crash, + * also in debug, but assertions are helpful in debugging a problem. + * + * This must be compiled into the debug runtime library to take effect. + */ +#ifndef FLATCC_VERIFIER_ASSERT_ON_ERROR +#define FLATCC_VERIFIER_ASSERT_ON_ERROR 1 +#endif + +/* May be redefined for logging purposes. */ +#ifndef FLATCC_VERIFIER_ASSERT +#define FLATCC_VERIFIER_ASSERT(cond, reason) FLATCC_ASSERT(cond) +#endif + +#if FLATCC_VERIFIER_ASSERT_ON_ERROR +#define flatcc_verify(cond, reason) if (!(cond)) { FLATCC_VERIFIER_ASSERT(cond, reason); return reason; } +#else +#define flatcc_verify(cond, reason) if (!(cond)) { return reason; } +#endif + + +#define uoffset_t flatbuffers_uoffset_t +#define soffset_t flatbuffers_soffset_t +#define voffset_t flatbuffers_voffset_t +#define utype_t flatbuffers_utype_t +#define thash_t flatbuffers_thash_t + +#define uoffset_size sizeof(uoffset_t) +#define soffset_size sizeof(soffset_t) +#define voffset_size sizeof(voffset_t) +#define utype_size sizeof(utype_t) +#define thash_size sizeof(thash_t) +#define offset_size uoffset_size + +const char *flatcc_verify_error_string(int err) +{ + switch (err) { +#define XX(no, str) \ + case flatcc_verify_error_##no: \ + return str; + FLATCC_VERIFY_ERROR_MAP(XX) +#undef XX + default: + return "unknown"; + } +} + +/* `cond` may have side effects. */ +#define verify(cond, reason) do { int c = (cond); flatcc_verify(c, reason); } while(0) + +/* + * Identify checks related to runtime conditions (buffer size and + * alignment) as seperate from those related to buffer content. + */ +#define verify_runtime(cond, reason) verify(cond, reason) + +#define check_result(x) if (x) { return (x); } + +#define check_field(td, id, required, base) do { \ + int ret = get_offset_field(td, id, required, &base); \ + if (ret || !base) { return ret; }} while (0) + +static inline uoffset_t read_uoffset(const void *p, uoffset_t base) +{ + return __flatbuffers_uoffset_read_from_pe((uint8_t *)p + base); +} + +static inline thash_t read_thash_identifier(const char *identifier) +{ + return flatbuffers_type_hash_from_string(identifier); +} + +static inline thash_t read_thash(const void *p, uoffset_t base) +{ + return __flatbuffers_thash_read_from_pe((uint8_t *)p + base); +} + +static inline voffset_t read_voffset(const void *p, uoffset_t base) +{ + return __flatbuffers_voffset_read_from_pe((uint8_t *)p + base); +} + +static inline int check_header(uoffset_t end, uoffset_t base, uoffset_t offset) +{ + uoffset_t k = base + offset; + + if (uoffset_size <= voffset_size && k + offset_size < k) { + return 0; + } + + /* The `k > base` rather than `k >= base` is to avoid null offsets. */ + return k > base && k + offset_size <= end && !(k & (offset_size - 1)); +} + +static inline int verify_struct(uoffset_t end, uoffset_t base, uoffset_t offset, uoffset_t size, uint16_t align) +{ + /* Structs can have zero size so `end` is a valid value. */ + if (offset == 0 || base + offset > end) { + return flatcc_verify_error_offset_out_of_range; + } + base += offset; + verify(base + size >= base, flatcc_verify_error_struct_size_overflow); + verify(base + size <= end, flatcc_verify_error_struct_out_of_range); + verify (!(base & (align - 1u)), flatcc_verify_error_struct_unaligned); + return flatcc_verify_ok; +} + +static inline voffset_t read_vt_entry(flatcc_table_verifier_descriptor_t *td, voffset_t id) +{ + voffset_t vo = (id + 2u) * sizeof(voffset_t); + + /* Assumes tsize has been verified for alignment. */ + if (vo >= td->vsize) { + return 0; + } + return read_voffset(td->vtable, vo); +} + +static inline const void *get_field_ptr(flatcc_table_verifier_descriptor_t *td, voffset_t id) +{ + voffset_t vte = read_vt_entry(td, id); + return vte ? (const uint8_t *)td->buf + td->table + vte : 0; +} + +static int verify_field(flatcc_table_verifier_descriptor_t *td, + voffset_t id, int required, uoffset_t size, uint16_t align) +{ + uoffset_t k, k2; + voffset_t vte; + uoffset_t base = (uoffset_t)(size_t)td->buf; + + + /* + * Otherwise range check assumptions break, and normal access code likely also. + * We don't require voffset_size < uoffset_size, but some checks are faster if true. + */ + FLATCC_ASSERT(uoffset_size >= voffset_size); + FLATCC_ASSERT(soffset_size == uoffset_size); + + vte = read_vt_entry(td, id); + if (!vte) { + verify(!required, flatcc_verify_error_required_field_missing); + return flatcc_verify_ok; + } + trace_verify("table buffer", td->buf); + trace_verify("table", td->table); + trace_verify("id", id); + trace_verify("vte", vte); + + /* + * Note that we don't add td.table to k and we test against table + * size not table end or buffer end. Otherwise it would not be safe + * to optimized out the k <= k2 check for normal uoffset and voffset + * configurations. + */ + k = vte; + k2 = k + size; + verify(k2 <= td->tsize, flatcc_verify_error_table_field_out_of_range); + /* This normally optimizes to nop. */ + verify(uoffset_size > voffset_size || k <= k2, flatcc_verify_error_table_field_size_overflow); + trace_verify("table + vte", vte + td->table); + k += td->table + base; + trace_verify("entry: buf + table + vte", k); + trace_verify("align", align); + trace_verify("align masked entry", k & (align - 1u)); + verify(!(k & (align - 1u)), flatcc_verify_error_table_field_not_aligned); + /* We assume the table size has already been verified. */ + return flatcc_verify_ok; +} + +static int get_offset_field(flatcc_table_verifier_descriptor_t *td, voffset_t id, int required, uoffset_t *out) +{ + uoffset_t k, k2; + voffset_t vte; + + vte = read_vt_entry(td, id); + if (!vte) { + *out = 0; + if (required) { + return flatcc_verify_error_required_field_missing; + } + /* Missing, but not invalid. */ + return flatcc_verify_ok; + } + /* + * Note that we don't add td.table to k and we test against table + * size not table end or buffer end. Otherwise it would not be safe + * to optimized out the k <= k2 check for normal uoffset and voffset + * configurations. + */ + k = vte; + k2 = k + offset_size; + verify(k2 <= td->tsize, flatcc_verify_error_table_field_out_of_range); + /* This normally optimizes to nop. */ + verify(uoffset_size > voffset_size || k <= k2, flatcc_verify_error_table_field_size_overflow); + k += td->table; + verify(!(k & (offset_size - 1u)), flatcc_verify_error_table_field_not_aligned); + /* We assume the table size has already been verified. */ + *out = k; + return flatcc_verify_ok; +} + +static inline int verify_string(const void *buf, uoffset_t end, uoffset_t base, uoffset_t offset) +{ + uoffset_t n; + + verify(check_header(end, base, offset), flatcc_verify_error_string_header_out_of_range_or_unaligned); + base += offset; + n = read_uoffset(buf, base); + base += offset_size; + verify(end - base > n, flatcc_verify_error_string_out_of_range); + verify(((uint8_t *)buf + base)[n] == 0, flatcc_verify_error_string_not_zero_terminated); + return flatcc_verify_ok; +} + +/* + * Keep interface somwewhat similar ot flatcc_builder_start_vector. + * `max_count` is a precomputed division to manage overflow check on vector length. + */ +static inline int verify_vector(const void *buf, uoffset_t end, uoffset_t base, uoffset_t offset, uoffset_t elem_size, uint16_t align, uoffset_t max_count) +{ + uoffset_t n; + + verify(check_header(end, base, offset), flatcc_verify_error_vector_header_out_of_range_or_unaligned); + base += offset; + + n = read_uoffset(buf, base); + base += offset_size; + +#if !FLATCC_ENFORCE_ALIGNED_EMPTY_VECTORS + /* This is due to incorrect buffers from other builders than cannot easily be ignored. */ + align = n == 0 ? uoffset_size : align; +#endif + verify(!(base & ((align - 1u) | (uoffset_size - 1u))), flatcc_verify_error_vector_header_out_of_range_or_unaligned); + /* `n * elem_size` can overflow uncontrollably otherwise. */ + verify(n <= max_count, flatcc_verify_error_vector_count_exceeds_representable_vector_size); + verify(end - base >= n * elem_size, flatcc_verify_error_vector_out_of_range); + return flatcc_verify_ok; +} + +static inline int verify_string_vector(const void *buf, uoffset_t end, uoffset_t base, uoffset_t offset) +{ + uoffset_t i, n; + + check_result(verify_vector(buf, end, base, offset, offset_size, offset_size, FLATBUFFERS_COUNT_MAX(offset_size))); + base += offset; + n = read_uoffset(buf, base); + base += offset_size; + for (i = 0; i < n; ++i, base += offset_size) { + check_result(verify_string(buf, end, base, read_uoffset(buf, base))); + } + return flatcc_verify_ok; +} + +static inline int verify_table(const void *buf, uoffset_t end, uoffset_t base, uoffset_t offset, + int ttl, flatcc_table_verifier_f tvf) +{ + uoffset_t vbase, vend; + flatcc_table_verifier_descriptor_t td; + + verify((td.ttl = ttl - 1), flatcc_verify_error_max_nesting_level_reached); + verify(check_header(end, base, offset), flatcc_verify_error_table_header_out_of_range_or_unaligned); + td.table = base + offset; + /* Read vtable offset - it is signed, but we want it unsigned, assuming 2's complement works. */ + vbase = td.table - read_uoffset(buf, td.table); + verify((soffset_t)vbase >= 0 && !(vbase & (voffset_size - 1)), flatcc_verify_error_vtable_offset_out_of_range_or_unaligned); + verify(vbase + voffset_size <= end, flatcc_verify_error_vtable_header_out_of_range); + /* Read vtable size. */ + td.vsize = read_voffset(buf, vbase); + vend = vbase + td.vsize; + verify(vend <= end && !(td.vsize & (voffset_size - 1)), flatcc_verify_error_vtable_size_out_of_range_or_unaligned); + /* Optimizes away overflow check if uoffset_t is large enough. */ + verify(uoffset_size > voffset_size || vend >= vbase, flatcc_verify_error_vtable_size_overflow); + + verify(td.vsize >= 2 * voffset_size, flatcc_verify_error_vtable_header_too_small); + /* Read table size. */ + td.tsize = read_voffset(buf, vbase + voffset_size); + verify(end - td.table >= td.tsize, flatcc_verify_error_table_size_out_of_range); + td.vtable = (uint8_t *)buf + vbase; + td.buf = buf; + td.end = end; + return tvf(&td); +} + +static inline int verify_table_vector(const void *buf, uoffset_t end, uoffset_t base, uoffset_t offset, int ttl, flatcc_table_verifier_f tvf) +{ + uoffset_t i, n; + + verify(ttl-- > 0, flatcc_verify_error_max_nesting_level_reached); + check_result(verify_vector(buf, end, base, offset, offset_size, offset_size, FLATBUFFERS_COUNT_MAX(offset_size))); + base += offset; + n = read_uoffset(buf, base); + base += offset_size; + for (i = 0; i < n; ++i, base += offset_size) { + check_result(verify_table(buf, end, base, read_uoffset(buf, base), ttl, tvf)); + } + return flatcc_verify_ok; +} + +static inline int verify_union_vector(const void *buf, uoffset_t end, uoffset_t base, uoffset_t offset, + uoffset_t count, const utype_t *types, int ttl, flatcc_union_verifier_f uvf) +{ + uoffset_t i, n, elem; + flatcc_union_verifier_descriptor_t ud; + + verify(ttl-- > 0, flatcc_verify_error_max_nesting_level_reached); + check_result(verify_vector(buf, end, base, offset, offset_size, offset_size, FLATBUFFERS_COUNT_MAX(offset_size))); + base += offset; + n = read_uoffset(buf, base); + verify(n == count, flatcc_verify_error_union_vector_length_mismatch); + base += offset_size; + + ud.buf = buf; + ud.end = end; + ud.ttl = ttl; + + for (i = 0; i < n; ++i, base += offset_size) { + /* Table vectors can never be null, but unions can when the type is NONE. */ + elem = read_uoffset(buf, base); + if (elem == 0) { + verify(types[i] == 0, flatcc_verify_error_union_element_absent_without_type_NONE); + } else { + verify(types[i] != 0, flatcc_verify_error_union_element_present_with_type_NONE); + ud.type = types[i]; + ud.base = base; + ud.offset = elem; + check_result(uvf(&ud)); + } + } + return flatcc_verify_ok; +} + +int flatcc_verify_field(flatcc_table_verifier_descriptor_t *td, + voffset_t id, size_t size, uint16_t align) +{ + check_result(verify_field(td, id, 0, (uoffset_t)size, align)); + return flatcc_verify_ok; +} + +int flatcc_verify_string_field(flatcc_table_verifier_descriptor_t *td, + voffset_t id, int required) +{ + uoffset_t base; + + check_field(td, id, required, base); + return verify_string(td->buf, td->end, base, read_uoffset(td->buf, base)); +} + +int flatcc_verify_vector_field(flatcc_table_verifier_descriptor_t *td, + voffset_t id, int required, size_t elem_size, uint16_t align, size_t max_count) +{ + uoffset_t base; + + check_field(td, id, required, base); + return verify_vector(td->buf, td->end, base, read_uoffset(td->buf, base), + (uoffset_t)elem_size, align, (uoffset_t)max_count); +} + +int flatcc_verify_string_vector_field(flatcc_table_verifier_descriptor_t *td, + voffset_t id, int required) +{ + uoffset_t base; + + check_field(td, id, required, base); + return verify_string_vector(td->buf, td->end, base, read_uoffset(td->buf, base)); +} + +int flatcc_verify_table_field(flatcc_table_verifier_descriptor_t *td, + voffset_t id, int required, flatcc_table_verifier_f tvf) +{ + uoffset_t base; + + check_field(td, id, required, base); + return verify_table(td->buf, td->end, base, read_uoffset(td->buf, base), td->ttl, tvf); +} + +int flatcc_verify_table_vector_field(flatcc_table_verifier_descriptor_t *td, + voffset_t id, int required, flatcc_table_verifier_f tvf) +{ + uoffset_t base; + + check_field(td, id, required, base); + return verify_table_vector(td->buf, td->end, base, read_uoffset(td->buf, base), td->ttl, tvf); +} + +int flatcc_verify_union_table(flatcc_union_verifier_descriptor_t *ud, flatcc_table_verifier_f *tvf) +{ + return verify_table(ud->buf, ud->end, ud->base, ud->offset, ud->ttl, tvf); +} + +int flatcc_verify_union_struct(flatcc_union_verifier_descriptor_t *ud, size_t size, uint16_t align) +{ + return verify_struct(ud->end, ud->base, ud->offset, (uoffset_t)size, align); +} + +int flatcc_verify_union_string(flatcc_union_verifier_descriptor_t *ud) +{ + return verify_string(ud->buf, ud->end, ud->base, ud->offset); +} + +int flatcc_verify_buffer_header(const void *buf, size_t bufsiz, const char *fid) +{ + thash_t id, id2; + + verify_runtime(!(((size_t)buf) & (offset_size - 1)), flatcc_verify_error_runtime_buffer_header_not_aligned); + /* -8 ensures no scalar or offset field size can overflow. */ + verify_runtime(bufsiz <= FLATBUFFERS_UOFFSET_MAX - 8, flatcc_verify_error_runtime_buffer_size_too_large); + /* + * Even if we specify no fid, the user might later. Therefore + * require space for it. Not all buffer generators will take this + * into account, so it is possible to fail an otherwise valid buffer + * - but such buffers aren't safe. + */ + verify(bufsiz >= offset_size + FLATBUFFERS_IDENTIFIER_SIZE, flatcc_verify_error_buffer_header_too_small); + if (fid != 0) { + id2 = read_thash_identifier(fid); + id = read_thash(buf, offset_size); + verify(id2 == 0 || id == id2, flatcc_verify_error_identifier_mismatch); + } + return flatcc_verify_ok; +} + +int flatcc_verify_buffer_header_with_size(const void *buf, size_t *bufsiz, const char *fid) +{ + thash_t id, id2; + size_t size_field; + + verify_runtime(!(((size_t)buf) & (offset_size - 1)), flatcc_verify_error_runtime_buffer_header_not_aligned); + /* -8 ensures no scalar or offset field size can overflow. */ + verify_runtime(*bufsiz <= FLATBUFFERS_UOFFSET_MAX - 8, flatcc_verify_error_runtime_buffer_size_too_large); + + /* Size field, offset field, optional identifier field that must be read even if not present. */ + verify(*bufsiz >= 2 * offset_size + FLATBUFFERS_IDENTIFIER_SIZE, flatcc_verify_error_buffer_header_too_small); + + size_field = (size_t)read_uoffset(buf, 0); + verify_runtime(size_field <= *bufsiz - offset_size, flatcc_verify_error_runtime_buffer_size_less_than_size_field); + if (fid != 0) { + id2 = read_thash_identifier(fid); + id = read_thash(buf, offset_size); + verify(id2 == 0 || id == id2, flatcc_verify_error_identifier_mismatch); + } + *bufsiz = size_field + offset_size; + return flatcc_verify_ok; +} + +int flatcc_verify_typed_buffer_header(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + thash_t id, id2; + + verify_runtime(!(((size_t)buf) & (offset_size - 1)), flatcc_verify_error_runtime_buffer_header_not_aligned); + /* -8 ensures no scalar or offset field size can overflow. */ + verify_runtime(bufsiz <= FLATBUFFERS_UOFFSET_MAX - 8, flatcc_verify_error_runtime_buffer_size_too_large); + /* + * Even if we specify no fid, the user might later. Therefore + * require space for it. Not all buffer generators will take this + * into account, so it is possible to fail an otherwise valid buffer + * - but such buffers aren't safe. + */ + verify(bufsiz >= offset_size + FLATBUFFERS_IDENTIFIER_SIZE, flatcc_verify_error_buffer_header_too_small); + if (thash != 0) { + id2 = thash; + id = read_thash(buf, offset_size); + verify(id2 == 0 || id == id2, flatcc_verify_error_identifier_mismatch); + } + return flatcc_verify_ok; +} + +int flatcc_verify_typed_buffer_header_with_size(const void *buf, size_t *bufsiz, flatbuffers_thash_t thash) +{ + thash_t id, id2; + size_t size_field; + + verify_runtime(!(((size_t)buf) & (offset_size - 1)), flatcc_verify_error_runtime_buffer_header_not_aligned); + /* -8 ensures no scalar or offset field size can overflow. */ + verify_runtime(*bufsiz <= FLATBUFFERS_UOFFSET_MAX - 8, flatcc_verify_error_runtime_buffer_size_too_large); + + /* Size field, offset field, optional identifier field that must be read even if not present. */ + verify(*bufsiz >= 2 * offset_size + FLATBUFFERS_IDENTIFIER_SIZE, flatcc_verify_error_buffer_header_too_small); + + size_field = (size_t)read_uoffset(buf, 0); + verify_runtime(size_field <= *bufsiz - offset_size, flatcc_verify_error_runtime_buffer_size_less_than_size_field); + if (thash != 0) { + id2 = thash; + id = read_thash(buf, offset_size); + verify(id2 == 0 || id == id2, flatcc_verify_error_identifier_mismatch); + } + *bufsiz = size_field + offset_size; + return flatcc_verify_ok; +} + +int flatcc_verify_struct_as_root(const void *buf, size_t bufsiz, const char *fid, size_t size, uint16_t align) +{ + check_result(flatcc_verify_buffer_header(buf, bufsiz, fid)); + return verify_struct((uoffset_t)bufsiz, 0, read_uoffset(buf, 0), (uoffset_t)size, align); +} + +int flatcc_verify_struct_as_root_with_size(const void *buf, size_t bufsiz, const char *fid, size_t size, uint16_t align) +{ + check_result(flatcc_verify_buffer_header_with_size(buf, &bufsiz, fid)); + return verify_struct((uoffset_t)bufsiz, 0, read_uoffset(buf, 0), (uoffset_t)size, align); +} + +int flatcc_verify_struct_as_typed_root(const void *buf, size_t bufsiz, flatbuffers_thash_t thash, size_t size, uint16_t align) +{ + check_result(flatcc_verify_typed_buffer_header(buf, bufsiz, thash)); + return verify_struct((uoffset_t)bufsiz, 0, read_uoffset(buf, 0), (uoffset_t)size, align); +} + +int flatcc_verify_struct_as_typed_root_with_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash, size_t size, uint16_t align) +{ + check_result(flatcc_verify_typed_buffer_header_with_size(buf, &bufsiz, thash)); + return verify_struct((uoffset_t)bufsiz, uoffset_size, read_uoffset(buf, uoffset_size), (uoffset_t)size, align); +} + +int flatcc_verify_table_as_root(const void *buf, size_t bufsiz, const char *fid, flatcc_table_verifier_f *tvf) +{ + check_result(flatcc_verify_buffer_header(buf, bufsiz, fid)); + return verify_table(buf, (uoffset_t)bufsiz, 0, read_uoffset(buf, 0), FLATCC_VERIFIER_MAX_LEVELS, tvf); +} + +int flatcc_verify_table_as_root_with_size(const void *buf, size_t bufsiz, const char *fid, flatcc_table_verifier_f *tvf) +{ + check_result(flatcc_verify_buffer_header_with_size(buf, &bufsiz, fid)); + return verify_table(buf, (uoffset_t)bufsiz, uoffset_size, read_uoffset(buf, uoffset_size), FLATCC_VERIFIER_MAX_LEVELS, tvf); +} + +int flatcc_verify_table_as_typed_root(const void *buf, size_t bufsiz, flatbuffers_thash_t thash, flatcc_table_verifier_f *tvf) +{ + check_result(flatcc_verify_typed_buffer_header(buf, bufsiz, thash)); + return verify_table(buf, (uoffset_t)bufsiz, 0, read_uoffset(buf, 0), FLATCC_VERIFIER_MAX_LEVELS, tvf); +} + +int flatcc_verify_table_as_typed_root_with_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash, flatcc_table_verifier_f *tvf) +{ + check_result(flatcc_verify_typed_buffer_header_with_size(buf, &bufsiz, thash)); + return verify_table(buf, (uoffset_t)bufsiz, uoffset_size, read_uoffset(buf, uoffset_size), FLATCC_VERIFIER_MAX_LEVELS, tvf); +} + +int flatcc_verify_struct_as_nested_root(flatcc_table_verifier_descriptor_t *td, + voffset_t id, int required, const char *fid, size_t size, uint16_t align) +{ + const uoffset_t *buf; + uoffset_t bufsiz; + + check_result(flatcc_verify_vector_field(td, id, required, align, 1, FLATBUFFERS_COUNT_MAX(1))); + if (0 == (buf = get_field_ptr(td, id))) { + return flatcc_verify_ok; + } + buf = (const uoffset_t *)((size_t)buf + read_uoffset(buf, 0)); + bufsiz = read_uoffset(buf, 0); + ++buf; + return flatcc_verify_struct_as_root(buf, bufsiz, fid, size, align); +} + +int flatcc_verify_table_as_nested_root(flatcc_table_verifier_descriptor_t *td, + voffset_t id, int required, const char *fid, + uint16_t align, flatcc_table_verifier_f tvf) +{ + const uoffset_t *buf; + uoffset_t bufsiz; + + check_result(flatcc_verify_vector_field(td, id, required, align, 1, FLATBUFFERS_COUNT_MAX(1))); + if (0 == (buf = get_field_ptr(td, id))) { + return flatcc_verify_ok; + } + buf = (const uoffset_t *)((size_t)buf + read_uoffset(buf, 0)); + bufsiz = read_uoffset(buf, 0); + ++buf; + /* + * Don't verify nested buffers identifier - information is difficult to get and + * might not be what is desired anyway. User can do it later. + */ + check_result(flatcc_verify_buffer_header(buf, bufsiz, fid)); + return verify_table(buf, bufsiz, 0, read_uoffset(buf, 0), td->ttl, tvf); +} + +int flatcc_verify_union_field(flatcc_table_verifier_descriptor_t *td, + voffset_t id, int required, flatcc_union_verifier_f uvf) +{ + voffset_t vte_type, vte_table; + const uint8_t *type; + uoffset_t base; + flatcc_union_verifier_descriptor_t ud; + + if (0 == (vte_type = read_vt_entry(td, id - 1))) { + vte_table = read_vt_entry(td, id); + verify(vte_table == 0, flatcc_verify_error_union_cannot_have_a_table_without_a_type); + verify(!required, flatcc_verify_error_type_field_absent_from_required_union_field); + return flatcc_verify_ok; + } + /* No need to check required here. */ + check_result(verify_field(td, id - 1, 0, 1, 1)); + /* Only now is it safe to read the type. */ + vte_table = read_vt_entry(td, id); + type = (const uint8_t *)td->buf + td->table + vte_type; + verify(*type || vte_table == 0, flatcc_verify_error_union_type_NONE_cannot_have_a_value); + + if (*type == 0) { + return flatcc_verify_ok; + } + check_field(td, id, required, base); + ud.buf = td->buf; + ud.end = td->end; + ud.ttl = td->ttl; + ud.base = base; + ud.offset = read_uoffset(td->buf, base); + ud.type = *type; + return uvf(&ud); +} + +int flatcc_verify_union_vector_field(flatcc_table_verifier_descriptor_t *td, + flatbuffers_voffset_t id, int required, flatcc_union_verifier_f uvf) +{ + voffset_t vte_type, vte_table; + const uoffset_t *buf; + const utype_t *types; + uoffset_t count, base; + + if (0 == (vte_type = read_vt_entry(td, id - 1))) { // NOLINT(clang-analyzer-deadcode.DeadStores) + if (0 == (vte_table = read_vt_entry(td, id))) { // NOLINT(clang-analyzer-deadcode.DeadStores) + verify(!required, flatcc_verify_error_type_field_absent_from_required_union_vector_field); + } + } + check_result(flatcc_verify_vector_field(td, id - 1, required, + utype_size, utype_size, FLATBUFFERS_COUNT_MAX(utype_size))); + if (0 == (buf = get_field_ptr(td, id - 1))) { + return flatcc_verify_ok; + } + buf = (const uoffset_t *)((size_t)buf + read_uoffset(buf, 0)); + count = read_uoffset(buf, 0); + ++buf; + types = (utype_t *)buf; + + check_field(td, id, required, base); + return verify_union_vector(td->buf, td->end, base, read_uoffset(td->buf, base), + count, types, td->ttl, uvf); +} +/* + * Optional file that can be included in runtime library to support DAG + * cloning with the builder and may also be used for custom purposes + * standalone. See also comments in `flatcc/flatcc_builder.h`. + * + * Note that dynamic construction takes place and that large offset + * vectors might consume significant space if there are not many shared + * references. In the basic use case no allocation takes place because a + * few references can be held using only a small stack allocated hash + * table. + */ + +#include +#include + +#include "flatcc/flatcc_rtconfig.h" +#include "flatcc/flatcc_refmap.h" +#include "flatcc/flatcc_alloc.h" +#include "flatcc/flatcc_assert.h" + +#define _flatcc_refmap_calloc FLATCC_CALLOC +#define _flatcc_refmap_free FLATCC_FREE + +/* Can be used as a primitive defense against collision attacks. */ +#ifdef FLATCC_HASH_SEED +#define _flatcc_refmap_seed FLATCC_HASH_SEED +#else +#define _flatcc_refmap_seed 0x2f693b52 +#endif + +static inline size_t _flatcc_refmap_above_load_factor(size_t count, size_t buckets) +{ + static const size_t d = 256; + static const size_t n = (size_t)((FLATCC_REFMAP_LOAD_FACTOR) * 256.0f); + + return count >= buckets * n / d; +} + +#define _flatcc_refmap_probe(k, i, N) ((k + i) & N) + +void flatcc_refmap_clear(flatcc_refmap_t *refmap) +{ + if (refmap->table && refmap->table != refmap->min_table) { + _flatcc_refmap_free(refmap->table); + } + flatcc_refmap_init(refmap); +} + +static inline size_t _flatcc_refmap_hash(const void *src) +{ + /* MurmurHash3 64-bit finalizer */ + uint64_t x; + + x = (uint64_t)((size_t)src) ^ _flatcc_refmap_seed; + + x ^= x >> 33; + x *= 0xff51afd7ed558ccdULL; + x ^= x >> 33; + x *= 0xc4ceb9fe1a85ec53ULL; + x ^= x >> 33; + return (size_t)x; +} + +void flatcc_refmap_reset(flatcc_refmap_t *refmap) +{ + if (refmap->count) { + memset(refmap->table, 0, sizeof(refmap->table[0]) * refmap->buckets); + } + refmap->count = 0; +} + +/* + * Technically resize also supports shrinking which may be useful for + * adapations, but the current hash table never deletes individual items. + */ +int flatcc_refmap_resize(flatcc_refmap_t *refmap, size_t count) +{ + const size_t min_buckets = sizeof(refmap->min_table) / sizeof(refmap->min_table[0]); + + size_t i; + size_t buckets; + size_t buckets_old; + struct flatcc_refmap_item *T_old; + + if (count < refmap->count) { + count = refmap->count; + } + buckets = min_buckets; + + while (_flatcc_refmap_above_load_factor(count, buckets)) { + buckets *= 2; + } + if (refmap->buckets == buckets) { + return 0; + } + T_old = refmap->table; + buckets_old = refmap->buckets; + if (buckets == min_buckets) { + memset(refmap->min_table, 0, sizeof(refmap->min_table)); + refmap->table = refmap->min_table; + } else { + refmap->table = _flatcc_refmap_calloc(buckets, sizeof(refmap->table[0])); + if (refmap->table == 0) { + refmap->table = T_old; + FLATCC_ASSERT(0); /* out of memory */ + return -1; + } + } + refmap->buckets = buckets; + refmap->count = 0; + for (i = 0; i < buckets_old; ++i) { + if (T_old[i].src) { + flatcc_refmap_insert(refmap, T_old[i].src, T_old[i].ref); + } + } + if (T_old && T_old != refmap->min_table) { + _flatcc_refmap_free(T_old); + } + return 0; +} + +flatcc_refmap_ref_t flatcc_refmap_insert(flatcc_refmap_t *refmap, const void *src, flatcc_refmap_ref_t ref) +{ + struct flatcc_refmap_item *T; + size_t N, i, j, k; + + if (src == 0) return ref; + if (_flatcc_refmap_above_load_factor(refmap->count, refmap->buckets)) { + if (flatcc_refmap_resize(refmap, refmap->count * 2)) { + return flatcc_refmap_not_found; /* alloc failed */ + } + } + T = refmap->table; + N = refmap->buckets - 1; + k = _flatcc_refmap_hash(src); + i = 0; + j = _flatcc_refmap_probe(k, i, N); + while (T[j].src) { + if (T[j].src == src) { + return T[j].ref = ref; + } + ++i; + j = _flatcc_refmap_probe(k, i, N); + } + ++refmap->count; + T[j].src = src; + return T[j].ref = ref; +} + +flatcc_refmap_ref_t flatcc_refmap_find(flatcc_refmap_t *refmap, const void *src) +{ + struct flatcc_refmap_item *T; + size_t N, i, j, k; + + if (refmap->count == 0) { + return flatcc_refmap_not_found; + } + T = refmap->table; + N = refmap->buckets - 1; + k = _flatcc_refmap_hash(src); + i = 0; + j = _flatcc_refmap_probe(k, i, N); + while (T[j].src) { + if (T[j].src == src) return T[j].ref; + ++i; + j = _flatcc_refmap_probe(k, i, N); + } + return flatcc_refmap_not_found; +} + +/* + * To run test from project root: + * + * cc -D FLATCC_REFMAP_TEST -I include src/runtime/refmap.c -o test_refmap && ./test_refmap + * + */ +#ifdef FLATCC_REFMAP_TEST + +#include + +#ifndef FLATCC_REFMAP_H +#include "flatcc/flatcc_refmap.h" +#endif + +#define test(x) do { if (!(x)) { fprintf(stderr, "%02d: refmap test failed\n", __LINE__); exit(-1); } } while (0) +#define test_start() fprintf(stderr, "starting refmap test ...\n") +#define test_ok() fprintf(stderr, "refmap test succeeded\n") + +int main() +{ + int i; + int data[1000]; + int a = 1; + int b = 2; + int c = 3; + flatcc_refmap_t refmap; + + flatcc_refmap_init(&refmap); + + test(flatcc_refmap_find(&refmap, &a) == flatcc_refmap_not_found); + test(flatcc_refmap_find(&refmap, &b) == flatcc_refmap_not_found); + test(flatcc_refmap_find(&refmap, &c) == flatcc_refmap_not_found); + test(flatcc_refmap_find(&refmap, 0) == flatcc_refmap_not_found); + test(flatcc_refmap_find(&refmap, &a) == 0); + + test(flatcc_refmap_insert(&refmap, &a, 42) == 42); + test(flatcc_refmap_find(&refmap, &a) == 42); + test(flatcc_refmap_find(&refmap, &b) == flatcc_refmap_not_found); + test(flatcc_refmap_find(&refmap, &c) == flatcc_refmap_not_found); + test(flatcc_refmap_insert(&refmap, &a, 42) == 42); + test(flatcc_refmap_find(&refmap, &a) == 42); + test(refmap.count == 1); + test(flatcc_refmap_insert(&refmap, &a, 43) == 43); + test(flatcc_refmap_find(&refmap, &a) == 43); + test(refmap.count == 1); + test(flatcc_refmap_insert(&refmap, &b, -10) == -10); + test(flatcc_refmap_insert(&refmap, &c, 100) == 100); + test(refmap.count == 3); + test(flatcc_refmap_find(&refmap, &a) == 43); + test(flatcc_refmap_find(&refmap, &b) == -10); + test(flatcc_refmap_find(&refmap, &c) == 100); + + test(flatcc_refmap_insert(&refmap, 0, 1000) == 1000); + test(flatcc_refmap_find(&refmap, 0) == 0); + test(refmap.count == 3); + + test(flatcc_refmap_insert(&refmap, &b, 0) == 0); + test(flatcc_refmap_find(&refmap, &b) == 0); + test(refmap.count == 3); + + flatcc_refmap_reset(&refmap); + test(refmap.count == 0); + test(refmap.buckets > 0); + for (i = 0; i < 1000; ++i) { + test(flatcc_refmap_insert(&refmap, data + i, i + 42) == i + 42); + } + test(refmap.count == 1000); + for (i = 0; i < 1000; ++i) { + test(flatcc_refmap_find(&refmap, data + i) == i + 42); + } + flatcc_refmap_clear(&refmap); + test(refmap.count == 0); + test(refmap.buckets == 0); + test_ok(); + return 0; +} + +#endif /* FLATCC_REFMAP_TEST */ diff --git a/3rd_party/nanoarrow/flatcc/flatcc_accessors.h b/3rd_party/nanoarrow/flatcc/flatcc_accessors.h new file mode 100644 index 0000000..51f6e34 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/flatcc_accessors.h @@ -0,0 +1,106 @@ +#ifndef FLATCC_ACCESSORS +#define FLATCC_ACCESSORS + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef UINT8_MAX +#include +#endif + + +#define __flatcc_basic_scalar_accessors_impl(N, T, W, E) \ +static inline size_t N ## __size(void) \ +{ return sizeof(T); } \ +static inline T *N ## __ptr_add(T *p, size_t i) \ +{ return p + i; } \ +static inline const T *N ## __const_ptr_add(const T *p, size_t i) \ +{ return p + i; } \ +static inline T N ## _read_from_pe(const void *p) \ +{ return N ## _cast_from_pe(N ## _read(p)); } \ +static inline T N ## _read_to_pe(const void *p) \ +{ return N ## _cast_to_pe(N ## _read(p)); } \ +static inline void N ## _write_from_pe(void *p, T v) \ +{ N ## _write(p, N ## _cast_from_pe(v)); } \ +static inline void N ## _write_to_pe(void *p, T v) \ +{ N ## _write(p, N ## _cast_to_pe(v)); } \ +static inline T N ## _read_from_le(const void *p) \ +{ return N ## _cast_from_le(N ## _read(p)); } \ +typedef struct { int is_null; T value; } N ## _option_t; + +#define __flatcc_define_integer_accessors_impl(N, T, W, E) \ +static inline T N ## _read(const void *p) \ +{ return (T) mem_read_ ## W(p); } \ +static inline void N ## _write(void *p, T v) \ +{ mem_write_ ## W(p, v); } \ +static inline T N ## _cast_from_pe(T v) \ +{ return (T) E ## W ## toh((uint ## W ## _t)v); } \ +static inline T N ## _cast_to_pe(T v) \ +{ return (T) hto ## E ## W((uint ## W ## _t)v); } \ +static inline T N ## _cast_from_le(T v) \ +{ return (T) le ## W ## toh((uint ## W ## _t)v); } \ +static inline T N ## _cast_to_le(T v) \ +{ return (T) htole ## W((uint ## W ## _t)v); } \ +static inline T N ## _cast_from_be(T v) \ +{ return (T) be ## W ## toh((uint ## W ## _t)v); } \ +static inline T N ## _cast_to_be(T v) \ +{ return (T) htobe ## W((uint ## W ## _t)v); } \ +__flatcc_basic_scalar_accessors_impl(N, T, W, E) + +#define __flatcc_define_real_accessors_impl(N, T, W, E) \ +static inline T N ## _read(const void *p) \ +{ return (T) mem_read_float_ ## W(p); } \ +static inline void N ## _write(void *p, T v) \ +{ mem_write_float_ ## W(p, v); } \ +union __ ## N ## _cast { T v; uint ## W ## _t u; }; \ +static inline T N ## _cast_from_pe(T v) \ +{ union __ ## N ## _cast x; \ + x.v = v; x.u = E ## W ## toh(x.u); return x.v; } \ +static inline T N ## _cast_to_pe(T v) \ +{ union __ ## N ## _cast x; \ + x.v = v; x.u = hto ## E ## W(x.u); return x.v; } \ +static inline T N ## _cast_from_le(T v) \ +{ union __ ## N ## _cast x; \ + x.v = v; x.u = le ## W ## toh(x.u); return x.v; } \ +static inline T N ## _cast_to_le(T v) \ +{ union __ ## N ## _cast x; \ + x.v = v; x.u = htole ## W(x.u); return x.v; } \ +static inline T N ## _cast_from_be(T v) \ +{ union __ ## N ## _cast x; \ + x.v = v; x.u = be ## W ## toh(x.u); return x.v; } \ +static inline T N ## _cast_to_be(T v) \ +{ union __ ## N ## _cast x; \ + x.v = v; x.u = htobe ## W(x.u); return x.v; } \ +__flatcc_basic_scalar_accessors_impl(N, T, W, E) + +#define __flatcc_define_integer_accessors(N, T, W, E) \ +__flatcc_define_integer_accessors_impl(N, T, W, E) + +#define __flatcc_define_real_accessors(N, T, W, E) \ +__flatcc_define_real_accessors_impl(N, T, W, E) + +#define __flatcc_define_basic_integer_accessors(NS, TN, T, W, E) \ +__flatcc_define_integer_accessors(NS ## TN, T, W, E) + +#define __flatcc_define_basic_real_accessors(NS, TN, T, W, E) \ +__flatcc_define_real_accessors(NS ## TN, T, W, E) + +#define __flatcc_define_basic_scalar_accessors(NS, E) \ +__flatcc_define_basic_integer_accessors(NS, char, char, 8, E) \ +__flatcc_define_basic_integer_accessors(NS, uint8, uint8_t, 8, E) \ +__flatcc_define_basic_integer_accessors(NS, uint16, uint16_t, 16, E) \ +__flatcc_define_basic_integer_accessors(NS, uint32, uint32_t, 32, E) \ +__flatcc_define_basic_integer_accessors(NS, uint64, uint64_t, 64, E) \ +__flatcc_define_basic_integer_accessors(NS, int8, int8_t, 8, E) \ +__flatcc_define_basic_integer_accessors(NS, int16, int16_t, 16, E) \ +__flatcc_define_basic_integer_accessors(NS, int32, int32_t, 32, E) \ +__flatcc_define_basic_integer_accessors(NS, int64, int64_t, 64, E) \ +__flatcc_define_basic_real_accessors(NS, float, float, 32, E) \ +__flatcc_define_basic_real_accessors(NS, double, double, 64, E) + +#ifdef __cplusplus +} +#endif + +#endif /* FLATCC_ACCESSORS */ diff --git a/3rd_party/nanoarrow/flatcc/flatcc_alloc.h b/3rd_party/nanoarrow/flatcc/flatcc_alloc.h new file mode 100644 index 0000000..20fd207 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/flatcc_alloc.h @@ -0,0 +1,128 @@ +#ifndef FLATCC_ALLOC_H +#define FLATCC_ALLOC_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * These allocation abstractions are __only__ for runtime libraries. + * + * The flatcc compiler uses Posix allocation routines regardless + * of how this file is configured. + * + * This header makes it possible to use systems where malloc is not + * valid to use. In this case the portable library will not help + * because it implements Posix / C11 abstractions. + * + * Systems like FreeRTOS do not work with Posix memory calls and here it + * can be helpful to override runtime allocation primitives. + * + * In general, it is better to customize the allocator and emitter via + * flatcc_builder_custom_init and to avoid using the default emitter + * specific high level calls the copy out a buffer that must later be + * deallocated. This provides full control of allocation withou the need + * for this file. + * + * + * IMPORTANT + * + * If you override malloc, free, etc., make sure your applications + * use the same allocation methods. For example, samples/monster.c + * and several test cases are no longer guaranteed to work out of the + * box. + * + * The changes must only affect target runtime compilation including the + * the runtime library libflatccrt. + * + * The host system flatcc compiler and the compiler library libflatcc + * should NOT be compiled with non-Posix allocation since the compiler + * has a dependency on the runtime library and the wrong free operation + * might be callled. The safest way to avoid this problem this is to + * compile flatcc with the CMake script and the runtime files with a + * dedicated build system for the target system. + */ + +#include + +#ifndef FLATCC_ALLOC +#define FLATCC_ALLOC(n) malloc(n) +#endif + +#ifndef FLATCC_FREE +#define FLATCC_FREE(p) free(p) +#endif + +#ifndef FLATCC_REALLOC +#define FLATCC_REALLOC(p, n) realloc(p, n) +#endif + +#ifndef FLATCC_CALLOC +#define FLATCC_CALLOC(nm, n) calloc(nm, n) +#endif + +/* + * Implements `aligned_alloc` and `aligned_free`. + * Even with C11, this implements non-standard aligned_free needed for portable + * aligned_alloc implementations. + */ +#ifndef FLATCC_USE_GENERIC_ALIGNED_ALLOC + +#ifndef FLATCC_NO_PALIGNED_ALLOC +#include "flatcc/portable/paligned_alloc.h" +#else +#if !defined(__aligned_free_is_defined) || !__aligned_free_is_defined +#define aligned_free free +#endif +#endif + +#else /* FLATCC_USE_GENERIC_ALIGNED_ALLOC */ + +#ifndef FLATCC_ALIGNED_ALLOC +static inline void *__flatcc_aligned_alloc(size_t alignment, size_t size) +{ + char *raw; + void *buf; + size_t total_size = (size + alignment - 1 + sizeof(void *)); + + if (alignment < sizeof(void *)) { + alignment = sizeof(void *); + } + raw = (char *)(size_t)FLATCC_ALLOC(total_size); + if (!raw) return 0; + buf = raw + alignment - 1 + sizeof(void *); + buf = (void *)(((size_t)buf) & ~(alignment - 1)); + ((void **)buf)[-1] = raw; + return buf; +} +#define FLATCC_ALIGNED_ALLOC(alignment, size) __flatcc_aligned_alloc(alignment, size) +#endif /* FLATCC_USE_GENERIC_ALIGNED_ALLOC */ + +#ifndef FLATCC_ALIGNED_FREE +static inline void __flatcc_aligned_free(void *p) +{ + char *raw; + + if (!p) return; + raw = ((void **)p)[-1]; + + FLATCC_FREE(raw); +} +#define FLATCC_ALIGNED_FREE(p) __flatcc_aligned_free(p) +#endif + +#endif /* FLATCC_USE_GENERIC_ALIGNED_ALLOC */ + +#ifndef FLATCC_ALIGNED_ALLOC +#define FLATCC_ALIGNED_ALLOC(a, n) aligned_alloc(a, n) +#endif + +#ifndef FLATCC_ALIGNED_FREE +#define FLATCC_ALIGNED_FREE(p) aligned_free(p) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* FLATCC_ALLOC_H */ diff --git a/3rd_party/nanoarrow/flatcc/flatcc_assert.h b/3rd_party/nanoarrow/flatcc/flatcc_assert.h new file mode 100644 index 0000000..0a3b8ee --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/flatcc_assert.h @@ -0,0 +1,45 @@ +#ifndef FLATCC_ASSERT_H +#define FLATCC_ASSERT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* +* This assert abstraction is only used for the flatcc runtime library. +* The flatcc compiler uses Posix assert routines regardless of how this +* file is configured. +* +* This header makes it possible to use systems where assert is not +* valid to use. Note that `` may remain a dependency for static +* assertions. +* +* `FLATCC_ASSERT` is designed to handle errors which cannot be ignored +* and could lead to crash. The portable library may use assertions that +* are not affected by this macro. +* +* `FLATCC_ASSERT` defaults to POSIX assert but can be overrided by a +* preprocessor definition. +* +* Runtime assertions can be entirely disabled by defining +* `FLATCC_NO_ASSERT`. +*/ + +#ifdef FLATCC_NO_ASSERT +/* NOTE: This will not affect inclusion of for static assertions. */ +#undef FLATCC_ASSERT +#define FLATCC_ASSERT(x) ((void)0) +/* Grisu3 is used for floating point conversion in JSON processing. */ +#define GRISU3_NO_ASSERT +#endif + +#ifndef FLATCC_ASSERT +#include +#define FLATCC_ASSERT assert +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* FLATCC_ASSERT_H */ diff --git a/3rd_party/nanoarrow/flatcc/flatcc_builder.h b/3rd_party/nanoarrow/flatcc/flatcc_builder.h new file mode 100644 index 0000000..2e84d29 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/flatcc_builder.h @@ -0,0 +1,1911 @@ +#ifndef FLATCC_BUILDER_H +#define FLATCC_BUILDER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Library for building untyped FlatBuffers. Intended as a support + * library for generated C code to produce typed builders, but might + * also be useful in runtime environments and as support for scripting + * languages. + * + * The builder has two API layers: a stack based `start/end` approach, + * and a direct `create`, and they may be mixed freely. The direct + * approach may be used as part of more specialized optimizations such + * as rewriting buffers while the stack approach is convenient for state + * machine driven parsers without a stack, or with a very simple stack + * without extra allocations. + * + * The builder emits partial buffer sequences to a user provided emitter + * function and does not require a full buffer reprensenation in memory. + * For this reason it also does not support sorting or other operations + * that requires representing the buffer, but post-processors can easily + * do this, and the generated schema specific code and provide functions + * to handle this. + * + * A custom allocator with a default realloc implementation can place + * restraints on resource consumption and provide initial allocation + * sizes for various buffers and stacks in use. + * + * A buffer under construction uses a virtual address space for the + * completed part of the buffer, starting at 0 and growing in both + * directions, or just down depending on whether vtables should be + * clustered at the end or not. Clustering may help caching and + * preshipping that part of the buffer. + * + * Because an offset cannot be known before its reference location is + * defined, every completed table, vector, etc. returns a reference into + * the virtual address range. If the final buffer keeps the 0 offset, + * these references remain stable an may be used for external references + * into the buffer. + * + * The maximum buffer that can be constructed is in praxis limited to + * half the UOFFSET_MAX size, typically 2^31 bytes, not counting + * clustered vtables that may consume and additional 2^31 bytes + * (positive address range), but in praxis cannot because vtable + * references are signed and thus limited to 2^31 bytes (or equivalent + * depending on the flatbuffer types chosen). + * + * CORRECTION: in various places rules are mentioned about nesting and using + * a reference at most once. In fact, DAG's are also valid flatbuffers. + * This means a reference may be reused as long as each individual use + * obeys the rules and, for example, circular references are not + * constructed (circular types are ok, but objects graphs with cycles + * are not permitted). Be especially aware of the offset vector create + * call which translates the references into offsets - this can be + * reverted by noting the reference in vector and calculate the base + * used for the offset to restore the original references after the + * vector has been emitted. + */ + +#include +#ifndef UINT8_MAX +#include +#endif + +#include "flatcc_flatbuffers.h" +#include "flatcc_emitter.h" +#include "flatcc_refmap.h" + +/* It is possible to enable logging here. */ +#ifndef FLATCC_BUILDER_ASSERT +#define FLATCC_BUILDER_ASSERT(cond, reason) FLATCC_ASSERT(cond) +#endif + +/* + * Eror handling is not convenient and correct use should not cause + * errors beyond possibly memory allocation, but assertions are a + * good way to trace problems. + * + * Note: some internal assertion will remain if disabled. + */ +#ifndef FLATCC_BUILDER_ASSERT_ON_ERROR +#define FLATCC_BUILDER_ASSERT_ON_ERROR 1 +#endif + +/* + * If set, checks user input agains state and returns error, + * otherwise errors are ignored (assuming they won't happen). + * Errors will be asserted if enabled and checks are not skipped. + */ +#ifndef FLATCC_BUILDER_SKIP_CHECKS +#define FLATCC_BUILDER_SKIP_CHECKS 0 +#endif + + +/* + * When adding the same field to a table twice this is either an error + * or the existing field is returned, potentially introducing garbage + * if the type is a vector, table, or string. When implementing parsers + * it may be convenient to not treat this as an error. + */ +#ifndef FLATCC_BUILDER_ALLOW_REPEAT_TABLE_ADD +#define FLATCC_BUILDER_ALLOW_REPEAT_TABLE_ADD 0 +#endif + +/** + * This type must have same size as `flatbuffers_uoffset_t` + * and must be a signed type. + */ +typedef flatbuffers_soffset_t flatcc_builder_ref_t; +typedef flatbuffers_utype_t flatcc_builder_utype_t; + +/** + * This type must be compatible with code generation that + * creates union specific ref types. + */ +typedef struct flatcc_builder_union_ref { + flatcc_builder_utype_t type; + flatcc_builder_ref_t value; +} flatcc_builder_union_ref_t; + +typedef struct flatcc_builder_union_vec_ref { + flatcc_builder_ref_t type; + flatcc_builder_ref_t value; +} flatcc_builder_union_vec_ref_t; + +/** + * Virtual tables are off by one to avoid being mistaken for error at + * position 0, and it makes them detectable as such because no other + * reference is uneven. Vtables are emitted at their actual location + * which is one less than the reference value. + */ +typedef flatbuffers_soffset_t flatcc_builder_vt_ref_t; + +typedef flatbuffers_uoffset_t flatcc_builder_identifier_t; + +/** + * Hints to custom allocators so they can provide initial alloc sizes + * etc. There will be at most one buffer for each allocation type per + * flatcc_builder instance. Buffers containing only structs may avoid + * allocation altogether using a `create` call. The vs stack must hold + * vtable entries for all open tables up to their requested max id, but + * unused max id overlap on the stack. The final vtables only store the + * largest id actually added. The fs stack must hold stack frames for + * the nesting levels expected in the buffer, each about 50-100 bytes. + * The ds stack holds open vectors, table data, and nested buffer state. + * `create` calls bypass the `ds` and `fs` stack and are thus faster. + * The vb buffer holds a copy of all vtables seen and emitted since last + * vtable flush. The patch log holds a uoffset for every table field + * added to currently open tables. The hash table holds a uoffset entry + * for each hash slot where the allocator decides how many to provide + * above a certain minimum. The vd buffer allocates vtable descriptors + * which is a reference to an emitted vtable, an offset to a cached + * vtable, and a link to next descriptor with same hash. Calling `reset` + * after build can either keep the allocation levels for the next + * buffer, or reduce the buffers already allocated by requesting 1 byte + * allocations (meaning provide a default). + * + * The user stack is not automatically allocated, but when entered + * explicitly, the boundary is rembered in the current live + * frame. + */ +enum flatcc_builder_alloc_type { + /* The stack where vtables are build. */ + flatcc_builder_alloc_vs, + /* The stack where data structures are build. */ + flatcc_builder_alloc_ds, + /* The virtual table buffer cache, holds a copy of each vt seen. */ + flatcc_builder_alloc_vb, + /* The patch log, remembers table fields with outstanding offset refs. */ + flatcc_builder_alloc_pl, + /* The stack of frames for nested types. */ + flatcc_builder_alloc_fs, + /* The hash table part of the virtual table cache. */ + flatcc_builder_alloc_ht, + /* The vtable descriptor buffer, i.e. list elements for emitted vtables. */ + flatcc_builder_alloc_vd, + /* User stack frame for custom data. */ + flatcc_builder_alloc_us, + + /* Number of allocation buffers. */ + flatcc_builder_alloc_buffer_count +}; + +/** Must reflect the `flatcc_builder_alloc_type` enum. */ +#define FLATCC_BUILDER_ALLOC_BUFFER_COUNT flatcc_builder_alloc_buffer_count + +#ifndef FLATCC_BUILDER_ALLOC +#define FLATCC_BUILDER_ALLOC(n) FLATCC_ALLOC(n) +#endif + +#ifndef FLATCC_BUILDER_FREE +#define FLATCC_BUILDER_FREE(p) FLATCC_FREE(p) +#endif + +#ifndef FLATCC_BUILDER_REALLOC +#define FLATCC_BUILDER_REALLOC(p, n) FLATCC_REALLOC(p, n) +#endif + +#ifndef FLATCC_BUILDER_ALIGNED_ALLOC +#define FLATCC_BUILDER_ALIGNED_ALLOC(a, n) FLATCC_ALIGNED_ALLOC(a, n) +#endif + +#ifndef FLATCC_BUILDER_ALIGNED_FREE +#define FLATCC_BUILDER_ALIGNED_FREE(p) FLATCC_ALIGNED_FREE(p) +#endif + +/** + * Emits data to a conceptual deque by appending to either front or + * back, starting from offset 0. + * + * Each emit call appends a strictly later or earlier sequence than the + * last emit with same offset sign. Thus a buffer is gradually grown at + * both ends. `len` is the combined length of all iov entries such that + * `offset + len` yields the former offset for negative offsets and + * `offset + len` yields the next offset for non-negative offsets. + * The bulk of the data will be in the negative range, possibly all of + * it. The first emitted emitted range will either start or end at + * offset 0. If offset 0 is emitted, it indicates the start of clustered + * vtables. The last positive (non-zero) offset may be zero padding to + * place the buffer in a full multiple of `block_align`, if set. + * + * No iov entry is empty, 0 < iov_count <= FLATCC_IOV_COUNT_MAX. + * + * The source data are in general ephemeral and should be consumed + * immediately, as opposed to caching iov. + * + * For high performance applications: + * + * The `create` calls may reference longer living data, but header + * fields etc. will still be short lived. If an emitter wants to + * reference data in another buffer rather than copying, it should + * inspect the memory range. The length of an iov entry may also be used + * since headers are never very long (anything starting at 16 bytes can + * safely be assumed to be user provided, or static zero padding). It is + * guaranteed that data pointers in `create` calls receive a unique slot + * separate from temporary headers, in the iov table which may be used + * for range checking or hashing (`create_table` is the only call that + * mutates the data buffer). It is also guaranteed (with the exception + * of `create_table` and `create_cached_vtable`) that data provided to + * create calls are not referenced at all by the builder, and these data + * may therefore de-facto be handles rather than direct pointers when + * the emitter and data provider can agree on such a protocol. This does + * NOT apply to any start/end/add/etc. calls which do copy to stack. + * `flatcc_builder_padding_base` may be used to test if an iov entry is + * zero padding which always begins at that address. + * + * Future: the emit interface could be extended with a type code + * and return an existing object insted of the emitted if, for + * example, they are identical. Outside this api level, generated + * code could provide a table comparison function to help such + * deduplication. It would be optional because two equal objects + * are not necessarily identical. The emitter already receives + * one object at time. + * + * Returns 0 on success and otherwise causes the flatcc_builder + * to fail. + */ +typedef int flatcc_builder_emit_fun(void *emit_context, + const flatcc_iovec_t *iov, int iov_count, flatbuffers_soffset_t offset, size_t len); + +/* + * Returns a pointer to static padding used in emitter calls. May + * sometimes also be used for empty defaults such as identifier. + */ +extern const uint8_t flatcc_builder_padding_base[]; + +/** + * `request` is a minimum size to be returned, but allocation is + * expected to grow exponentially or in reasonable chunks. Notably, + * `alloc_type = flatcc_builder_alloc_ht` will only use highest available + * power of 2. The allocator may shrink if `request` is well below + * current size but should avoid repeated resizing on small changes in + * request sizes. If `zero_fill` is non-zero, allocated data beyond + * the current size must be zeroed. The buffer `b` may be null with 0 + * length initially. `alloc_context` is completely implementation + * dependendent, and not needed when just relying on realloc. The + * resulting buffer may be the same or different with moved data, like + * realloc. Returns -1 with unmodified buffer on failure or 0 on + * success. The `alloc_type` identifies the buffer type. This may be + * used to cache buffers between instances of builders, or to decide a + * default allocation size larger than requested. If `need` is zero the + * buffer should be deallocate if non-zero, and return success (0) + * regardless. + */ +typedef int flatcc_builder_alloc_fun(void *alloc_context, + flatcc_iovec_t *b, size_t request, int zero_fill, int alloc_type); + +/* + * The number of hash slots there will be allocated space for. The + * allocator may provide more. The size returned should be + * `sizeof(flatbuffers_uoffset_t) * count`, where the size is a power of + * 2 (or the rest is wasted). The hash table can store many more entries + * than slots using linear search. The table does not resize. + */ +#ifndef FLATCC_BUILDER_MIN_HASH_COUNT +#define FLATCC_BUILDER_MIN_HASH_COUNT 64 +#endif + +typedef struct __flatcc_builder_buffer_frame __flatcc_builder_buffer_frame_t; +struct __flatcc_builder_buffer_frame { + flatcc_builder_identifier_t identifier; + flatcc_builder_ref_t mark; + flatbuffers_uoffset_t vs_end; + flatbuffers_uoffset_t nest_id; + uint16_t flags; + uint16_t block_align; +}; + +typedef struct __flatcc_builder_vector_frame __flatcc_builder_vector_frame_t; +struct __flatcc_builder_vector_frame { + flatbuffers_uoffset_t elem_size; + flatbuffers_uoffset_t count; + flatbuffers_uoffset_t max_count; +}; + +typedef struct __flatcc_builder_table_frame __flatcc_builder_table_frame_t; +struct __flatcc_builder_table_frame { + flatbuffers_uoffset_t vs_end; + flatbuffers_uoffset_t pl_end; + uint32_t vt_hash; + flatbuffers_voffset_t id_end; +}; + +/* + * Store state for nested structures such as buffers, tables and vectors. + * + * For less busy data and data where access to a previous state is + * irrelevant, the frame may store the current state directly. Otherwise + * the current state is maintained in the flatcc_builder_t structure in a + * possibly derived form (e.g. ds pointer instead of ds_end offset) and + * the frame is used to store the previous state when the frame is + * entered. + * + * Most operations have a start/update/end cycle the decides the + * liftetime of a frame, but these generally also have a direct form + * (create) that does not use a frame at all. These still do some + * state updates notably passing min_align to parent which may also be + * an operation without a frame following the child level operation + * (e.g. create struct, create buffer). Ending a frame results in the + * same kind of updates. + */ +typedef struct __flatcc_builder_frame __flatcc_builder_frame_t; +struct __flatcc_builder_frame { + flatbuffers_uoffset_t ds_first; + flatbuffers_uoffset_t type_limit; + flatbuffers_uoffset_t ds_offset; + uint16_t align; + uint16_t type; + union { + __flatcc_builder_table_frame_t table; + __flatcc_builder_vector_frame_t vector; + __flatcc_builder_buffer_frame_t buffer; + } container; +}; + +/** + * The main flatcc_builder structure. Can be stack allocated and must + * be initialized with `flatcc_builder_init` and cleared with + * `flatcc_builder_clear` to reclaim memory. Between buffer builds, + * `flatcc_builder_reset` may be used. + */ +typedef struct flatcc_builder flatcc_builder_t; + +struct flatcc_builder { + /* Next entry on reserved stack in `alloc_pl` buffer. */ + flatbuffers_voffset_t *pl; + /* Next entry on reserved stack in `alloc_vs` buffer. */ + flatbuffers_voffset_t *vs; + /* One above the highest entry in vs, used to track vt_size. */ + flatbuffers_voffset_t id_end; + /* The evolving vtable hash updated with every new field. */ + uint32_t vt_hash; + + /* Pointer to ds_first. */ + uint8_t *ds; + /* Offset from `ds` on current frame. */ + flatbuffers_uoffset_t ds_offset; + /* ds buffer size relative to ds_first, clamped to max size of current type. */ + flatbuffers_uoffset_t ds_limit; + + /* ds_first, ds_first + ds_offset is current ds stack range. */ + flatbuffers_uoffset_t ds_first; + /* Points to currently open frame in `alloc_fs` buffer. */ + __flatcc_builder_frame_t *frame; + + /* Only significant to emitter function, if at all. */ + void *emit_context; + /* Only significant to allocator function, if at all. */ + void *alloc_context; + /* Customizable write function that both appends and prepends data. */ + flatcc_builder_emit_fun *emit; + /* Customizable allocator that also deallocates. */ + flatcc_builder_alloc_fun *alloc; + /* Buffers indexed by `alloc_type` */ + flatcc_iovec_t buffers[FLATCC_BUILDER_ALLOC_BUFFER_COUNT]; + /* Number of slots in ht given as 1 << ht_width. */ + size_t ht_width; + + /* The location in vb to add next cached vtable. */ + flatbuffers_uoffset_t vb_end; + /* Where to allocate next vtable descriptor for hash table. */ + flatbuffers_uoffset_t vd_end; + /* Ensure final buffer is aligned to at least this. Nested buffers get their own `min_align`. */ + uint16_t min_align; + /* The current active objects alignment isolated from nested activity. */ + uint16_t align; + /* The current buffers block alignment used when emitting buffer. */ + uint16_t block_align; + /* Signed virtual address range used for `flatcc_builder_ref_t` and emitter. */ + flatcc_builder_ref_t emit_start; + flatcc_builder_ref_t emit_end; + /* 0 for top level, and end of buffer ref for nested buffers (can also be 0). */ + flatcc_builder_ref_t buffer_mark; + /* Next nest_id. */ + flatbuffers_uoffset_t nest_count; + /* Unique id to prevent sharing of vtables across buffers. */ + flatbuffers_uoffset_t nest_id; + /* Current nesting level. Helpful to state-machines with explicit stack and to check `max_level`. */ + int level; + /* Aggregate check for allocated frame and max_level. */ + int limit_level; + /* Track size prefixed buffer. */ + uint16_t buffer_flags; + + /* Settings that may happen with no frame allocated. */ + + flatcc_builder_identifier_t identifier; + + /* Settings that survive reset (emitter, alloc, and contexts also survive): */ + + /* If non-zero, vtable cache gets flushed periodically. */ + size_t vb_flush_limit; + /* If non-zero, fails on deep nesting to help drivers with a stack, such as recursive parsers etc. */ + int max_level; + /* If non-zero, do not cluster vtables at end, only emit negative offsets (0 by default). */ + int disable_vt_clustering; + + /* Set if the default emitter is being used. */ + int is_default_emitter; + /* Only used with default emitter. */ + flatcc_emitter_t default_emit_context; + + /* Offset to the last entered user frame on the user frame stack, after frame header, or 0. */ + size_t user_frame_offset; + + /* The offset to the end of the most recent user frame. */ + size_t user_frame_end; + + /* The optional user supplied refmap for cloning DAG's - not shared with nested buffers. */ + flatcc_refmap_t *refmap; +}; + +/** + * Call this before any other API call. + * + * The emitter handles the completed chunks of the buffer that will no + * longer be required by the builder. It is largely a `write` function + * that can append to both positive and negative offsets. + * + * No memory is allocated during init. Buffers will be allocated as + * needed. The `emit_context` is only used by the emitter, if at all. + * + * `flatcc_builder_reset/clear` calls are automtically forwarded to the + * default emitter. + * + * Returns -1 on failure, 0 on success. + */ +int flatcc_builder_init(flatcc_builder_t *B); + +/** + * Use instead of `flatcc_builder_init` when providing a custom allocator + * or emitter. Leave emitter or allocator null to use default. + * Cleanup of emit and alloc context must be handled manually after + * the builder is cleared or reset, except if emitter is null the + * default will be automatically cleared and reset. + * + * Returns -1 on failure, 0 on success. + */ +int flatcc_builder_custom_init(flatcc_builder_t *B, + flatcc_builder_emit_fun *emit, void *emit_context, + flatcc_builder_alloc_fun *alloc, void *alloc_context); + +/* + * Returns (flatcc_emitter_t *) if the default context is used. + * Other emitter might have null contexts. + */ +void *flatcc_builder_get_emit_context(flatcc_builder_t *B); + +/** + * Prepares builder for a new build. The emitter is not told when a + * buffer is finished or when a new begins, and must be told so + * separately. Allocated buffers will be zeroed, but may optionally be + * reduced to their defaults (signalled by reallocating each non-empty + * buffer to a single byte). General settings are cleared optionally, + * such as cache flushing. Buffer specific settings such as buffer + * identifier are always cleared. + * + * Returns -1 if allocator complains during buffer reduction, 0 on + * success. + */ +int flatcc_builder_custom_reset(flatcc_builder_t *B, + int reduce_buffers, int set_defaults); + +/* + * Same as `flatcc_builder_custom_reset` with default arguments + * where buffers are not reduced and default settings are not reset. + */ +int flatcc_builder_reset(flatcc_builder_t *B); + +/** + * Deallocates all memory by calling allocate with a zero size request + * on each buffer, then zeroing the builder structure itself. + */ +void flatcc_builder_clear(flatcc_builder_t *B); + +/** + * Allocates to next higher power of 2 using system realloc and ignores + * `alloc_context`. Only reduces size if a small subsequent increase in + * size would not trigger a reallocation. `alloc_type` is used to + * set minimum sizes. Hash tables are allocated to the exact requested + * size. See also `alloc_fun`. + */ +int flatcc_builder_default_alloc(void *alloc_context, + flatcc_iovec_t *b, size_t request, int zero_fill, int alloc_type); + +/** + * If non-zero, the vtable cache will get flushed whenever it reaches + * the given limit at a point in time where more space is needed. The + * limit is not exact as it is only tested when reallocation is + * required. + */ +void flatcc_builder_set_vtable_cache_limit(flatcc_builder_t *B, size_t size); + +/** + * Manual flushing of vtable for long running tasks. Mostly used + * internally to deal with nested buffers. + */ +void flatcc_builder_flush_vtable_cache(flatcc_builder_t *B); + +/** + * Low-level support function to aid in constructing nested buffers without + * allocation. Not for regular use. + * + * Call where `start_buffer` would have been placed when using + * `create_buffer` in a nested context. Save the return value on a stack + * as argument to `pop_buffer_alignment`. + * + * The call resets the current derived buffer alignment so the nested + * buffer will not be aligned to more than required. + * + * Often it will not be necessary to be so careful with alignment since + * the alignment cannot be invalid by failing to use push and pop, but + * for code generation it will ensure the correct result every time. + */ +uint16_t flatcc_builder_push_buffer_alignment(flatcc_builder_t *B); + +/** + * Low-level call. + * + * Call with the return value from push_buffer_alignment after a nested + * `create_buffer_call`. The alignments merge back up in the buffer + * hierarchy so the top level buffer gets the largest of all aligments. + */ +void flatcc_builder_pop_buffer_alignment(flatcc_builder_t *B, uint16_t buffer_align); + +/** + * This value may be of interest when the buffer has been ended, for + * example when subsequently allocating memory for the buffer to ensure + * that memory is properly aligned. + */ +uint16_t flatcc_builder_get_buffer_alignment(flatcc_builder_t *B); + +/** + * Level 0 means no buffer is started, otherwise it increments with + * start calls and decrements with end calls (approximately for + * optimized operations such as table vectors). + * + * If `max_level` has been set, `get_level` always returns a value <= + * `max_level` provided no start call has failed. + * + * Level continues to increment inside nested buffers. + */ +int flatcc_builder_get_level(flatcc_builder_t *B); + +/** + * Setting the max level triggers a failure on start of new nestings + * when the level is reached. May be used to protect recursive descend + * parsers etc. or later buffer readers. + * + * The builder itself is not sensitive to depth, and the allocator is a + * better way to protect resource abuse. + * + * `max_level` is not reset inside nested buffers. + */ +void flatcc_builder_set_max_level(flatcc_builder_t *B, int level); + +/** + * By default ordinary data such as tables are placed in front of + * earlier produced content and vtables are placed at the very end thus + * clustering vtables together. This can be disabled so all content is + * placed in front. Nested buffers ignores this setting because they can + * only place content in front because they cannot blend with the + * containing buffers content. Clustering could be more cache friendly + * and also enables pre-shipping of the vtables during transmission. + */ +void flatcc_builder_set_vtable_clustering(flatcc_builder_t *B, int enable); + +/** + * Sets a new user supplied refmap which maps source pointers to + * references and returns the old refmap, or null. It is also + * possible to disable an existing refmap by setting a null + * refmap. + * + * A clone or pick operation may use this map when present, + * depending on the data type. If a hit is found, the stored + * reference will be used instead of performing a new clone or + * pick operation. It is also possible to manually populate the + * refmap. Note that the builder does not have a concept of + * clone or pick - these are higher level recursive operations + * to add data from one buffer to another - but such code may + * rely on the builder to provide the current refmap during + * recursive operations. For this reason, the builder makes no + * calls to the refmap interface on its own - it just stores the + * current refmap such that recursive operations can find it. + * + * Refmaps MUST be reset, replaced or disabled if a source + * pointer may be reused for different purposes - for example if + * repeatedly reading FlatBuffers into the same memory buffer + * and performing a clone into a buffer under construction. + * Refmaps may also be replaced if the same object is to be + * cloned several times keeping the internal DAG structure + * intact with every new clone being an independent object. + * + * Refmaps must also be replaced or disabled prior to starting a + * nested buffer and after stopping it, or when cloning a object + * as a nested root. THIS IS VERY EASY TO GET WRONG! The + * builder does a lot of bookkeeping for nested buffers but not + * in this case. Shared references may happen and they WILL fail + * verification and they WILL break when copying out a nested + * buffer to somewhere else. The user_frame stack may be used + * for pushing refmaps, but often user codes recursive stack + * will work just as well. + * + * It is entirely optional to use refmaps when cloning - they + * preserve DAG structure and may speed up operations or slow + * them down, depending on the source material. + * + * Refmaps may consume a lot of space when large offset vectors + * are cloned when these do not have significant shared + * references. They may also be very cheap to use without any + * dynamic allocation when objects are small and have at most a + * few references. + * + * Refmaps only support init, insert, find, reset, clear but not + * delete. There is a standard implementation in the runtime + * source tree but it can easily be replaced compile time and it + * may also be left out if unused. The builder wraps reset, insert, + * and find so the user does not have to check if a refmap is + * present but other operations must be done direcly on the + * refmap. + * + * The builder wrapped refmap operations are valid on a null + * refmap which will find nothing and insert nothing. + * + * The builder will reset the refmap during a builder reset and + * clear the refmap during a builder clear operation. If the + * refmap goes out of scope before that happens it is important + * to call set_refmap with null and manually clear the refmap. + */ +static inline flatcc_refmap_t *flatcc_builder_set_refmap(flatcc_builder_t *B, flatcc_refmap_t *refmap) +{ + flatcc_refmap_t *refmap_old; + + refmap_old = B->refmap; + B->refmap = refmap; + return refmap_old; +} + +/* Retrieves the current refmap, or null. */ +static inline flatcc_refmap_t *flatcc_builder_get_refmap(flatcc_builder_t *B) +{ + return B->refmap; +} + +/* Finds a reference, or a null reference if no refmap is active. * */ +static inline flatcc_builder_ref_t flatcc_builder_refmap_find(flatcc_builder_t *B, const void *src) +{ + return B->refmap ? flatcc_refmap_find(B->refmap, src) : flatcc_refmap_not_found; +} + +/* + * Inserts into the current refmap with the inseted ref upon + * upon success, or not_found on failure (default 0), or just + * returns ref if refmap is absent. + * + * Note that if an existing item exists, the ref is replaced + * and the new, not the old, ref is returned. + */ +static inline flatcc_builder_ref_t flatcc_builder_refmap_insert(flatcc_builder_t *B, const void *src, flatcc_builder_ref_t ref) +{ + return B->refmap ? flatcc_refmap_insert(B->refmap, src, ref) : ref; +} + +static inline void flatcc_builder_refmap_reset(flatcc_builder_t *B) +{ + if (B->refmap) flatcc_refmap_reset(B->refmap); +} + + +typedef uint16_t flatcc_builder_buffer_flags_t; +static const flatcc_builder_buffer_flags_t flatcc_builder_is_nested = 1; +static const flatcc_builder_buffer_flags_t flatcc_builder_with_size = 2; + +/* The flag size in the API needs to match the internal size. */ +static_assert(sizeof(flatcc_builder_buffer_flags_t) == + sizeof(((flatcc_builder_t *)0)->buffer_flags), "flag size mismatch"); + +/** + * An alternative to start buffer, start struct/table ... end buffer. + * + * This call is mostly of interest as a means to quicly create a zero + * allocation top-level buffer header following a call to create_struct, + * or to create_vtable/create_table. For that, it is quite simple to + * use. For general buffer construction without allocation, more care is + * needed, as discussed below. + * + * If the content is created with `start/end_table` calls, or similar, + * it is better to use `start/end_buffer` since stack allocation is used + * anyway. + * + * The buffer alignment must be provided manually as it is not derived + * from constructed content, unlike `start/end_buffer`. Typically + * `align` would be same argument as provided to `create_struct`. + * `get_buffer_alignment` may also used (note: `get_buffer_alignment` + * may return different after the call because it will be updated with + * the `block_align` argument to `create_buffer` but that is ok). + * + * The buffer may be constructed as a nested buffer with the `is_nested + * = 1` flag. As a nested buffer a ubyte vector header is placed before + * the aligned buffer header. A top-level buffer will normally have + * flags set to 0. + * + * A top-level buffer may also be constructed with the `with_size = 2` + * flag for top level buffers. It adds a size prefix similar to + * `is_nested` but the size is part of the aligned buffer. A size + * prefixed top level buffer must be accessed with a size prefix aware + * reader, or the buffer given to a standard reader must point to after + * the size field while keeping the buffer aligned to the size field + * (this will depend on the readers API which may be an arbitrary other + * language). + * + * If the `with_size` is used with the `is_nested` flag, the size is + * added as usual and all fields remain aligned as before, but padding + * is adjusted to ensure the buffer is aligned to the size field so + * that, for example, the nested buffer with size can safely be copied + * to a new memory buffer for consumption. + * + * Generally, references may only be used within the same buffer + * context. With `create_buffer` this becomes less precise. The rule + * here is that anything that would be valid with start/end_buffer + * nestings is also valid when removing the `start_buffer` call and + * replacing `end_buffer` with `create_buffer`. + * + * Note the additional burden of tracking buffer alignment manually - + * To help with this use `push_buffer_alignment` where `start_buffer` + * would have been placed, and `pop_buffer_alignment after the + * `create_buffer` call, and use `get_buffer_alignemnt` as described + * above. + * + * `create_buffer` is not suitable as a container for buffers created + * with `start/end_buffer` as these make assumptions about context that + * create buffer does not provide. Also, there is no point in doing so, + * since the idea of `create_buffer` is to avoid allocation in the first + * place. + */ +flatcc_builder_ref_t flatcc_builder_create_buffer(flatcc_builder_t *B, + const char identifier[FLATBUFFERS_IDENTIFIER_SIZE], + uint16_t block_align, + flatcc_builder_ref_t ref, uint16_t align, flatcc_builder_buffer_flags_t flags); + +/** + * Creates a struct within the current buffer without using any + * allocation. + * + * The struct should be used as a root in the `end_buffer` call or as a + * union value as there are no other ways to use struct while conforming + * to the FlatBuffer format - noting that tables embed structs in their + * own data area except in union fields. + * + * The struct should be in little endian format and follow the usual + * FlatBuffers alignment rules, although this API won't care about what + * is being stored. + * + * May also be used to simply emit a struct through the emitter + * interface without being in a buffer and without being a valid + * FlatBuffer. + */ +flatcc_builder_ref_t flatcc_builder_create_struct(flatcc_builder_t *B, + const void *data, size_t size, uint16_t align); + +/** + * Starts a struct and returns a pointer that should be used immediately + * to fill in the struct in protocol endian format, and when done, + * `end_struct` should be called. The returned reference should be used + * as argument to `end_buffer` or as a union value. See also + * `create_struct`. + */ +void *flatcc_builder_start_struct(flatcc_builder_t *B, + size_t size, uint16_t align); + +/** + * Return a pointer also returned at start struct, e.g. for endian + * conversion. + */ +void *flatcc_builder_struct_edit(flatcc_builder_t *B); + +/** + * Emits the struct started by `start_struct` and returns a reference to + * be used as root in an enclosing `end_buffer` call or as a union + * value. As mentioned in `create_struct`, these can also be used more + * freely, but not while being conformant FlatBuffers. + */ +flatcc_builder_ref_t flatcc_builder_end_struct(flatcc_builder_t *B); + +/** + * The buffer always aligns to at least the offset size (typically 4) + * and the internal alignment requirements of the buffer content which + * is derived as content is added. + * + * In addition, block_align can be specified. This ensures the resulting + * buffer is at least aligned to the block size and that the total size + * is zero padded to fill a block multiple if necessary. Because the + * emitter operates on a virtual address range before the full buffer is + * aligned, it may have to make assumptions based on that: For example, + * it may be processing encryption blocks in the fly, and the resulting + * buffer should be aligned to the encryption block size, even if the + * content is just a byte aligned struct. Block align helps ensure this. + * If the block align as 1 there will be no attempt to zero pad at the + * end, but the content may still warrant padding after the header. End + * padding is only needed with clustered vtables (which is the default). + * + * `block_align` is allowed to be 0 meaning it will inherit from parent if + * present, and otherwise it defaults to 1. + * + * The identifier may be null, and it may optionally be set later with + * `set_identifier` before the `end_buffer` call. + * + * General note: + * + * Only references returned with this buffer as current (i.e. last + * unended buffer) can be stored in other objects (tables, offset + * vectors) also belonging to this buffer, or used as the root argument + * to `end_buffer`. A reference may be stored at most once, and unused + * references will result in buffer garbage. All calls must be balanced + * around the respective start / end operations, but may otherwise nest + * freely, including nested buffers. Nested buffers are supposed to be + * stored in a table offset field to comply with FlatBuffers, but the + * API does not place any restrictions on where references are stored, + * as long as they are indicated as offset fields. + * + * All alignment in all API calls must be between 1 and 256 and must be a + * power of 2. This is not checked. Only if explicitly documented can it + * also be 0 for a default value. + * + * `flags` can be `with_size` but `is_nested` is derived from context + * see also `create_buffer`. + */ +int flatcc_builder_start_buffer(flatcc_builder_t *B, + const char identifier[FLATBUFFERS_IDENTIFIER_SIZE], + uint16_t block_align, flatcc_builder_buffer_flags_t flags); + +/** + * The root object should be a struct or a table to conform to the + * FlatBuffers format, but technically it can also be a vector or a + * string, or even a child buffer (which is also vector as seen by the + * buffer). The object must be created within the current buffer + * context, that is, while the current buffer is the deepest nested + * buffer on the stack. + */ +flatcc_builder_ref_t flatcc_builder_end_buffer(flatcc_builder_t *B, flatcc_builder_ref_t root); + +/** + * The embed buffer is mostly intended to add an existing buffer as a + * nested buffer. The buffer will be wrapped in a ubyte vector such that + * the buffer is aligned at vector start, after the size field. + * + * If `align` is 0 it will default to 8 so that all FlatBuffer numeric + * types will be readable. NOTE: generally do not count on align 0 being + * valid or even checked by the API, but in this case it may be + * difficult to know the internal buffer alignment, and 1 would be the wrong + * choice. + * + * If `block_align` is set (non-zero), the buffer is placed in an isolated + * block multiple. This may cost up to almost 2 block sizes in padding. + * If the `block_align` argument is 0, it inherits from the parent + * buffer block_size, or defaults to 1. + * + * The `align` argument must be set to respect the buffers internal + * alignment requirements, but if the buffer is smaller it will not be + * padded to isolate the buffer. For example a buffer of with + * `align = 64` and `size = 65` may share its last 64 byte block with + * other content, but not if `block_align = 64`. + * + * Because the ubyte size field is not, by default, part of the aligned + * buffer, significant space can be wasted if multiple blocks are added + * in sequence with a large block size. + * + * In most cases the distinction between the two alignments is not + * important, but it allows separate configuration of block internal + * alignment and block size, which can be important for auto-generated + * code that may know the alignment of the buffer, but not the users + * operational requirements. + * + * If the buffer is embedded without a parent buffer, it will simply + * emit the buffer through the emit interface, but may also add padding + * up to block alignment. At top-level there will be no size field + * header. + * + * If `with_size` flag is set, the buffer is aligned to size field and + * the above note about padding space no longer applies. The size field + * is added regardless. The `is_nested` flag has no effect since it is + * impplied. + */ +flatcc_builder_ref_t flatcc_builder_embed_buffer(flatcc_builder_t *B, + uint16_t block_align, + const void *data, size_t size, uint16_t align, flatcc_builder_buffer_flags_t flags); + +/** + * Applies to the innermost open buffer. The identifier may be null or + * contain all zero. Overrides any identifier given to the start buffer + * call. + */ +void flatcc_builder_set_identifier(flatcc_builder_t *B, + const char identifier[FLATBUFFERS_IDENTIFIER_SIZE]); + +enum flatcc_builder_type { + flatcc_builder_empty = 0, + flatcc_builder_buffer, + flatcc_builder_struct, + flatcc_builder_table, + flatcc_builder_vector, + flatcc_builder_offset_vector, + flatcc_builder_string, + flatcc_builder_union_vector +}; + +/** + * Returns the object type currently on the stack, for example if + * needing to decide how to close a buffer. Because a table is + * automatically added when starting a table buffer, + * `flatcc_builder_table_buffer` should not normally be seen and the level + * should be 2 before when closing a top-level table buffer, and 0 + * after. A `flatcc_builder_struct_buffer` will be visible at level 1. + * + */ +enum flatcc_builder_type flatcc_builder_get_type(flatcc_builder_t *B); + +/** + * Similar to `get_type` but for a specific level. `get_type_at(B, 1)` + * will return `flatcc_builder_table_buffer` if this is the root buffer + * type. get_type_at(B, 0) is always `flatcc_builder_empty` and so are any + * level above `get_level`. + */ +enum flatcc_builder_type flatcc_builder_get_type_at(flatcc_builder_t *B, int level); + +/** + * The user stack is available for custom data. It may be used as + * a simple stack by extending or reducing the inner-most frame. + * + * A frame has a size and a location on the user stack. Entering + * a frame ensures the start is aligned to sizeof(size_t) and + * ensures the requested space is available without reallocation. + * When exiting a frame, the previous frame is restored. + * + * A user frame works completely independently of the builders + * frame stack for tracking tables vectors etc. and does not have + * to be completely at exit, but obviously it is not valid to + * exit more often the entered. + * + * The frame is zeroed when entered. + * + * Returns a non-zero handle to the user frame upon success or + * 0 on allocation failure. + */ +size_t flatcc_builder_enter_user_frame(flatcc_builder_t *B, size_t size); + +/** + * Makes the parent user frame current, if any. It is not valid to call + * if there isn't any current frame. Returns handle to parent frame if + * any, or 0. + */ +size_t flatcc_builder_exit_user_frame(flatcc_builder_t *B); + +/** + * Exits the frame represented by the given handle. All more + * recently entered frames will also be exited. Returns the parent + * frame handle if any, or 0. + */ +size_t flatcc_builder_exit_user_frame_at(flatcc_builder_t *B, size_t handle); + +/** + * Returns a non-zero handle to the current inner-most user frame if + * any, or 0. + */ +size_t flatcc_builder_get_current_user_frame(flatcc_builder_t *B); + +/* + * Returns a pointer to the user frame at the given handle. Any active + * frame can be accessed in this manner but the pointer is invalidated + * by user frame enter and exit operations. + */ +void *flatcc_builder_get_user_frame_ptr(flatcc_builder_t *B, size_t handle); + +/** + * Returns the size of the buffer and the logical start and end address + * of with respect to the emitters address range. `end` - `start` also + * yields the size. During construction `size` is the emitted number of + * bytes and after buffer close it is the actual buffer size - by then + * the start is also the return value of close buffer. End marks the end + * of the virtual table cluster block. + * + * NOTE: there is no guarantee that all vtables end up in the cluster + * block if there is placed a limit on the vtable size, or if nested + * buffers are being used. On the other hand, if these conditions are + * met, it is guaranteed that all vtables are present if the vtable + * block is available (this depends on external transmission - the + * vtables are always emitted before tables using them). In all cases + * the vtables will behave as valid vtables in a flatbuffer. + */ +size_t flatcc_builder_get_buffer_size(flatcc_builder_t *B); + +/** + * Returns the reference to the start of the emitter buffer so far, or + * in total after buffer end, in the virtual address range used + * by the emitter. Start is also returned by buffer end. + */ +flatcc_builder_ref_t flatcc_builder_get_buffer_start(flatcc_builder_t *B); + +/** + * Returns the reference to the end of buffer emitted so far. When + * clustering vtables, this is the end of tables, or after buffer end, + * also zero padding if block aligned. If clustering is disabled, this + * method will return 0 as the buffer only grows down then. + */ +flatcc_builder_ref_t flatcc_builder_get_buffer_mark(flatcc_builder_t *B); + +/** + * Creates the vtable in the current buffer context, somewhat similar to + * how create_vector operates. Each call results in a new table even if + * an identical has already been emitted. + * + * Also consider `create_cached_vtable` which will reuse existing + * vtables. + * + * This is low-low-level function intended to support + * `create_cached_vtable` or equivalent, and `create_table`, both of + * which are normally used indirectly via `start_table`, `table_add`, + * `table_add_offset`..., `table_end`. + * + * Creates a vtable as a verbatim copy. This means the vtable must + * include the header fields containing the vtable size and the table + * size in little endian voffset_t encoding followed by the vtable + * entries in same encoding. + * + * The function may be used to copy vtables from other other buffers + * since they are directly transferable. + * + * The returned reference is actually the emitted location + 1. This + * ensures the vtable is not mistaken for error because 0 is a valid + * vtable reference. `create_table` is aware of this and substracts one + * before computing the final offset relative to the table. This also + * means vtable references are uniquely identifiable by having the + * lowest bit set. + * + * vtable references may be reused within the same buffer, not any + * parent or other related buffer (technically this is possible though, + * as long as it is within same builder context, but it will not construct + * valid FlatBuffers because the buffer cannot be extracted in isolation). + */ +flatcc_builder_vt_ref_t flatcc_builder_create_vtable(flatcc_builder_t *B, + const flatbuffers_voffset_t *vt, + flatbuffers_voffset_t vt_size); + +/** + * Support function to `create_vtable`. See also the uncached version + * `create_vtable`. + * + * Looks up the constructed vtable on the vs stack too see if it matches + * a cached entry. If not, it emits a new vtable either at the end if + * top-level and clustering is enabled, or at the front (always for + * nested buffers). + * + * If the same vtable was already emitted in a different buffer, but not + * in the current buffer, the cache entry will be reused, but a new + * table will be emitted the first it happens in the same table. + * + * The returned reference is + 1 relative to the emitted address range + * to identify it as a vtable and to avoid mistaking the valid 0 + * reference for an error (clustered vtables tend to start at the end at + * the virtual address 0, and up). + * + * The hash function can be chosen arbitrarily but may result in + * duplicate emitted vtables if different hash functions are being used + * concurrently, such as mixing the default used by `start/end table` + * with a custom function (this is not incorrect, it only increases the + * buffer size and cache pressure). + * + * If a vtable has a unique ID by other means than hashing the content, + * such as an integer id, and offset into another buffer, or a pointer, + * a good hash may be multiplication by a 32-bit prime number. The hash + * table is not very sensitive to collissions as it uses externally + * chained hashing with move to front semantics. + */ +flatcc_builder_vt_ref_t flatcc_builder_create_cached_vtable(flatcc_builder_t *B, + const flatbuffers_voffset_t *vt, + flatbuffers_voffset_t vt_size, uint32_t vt_hash); + +/* + * Based on Knuth's prime multiplier. + * + * This is an incremental hash that is called with id and size of each + * non-empty field, and finally with the two vtable header fields + * when vtables are constructed via `table_add/table_add_offset`. + * + */ +#ifndef FLATCC_SLOW_MUL +#ifndef FLATCC_BUILDER_INIT_VT_HASH +#define FLATCC_BUILDER_INIT_VT_HASH(hash) { (hash) = (uint32_t)0x2f693b52UL; } +#endif +#ifndef FLATCC_BUILDER_UPDATE_VT_HASH +#define FLATCC_BUILDER_UPDATE_VT_HASH(hash, id, offset) \ + { (hash) = (((((uint32_t)id ^ (hash)) * (uint32_t)2654435761UL)\ + ^ (uint32_t)(offset)) * (uint32_t)2654435761UL); } +#endif +#ifndef FLATCC_BUILDER_BUCKET_VT_HASH +#define FLATCC_BUILDER_BUCKET_VT_HASH(hash, width) (((uint32_t)(hash)) >> (32 - (width))) +#endif +#endif + +/* + * By default we use Bernsteins hash as fallback if multiplication is slow. + * + * This just have to be simple, fast, and work on devices without fast + * multiplication. We are not too sensitive to collisions. Feel free to + * experiment and replace. + */ +#ifndef FLATCC_BUILDER_INIT_VT_HASH +#define FLATCC_BUILDER_INIT_VT_HASH(hash) { (hash) = 5381; } +#endif +#ifndef FLATCC_BUILDER_UPDATE_VT_HASH +#define FLATCC_BUILDER_UPDATE_VT_HASH(hash, id, offset) \ + { (hash) = ((((hash) << 5) ^ (id)) << 5) ^ (offset); } +#endif +#ifndef FLATCC_BUILDER_BUCKET_VT_HASH +#define FLATCC_BUILDER_BUCKET_VT_HASH(hash, width) (((1 << (width)) - 1) & (hash)) +#endif + + + +/** + * Normally use `start_table` instead of this call. + * + * This is a low-level call only intended for high-performance + * applications that repeatedly churn about similar tables of known + * layout, or as a support layer for other builders that maintain their + * own allocation rather than using the stack of this builder. + * + * Creates a table from an already emitted vtable, actual data that is + * properly aligned relative to data start and in little endian + * encoding. Unlike structs, tables can have offset fields. These must + * be stored as flatcc_builder_ref_t types (which have uoffset_t size) as + * returned by the api in native encoding. The `offsets` table contain + * voffsets relative to `data` start (this is different from how vtables + * store offsets because they are relative to a table header). The + * `offsets` table is only used temporarily to translate the stored + * references and is not part of final buffer content. `offsets` may be + * null if `offset_count` is 0. `align` should be the highest aligned + * field in the table, but `size` need not be a multiple of `align`. + * Aside from endian encoding, the vtable must record a table size equal + * to `size + sizeof(flatbuffers_uoffset_t)` because it includes the + * table header field size. The vtable is not accessed by this call (nor + * is it available). Unlike other references, the vtable reference may + * be shared between tables in the same buffer (not with any related + * buffer such as a parent buffer). + * + * The operation will not use any allocation, but will update the + * alignment of the containing buffer if any. + * + * Note: unlike other create calls, except `create_offset_vector`, + * the source data is modified in order to translate references intok + * offsets before emitting the table. + */ +flatcc_builder_ref_t flatcc_builder_create_table(flatcc_builder_t *B, + const void *data, size_t size, uint16_t align, + flatbuffers_voffset_t *offsets, int offset_count, + flatcc_builder_vt_ref_t vt_ref); + +/** + * Starts a table, typically following a start_buffer call as an + * alternative to starting a struct, or to create table fields to be + * stored in a parent table, or in an offset vector. + * A number of `table_add` and table_add_offset` call may be placed + * before the `end_table` call. Struct fields should NOT use `struct` + * related call (because table structs are in-place), rather they should + * use the `table_add` call with the appropriate size and alignment. + * + * A table, like other reference returning calls, may also be started + * outside a buffer if the buffer header and alignment is of no + * interest to the application, for example as part of an externally + * built buffer. + * + * `count` must be larger than the largest id used for this table + * instance. Normally it is set to the number of fields defined in the + * schema, but it may be less if memory is constrained and only few + * fields with low valued id's are in use. The count can extended later + * with `reserve_table` if necessary. `count` may be also be set to a + * large enough value such as FLATBUFFERS_ID_MAX + 1 if memory is not a + * concern (reserves about twice the maximum vtable size to track the + * current vtable and voffsets where references must be translated to + * offsets at table end). `count` may be zero if for example + * `reserve_table` is being used. + * + * Returns -1 on error, 0 on success. + */ +int flatcc_builder_start_table(flatcc_builder_t *B, int count); + +/** + * Call before adding a field with an id that is not below the count set + * at table start. Not needed in most cases. For performance reasons + * the builder does not check all bounds all the the time, but the user + * can do so if memory constraints prevent start_table from using a + * conservative value. See also `table_start`. + * + * Note: this call has absolutely no effect on the table layout, it just + * prevents internal buffer overruns. + * + * Returns -1 on error, 0 on success. + */ +int flatcc_builder_reserve_table(flatcc_builder_t *B, int count); + +/** + * Completes the table constructed on the internal stack including + * emitting a vtable, or finding a matching vtable that has already been + * emitted to the same buffer. (Vtables cannot be shared between + * buffers, but they can between tables of the same buffer). + * + * Note: there is a considerable, but necessary, amount of bookkeeping + * involved in constructing tables. The `create_table` call is much + * faster, but it also expects a lot of work to be done already. + * + * Tables can be created with no fields added. This will result in an + * empty vtable and a table with just a vtable reference. If a table is + * used as a sub-table, such a table might also not be stored at all, + * but we do not return a special reference for that, nor do we provide + * and option to not create the table in this case. This may be + * interpreted as the difference between a null table (not stored in + * parent), and an empty table with a unique offset (and thus identity) + * different from other empty tables. + */ +flatcc_builder_ref_t flatcc_builder_end_table(flatcc_builder_t *B); + +/** + * Optionally this method can be called just before `flatcc_builder_end_table` + * to verify that all required fields have been set. + * Each entry is a table field id. + * + * Union fields should use the type field when checking for presence and + * may also want to check the soundness of the union field overall using + * `check_union_field` with the id one higher than the type field id. + * + * This funcion is typically called by an assertion in generated builder + * interfaces while release builds may want to avoid this performance + * overhead. + * + * Returns 1 if all fields are matched, 0 otherwise. + */ +int flatcc_builder_check_required(flatcc_builder_t *B, const flatbuffers_voffset_t *required, int count); + +/** + * Same as `check_required` when called with a single element. + * + * Typically used when direct calls are more convenient than building an + * array first. Useful when dealing with untrusted intput such as parsed + * text from an external source. + */ +int flatcc_builder_check_required_field(flatcc_builder_t *B, flatbuffers_voffset_t id); + +/** + * Checks that a union field is valid. + * + * The criteria is: + * + * If the type field is not present (at id - 1), or it holds a zero value, + * then the table field (at id) must be present. + * + * Generated builder code may be able to enforce valid unions without + * this check by setting both type and table together, but e.g. parsers + * may receive the type and the table independently and then it makes + * sense to validate the union fields before table completion. + * + * Note that an absent union field is perfectly valid. If a union is + * required, the type field (id - 1), should be checked separately + * while the table field should only be checked here because it can + * (and must) be absent when the type is NONE (= 0). + */ +int flatcc_builder_check_union_field(flatcc_builder_t *B, flatbuffers_voffset_t id); + +/** + * A struct, enum or scalar added should be stored in little endian in + * the return pointer location. The pointer is short lived and will + * not necessarily survive other builder calls. + * + * A union type field can also be set using this call. In fact, this is + * the only way to deal with unions via this API. Consequently, it is + * the users repsonsibility to ensure the appropriate type is added + * at the next higher id. + * + * Null and default values: + * + * FlatBuffers does not officially provide an option for null values + * because it does not distinguish between default values and values + * that are not present. At this api level, we do not deal with defaults + * at all. Callee should test the stored value against the default value + * and only add the field if it does not match the default. This only + * applies to scalar and enum values. Structs cannot have defaults so + * their absence means null, and strings, vectors and subtables do have + * natural null values different from the empty object and empty objects + * with different identity is also possible. + * + * To handle Null for scalars, the following approach is recommended: + * + * Provide a schema-specific `add` operation that only calls this + * low-level add method if the default does not match, and also provide + * another `set` operation that always stores the value, regardless of + * default. For most readers this will be transparent, except for extra + * space used, but for Null aware readers, these can support operations + * to test for Null/default/other value while still supporting the + * normal read operation that returns default when a value is absent + * (i.e. Null). + * + * It is valid to call with a size of 0 - the effect being adding the + * vtable entry. The call may also be dropped in this case to reduce + * the vtable size - the difference will be in null detection. + */ +void *flatcc_builder_table_add(flatcc_builder_t *B, int id, size_t size, uint16_t align); + +/** + * Returns a pointer to the buffer holding the last field added. The + * size argument must match the field size added. May, for example, be + * used to perform endian conversion after initially updating field + * as a native struct. Must be called before the table is ended. + */ +void *flatcc_builder_table_edit(flatcc_builder_t *B, size_t size); + +/** + * Similar to `table_add` but copies source data into the buffer before + * it is returned. Useful when adding a larger struct already encoded in + * little endian. + */ +void *flatcc_builder_table_add_copy(flatcc_builder_t *B, int id, const void *data, size_t size, uint16_t align); + +/** + * Add a string, vector, or sub-table depending on the type if the + * field identifier. The offset ref obtained when the field object was + * closed should be stored as is in the given pointer. The pointer + * is only valid short term, so create the object before calling + * add to table, but the owner table can be started earlier. Never mix + * refs from nested buffers with parent buffers. + * + * Also uses this method to add nested buffers. A nested buffer is + * simple a buffer created while another buffer is open. The buffer + * close operation provides the necessary reference. + * + * When the table closes, all references get converted into offsets. + * Before that point, it is not required that the offset is written + * to. + */ +flatcc_builder_ref_t *flatcc_builder_table_add_offset(flatcc_builder_t *B, int id); + +/* + * Adds a union type and reference in a single operation and returns 0 + * on success. Stores the type field at `id - 1` and the value at + * `id`. The `value` is a reference to a table, to a string, or to a + * standalone `struct` outside the table. + * + * If the type is 0, the value field must also be 0. + * + * Unions can also be added as separate calls to the type and the offset + * separately which can lead to better packing when the type is placed + * together will other small fields. + */ +int flatcc_builder_table_add_union(flatcc_builder_t *B, int id, + flatcc_builder_union_ref_t uref); + +/* + * Adds a union type vector and value vector in a single operations + * and returns 0 on success. + * + * If both the type and value vector is null, nothing is added. + * Otherwise both must be present and have the same length. + * + * Any 0 entry in the type vector must also have a 0 entry in + * the value vector. + */ +int flatcc_builder_table_add_union_vector(flatcc_builder_t *B, int id, + flatcc_builder_union_vec_ref_t uvref); +/** + * Creates a vector in a single operation using an externally supplied + * buffer. This completely bypasses the stack, but the size must be + * known and the content must be little endian. Do not use for strings + * and offset vectors. Other flatbuffer vectors could be used as a + * source, but the length prefix is not required. + * + * Set `max_count` to `FLATBUFFERS_COUNT_MAX(elem_size)` before a call + * to any string or vector operation to the get maximum safe vector + * size, or use (size_t)-1 if overflow is not a concern. + * + * The max count property is a global property that remains until + * explicitly changed. + * + * `max_count` is to prevent malicous or accidental overflow which is + * difficult to detect by multiplication alone, depending on the type + * sizes being used and having `max_count` thus avoids a division for + * every vector created. `max_count` does not guarantee a vector will + * fit in an empty buffer, it just ensures the internal size checks do + * not overflow. A safe, sane limit woud be max_count / 4 because that + * is half the maximum buffer size that can realistically be + * constructed, corresponding to a vector size of `UOFFSET_MAX / 4` + * which can always hold the vector in 1GB excluding the size field when + * sizeof(uoffset_t) = 4. + */ +flatcc_builder_ref_t flatcc_builder_create_vector(flatcc_builder_t *B, + const void *data, size_t count, size_t elem_size, uint16_t align, size_t max_count); + +/** + * Starts a vector on the stack. + * + * Do not use these calls for string or offset vectors, but do store + * scalars, enums and structs, always in little endian encoding. + * + * Use `extend_vector` subsequently to add zero, one or more elements + * at time. + * + * See `create_vector` for `max_count` argument (strings and offset + * vectors have a fixed element size and does not need this argument). + * + * Returns 0 on success. + */ +int flatcc_builder_start_vector(flatcc_builder_t *B, size_t elem_size, + uint16_t align, size_t max_count); + +/** + * Emits the vector constructed on the stack by start_vector. + * + * The vector may be accessed in the emitted stream using the returned + * reference, even if the containing buffer is still under construction. + * This may be useful for sorting. This api does not support sorting + * because offset vectors cannot read their references after emission, + * and while plain vectors could be sorted, it has been chosen that this + * task is better left as a separate processing step. Generated code can + * provide sorting functions that work on final in-memory buffers. + */ +flatcc_builder_ref_t flatcc_builder_end_vector(flatcc_builder_t *B); + +/** Returns the number of elements currently on the stack. */ +size_t flatcc_builder_vector_count(flatcc_builder_t *B); + +/** + * Returns a pointer ot the first vector element on stack, + * accessible up to the number of elements currently on stack. + */ +void *flatcc_builder_vector_edit(flatcc_builder_t *B); + +/** + * Returns a zero initialized buffer to a new region of the vector which + * is extended at the end. The buffer must be consumed before other api + * calls that may affect the stack, including `extend_vector`. + * + * Do not use for strings, offset or union vectors. May be used for nested + * buffers, but these have dedicated calls to provide better alignment. + */ +void *flatcc_builder_extend_vector(flatcc_builder_t *B, size_t count); + +/** + * A specialized `vector_extend` that pushes a single element. + * + * Returns the buffer holding a modifiable copy of the added content, + * or null on error. Note: for structs, care must be taken to ensure + * the source has been zero padded. For this reason it may be better to + * use extend(B, 1) and assign specific fields instead. + */ +void *flatcc_builder_vector_push(flatcc_builder_t *B, const void *data); + +/** + * Pushes multiple elements at a time. + * + * Returns the buffer holding a modifiable copy of the added content, + * or null on error. + */ +void *flatcc_builder_append_vector(flatcc_builder_t *B, const void *data, size_t count); + +/** + * Removes elements already added to vector that has not been ended. + * For example, a vector of parsed list may remove the trailing comma, + * or the vector may simply overallocate to get some temporary working + * space. The total vector size must never become negative. + * + * Returns -1 if the count as larger than current count, or 0 on success. + */ +int flatcc_builder_truncate_vector(flatcc_builder_t *B, size_t count); + +/* + * Similar to `create_vector` but with references that get translated + * into offsets. The references must, as usual, belong to the current + * buffer. Strings, scalar and struct vectors can emit directly without + * stack allocation, but offset vectors must translate the offsets + * and therefore need the temporary space. Thus, this function is + * roughly equivalent to to start, append, end offset vector. + * + * See also `flatcc_builder_create_offset_vector_direct`. + */ +flatcc_builder_ref_t flatcc_builder_create_offset_vector(flatcc_builder_t *B, + const flatcc_builder_ref_t *data, size_t count); + +/* + * NOTE: this call takes non-const source array of references + * and destroys the content. + * + * This is a faster version of `create_offset_vector` where the + * source references are destroyed. In return the vector can be + * emitted directly without passing over the stack. + */ +flatcc_builder_ref_t flatcc_builder_create_offset_vector_direct(flatcc_builder_t *B, + flatcc_builder_ref_t *data, size_t count); + + +/** + * Starts a vector holding offsets to tables or strings. Before + * completion it will hold `flatcc_builder_ref_t` references because the + * offset is not known until the vector start location is known, which + * depends to the final size, which for parsers is generally unknown. + */ +int flatcc_builder_start_offset_vector(flatcc_builder_t *B); + +/** + * Similar to `end_vector` but updates all stored references so they + * become offsets to the vector start. + */ +flatcc_builder_ref_t flatcc_builder_end_offset_vector(flatcc_builder_t *B); + +/** + * Same as `flatcc_builder_end_offset_vector` except null references are + * permitted when the corresponding `type` entry is 0 (the 'NONE' type). + * This makes it possible to build union vectors with less overhead when + * the `type` vector is already known. Use standand offset vector calls + * prior to this call. + */ +flatcc_builder_ref_t flatcc_builder_end_offset_vector_for_unions(flatcc_builder_t *B, + const flatcc_builder_utype_t *type); + +/** Returns the number of elements currently on the stack. */ +size_t flatcc_builder_offset_vector_count(flatcc_builder_t *B); + +/** + * Returns a pointer ot the first vector element on stack, + * accessible up to the number of elements currently on stack. + */ +void *flatcc_builder_offset_vector_edit(flatcc_builder_t *B); + +/** + * Similar to `extend_vector` but returns a buffer indexable as + * `flatcc_builder_ref_t` array. All elements must be set to a valid + * unique non-null reference, but truncate and extend may be used to + * perform edits. Unused references will leave garbage in the buffer. + * References should not originate from any other buffer than the + * current, including parents and nested buffers. It is valid to reuse + * references in DAG form when contained in the sammer, excluding any + * nested, sibling or parent buffers. + */ +flatcc_builder_ref_t *flatcc_builder_extend_offset_vector(flatcc_builder_t *B, size_t count); + +/** Similar to truncate_vector. */ +int flatcc_builder_truncate_offset_vector(flatcc_builder_t *B, size_t count); + +/** + * A specialized extend that pushes a single element. + * + * Returns the buffer holding a modifiable copy of the added content, + * or null on error. + */ +flatcc_builder_ref_t *flatcc_builder_offset_vector_push(flatcc_builder_t *B, + flatcc_builder_ref_t ref); + +/** + * Takes an array of refs as argument to do a multi push operation. + * + * Returns the buffer holding a modifiable copy of the added content, + * or null on error. + */ +flatcc_builder_ref_t *flatcc_builder_append_offset_vector(flatcc_builder_t *B, + const flatcc_builder_ref_t *refs, size_t count); + +/** + * All union vector operations are like offset vector operations, + * except they take a struct with a type and a reference rather than + * just a reference. The finished union vector is returned as a struct + * of two references, one for the type vector and one for the table offset + * vector. Each reference goes to a separate table field where the type + * offset vector id must be one larger than the type vector. + */ + +/** + * Creates a union vector which is in reality two vectors, a type vector + * and an offset vector. Both vectors references are returned. + */ +flatcc_builder_union_vec_ref_t flatcc_builder_create_union_vector(flatcc_builder_t *B, + const flatcc_builder_union_ref_t *urefs, size_t count); + +/* + * NOTE: this call takes non-const source array of references + * and destroys the content. The type array remains intact. + * + * This is a faster version of `create_union_vector` where the source + * references are destroyed and where the types are given in a separate + * array. In return the vector can be emitted directly without passing + * over the stack. + * + * Unlike `create_offset_vector` we do allow null references but only if + * the union type is NONE (0). + */ +flatcc_builder_union_vec_ref_t flatcc_builder_create_union_vector_direct(flatcc_builder_t *B, + const flatcc_builder_utype_t *types, flatcc_builder_ref_t *data, size_t count); + +/* + * Creates just the type vector part of a union vector. This is + * similar to a normal `create_vector` call except that the size + * and alignment are given implicitly. Can be used during + * cloning or similar operations where the types are all given + * but the values must be handled one by one as prescribed by + * the type. The values can be added separately as an offset vector. + */ +flatcc_builder_ref_t flatcc_builder_create_type_vector(flatcc_builder_t *B, + const flatcc_builder_utype_t *types, size_t count); + +/** + * Starts a vector holding types and offsets to tables or strings. Before + * completion it will hold `flatcc_builder_union_ref_t` references because the + * offset is not known until the vector start location is known, which + * depends to the final size, which for parsers is generally unknown, + * and also because the union type must be separated out into a separate + * vector. It would not be practicaly to push on two different vectors + * during construction. + */ +int flatcc_builder_start_union_vector(flatcc_builder_t *B); + +/** + * Similar to `end_vector` but updates all stored references so they + * become offsets to the vector start and splits the union references + * into a type vector and an offset vector. + */ +flatcc_builder_union_vec_ref_t flatcc_builder_end_union_vector(flatcc_builder_t *B); + +/** Returns the number of elements currently on the stack. */ +size_t flatcc_builder_union_vector_count(flatcc_builder_t *B); + +/** + * Returns a pointer ot the first vector element on stack, + * accessible up to the number of elements currently on stack. + */ +void *flatcc_builder_union_vector_edit(flatcc_builder_t *B); + +/** + * Similar to `extend_offset_vector` but returns a buffer indexable as a + * `flatcc_builder_union_ref_t` array. All elements must be set to a valid + * unique non-null reference with a valid union type to match, or it + * must be null with a zero union type. + */ +flatcc_builder_union_ref_t *flatcc_builder_extend_union_vector(flatcc_builder_t *B, size_t count); + +/** Similar to truncate_vector. */ +int flatcc_builder_truncate_union_vector(flatcc_builder_t *B, size_t count); + +/** + * A specialized extend that pushes a single element. + * + * Returns the buffer holding a modifiable copy of the added content, + * or null on error. + */ +flatcc_builder_union_ref_t *flatcc_builder_union_vector_push(flatcc_builder_t *B, + flatcc_builder_union_ref_t uref); + +/** + * Takes an array of union_refs as argument to do a multi push operation. + * + * Returns the buffer holding a modifiable copy of the added content, + * or null on error. + */ +flatcc_builder_union_ref_t *flatcc_builder_append_union_vector(flatcc_builder_t *B, + const flatcc_builder_union_ref_t *urefs, size_t count); + +/** + * Faster string operation that avoids temporary stack storage. The + * string is not required to be zero-terminated, but is expected + * (unchecked) to be utf-8. Embedded zeroes would be allowed but + * ubyte vectors should be used for that. The resulting string will + * have a zero termination added, not included in length. + */ +flatcc_builder_ref_t flatcc_builder_create_string(flatcc_builder_t *B, + const char *s, size_t len); + +/** `create_string` up to zero termination of source. */ +flatcc_builder_ref_t flatcc_builder_create_string_str(flatcc_builder_t *B, + const char *s); + +/** + * `create_string` up to zero termination or at most max_len of source. + * + * Note that like `strncpy` it will include `max_len` characters if + * the source is longer than `max_len`, but unlike `strncpy` it will + * always add zero termination. + */ +flatcc_builder_ref_t flatcc_builder_create_string_strn(flatcc_builder_t *B, const char *s, size_t max_len); + +/** + * Starts an empty string that can be extended subsequently. + * + * While the string is being created, it is guaranteed that there is + * always a null character after the end of the current string length. + * This also holds after `extend` and `append` operations. It is not + * allowed to modify the null character. + * + * Returns 0 on success. + */ +int flatcc_builder_start_string(flatcc_builder_t *B); + +/** + * Similar to `extend_vector` except for the buffer return type and a + * slight speed advantage. Strings are expected to contain utf-8 content + * but this isn't verified, and null characters would be accepted. The + * length is given in bytes. + * + * Appending too much, then truncating can be used to trim string + * escapes during parsing, or convert between unicode formats etc. + */ +char *flatcc_builder_extend_string(flatcc_builder_t *B, size_t len); + +/** + * Concatenes a length of string. If the string contains zeroes (which + * it formally shouldn't), they will be copied in. + * + * Returns the buffer holding a modifiable copy of the added content, + * or null on error. + */ +char *flatcc_builder_append_string(flatcc_builder_t *B, const char *s, size_t len); + +/** `append_string` up to zero termination of source. */ +char *flatcc_builder_append_string_str(flatcc_builder_t *B, const char *s); + +/** `append_string` up zero termination or at most max_len of source. */ +char *flatcc_builder_append_string_strn(flatcc_builder_t *B, const char *s, size_t max_len); + +/** + * Similar to `truncate_vector` available for consistency and a slight + * speed advantage. Reduces string by `len` bytes - it does not set + * the length. The resulting length must not become negative. Zero + * termination is not counted. + * + * Returns -1 of the length becomes negative, 0 on success. + */ +int flatcc_builder_truncate_string(flatcc_builder_t *B, size_t len); + +/** + * Similar to `end_vector` but adds a trailing zero not included + * in the length. The trailing zero is added regardless of whatever + * zero content may exist in the provided string (although it + * formally should not contain any). + */ +flatcc_builder_ref_t flatcc_builder_end_string(flatcc_builder_t *B); + +/** Returns the length of string currently on the stack. */ +size_t flatcc_builder_string_len(flatcc_builder_t *B); + +/** + * Returns a ponter to the start of the string + * accessible up the length of string currently on the stack. + */ +char *flatcc_builder_string_edit(flatcc_builder_t *B); + + +/* + * Only for use with the default emitter. + * + * Fast acces to small buffers from default emitter. + * + * Only valid for default emitters before `flatcc_builder_clear`. The + * return buffer is not valid after a call to `flatcc_builder_reset` or + * `flatcc_builder_clear`. + * + * Returns null if the buffer size is too large to a have a linear + * memory representation or if the emitter is not the default. A valid + * size is between half and a full emitter page size depending on vtable + * content. + * + * Non-default emitters must be accessed by means specific to the + * particular emitter. + * + * If `size_out` is not null, it is set to the buffer size, or 0 if + * operation failed. + * + * The returned buffer should NOT be deallocated explicitly. + * + * The buffer size is the size reported by `flatcc_builder_get_buffer_size`. + */ +void *flatcc_builder_get_direct_buffer(flatcc_builder_t *B, size_t *size_out); + +/* + * Only for use with the default emitter. + * + * Default finalizer that allocates a buffer from the default emitter. + * + * Returns null if memory could not be allocated or if the emitter is + * not the default. This is just a convenience method - there are many + * other possible ways to extract the result of the emitter depending on + * use case. + * + * If `size_out` is not null, it is set to the buffer size, or 0 if + * operation failed. + * + * The allocated buffer is aligned according to malloc which may not be + * sufficient in advanced cases - for that purpose + * `flatcc_builder_finalize_aligned_buffer` may be used. + * + * It may be worth calling `flatcc_builder_get_direct_buffer` first to see + * if the buffer is small enough to avoid copying. + * + * The returned buffer must be deallocated using `free`. + */ +void *flatcc_builder_finalize_buffer(flatcc_builder_t *B, size_t *size_out); + +/* + * Only for use with the default emitter. + * + * Similar to `flatcc_builder_finalize_buffer` but ensures the returned + * memory is aligned to the overall alignment required for the buffer. + * Often it is not necessary unless special operations rely on larger + * alignments than the stored scalars. + * + * If `size_out` is not null, it is set to the buffer size, or 0 if + * operation failed. + * + * The returned buffer must be deallocated using `aligned_free` which is + * implemented via `flatcc_flatbuffers.h`. `free` will usually work but + * is not portable to platforms without posix_memalign or C11 + * aligned_alloc support. + * + * NOTE: if a library might be compiled with a version of aligned_free + * that differs from the application using it, use + * `flatcc_builder_aligned_free` to make sure the correct deallocation + * function is used. + */ +void *flatcc_builder_finalize_aligned_buffer(flatcc_builder_t *B, size_t *size_out); + +/* + * A stable implementation of `aligned_alloc` that is not sensitive + * to the applications compile time flags. + */ +void *flatcc_builder_aligned_alloc(size_t alignment, size_t size); + +/* + * A stable implementation of `aligned_free` that is not sensitive + * to the applications compile time flags. + */ +void flatcc_builder_aligned_free(void *p); + +/* + * Same allocation as `flatcc_builder_finalize_buffer` returnes. Usually + * same as `malloc` but can redefined via macros. + */ +void *flatcc_builder_alloc(size_t size); + +/* + * A stable implementation of `free` when the default allocation + * methods have been redefined. + * + * Deallocates memory returned from `flatcc_builder_finalize_buffer`. + */ +void flatcc_builder_free(void *p); + +/* + * Only for use with the default emitter. + * + * Convenience method to copy buffer from default emitter. Forwards + * call to default emitter and returns input pointer, or null if + * the emitter is not default or of the given size is smaller than + * the buffer size. + * + * Note: the `size` argument is the target buffers capacity, not the + * flatcc_builders buffer size. + * + * Other emitters have custom interfaces for reaching their content. + */ +void *flatcc_builder_copy_buffer(flatcc_builder_t *B, void *buffer, size_t size); + +#ifdef __cplusplus +} +#endif + +#endif /* FLATCC_BUILDER_H */ diff --git a/3rd_party/nanoarrow/flatcc/flatcc_emitter.h b/3rd_party/nanoarrow/flatcc/flatcc_emitter.h new file mode 100644 index 0000000..b8c83b9 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/flatcc_emitter.h @@ -0,0 +1,215 @@ +#ifndef FLATCC_EMITTER_H +#define FLATCC_EMITTER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Default implementation of a flatbuilder emitter. + * + * This may be used as a starting point for more advanced emitters, + * for example writing completed pages to disk or network and + * the recycling those pages. + */ + +#include +#include + +#include "flatcc/flatcc_types.h" +#include "flatcc/flatcc_iov.h" +#include "flatcc/flatcc_alloc.h" + +/* + * The buffer steadily grows during emission but the design allows for + * an extension where individual pages can recycled before the buffer + * is complete, for example because they have been transmitted. + * + * When done, the buffer can be cleared to free all memory, or reset to + * maintain an adaptive page pool for next buffer construction. + * + * Unlike an exponentially growing buffer, each buffer page remains + * stable in memory until reset, clear or recycle is called. + * + * Design notes for possible extensions: + * + * The buffer is a ring buffer marked by a front and a back page. The + * front and back may be the same page and may initially be absent. + * Anything outside these pages are unallocated pages for recycling. + * Any page between (but excluding) the front and back pages may be + * recycled by unlinking and relinking outside the front and back pages + * but then copy operations no longer makes sense. Each page stores the + * logical offset within the buffer but isn't otherwise used by the + * implemention - it might be used for network transmission. The buffer + * is not explicitly designed for multithreaded access but any page + * strictly between front and back is not touched unless recycled and in + * this case aligned allocation is useful to prevent cache line sharing. + */ + +/* + * Memory is allocated in fixed length page units - the first page is + * split between front and back so each get half the page size. If the + * size is a multiple of 128 then each page offset will be a multiple of + * 64, which may be useful for sequencing etc. + */ +#ifndef FLATCC_EMITTER_PAGE_SIZE +#define FLATCC_EMITTER_MAX_PAGE_SIZE 3000 +#define FLATCC_EMITTER_PAGE_MULTIPLE 64 +#define FLATCC_EMITTER_PAGE_SIZE ((FLATCC_EMITTER_MAX_PAGE_SIZE) &\ + ~(2 * (FLATCC_EMITTER_PAGE_MULTIPLE) - 1)) +#endif + +#ifndef FLATCC_EMITTER_ALLOC +#ifdef FLATCC_EMITTER_USE_ALIGNED_ALLOC +/* + * does not always provide aligned_alloc, so include whatever + * is required when enabling this feature. + */ +#define FLATCC_EMITTER_ALLOC(n) aligned_alloc(FLATCC_EMITTER_PAGE_MULTIPLE,\ + (((n) + FLATCC_EMITTER_PAGE_MULTIPLE - 1) & ~(FLATCC_EMITTER_PAGE_MULTIPLE - 1))) +#ifndef FLATCC_EMITTER_FREE +#define FLATCC_EMITTER_FREE(p) aligned_free(p) +#endif +#endif +#endif + +#ifndef FLATCC_EMITTER_ALLOC +#define FLATCC_EMITTER_ALLOC(n) FLATCC_ALLOC(n) +#endif +#ifndef FLATCC_EMITTER_FREE +#define FLATCC_EMITTER_FREE(p) FLATCC_FREE(p) +#endif + +typedef struct flatcc_emitter_page flatcc_emitter_page_t; +typedef struct flatcc_emitter flatcc_emitter_t; + +struct flatcc_emitter_page { + uint8_t page[FLATCC_EMITTER_PAGE_SIZE]; + flatcc_emitter_page_t *next; + flatcc_emitter_page_t *prev; + /* + * The offset is relative to page start, but not necessarily + * to any present content if part of front or back page, + * and undefined for unused pages. + */ + flatbuffers_soffset_t page_offset; +}; + +/* + * Must be allocated and zeroed externally, e.g. on the stack + * then provided as emit_context to the flatbuilder along + * with the `flatcc_emitter` function. + */ +struct flatcc_emitter { + flatcc_emitter_page_t *front, *back; + uint8_t *front_cursor; + size_t front_left; + uint8_t *back_cursor; + size_t back_left; + size_t used; + size_t capacity; + size_t used_average; +}; + +/* Optional helper to ensure emitter is zeroed initially. */ +static inline void flatcc_emitter_init(flatcc_emitter_t *E) +{ + memset(E, 0, sizeof(*E)); +} + +/* Deallocates all buffer memory making the emitter ready for next use. */ +void flatcc_emitter_clear(flatcc_emitter_t *E); + +/* + * Similar to `clear_flatcc_emitter` but heuristacally keeps some allocated + * memory between uses while gradually reducing peak allocations. + * For small buffers, a single page will remain available with no + * additional allocations or deallocations after first use. + */ +void flatcc_emitter_reset(flatcc_emitter_t *E); + +/* + * Helper function that allows a page between front and back to be + * recycled while the buffer is still being constructed - most likely as part + * of partial copy or transmission. Attempting to recycle front or back + * pages will result in an error. Recycling pages outside the + * front and back will be valid but pointless. After recycling and copy + * operations are no longer well-defined and should be replaced with + * whatever logic is recycling the pages. The reset operation + * automatically recycles all (remaining) pages when emission is + * complete. After recycling, the `flatcc_emitter_size` function will + * return as if recycle was not called, but will only represent the + * logical size, not the size of the active buffer. Because a recycled + * page is fully utilized, it is fairly easy to compensate for this if + * required. + * + * Returns 0 on success. + */ +int flatcc_emitter_recycle_page(flatcc_emitter_t *E, flatcc_emitter_page_t *p); + +/* + * The amount of data copied with `flatcc_emitter_copy_buffer` and related + * functions. Normally called at end of buffer construction but is + * always valid, as is the copy functions. The size is a direct + * function of the amount emitted data so the flatbuilder itself can + * also provide this information. + */ +static inline size_t flatcc_emitter_get_buffer_size(flatcc_emitter_t *E) +{ + return E->used; +} + +/* + * Returns buffer start iff the buffer fits on a single internal page. + * Only useful for fairly small buffers - about half the page size since + * one half of first page goes to vtables that likely use little space. + * Returns null if request could not be served. + * + * If `size_out` is not null, it is set to the buffer size, or 0 if + * operation failed. + */ +static inline void *flatcc_emitter_get_direct_buffer(flatcc_emitter_t *E, size_t *size_out) +{ + if (E->front == E->back) { + if (size_out) { + *size_out = E->used; + } + return E->front_cursor; + } + if (size_out) { + *size_out = 0; + } + return 0; +} + +/* + * Copies the internal flatcc_emitter representation to an externally + * provided linear buffer that must have size `flatcc_emitter_get_size`. + * + * If pages have been recycled, only the remaining pages will be copied + * and thus less data than what `flatcc_emitter_get_size` would suggest. It + * makes more sense to provide a customized copy operation when + * recycling pages. + * + * If the buffer is too small, nothing is copied, otherwise the + * full buffer is copied and the input buffer is returned. + */ +void *flatcc_emitter_copy_buffer(flatcc_emitter_t *E, void *buf, size_t size); + +/* + * The emitter interface function to the flatbuilder API. + * `emit_context` should be of type `flatcc_emitter_t` for this + * particular implementation. + * + * This function is compatible with the `flatbuilder_emit_fun` + * type defined in "flatbuilder.h". + */ +int flatcc_emitter(void *emit_context, + const flatcc_iovec_t *iov, int iov_count, + flatbuffers_soffset_t offset, size_t len); + +#ifdef __cplusplus +} +#endif + +#endif /* FLATCC_EMITTER_H */ diff --git a/3rd_party/nanoarrow/flatcc/flatcc_endian.h b/3rd_party/nanoarrow/flatcc/flatcc_endian.h new file mode 100644 index 0000000..0592f31 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/flatcc_endian.h @@ -0,0 +1,125 @@ +#ifndef FLATCC_ENDIAN_H +#define FLATCC_ENDIAN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This file provides helper macros to define type-specific macros and + * inline functions that convert between stored data and native data + * indedpently of both native (host) endianness and protocol endianness + * (i.e. the serialized endian format). + * + * To detect endianness correctly ensure one of the following is defined. + * + * __LITTLE_ENDIAN__ + * __BIG_ENDIAN__ + * FLATBUFFERS_LITTLEENDIAN=1 + * FLATBUFFERS_LITTLEENDIAN=0 + * + * Note: the Clang compiler likely already does this, but other + * compilers may have their own way, if at all. + * + * It is also necessary to include or a compatible + * implementation in order to provide: + * + * le16toh, le32to, le64toh, be16toh, be32toh, be64toh, + * htole16, htole32, htole64, htobe16, htobe32, htobe64. + * + * A simple way to ensure all of the above for most platforms is + * to include the portable endian support file: + * + * #include "flatcc/portable/pendian.h" + * + * It is also necessary to include + * + * #include "flatcc/flatcc_types.h" + * + * or an equivalent file. This makes it possible to change the + * endianness of the serialized data and the sizes of flatbuffer + * specific types such as `uoffset_t`. + * + * Note: the mentioned include files are likely already included + * by the file including this file, at least for the default + * configuration. + */ + +#ifndef UINT8_t +#include +#endif + +/* These are needed to simplify accessor macros and are not found in . */ +#ifndef le8toh +#define le8toh(n) (n) +#endif + +#ifndef be8toh +#define be8toh(n) (n) +#endif + +#ifndef htole8 +#define htole8(n) (n) +#endif + +#ifndef htobe8 +#define htobe8(n) (n) +#endif + +#include "flatcc/flatcc_accessors.h" + +/* This is the binary encoding endianness, usually LE for flatbuffers. */ +#if FLATBUFFERS_PROTOCOL_IS_LE +#define flatbuffers_endian le +#elif FLATBUFFERS_PROTOCOL_IS_BE +#define flatbuffers_endian be +#else +#error "flatbuffers has no defined endiannesss" +#endif + + __flatcc_define_basic_scalar_accessors(flatbuffers_, flatbuffers_endian) + + __flatcc_define_integer_accessors(flatbuffers_bool, flatbuffers_bool_t, + FLATBUFFERS_BOOL_WIDTH, flatbuffers_endian) + __flatcc_define_integer_accessors(flatbuffers_union_type, flatbuffers_union_type_t, + FLATBUFFERS_UTYPE_WIDTH, flatbuffers_endian) + + __flatcc_define_integer_accessors(__flatbuffers_uoffset, flatbuffers_uoffset_t, + FLATBUFFERS_UOFFSET_WIDTH, flatbuffers_endian) + __flatcc_define_integer_accessors(__flatbuffers_soffset, flatbuffers_soffset_t, + FLATBUFFERS_SOFFSET_WIDTH, flatbuffers_endian) + __flatcc_define_integer_accessors(__flatbuffers_voffset, flatbuffers_voffset_t, + FLATBUFFERS_VOFFSET_WIDTH, flatbuffers_endian) + __flatcc_define_integer_accessors(__flatbuffers_utype, flatbuffers_utype_t, + FLATBUFFERS_UTYPE_WIDTH, flatbuffers_endian) + __flatcc_define_integer_accessors(__flatbuffers_thash, flatbuffers_thash_t, + FLATBUFFERS_THASH_WIDTH, flatbuffers_endian) + +/* flatcc/portable/pendian.h sets LITTLE/BIG flags if possible, and always defines le16toh. */ +#ifndef flatbuffers_is_native_pe +#if defined(__LITTLE_ENDIAN__) || FLATBUFFERS_LITTLEENDIAN +#undef FLATBUFFERS_LITTLEENDIAN +#define FLATBUFFERS_LITTLEENDIAN 1 +#define flatbuffers_is_native_pe() (FLATBUFFERS_PROTOCOL_IS_LE) +#elif defined(__BIG_ENDIAN__) || (defined(FLATBUFFERS_LITTLEENDIAN) && !FLATBUFFERS_LITTLEENDIAN) +#undef FLATBUFFERS_LITTLEENDIAN +#define FLATBUFFERS_LITTLEENDIAN 0 +#define flatbuffers_is_native_pe() (FLATBUFFERS_PROTOCOL_IS_BE) +#else +#define flatbuffers_is_native_pe() (__FLATBUFFERS_CONCAT(flatbuffers_endian, 16toh)(1) == 1) +#endif +#endif + +#ifndef flatbuffers_is_native_le +#define flatbuffers_is_native_le() flatbuffers_is_native_pe() +#endif + +#ifndef flatbuffers_is_native_be +#define flatbuffers_is_native_be() (!flatbuffers_is_native_pe()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* FLATCC_ENDIAN_H */ diff --git a/3rd_party/nanoarrow/flatcc/flatcc_epilogue.h b/3rd_party/nanoarrow/flatcc/flatcc_epilogue.h new file mode 100644 index 0000000..e43114d --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/flatcc_epilogue.h @@ -0,0 +1,7 @@ +/* Include guard intentionally left out. */ + +#ifdef __cplusplus +} +#endif + +#include "flatcc/portable/pdiagnostic_pop.h" diff --git a/3rd_party/nanoarrow/flatcc/flatcc_flatbuffers.h b/3rd_party/nanoarrow/flatcc/flatcc_flatbuffers.h new file mode 100644 index 0000000..6b17583 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/flatcc_flatbuffers.h @@ -0,0 +1,57 @@ +/* + * Even C11 compilers depend on clib support for `static_assert` which + * isn't always present, so we deal with this here for all compilers. + * + * Outside include guard to handle scope counter. + */ +#include "flatcc/portable/pstatic_assert.h" + +#ifndef FLATCC_FLATBUFFERS_H +#define FLATCC_FLATBUFFERS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef flatcc_flatbuffers_defined +#define flatcc_flatbuffers_defined + +#ifdef FLATCC_PORTABLE +#include "flatcc/flatcc_portable.h" +#endif +#include "flatcc/portable/pwarnings.h" +/* Needed by C99 compilers without FLATCC_PORTABLE. */ +#include "flatcc/portable/pstdalign.h" + +/* Handle fallthrough attribute in switch statements. */ +#include "flatcc/portable/pattributes.h" + +#include "flatcc/flatcc_alloc.h" +#include "flatcc/flatcc_assert.h" + +#define __FLATBUFFERS_PASTE2(a, b) a ## b +#define __FLATBUFFERS_PASTE3(a, b, c) a ## b ## c +#define __FLATBUFFERS_CONCAT(a, b) __FLATBUFFERS_PASTE2(a, b) + +/* + * "flatcc_endian.h" requires the preceeding include files, + * or compatible definitions. + */ +#include "flatcc/portable/pendian.h" +/* Needed by flatcc_accessors.h to handle strict aliasing rules. */ +#include "flatcc/portable/pmemaccess.h" +#include "flatcc/flatcc_types.h" +#include "flatcc/flatcc_endian.h" +#include "flatcc/flatcc_identifier.h" + +#ifndef FLATBUFFERS_WRAP_NAMESPACE +#define FLATBUFFERS_WRAP_NAMESPACE(ns, x) ns ## _ ## x +#endif + +#endif /* flatcc_flatbuffers_defined */ + +#ifdef __cplusplus +} +#endif + +#endif /* FLATCC_FLATBUFFERS_H */ diff --git a/3rd_party/nanoarrow/flatcc/flatcc_identifier.h b/3rd_party/nanoarrow/flatcc/flatcc_identifier.h new file mode 100644 index 0000000..825f0fd --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/flatcc_identifier.h @@ -0,0 +1,148 @@ +#ifndef FLATCC_IDENTIFIER_H +#define FLATCC_IDENTIFIER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef FLATCC_FLATBUFFERS_H +#error "include via flatcc/flatcc_flatbuffers.h" +#endif + +#ifndef UINT8_MAX +#include +#endif + +/* + * FlatBuffers identifiers are normally specified by "file_identifer" in + * the schema, but a standard hash of the fully qualified type name can + * also be used. This file implements such a mapping, but the generated + * headers also contain the necessary information for known types. + */ + + +/* + * Returns the type hash of a given name in native endian format. + * Generated code already provides these, but if a name was changed + * in the schema it may be relevant to recompute the hash manually. + * + * The wire-format of this value should always be little endian. + * + * Note: this must be the fully qualified name, e.g. in the namespace + * "MyGame.Example": + * + * flatbuffers_type_hash_from_name("MyGame.Example.Monster"); + * + * or, in the global namespace just: + * + * flatbuffers_type_hash_from_name("MyTable"); + * + * This assumes 32 bit hash type. For other sizes, other FNV-1a + * constants would be required. + * + * Note that we reserve hash value 0 for missing or ignored value. + */ +static inline flatbuffers_thash_t flatbuffers_type_hash_from_name(const char *name) +{ + uint32_t hash = UINT32_C(2166136261); + while (*name) { + hash ^= (unsigned char)*name; + hash = hash * UINT32_C(16777619); + ++name; + } + if (hash == 0) { + hash = UINT32_C(2166136261); + } + return hash; +} + +/* + * Type hash encoded as little endian file identifier string. + * Note: if type hash is 0, the identifier should be null which + * we cannot return in this interface. + */ +static inline void flatbuffers_identifier_from_type_hash(flatbuffers_thash_t type_hash, flatbuffers_fid_t out_identifier) +{ + out_identifier[0] = (char)(type_hash & 0xff); + type_hash >>= 8; + out_identifier[1] = (char)(type_hash & 0xff); + type_hash >>= 8; + out_identifier[2] = (char)(type_hash & 0xff); + type_hash >>= 8; + out_identifier[3] = (char)(type_hash & 0xff); +} + +/* Native integer encoding of file identifier. */ +static inline flatbuffers_thash_t flatbuffers_type_hash_from_identifier(const flatbuffers_fid_t identifier) +{ + uint8_t *p = (uint8_t *)identifier; + + return identifier ? + (uint32_t)p[0] + (((uint32_t)p[1]) << 8) + (((uint32_t)p[2]) << 16) + (((uint32_t)p[3]) << 24) : 0; +} + +/* + * Convert a null terminated string identifier like "MONS" or "X" into a + * native type hash identifier, usually for comparison. This will not + * work with type hash strings because they can contain null bytes. + */ +static inline flatbuffers_thash_t flatbuffers_type_hash_from_string(const char *identifier) +{ + flatbuffers_thash_t h = 0; + const uint8_t *p = (const uint8_t *)identifier; + + if (!p[0]) return h; + h += ((flatbuffers_thash_t)p[0]); + if (!p[1]) return h; + h += ((flatbuffers_thash_t)p[1]) << 8; + if (!p[2]) return h; + h += ((flatbuffers_thash_t)p[2]) << 16; + /* No need to test for termination here. */ + h += ((flatbuffers_thash_t)p[3]) << 24; + return h; +} + +/* + * Computes the little endian wire format of the type hash. It can be + * used as a file identifer argument to various flatcc buffer calls. + * + * `flatbuffers_fid_t` is just `char [4]` for the default flatbuffers + * type system defined in `flatcc/flatcc_types.h`. + */ +static inline void flatbuffers_identifier_from_name(const char *name, flatbuffers_fid_t out_identifier) +{ + flatbuffers_identifier_from_type_hash(flatbuffers_type_hash_from_name(name), out_identifier); +} + +/* + * This is a collision free hash (a permutation) of the type hash to + * provide better distribution for use in hash tables. It is likely not + * necessary in praxis, and for uniqueness of identifiers it provides no + * advantage over just using the FNV-1a type hash, except when truncating + * the identifier to less than 32-bits. + * + * Note: the output should not be used in transmission. It provides no + * additional information and just complicates matters. Furthermore, the + * unmodified type hash has the benefit that it can seed a child namespace. + */ +static inline uint32_t flatbuffers_disperse_type_hash(flatbuffers_thash_t type_hash) +{ + /* http://stackoverflow.com/a/12996028 */ + uint32_t x = type_hash; + + x = ((x >> 16) ^ x) * UINT32_C(0x45d9f3b); + x = ((x >> 16) ^ x) * UINT32_C(0x45d9f3b); + x = ((x >> 16) ^ x); + return x; +} + + +/* We have hardcoded assumptions about identifier size. */ +static_assert(sizeof(flatbuffers_fid_t) == 4, "unexpected file identifier size"); +static_assert(sizeof(flatbuffers_thash_t) == 4, "unexpected type hash size"); + +#ifdef __cplusplus +} +#endif + +#endif /* FLATCC_IDENTIFIER_H */ diff --git a/3rd_party/nanoarrow/flatcc/flatcc_iov.h b/3rd_party/nanoarrow/flatcc/flatcc_iov.h new file mode 100644 index 0000000..a6d27f8 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/flatcc_iov.h @@ -0,0 +1,31 @@ +#ifndef FLATCC_IOV_H +#define FLATCC_IOV_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * The emitter receives one, or a few buffers at a time via + * this type. compatible iovec structure used for + * allocation and emitter interface. + */ +typedef struct flatcc_iovec flatcc_iovec_t; +struct flatcc_iovec { + void *iov_base; + size_t iov_len; +}; + +/* + * The largest iovec vector the builder will issue. It will + * always be a relatively small number. + */ +#define FLATCC_IOV_COUNT_MAX 8 + +#ifdef __cplusplus +} +#endif + +#endif /* FLATCC_IOV_H */ diff --git a/3rd_party/nanoarrow/flatcc/flatcc_portable.h b/3rd_party/nanoarrow/flatcc/flatcc_portable.h new file mode 100644 index 0000000..9b0eb0c --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/flatcc_portable.h @@ -0,0 +1,14 @@ +#ifndef FLATCC_PORTABLE_H +#define FLATCC_PORTABLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "flatcc/portable/portable_basic.h" + +#ifdef __cplusplus +} +#endif + +#endif /* FLATCC_PORTABLE_H */ diff --git a/3rd_party/nanoarrow/flatcc/flatcc_prologue.h b/3rd_party/nanoarrow/flatcc/flatcc_prologue.h new file mode 100644 index 0000000..3a74ed6 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/flatcc_prologue.h @@ -0,0 +1,8 @@ +/* Include guard intentionally left out. */ + +#define PDIAGNOSTIC_IGNORE_UNUSED +#include "flatcc/portable/pdiagnostic_push.h" + +#ifdef __cplusplus +extern "C" { +#endif diff --git a/3rd_party/nanoarrow/flatcc/flatcc_refmap.h b/3rd_party/nanoarrow/flatcc/flatcc_refmap.h new file mode 100644 index 0000000..062d94f --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/flatcc_refmap.h @@ -0,0 +1,144 @@ +/* + * The flatcc builder supports storing a pointer to a refmap + * and wraps some operations to make them work as a dummy + * even if no refmap has been set. This enables optional + * DAG preservation possible during clone operations. + * + * A refmap maps a source address to a builder reference. + * + * This is just a map, but the semantics are important: + * + * The map thus preserves identity of the source. It is not a + * cache because cache eviction would fail to properly track + * identity. + * + * The map is used for memoization during object cloning are and + * may also be used by user logic doing similar operations. + * This ensures that identity is preserved so a source object is + * not duplicated which could lead to either loss of semantic + * information, or an explosion in size, or both. In some, or + * even most, cases this concern may not be important, but when + * it is important, it is important. + * + * The source address must not be reused for different content + * for the lifetime of the map, although the content doest not + * have to be valid or event exist at that location since source + * address is just used as a key. + * + * The lifetime may be a single clone operation which then + * tracks child object references as well, or it may be the + * lifetime of the buffer builder. + * + * The map may be flushed explicitly when the source addresses + * are no longer unique, such as when reusing a memory buffer, + * and when identity preservation is no longer important. + * Flushing a map is esentially the same as ending a lifetime. + * + * Multiple maps may exist concurrently for example if cloning + * an object twice into two new objects that should have + * separate identities. This is especially true and necessary + * when creating a new nested buffer because the nested buffer + * cannot share references with the parent. Cloning and object + * that contains a nested buffer does not require multiple maps + * because the nested buffer is then opaque. + */ + +#ifndef FLATCC_REFMAP_H +#define FLATCC_REFMAP_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "flatcc/flatcc_types.h" + +#ifndef FLATCC_REFMAP_MIN_BUCKETS +/* 8 buckets gives us 5 useful initial entries with a load factor of 0.7 */ +#define FLATCC_REFMAP_MIN_BUCKETS 8 +#endif + +#define FLATCC_REFMAP_LOAD_FACTOR 0.7f + +typedef struct flatcc_refmap flatcc_refmap_t; +typedef flatbuffers_soffset_t flatcc_refmap_ref_t; + +static const flatcc_refmap_ref_t flatcc_refmap_not_found = 0; + +struct flatcc_refmap_item { + const void *src; + flatcc_refmap_ref_t ref; +}; + +struct flatcc_refmap { + size_t count; + size_t buckets; + struct flatcc_refmap_item *table; + /* Use stack allocation for small maps. */ + struct flatcc_refmap_item min_table[FLATCC_REFMAP_MIN_BUCKETS]; +}; + +/* + * Fast zero initialization - does not allocate any memory. + * May be replaced by memset 0, but `init` avoids clearing the + * stack allocated initial hash table until it is needed. + */ +static inline int flatcc_refmap_init(flatcc_refmap_t *refmap) +{ + refmap->count = 0; + refmap->buckets = 0; + refmap->table = 0; + return 0; +} + +/* + * Removes all items and deallocates memory. + * Not required unless `insert` or `resize` took place. The map can be + * reused subsequently without calling `init`. + */ +void flatcc_refmap_clear(flatcc_refmap_t *refmap); + +/* + * Keeps allocated memory as is, but removes all items. The map + * must intialized first. + */ +void flatcc_refmap_reset(flatcc_refmap_t *refmap); + +/* + * Returns the inserted reference if the `src` pointer was found, + * without inspecting the content of the `src` pointer. + * + * Returns flatcc_refmap_not_found (default 0) if the `src` pointer was + * not found. + */ +flatcc_refmap_ref_t flatcc_refmap_find(flatcc_refmap_t *refmap, const void *src); + +/* + * Inserts a `src` source pointer and its associated `ref` reference + * into the refmap without inspecting the `src` pointer content. The + * `ref` value will be replaced if the the `src` pointer already exists. + * + * Inserting null will just return the ref without updating the map. + * + * There is no delete operation which simplifies an open + * addressing hash table, and it isn't needed for this use case. + * + * Returns the input ref or not_found on allocation error. + */ +flatcc_refmap_ref_t flatcc_refmap_insert(flatcc_refmap_t *refmap, const void *src, flatcc_refmap_ref_t ref); + +/* + * Set the hash table to accommodate at least `count` items while staying + * within the predefined load factor. + * + * Resize is primarily an internal operation, but the user may resize + * ahead of a large anticipated load, or after a large load to shrink + * the table using 0 as the `count` argument. The table never shrinks + * on its own account. + */ +int flatcc_refmap_resize(flatcc_refmap_t *refmap, size_t count); + +#ifdef __cplusplus +} +#endif + +#endif /* FLATCC_REFMAP_H */ diff --git a/3rd_party/nanoarrow/flatcc/flatcc_rtconfig.h b/3rd_party/nanoarrow/flatcc/flatcc_rtconfig.h new file mode 100644 index 0000000..32b80da --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/flatcc_rtconfig.h @@ -0,0 +1,171 @@ +#ifndef FLATCC_RTCONFIG_H +#define FLATCC_RTCONFIG_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Include portability layer here since all other files depend on it. */ +#ifdef FLATCC_PORTABLE +#include "flatcc/portable/portable.h" +#endif + +/* + * Fast printing and parsing of double. + * + * This requires the grisu3/grisu3_* files to be in the include path, + * otherwise strod and sprintf will be used (these needed anyway + * as fallback for cases not supported by grisu3). + */ +#ifndef FLATCC_USE_GRISU3 +#define FLATCC_USE_GRISU3 1 +#endif + +/* + * This requires compiler that has enabled marc=native or similar so + * __SSE4_2__ flag is defined. Otherwise it will have no effect. + * + * While SSE may be used for different purposes, it has (as of this + * writing) only be used to test the effect on JSON whitespace handling + * which improved, but not by a lot, assuming 64-bit unligned access is + * otherwise available: + * + * With 8 space indentation, the JSON benchmark handles 308K parse ops/sec + * while SSE ups that to 333 parse ops/sec or 336 if \r\n is also + * consumed by SSE. Disabling indentation leaves SSE spacing handling + * ineffective, and performance reaches 450K parse ops/sec and can + * improve further to 500+K parse ops/sec if inexact GRISU3 numbers are + * allowed (they are pretty accurate anyway, just not exact). This + * feature requires hacking a flag direct in the grisu3 double parsing + * lib directly and only mentioned for comparison. + * + * In conclusion SSE doesn't add a lot to JSON space handling at least. + * + * Disabled by default, but can be overriden by build system. + */ +#ifndef FLATCC_USE_SSE4_2 +#define FLATCC_USE_SSE4_2 0 +#endif + +/* + * The verifier only reports yes and no. The following setting + * enables assertions in debug builds. It must be compiled into + * the runtime library and is not normally the desired behavior. + * + * NOTE: enabling this can break test cases so use with build, not test. + */ +#if !defined(FLATCC_DEBUG_VERIFY) && !defined(NDEBUG) +#define FLATCC_DEBUG_VERIFY 0 +#endif + +#if !defined(FLATCC_TRACE_VERIFY) +#define FLATCC_TRACE_VERIFY 0 +#endif + +/* + * Some producers allow empty vectors to be misaligned. + * The following setting will cause the verifier to require the index 0 + * position to be element aligned even if the vector is empty (otherwise that + * position is only required to be aligned to the preceding size field). + */ +#if !defined(FLATCC_ENFORCE_ALIGNED_EMPTY_VECTORS) +#define FLATCC_ENFORCE_ALIGNED_EMPTY_VECTORS 0 +#endif + +/* + * Limit recursion level for tables. Actual level may be deeper + * when structs are deeply nested - but these are limited by the + * schema compiler. + */ +#ifndef FLATCC_JSON_PRINT_MAX_LEVELS +#define FLATCC_JSON_PRINT_MAX_LEVELS 100 +#endif + +/* Maximum length of names printed exluding _type suffix. */ +#ifndef FLATCC_JSON_PRINT_NAME_LEN_MAX +#define FLATCC_JSON_PRINT_NAME_LEN_MAX 100 +#endif + +/* + * Print float and double values with C99 hexadecimal floating point + * notation. This option is not valid JSON but it avoids precision + * loss, correctly handles NaN, +/-Infinity and is significantly faster + * to parse and print. Some JSON parsers rely on strtod which does + * support hexadecimal floating points when C99 compliant. + */ +#ifndef FLATCC_JSON_PRINT_HEX_FLOAT +#define FLATCC_JSON_PRINT_HEX_FLOAT 0 +#endif + +/* + * Always print multipe enum flags like `color: "Red Green"` + * even when unquote is selected as an option for single + * value like `color: Green`. Otherwise multiple values + * are printed as `color: Red Green`, but this could break + * some flatbuffer json parser. + */ +#ifndef FLATCC_JSON_PRINT_ALWAYS_QUOTE_MULTIPLE_FLAGS +#define FLATCC_JSON_PRINT_ALWAYS_QUOTE_MULTIPLE_FLAGS 1 +#endif + +/* + * The general nesting limit may be lower, but for skipping + * JSON we do not need to - we can set this high as it only + * costs a single char per level in a stack array. + */ +#ifndef FLATCC_JSON_PARSE_GENERIC_MAX_NEST +#define FLATCC_JSON_PARSE_GENERIC_MAX_NEST 512 +#endif + +/* Store value even if it is default. */ +#ifndef FLATCC_JSON_PARSE_FORCE_DEFAULTS +#define FLATCC_JSON_PARSE_FORCE_DEFAULTS 0 +#endif + +#ifndef FLATCC_JSON_PARSE_ALLOW_UNQUOTED +#define FLATCC_JSON_PARSE_ALLOW_UNQUOTED 1 +#endif + +/* + * Multiple enum values are by default not permitted unless + * quoted like `color: "Red Green" as per Googles flatc JSON + * parser while a single value like `color: Red` can be + * unquoted. Enabling this setting will allow `color: Red + * Green`, but only if FLATCC_JSON_PARSE_ALLOW_UNQUOTED is + * also enabled. + */ +#ifndef FLATCC_JSON_PARSE_ALLOW_UNQUOTED_LIST +#define FLATCC_JSON_PARSE_ALLOW_UNQUOTED_LIST 0 +#endif + +#ifndef FLATCC_JSON_PARSE_ALLOW_UNKNOWN_FIELD +#define FLATCC_JSON_PARSE_ALLOW_UNKNOWN_FIELD 1 +#endif + +#ifndef FLATCC_JSON_PARSE_ALLOW_TRAILING_COMMA +#define FLATCC_JSON_PARSE_ALLOW_TRAILING_COMMA 1 +#endif + +/* + * Just parse to the closing bracket '}' if set. + * Otherwise parse to end by consuming space and + * fail if anything but space follows. + */ +#ifndef FLATCC_PARSE_IGNORE_TRAILING_DATA +#define FLATCC_PARSE_IGNORE_TRAILING_DATA 0 +#endif + +/* + * Optimize to parse a lot of white space, but + * in most cases it probably slows parsing down. + */ +#ifndef FLATCC_JSON_PARSE_WIDE_SPACE +#define FLATCC_JSON_PARSE_WIDE_SPACE 0 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* FLATCC_RTCONFIG_H */ diff --git a/3rd_party/nanoarrow/flatcc/flatcc_types.h b/3rd_party/nanoarrow/flatcc/flatcc_types.h new file mode 100644 index 0000000..69605d2 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/flatcc_types.h @@ -0,0 +1,97 @@ +#ifndef FLATCC_TYPES_H +#define FLATCC_TYPES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifndef UINT8_MAX +#include +#endif + +/* + * This should match generated type declaratios in + * `flatbuffers_common_reader.h` (might have different name prefix). + * Read only generated code does not depend on library code, + * hence the duplication. + */ +#ifndef flatbuffers_types_defined +#define flatbuffers_types_defined + +/* + * uoffset_t and soffset_t must be same integer type, except for sign. + * They can be (u)int16_t, (u)int32_t, or (u)int64_t. + * The default is (u)int32_t. + * + * voffset_t is expected to be uint16_t, but can experimentally be + * compiled from uint8_t up to uint32_t. + * + * ID_MAX is the largest value that can index a vtable. The table size + * is given as voffset value. Each id represents a voffset value index + * from 0 to max inclusive. Space is required for two header voffset + * fields and the unaddressible highest index (due to the table size + * representation). For 16-bit voffsets this yields a max of 2^15 - 4, + * or (2^16 - 1) / 2 - 3. + */ + +#define flatbuffers_uoffset_t_defined +#define flatbuffers_soffset_t_defined +#define flatbuffers_voffset_t_defined +#define flatbuffers_utype_t_defined +#define flatbuffers_bool_t_defined +#define flatbuffers_thash_t_defined +#define flatbuffers_fid_t_defined + +/* uoffset_t is also used for vector and string headers. */ +#define FLATBUFFERS_UOFFSET_MAX UINT32_MAX +#define FLATBUFFERS_SOFFSET_MAX INT32_MAX +#define FLATBUFFERS_SOFFSET_MIN INT32_MIN +#define FLATBUFFERS_VOFFSET_MAX UINT16_MAX +#define FLATBUFFERS_UTYPE_MAX UINT8_MAX +/* Well - the max of the underlying type. */ +#define FLATBUFFERS_BOOL_MAX UINT8_MAX +#define FLATBUFFERS_THASH_MAX UINT32_MAX + +#define FLATBUFFERS_ID_MAX (FLATBUFFERS_VOFFSET_MAX / sizeof(flatbuffers_voffset_t) - 3) +/* Vectors of empty structs can yield div by zero, so we must guard against this. */ +#define FLATBUFFERS_COUNT_MAX(elem_size) (FLATBUFFERS_UOFFSET_MAX/((elem_size) == 0 ? 1 : (elem_size))) + +#define FLATBUFFERS_UOFFSET_WIDTH 32 +#define FLATBUFFERS_COUNT_WIDTH 32 +#define FLATBUFFERS_SOFFSET_WIDTH 32 +#define FLATBUFFERS_VOFFSET_WIDTH 16 +#define FLATBUFFERS_UTYPE_WIDTH 8 +#define FLATBUFFERS_BOOL_WIDTH 8 +#define FLATBUFFERS_THASH_WIDTH 32 + +#define FLATBUFFERS_TRUE 1 +#define FLATBUFFERS_FALSE 0 + +#define FLATBUFFERS_PROTOCOL_IS_LE 1 +#define FLATBUFFERS_PROTOCOL_IS_BE 0 + +typedef uint32_t flatbuffers_uoffset_t; +typedef int32_t flatbuffers_soffset_t; +typedef uint16_t flatbuffers_voffset_t; +typedef uint8_t flatbuffers_utype_t; +typedef uint8_t flatbuffers_bool_t; +typedef uint32_t flatbuffers_thash_t; +/* Public facing type operations. */ +typedef flatbuffers_utype_t flatbuffers_union_type_t; + +static const flatbuffers_bool_t flatbuffers_true = FLATBUFFERS_TRUE; +static const flatbuffers_bool_t flatbuffers_false = FLATBUFFERS_FALSE; + +#define FLATBUFFERS_IDENTIFIER_SIZE (FLATBUFFERS_THASH_WIDTH / 8) + +typedef char flatbuffers_fid_t[FLATBUFFERS_IDENTIFIER_SIZE]; + +#endif /* flatbuffers_types_defined */ + +#ifdef __cplusplus +} +#endif + +#endif /* FLATCC_TYPES_H */ diff --git a/3rd_party/nanoarrow/flatcc/flatcc_verifier.h b/3rd_party/nanoarrow/flatcc/flatcc_verifier.h new file mode 100644 index 0000000..eb19b64 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/flatcc_verifier.h @@ -0,0 +1,267 @@ +#ifndef FLATCC_VERIFIER_H +#define FLATCC_VERIFIER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Runtime support for verifying flatbuffers. + * + * Link with the verifier implementation file. + * + * Note: + * + * 1) nested buffers will NOT have their identifier verified. + * The user may do so subsequently. The reason is in part because + * the information is not readily avaible without generated reader code, + * in part because the buffer might use a different, but valid, + * identifier and the user has no chance of specifiying this in the + * verifier code. The root verifier also doesn't assume a specific id + * but accepts a user supplied input which may be null. + * + * 2) All offsets in a buffer are verified for alignment relative to the + * buffer start, but the buffer itself is only assumed to aligned to + * uoffset_t. A reader should therefore ensure buffer alignment separately + * before reading the buffer. Nested buffers are in fact checked for + * alignment, but still only relative to the root buffer. + * + * 3) The max nesting level includes nested buffer nestings, so the + * verifier might fail even if the individual buffers are otherwise ok. + * This is to prevent abuse with lots of nested buffers. + * + * + * IMPORTANT: + * + * Even if verifier passes, the buffer may be invalid to access due to + * lack of alignemnt in memory, but the verifier is safe to call. + * + * NOTE: The buffer is not safe to modify after verification because an + * attacker may craft overlapping data structures such that modification + * of one field updates another in a way that violates the buffer + * constraints. This may also be caused by a clever compression scheme. + * + * It is likely faster to rewrite the table although this is also + * dangerous because an attacker (or even normal user) can draft a DAG + * that explodes when expanded carelesslessly. A safer approach is to + * hash all object references written and reuse those that match. This + * will expand references into other objects while bounding expansion + * and it will be safe to update assuming shared objects are ok to + * update. + * + */ + +#include "flatcc/flatcc_types.h" + +#define FLATCC_VERIFY_ERROR_MAP(XX)\ + XX(ok, "ok")\ + XX(buffer_header_too_small, "buffer header too small")\ + XX(identifier_mismatch, "identifier mismatch")\ + XX(max_nesting_level_reached, "max nesting level reached")\ + XX(required_field_missing, "required field missing")\ + XX(runtime_buffer_header_not_aligned, "runtime: buffer header not aligned")\ + XX(runtime_buffer_size_too_large, "runtime: buffer size too large")\ + XX(string_not_zero_terminated, "string not zero terminated")\ + XX(string_out_of_range, "string out of range")\ + XX(struct_out_of_range, "struct out of range")\ + XX(struct_size_overflow, "struct size overflow")\ + XX(struct_unaligned, "struct unaligned")\ + XX(table_field_not_aligned, "table field not aligned")\ + XX(table_field_out_of_range, "table field out of range")\ + XX(table_field_size_overflow, "table field size overflow")\ + XX(table_header_out_of_range_or_unaligned, "table header out of range or unaligned")\ + XX(vector_header_out_of_range_or_unaligned, "vector header out of range or unaligned")\ + XX(string_header_out_of_range_or_unaligned, "string header out of range or unaligned")\ + XX(offset_out_of_range, "offset out of range")\ + XX(table_offset_out_of_range_or_unaligned, "table offset out of range or unaligned")\ + XX(table_size_out_of_range, "table size out of range")\ + XX(type_field_absent_from_required_union_field, "type field absent from required union field")\ + XX(type_field_absent_from_required_union_vector_field, "type field absent from required union vector field")\ + XX(union_cannot_have_a_table_without_a_type, "union cannot have a table without a type")\ + XX(union_type_NONE_cannot_have_a_value, "union value field present with type NONE")\ + XX(vector_count_exceeds_representable_vector_size, "vector count exceeds representable vector size")\ + XX(vector_out_of_range, "vector out of range")\ + XX(vtable_header_out_of_range, "vtable header out of range")\ + XX(vtable_header_too_small, "vtable header too small")\ + XX(vtable_offset_out_of_range_or_unaligned, "vtable offset out of range or unaligned")\ + XX(vtable_size_out_of_range_or_unaligned, "vtable size out of range or unaligned")\ + XX(vtable_size_overflow, "vtable size overflow")\ + XX(union_element_absent_without_type_NONE, "union element absent without type NONE")\ + XX(union_element_present_with_type_NONE, "union element present with type NONE")\ + XX(union_vector_length_mismatch, "union type and table vectors have different lengths")\ + XX(union_vector_verification_not_supported, "union vector verification not supported")\ + XX(runtime_buffer_size_less_than_size_field, "runtime buffer size less than buffer headers size field")\ + XX(not_supported, "not supported") + + + +enum flatcc_verify_error_no { +#define XX(no, str) flatcc_verify_error_##no, + FLATCC_VERIFY_ERROR_MAP(XX) +#undef XX +}; + +#define flatcc_verify_ok flatcc_verify_error_ok + +const char *flatcc_verify_error_string(int err); + +/* + * Type specific table verifier function that checks each known field + * for existence in the vtable and then calls the appropriate verifier + * function in this library. + * + * The table descriptor values have been verified for bounds, overflow, + * and alignment, but vtable entries after header must be verified + * for all fields the table verifier function understands. + * + * Calls other typespecific verifier functions recursively whenever a + * table field, union or table vector is encountered. + */ +typedef struct flatcc_table_verifier_descriptor flatcc_table_verifier_descriptor_t; +struct flatcc_table_verifier_descriptor { + /* Pointer to buffer. Not assumed to be aligned beyond uoffset_t. */ + const void *buf; + /* Buffer size. */ + flatbuffers_uoffset_t end; + /* Time to live: number nesting levels left before failure. */ + int ttl; + /* Vtable of current table. */ + const void *vtable; + /* Table offset relative to buffer start */ + flatbuffers_uoffset_t table; + /* Table end relative to buffer start as per vtable[1] field. */ + flatbuffers_voffset_t tsize; + /* Size of vtable in bytes. */ + flatbuffers_voffset_t vsize; +}; + +typedef int flatcc_table_verifier_f(flatcc_table_verifier_descriptor_t *td); + +typedef struct flatcc_union_verifier_descriptor flatcc_union_verifier_descriptor_t; + +struct flatcc_union_verifier_descriptor { + /* Pointer to buffer. Not assumed to be aligned beyond uoffset_t. */ + const void *buf; + /* Buffer size. */ + flatbuffers_uoffset_t end; + /* Time to live: number nesting levels left before failure. */ + int ttl; + /* Type of union value to be verified */ + flatbuffers_utype_t type; + /* Offset relative to buffer start to where union value offset is stored. */ + flatbuffers_uoffset_t base; + /* Offset of union value relative to base. */ + flatbuffers_uoffset_t offset; +}; + +typedef int flatcc_union_verifier_f(flatcc_union_verifier_descriptor_t *ud); + +/* + * The `as_root` functions are normally the only functions called + * explicitly in this interface. + * + * If `fid` is null, the identifier is not checked and is allowed to be entirely absent. + * + * The buffer must at least be aligned to uoffset_t on systems that + * require aligned memory addresses. The buffer pointers alignment is + * not significant to internal verification of the buffer. + * + * The `_with_size` variant handles size prefixed buffers which aligns slighly differently + * due to the size prefix, notably for buffers with alignment above the uoffset_t type. + */ +int flatcc_verify_struct_as_root(const void *buf, size_t bufsiz, const char *fid, + size_t size, uint16_t align); + +int flatcc_verify_struct_as_root_with_size(const void *buf, size_t bufsiz, const char *fid, + size_t size, uint16_t align); + +int flatcc_verify_struct_as_typed_root(const void *buf, size_t bufsiz, flatbuffers_thash_t thash, + size_t size, uint16_t align); + +int flatcc_verify_struct_as_typed_root_with_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash, + size_t size, uint16_t align); + +int flatcc_verify_table_as_root(const void *buf, size_t bufsiz, const char *fid, + flatcc_table_verifier_f *root_tvf); + +int flatcc_verify_table_as_root_with_size(const void *buf, size_t bufsiz, const char *fid, + flatcc_table_verifier_f *root_tvf); + +int flatcc_verify_table_as_typed_root(const void *buf, size_t bufsiz, flatbuffers_thash_t thash, + flatcc_table_verifier_f *root_tvf); + +int flatcc_verify_table_as_typed_root_with_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash, + flatcc_table_verifier_f *root_tvf); + +/* + * The buffer header is verified by any of the `_as_root` verifiers, but + * this function may be used as a quick sanity check. + */ +int flatcc_verify_buffer_header(const void *buf, size_t bufsiz, const char *fid); + +int flatcc_verify_typed_buffer_header(const void *buf, size_t bufsiz, flatbuffers_thash_t type_hash); + +/* + * Verifies size prefixed buffer headers. The `bufsiz` argument is a pointer that will be updated + * with the size stored in the buffer header iff it is no larger than the input argument, and + * otherwise the verifer fails. The updated size field adds sizeof(flatbuffers_uoffset_t) to the size + * to be compatible with bufsiz since the header size field does not include itself. + */ +int flatcc_verify_buffer_header_with_size(const void *buf, size_t *bufsiz, const char *fid); + +int flatcc_verify_typed_buffer_header_with_size(const void *buf, size_t *bufsiz, flatbuffers_thash_t type_hash); + +/* + * The following functions are typically called by a generated table + * verifier function. + */ + +/* Scalar, enum or struct field. */ +int flatcc_verify_field(flatcc_table_verifier_descriptor_t *td, + flatbuffers_voffset_t id, size_t size, uint16_t align); +/* Vector of scalars, enums or structs. */ +int flatcc_verify_vector_field(flatcc_table_verifier_descriptor_t *td, + flatbuffers_voffset_t id, int required, size_t elem_size, uint16_t align, size_t max_count); +int flatcc_verify_string_field(flatcc_table_verifier_descriptor_t *td, + flatbuffers_voffset_t id, int required); +int flatcc_verify_string_vector_field(flatcc_table_verifier_descriptor_t *td, + flatbuffers_voffset_t id, int required); +int flatcc_verify_table_field(flatcc_table_verifier_descriptor_t *td, + flatbuffers_voffset_t id, int required, flatcc_table_verifier_f tvf); +int flatcc_verify_table_vector_field(flatcc_table_verifier_descriptor_t *td, + flatbuffers_voffset_t id, int required, flatcc_table_verifier_f tvf); +/* Table verifiers pass 0 as fid. */ +int flatcc_verify_struct_as_nested_root(flatcc_table_verifier_descriptor_t *td, + flatbuffers_voffset_t id, int required, const char *fid, + size_t size, uint16_t align); +int flatcc_verify_table_as_nested_root(flatcc_table_verifier_descriptor_t *td, + flatbuffers_voffset_t id, int required, const char *fid, + uint16_t align, flatcc_table_verifier_f tvf); + +/* + * A NONE type will not accept a table being present, and a required + * union will not accept a type field being absent, and an absent type + * field will not accept a table field being present. + * + * If the above checks out and the type is not NONE, the uvf callback + * is executed. It must test each known table type and silently accept + * any unknown table type for forward compatibility. A union table + * value is verified without the required flag because an absent table + * encodes a typed NULL value while an absent type field encodes a + * missing union which fails if required. + */ +int flatcc_verify_union_field(flatcc_table_verifier_descriptor_t *td, + flatbuffers_voffset_t id, int required, flatcc_union_verifier_f uvf); + +int flatcc_verify_union_vector_field(flatcc_table_verifier_descriptor_t *td, + flatbuffers_voffset_t id, int required, flatcc_union_verifier_f uvf); + +int flatcc_verify_union_table(flatcc_union_verifier_descriptor_t *ud, flatcc_table_verifier_f *tvf); +int flatcc_verify_union_struct(flatcc_union_verifier_descriptor_t *ud, size_t size, uint16_t align); +int flatcc_verify_union_string(flatcc_union_verifier_descriptor_t *ud); + +#ifdef __cplusplus +} +#endif + +#endif /* FLATCC_VERIFIER_H */ diff --git a/3rd_party/nanoarrow/flatcc/portable/paligned_alloc.h b/3rd_party/nanoarrow/flatcc/portable/paligned_alloc.h new file mode 100644 index 0000000..419b610 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/portable/paligned_alloc.h @@ -0,0 +1,213 @@ +#ifndef PALIGNED_ALLOC_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * NOTE: MSVC in general has no aligned alloc function that is + * compatible with free and it is not trivial to implement a version + * which is. Therefore, to remain portable, end user code needs to + * use `aligned_free` which is not part of C11 but defined in this header. + * + * glibc only provides aligned_alloc when _ISOC11_SOURCE is defined, but + * MingW does not support aligned_alloc despite of this, it uses the + * the _aligned_malloc as MSVC. + * + * The same issue is present on some Unix systems not providing + * posix_memalign. + * + * Note that clang and gcc with -std=c11 or -std=c99 will not define + * _POSIX_C_SOURCE and thus posix_memalign cannot be detected but + * aligned_alloc is not necessarily available either. We assume + * that clang always has posix_memalign although it is not strictly + * correct. For gcc, use -std=gnu99 or -std=gnu11 or don't use -std in + * order to enable posix_memalign, or live with the fallback until using + * a system where glibc has a version that supports aligned_alloc. + * + * For C11 compliant compilers and compilers with posix_memalign, + * it is valid to use free instead of aligned_free with the above + * caveats. + */ + +#include + +/* + * Define this to see which version is used so the fallback is not + * enganged unnecessarily: + * + * #define PORTABLE_DEBUG_ALIGNED_ALLOC + */ + +#if 0 +#define PORTABLE_DEBUG_ALIGNED_ALLOC +#endif + +#if !defined(PORTABLE_C11_ALIGNED_ALLOC) + +/* + * PORTABLE_C11_ALIGNED_ALLOC = 1 + * indicates that the system has builtin aligned_alloc + * If it doesn't, the section after detection provides an implemention. + */ +#if defined (__MINGW32__) +/* MingW does not provide aligned_alloc despite defining _ISOC11_SOURCE */ +#define PORTABLE_C11_ALIGNED_ALLOC 0 +#elif defined (_ISOC11_SOURCE) +/* glibc aligned_alloc detection, but MingW is not truthful */ +#define PORTABLE_C11_ALIGNED_ALLOC 1 +#elif defined (__GLIBC__) +/* aligned_alloc is not available in glibc just because __STDC_VERSION__ >= 201112L. */ +#define PORTABLE_C11_ALIGNED_ALLOC 0 +#elif defined (__clang__) +#define PORTABLE_C11_ALIGNED_ALLOC 0 +#elif defined (__APPLE__) +#define PORTABLE_C11_ALIGNED_ALLOC 0 +#elif defined(__IBMC__) +#define PORTABLE_C11_ALIGNED_ALLOC 0 +#elif (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) +#define PORTABLE_C11_ALIGNED_ALLOC 1 +#else +#define PORTABLE_C11_ALIGNED_ALLOC 0 +#endif + +#endif /* PORTABLE_C11_ALIGNED_ALLOC */ + +/* https://linux.die.net/man/3/posix_memalign */ +#if !defined(PORTABLE_POSIX_MEMALIGN) && defined(_GNU_SOURCE) +#define PORTABLE_POSIX_MEMALIGN 1 +#endif + +/* https://forum.kde.org/viewtopic.php?p=66274 */ +#if !defined(PORTABLE_POSIX_MEMALIGN) && defined(_XOPEN_SOURCE) +#if _XOPEN_SOURCE >= 600 +#define PORTABLE_POSIX_MEMALIGN 1 +#endif +#endif + +#if !defined(PORTABLE_POSIX_MEMALIGN) && defined(_POSIX_C_SOURCE) +#if _POSIX_C_SOURCE >= 200112L +#define PORTABLE_POSIX_MEMALIGN 1 +#endif +#endif + +#if !defined(PORTABLE_POSIX_MEMALIGN) && defined(__clang__) +#define PORTABLE_POSIX_MEMALIGN 1 +#endif + +#if !defined(PORTABLE_POSIX_MEMALIGN) +#define PORTABLE_POSIX_MEMALIGN 0 +#endif + +/* https://forum.kde.org/viewtopic.php?p=66274 */ +#if (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) +/* C11 or newer */ +#include +#endif + +/* C11 or newer */ +#if !defined(aligned_alloc) && !defined(__aligned_alloc_is_defined) + +#if PORTABLE_C11_ALIGNED_ALLOC +#ifdef PORTABLE_DEBUG_ALIGNED_ALLOC +#error "DEBUG: C11_ALIGNED_ALLOC configured" +#endif +#elif defined(_MSC_VER) || defined(__MINGW32__) + +#ifdef PORTABLE_DEBUG_ALIGNED_ALLOC +#error "DEBUG: Windows _aligned_malloc configured" +#endif + +/* Aligned _aligned_malloc is not compatible with free. */ +#define aligned_alloc(alignment, size) _aligned_malloc(size, alignment) +#define aligned_free(p) _aligned_free(p) +#define __aligned_alloc_is_defined 1 +#define __aligned_free_is_defined 1 + +#elif PORTABLE_POSIX_MEMALIGN + +#if defined(__GNUC__) +#if !defined(__GNUCC__) +extern int posix_memalign (void **, size_t, size_t); +#elif __GNUCC__ < 5 +extern int posix_memalign (void **, size_t, size_t); +#endif +#endif + +static inline void *__portable_aligned_alloc(size_t alignment, size_t size) +{ + int err; + void *p = 0; + + if (alignment < sizeof(void *)) { + alignment = sizeof(void *); + } + err = posix_memalign(&p, alignment, size); + if (err && p) { + free(p); + p = 0; + } + return p; +} + +#ifdef PORTABLE_DEBUG_ALIGNED_ALLOC +#error "DEBUG: POSIX_MEMALIGN configured" +#endif + +#define aligned_alloc(alignment, size) __portable_aligned_alloc(alignment, size) +#define aligned_free(p) free(p) +#define __aligned_alloc_is_defined 1 +#define __aligned_free_is_defined 1 + +#else + +static inline void *__portable_aligned_alloc(size_t alignment, size_t size) +{ + char *raw; + void *buf; + size_t total_size = (size + alignment - 1 + sizeof(void *)); + + if (alignment < sizeof(void *)) { + alignment = sizeof(void *); + } + raw = (char *)(size_t)malloc(total_size); + if (!raw) return 0; + buf = raw + alignment - 1 + sizeof(void *); + buf = (void *)(((size_t)buf) & ~(alignment - 1)); + ((void **)buf)[-1] = raw; + return buf; +} + +static inline void __portable_aligned_free(void *p) +{ + char *raw; + + if (p) { + raw = (char*)((void **)p)[-1]; + free(raw); + } +} + +#define aligned_alloc(alignment, size) __portable_aligned_alloc(alignment, size) +#define aligned_free(p) __portable_aligned_free(p) +#define __aligned_alloc_is_defined 1 +#define __aligned_free_is_defined 1 + +#ifdef PORTABLE_DEBUG_ALIGNED_ALLOC +#error "DEBUG: aligned_alloc malloc fallback configured" +#endif + +#endif + +#endif /* aligned_alloc */ + +#if !defined(aligned_free) && !defined(__aligned_free_is_defined) +#define aligned_free(p) free(p) +#define __aligned_free_is_defined 1 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* PALIGNED_ALLOC_H */ diff --git a/3rd_party/nanoarrow/flatcc/portable/pattributes.h b/3rd_party/nanoarrow/flatcc/portable/pattributes.h new file mode 100644 index 0000000..dd4918a --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/portable/pattributes.h @@ -0,0 +1,84 @@ + +/* + * C23 introduces an attribute syntax `[[]]`. Prior to that + * other non-standard syntaxes such as `__attribute__(())` + * and `__declspec()` have been supported by some compiler + * versions. + * + * See also: + * https://en.cppreference.com/w/c/language/attributes + * + * There is no portable way to use C23 attributes in older C standards + * so in order to use these portably, some macro name needs to be + * defined for each attribute that either maps to the older supported + * syntax, or ignores the attribute as appropriate. + * + * The Linux kernel defines certain attributes as macros, such as + * `fallthrough`. When adding attributes it seems reasonable to follow + * the Linux conventions in lack of any official standard. However, it + * is not the intention that this file should mirror the Linux + * attributes 1 to 1. + * + * See also: + * https://github.com/torvalds/linux/blob/master/include/linux/compiler_attributes.h + * + * There is a risk that exposed attribute names may lead to name + * conflicts. A conflicting name can be undefined and if necessary used + * using `pattribute()`. All attributes can be hidden by + * defining `PORTABLE_EXPOSE_ATTRIBUTES=0` in which case + * `pattribute()` can still be used and then if a specific + * attribute name still needs to be exposed, it can be defined manually + * like `#define fallthrough pattribute(fallthrough)`. + */ + + +#ifndef PATTRIBUTES_H +#define PATTRIBUTES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef PORTABLE_EXPOSE_ATTRIBUTES +#define PORTABLE_EXPOSE_ATTRIBUTES 0 +#endif + +#ifdef __has_c_attribute +# define PORTABLE_HAS_C_ATTRIBUTE(x) __has_c_attribute(x) +#else +# define PORTABLE_HAS_C_ATTRIBUTE(x) 0 +#endif + +#ifdef __has_attribute +# define PORTABLE_HAS_ATTRIBUTE(x) __has_attribute(x) +#else +# define PORTABLE_HAS_ATTRIBUTE(x) 0 +#endif + + +/* https://en.cppreference.com/w/c/language/attributes/fallthrough */ +#if PORTABLE_HAS_C_ATTRIBUTE(__fallthrough__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +# define pattribute_fallthrough [[__fallthrough__]] +#elif PORTABLE_HAS_ATTRIBUTE(__fallthrough__) +# define pattribute_fallthrough __attribute__((__fallthrough__)) +#else +# define pattribute_fallthrough ((void)0) +#endif + + +#define pattribute(x) pattribute_##x + +#if PORTABLE_EXPOSE_ATTRIBUTES + +#ifndef fallthrough +# define fallthrough pattribute(fallthrough) +#endif + +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* PATTRIBUTES_H */ diff --git a/3rd_party/nanoarrow/flatcc/portable/pdiagnostic.h b/3rd_party/nanoarrow/flatcc/portable/pdiagnostic.h new file mode 100644 index 0000000..7e48773 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/portable/pdiagnostic.h @@ -0,0 +1,84 @@ + /* There is intentionally no include guard in this file. */ + + +/* + * Usage: optionally disable any of these before including. + * + * #define PDIAGNOSTIC_IGNORE_UNUSED_FUNCTION + * #define PDIAGNOSTIC_IGNORE_UNUSED_VARIABLE + * #define PDIAGNOSTIC_IGNORE_UNUSED_PARAMETER + * #define PDIAGNOSTIC_IGNORE_UNUSED // all of the above + * + * #include "pdiagnostic.h" + * + * Alternatively use #include "pdiagnostic_push/pop.h" + */ + +#ifdef _MSC_VER +#pragma warning(disable: 4668) /* preprocessor name not defined */ +#endif + +#if !defined(PDIAGNOSTIC_AWARE_MSVC) && defined(_MSC_VER) +#define PDIAGNOSTIC_AWARE_MSVC 1 +#elif !defined(PDIAGNOSTIC_AWARE_MSVC) +#define PDIAGNOSTIC_AWARE_MSVC 0 +#endif + +#if !defined(PDIAGNOSTIC_AWARE_CLANG) && defined(__clang__) +#define PDIAGNOSTIC_AWARE_CLANG 1 +#elif !defined(PDIAGNOSTIC_AWARE_CLANG) +#define PDIAGNOSTIC_AWARE_CLANG 0 +#endif + +#if !defined(PDIAGNOSTIC_AWARE_GCC) && defined(__GNUC__) && !defined(__clang__) +/* Can disable some warnings even if push is not available (gcc-4.2 vs gcc-4.7) */ +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2) +#define PDIAGNOSTIC_AWARE_GCC 1 +#endif +#endif + +#if !defined(PDIAGNOSTIC_AWARE_GCC) +#define PDIAGNOSTIC_AWARE_GCC 0 +#endif + +#if defined(PDIAGNOSTIC_IGNORE_UNUSED_FUNCTION) || defined(PDIAGNOSTIC_IGNORE_UNUSED) +#if PDIAGNOSTIC_AWARE_CLANG +#pragma clang diagnostic ignored "-Wunused-function" +#elif PDIAGNOSTIC_AWARE_GCC +#pragma GCC diagnostic ignored "-Wunused-function" +#endif +#endif +#undef PDIAGNOSTIC_IGNORE_UNUSED_FUNCTION + +#if defined(PDIAGNOSTIC_IGNORE_UNUSED_VARIABLE) || defined(PDIAGNOSTIC_IGNORE_UNUSED) +#if PDIAGNOSTIC_AWARE_MSVC +#pragma warning(disable: 4101) /* unused local variable */ +#elif PDIAGNOSTIC_AWARE_CLANG +#pragma clang diagnostic ignored "-Wunused-variable" +#elif PDIAGNOSTIC_AWARE_GCC +#pragma GCC diagnostic ignored "-Wunused-variable" +#endif +#endif +#undef PDIAGNOSTIC_IGNORE_UNUSED_VARIABLE + +#if defined(PDIAGNOSTIC_IGNORE_UNUSED_PARAMETER) || defined(PDIAGNOSTIC_IGNORE_UNUSED) +#if PDIAGNOSTIC_AWARE_CLANG +#pragma clang diagnostic ignored "-Wunused-parameter" +#elif PDIAGNOSTIC_AWARE_GCC +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif +#endif +#undef PDIAGNOSTIC_IGNORE_UNUSED_PARAMETER + +#undef PDIAGNOSTIC_IGNORE_UNUSED + +#if defined (__cplusplus) && __cplusplus < 201103L +#if PDIAGNOSTIC_AWARE_CLANG +/* Needed for < C++11 clang C++ static_assert */ +#pragma clang diagnostic ignored "-Wc11-extensions" +/* Needed for empty macro arguments. */ +#pragma clang diagnostic ignored "-Wc99-extensions" +/* Needed for trailing commas. */ +#pragma clang diagnostic ignored "-Wc++11-extensions" +#endif +#endif diff --git a/3rd_party/nanoarrow/flatcc/portable/pdiagnostic_pop.h b/3rd_party/nanoarrow/flatcc/portable/pdiagnostic_pop.h new file mode 100644 index 0000000..f5e16b3 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/portable/pdiagnostic_pop.h @@ -0,0 +1,20 @@ +#if defined(PDIAGNOSTIC_PUSHED_MSVC) +#if PDIAGNOSTIC_PUSHED_MSVC +#pragma warning( pop ) +#endif // PDIAGNOSTIC_PUSHED_MSVC +#undef PDIAGNOSTIC_PUSHED_MSVC +#endif // defined(PDIAGNOSTIC_PUSHED_MSVC) + +#if defined(PDIAGNOSTIC_PUSHED_CLANG) +#if PDIAGNOSTIC_PUSHED_CLANG +#pragma clang diagnostic pop +#endif // PDIAGNOSTIC_PUSHED_CLANG +#undef PDIAGNOSTIC_PUSHED_CLANG +#endif // defined(PDIAGNOSTIC_PUSHED_CLANG) + +#if defined(PDIAGNOSTIC_PUSHED_GCC) +#if PDIAGNOSTIC_PUSHED_GCC +#pragma GCC diagnostic pop +#endif // PDIAGNOSTIC_PUSHED_GCC +#undef PDIAGNOSTIC_PUSHED_GCC +#endif // defined(PDIAGNOSTIC_PUSHED_GCC) diff --git a/3rd_party/nanoarrow/flatcc/portable/pdiagnostic_push.h b/3rd_party/nanoarrow/flatcc/portable/pdiagnostic_push.h new file mode 100644 index 0000000..66586d7 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/portable/pdiagnostic_push.h @@ -0,0 +1,51 @@ +/* + * See also comment in "pdiagnostic.h" + * + * e.g. + * #define PDIAGNOSTIC_IGNORE_USED_FUNCTION + * #define PDIAGNOSTIC_IGNORE_USED_VARIABLE + * #include "pdiagnostic_push" + * ... + * #include "pdiagnostic_pop.h" + * + * + * or if push pop isn't desired: + * #define PDIAGNOSTIC_IGNORE_USED_FUNCTION + * #define PDIAGNOSTIC_IGNORE_USED_VARIABLE + * #include "pdiagnostic.h" + * ... + * + * + * + * Some if these warnings cannot be ignored + * at the #pragma level, but might in the future. + * Use compiler switches like -Wno-unused-function + * to work around this. + */ + +#if defined(_MSC_VER) +#pragma warning( push ) +#define PDIAGNOSTIC_PUSHED_MSVC 1 +#else +#define PDIAGNOSTIC_PUSHED_MSVC 0 +#endif + +#if defined(__clang__) +#pragma clang diagnostic push +#define PDIAGNOSTIC_PUSHED_CLANG 1 +#else +#define PDIAGNOSTIC_PUSHED_CLANG 0 +#endif + +#if defined(__GNUC__) && !defined(__clang__) +#if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#pragma GCC diagnostic push +#define PDIAGNOSTIC_PUSHED_GCC 1 +#else +#define PDIAGNOSTIC_PUSHED_GCC 0 +#endif // GNUC >= 4.6 +#else +#define PDIAGNOSTIC_PUSHED_GCC 0 +#endif // defined(__GNUC__) && !defined(__clang__) + +#include "pdiagnostic.h" diff --git a/3rd_party/nanoarrow/flatcc/portable/pendian.h b/3rd_party/nanoarrow/flatcc/portable/pendian.h new file mode 100644 index 0000000..122ba8e --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/portable/pendian.h @@ -0,0 +1,206 @@ +#ifndef PENDIAN_H +#define PENDIAN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Defines platform optimized (as per linux + * + * le16toh, le32to, le64toh, be16toh, be32toh, be64toh + * htole16, htole32, htole64, htobe16, htobe32, htobe64 + * + * Falls back to auto-detect endian conversion which is also fast + * if fast byteswap operation was detected. + * + * Also defines platform optimized: + * + * bswap16, bswap32, bswap64, + * + * with fall-back to shift-or implementation. + * + * For convenience also defines: + * + * le8to, be8toh, htole8, htobe8 + * bswap8 + * + * The convience functions makes is simpler to define conversion macros + * based on type size. + * + * NOTE: this implementation expects arguments with no side-effects and + * with appropriately sized unsigned arguments. These are expected to be + * used with typesafe wrappers. + */ + +#ifndef UINT8_MAX +#include "pstdint.h" +#endif + +#if defined(__linux__) +#include +#elif defined(__OpenBSD__) || defined(__FreeBSD__) +#include +#endif + +#include "pendian_detect.h" + +#if defined(_MSC_VER) +#if _MSC_VER >= 1300 +#include +#define bswap16 _byteswap_ushort +#define bswap32 _byteswap_ulong +#define bswap64 _byteswap_uint64 +#endif +#elif defined(__clang__) +#if __has_builtin(__builtin_bswap16) +#ifndef bswap16 +#define bswap16 __builtin_bswap16 +#endif +#endif +#if __has_builtin(__builtin_bswap32) +#ifndef bswap32 +#define bswap32 __builtin_bswap32 +#endif +#endif +#if __has_builtin(__builtin_bswap64) +#ifndef bswap64 +#define bswap64 __builtin_bswap64 +#endif +#endif +#elif defined(__OpenBSD__) || defined(__FreeBSD__) +#ifndef bswap16 +#define bswap16 swap16 +#endif +#ifndef bswap32 +#define bswap32 swap32 +#endif +#ifndef bswap64 +#define bswap64 swap64 +#endif +#elif defined(__GNUC__) /* Supported since at least GCC 4.4 */ +#ifndef bswap32 +#define bswap32 __builtin_bswap32 +#endif +#ifndef bswap64 +#define bswap64 __builtin_bswap64 +#endif +#endif + +#ifndef bswap16 +#define bswap16(v) \ + (((uint16_t)(v) << 8) | ((uint16_t)(v) >> 8)) +#endif + +#ifndef bswap32 +#define bswap32(v) \ + ((((uint32_t)(v) << 24)) \ + | (((uint32_t)(v) << 8) & UINT32_C(0x00FF0000)) \ + | (((uint32_t)(v) >> 8) & UINT32_C(0x0000FF00)) \ + | (((uint32_t)(v) >> 24))) +#endif + +#ifndef bswap64 +#define bswap64(v) \ + ((((uint64_t)(v) << 56)) \ + | (((uint64_t)(v) << 40) & UINT64_C(0x00FF000000000000)) \ + | (((uint64_t)(v) << 24) & UINT64_C(0x0000FF0000000000)) \ + | (((uint64_t)(v) << 8) & UINT64_C(0x000000FF00000000)) \ + | (((uint64_t)(v) >> 8) & UINT64_C(0x00000000FF000000)) \ + | (((uint64_t)(v) >> 24) & UINT64_C(0x0000000000FF0000)) \ + | (((uint64_t)(v) >> 40) & UINT64_C(0x000000000000FF00)) \ + | (((uint64_t)(v) >> 56))) +#endif + +#ifndef bswap8 +#define bswap8(v) ((uint8_t)(v)) +#endif + +#if !defined(le16toh) && defined(letoh16) +#define le16toh letoh16 +#define le32toh letoh32 +#define le64toh letoh64 +#endif + +#if !defined(be16toh) && defined(betoh16) +#define be16toh betoh16 +#define be32toh betoh32 +#define be64toh betoh64 +#endif + +/* Assume it goes for all. */ +#if !defined(le16toh) + +#if defined(__LITTLE_ENDIAN__) + +#define le16toh(v) (v) +#define le32toh(v) (v) +#define le64toh(v) (v) + +#define htole16(v) (v) +#define htole32(v) (v) +#define htole64(v) (v) + +#define be16toh(v) bswap16(v) +#define be32toh(v) bswap32(v) +#define be64toh(v) bswap64(v) + +#define htobe16(v) bswap16(v) +#define htobe32(v) bswap32(v) +#define htobe64(v) bswap64(v) + +#elif defined(__BIG_ENDIAN__) + +#define le16toh(v) bswap16(v) +#define le32toh(v) bswap32(v) +#define le64toh(v) bswap64(v) + +#define htole16(v) bswap16(v) +#define htole32(v) bswap32(v) +#define htole64(v) bswap64(v) + +#define be16toh(v) (v) +#define be32toh(v) (v) +#define be64toh(v) (v) + +#define htobe16(v) (v) +#define htobe32(v) (v) +#define htobe64(v) (v) + +#else + +static const int __pendian_test = 1; + +#define le16toh(v) (*(char *)&__pendian_test ? (v) : bswap16(v)) +#define le32toh(v) (*(char *)&__pendian_test ? (v) : bswap32(v)) +#define le64toh(v) (*(char *)&__pendian_test ? (v) : bswap64(v)) + +#define htole16(v) (*(char *)&__pendian_test ? (v) : bswap16(v)) +#define htole32(v) (*(char *)&__pendian_test ? (v) : bswap32(v)) +#define htole64(v) (*(char *)&__pendian_test ? (v) : bswap64(v)) + +#define be16toh(v) (*(char *)&__pendian_test ? bswap16(v) : (v)) +#define be32toh(v) (*(char *)&__pendian_test ? bswap32(v) : (v)) +#define be64toh(v) (*(char *)&__pendian_test ? bswap64(v) : (v)) + +#define htobe16(v) (*(char *)&__pendian_test ? bswap16(v) : (v)) +#define htobe32(v) (*(char *)&__pendian_test ? bswap32(v) : (v)) +#define htobe64(v) (*(char *)&__pendian_test ? bswap64(v) : (v)) + +#endif + +#endif /* le16toh */ + +/* Helpers not part of Linux */ +#if !defined(le8toh) +#define le8toh(n) (n) +#define htole8(n) (n) +#define be8toh(n) (n) +#define htobe8(n) (n) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* PENDIAN_H */ diff --git a/3rd_party/nanoarrow/flatcc/portable/pendian_detect.h b/3rd_party/nanoarrow/flatcc/portable/pendian_detect.h new file mode 100644 index 0000000..1dd62c0 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/portable/pendian_detect.h @@ -0,0 +1,118 @@ +/* + * Uses various known flags to decide endianness and defines: + * + * __LITTLE_ENDIAN__ or __BIG_ENDIAN__ if not already defined + * + * and also defines + * + * __BYTE_ORDER__ to either __ORDER_LITTLE_ENDIAN__ or + * __ORDER_BIG_ENDIAN__ if not already defined + * + * If none of these could be set, __UNKNOWN_ENDIAN__ is defined, + * which is not a known flag. If __BYTE_ORDER__ is defined but + * not big or little endian, __UNKNOWN_ENDIAN__ is also defined. + * + * Note: Some systems define __BYTE_ORDER without __ at the end + * - this will be mapped to to __BYTE_ORDER__. + */ + +#ifndef PENDIAN_DETECT +#define PENDIAN_DETECT + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __ORDER_LITTLE_ENDIAN__ +#define __ORDER_LITTLE_ENDIAN__ 1234 +#endif + +#ifndef __ORDER_BIG_ENDIAN__ +#define __ORDER_BIG_ENDIAN__ 4321 +#endif + +#ifdef __BYTE_ORDER__ + +#if defined(__LITTLE_ENDIAN__) && __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ +#error __LITTLE_ENDIAN__ inconsistent with __BYTE_ORDER__ +#endif + +#if defined(__BIG_ENDIAN__) && __BYTE_ORDER__ != __ORDER_BIG_ENDIAN__ +#error __BIG_ENDIAN__ inconsistent with __BYTE_ORDER__ +#endif + +#else /* __BYTE_ORDER__ */ + + +#if \ + defined(__LITTLE_ENDIAN__) || \ + (defined(__BYTE_ORDER) && __BYTE_ORDER == __ORDER_LITTLE_ENDIAN) || \ + defined(__ARMEL__) || defined(__THUMBEL__) || \ + defined(__AARCH64EL__) || \ + (defined(_MSC_VER) && defined(_M_ARM)) || \ + defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || \ + defined(_M_X64) || defined(_M_IX86) || defined(_M_I86) || \ + defined(__i386__) || defined(__alpha__) || \ + defined(__ia64) || defined(__ia64__) || \ + defined(_M_IA64) || defined(_M_ALPHA) || \ + defined(__amd64) || defined(__amd64__) || defined(_M_AMD64) || \ + defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \ + defined(__bfin__) + +#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ + +#endif + +#if \ + defined (__BIG_ENDIAN__) || \ + (defined(__BYTE_ORDER) && __BYTE_ORDER == __ORDER_BIG_ENDIAN) || \ + defined(__ARMEB__) || defined(THUMBEB__) || defined (__AARCH64EB__) || \ + defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) || \ + defined(__sparc) || defined(__sparc__) || \ + defined(_POWER) || defined(__powerpc__) || defined(__ppc__) || \ + defined(__hpux) || defined(__hppa) || defined(__s390__) + +#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ + +#endif + +#endif /* __BYTE_ORDER__ */ + +#ifdef __BYTE_ORDER__ + +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + +#ifndef __LITTLE_ENDIAN__ +#define __LITTLE_ENDIAN__ 1 +#endif + +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + +#ifndef __BIG_ENDIAN__ +#define __BIG_ENDIAN__ 1 +#endif + +#else + +/* + * Custom extension - we only define __BYTE_ORDER__ if known big or little. + * User code that understands __BYTE_ORDER__ may also assume unkown if + * it is not defined by now - this will allow other endian formats than + * big or little when supported by compiler. + */ +#ifndef __UNKNOWN_ENDIAN__ +#define __UNKNOWN_ENDIAN__ 1 +#endif + +#endif +#endif /* __BYTE_ORDER__ */ + +#if defined(__LITTLE_ENDIAN__) && defined(__BIG_ENDIAN__) +#error conflicting definitions of __LITTLE_ENDIAN__ and __BIG_ENDIAN__ +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* PENDIAN_DETECT */ diff --git a/3rd_party/nanoarrow/flatcc/portable/pinline.h b/3rd_party/nanoarrow/flatcc/portable/pinline.h new file mode 100644 index 0000000..f4f8f27 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/portable/pinline.h @@ -0,0 +1,19 @@ +#ifndef PINLINE_H +#define PINLINE_H + +#ifndef __cplusplus + +#if (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) +/* C99 or newer */ +#elif _MSC_VER >= 1500 /* MSVC 9 or newer */ +#undef inline +#define inline __inline +#elif __GNUC__ >= 3 /* GCC 3 or newer */ +#define inline __inline +#else /* Unknown or ancient */ +#define inline +#endif + +#endif /* __cplusplus */ + +#endif /* PINLINE_H */ diff --git a/3rd_party/nanoarrow/flatcc/portable/pinttypes.h b/3rd_party/nanoarrow/flatcc/portable/pinttypes.h new file mode 100644 index 0000000..a1be9df --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/portable/pinttypes.h @@ -0,0 +1,52 @@ +#ifndef PINTTYPES_H +#define PINTTYPES_H + +#ifndef PRId16 + +#if (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) +/* C99 or newer */ +#include +#else + +/* + * This is not a complete implementation of , just the most + * useful printf modifiers. + */ + +#include "pstdint.h" + +#ifndef PRINTF_INT64_MODIFIER +#error "please define PRINTF_INT64_MODIFIER" +#endif + +#ifndef PRId64 +#define PRId64 PRINTF_INT64_MODIFIER "d" +#define PRIu64 PRINTF_INT64_MODIFIER "u" +#define PRIx64 PRINTF_INT64_MODIFIER "x" +#endif + +#ifndef PRINTF_INT32_MODIFIER +#define PRINTF_INT32_MODIFIER "l" +#endif + +#ifndef PRId32 +#define PRId32 PRINTF_INT32_MODIFIER "d" +#define PRIu32 PRINTF_INT32_MODIFIER "u" +#define PRIx32 PRINTF_INT32_MODIFIER "x" +#endif + +#ifndef PRINTF_INT16_MODIFIER +#define PRINTF_INT16_MODIFIER "h" +#endif + +#ifndef PRId16 +#define PRId16 PRINTF_INT16_MODIFIER "d" +#define PRIu16 PRINTF_INT16_MODIFIER "u" +#define PRIx16 PRINTF_INT16_MODIFIER "x" +#endif + +# endif /* __STDC__ */ + +#endif /* PRId16 */ + +#endif /* PINTTYPES */ diff --git a/3rd_party/nanoarrow/flatcc/portable/pmemaccess.h b/3rd_party/nanoarrow/flatcc/portable/pmemaccess.h new file mode 100644 index 0000000..0735af5 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/portable/pmemaccess.h @@ -0,0 +1,232 @@ +/* + * Copyright (c) 2024 Mikkel Fahnøe Jørgensen, dvide.com + * + * (MIT License) + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * - The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * - The Software is provided "as is", without warranty of any kind, express or + * implied, including but not limited to the warranties of merchantability, + * fitness for a particular purpose and noninfringement. In no event shall the + * authors or copyright holders be liable for any claim, damages or other + * liability, whether in an action of contract, tort or otherwise, arising from, + * out of or in connection with the Software or the use or other dealings in the + * Software. + */ + +/* Provide strict aliasing safe portable access to reading and writing integer and + floating point values from memory buffers of size 1, 2, 4, and 8 bytes, and + optionally 16 bytes when C23 uint128_t is available. + Also supports casting between integers and floats at the binary level, e.g. + mem_read_float32(&myuint32), which can be necessary for endian conversions. + + It is often suggested to use memcpy for this purpose, that is not an ideal + solution. See comments below. + + While this is intended to be aligned access, the strict C aliasing rules forces + this to be the same as unaligned access. On x86/64 we can be more relaxed both + with aliasing and alignment, but if at some point a compiler starts to + modify this behaviour, the header can be updated or PORTABLE_MEM_PTR_ACCESS + can be defined to 0 in the build configuration, or this file can be updated. + + The balance is betweem knowing memcpy or __builtin_memcpy is fast, + and knowing that pointer casts do not break. + + Known targets that require PORTABLE_MEM_PTR_ACCESS=0 for at least some version: + + - ARM cross compiler: arm-none-eabi, -O2, -mcpu=cortext-m7, + breaks on PORTABLE_MEM_PTR_ACCESS=0 + slow memcpy, has fast __builtin_memcpy + + - Intel ICC -O3 on x86/64 (that compiler is deprecated by Intel). + breaks on PORTABLE_MEM_PTR_ACCESS=0 + has __builtin_memcpy, performance unknown, memcpy perforamnce unknown. + + */ + + +/* NOTE: for best performance, `__builtin_memcpy` should be detectable, but + the current detection logic is not ideal for older compilers. See below. */ + + +#ifndef PMEMACCESS_H +#define PMEMACCESS_H + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Set to 1 to see which implementation is chosen on current platform. */ +#ifndef PORTABLE_MEM_ACCESS_DEBUG +#define PORTABLE_MEM_ACCESS_DEBUG 0 +#endif + +/* MEM_PTR_ACCESS (aka pointer casts) (*(T *)p) is not formally valid for strict aliasing. + It works in most cases, but not always. It may be the best option for older + compilers that do not optimize well and which don't care about strict aliazing. + x86/64 platforms appears to work well with this, while it only sometimes work + on other platforms. + + NOTE: this might change as compiler updates their optimization strategies. */ + +#ifndef PORTABLE_MEM_PTR_ACCESS + +#if defined(__INTEL_COMPILER) +# /* Prevents Intel ICC compiler from breaking on -O3 on x86/64 target, + likely due to strict aliasing rules. */ +# define PORTABLE_MEM_PTR_ACCESS 0 +#elif (defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)) +# define PORTABLE_MEM_PTR_ACCESS 1 +#else +# define PORTABLE_MEM_PTR_ACCESS 0 +#endif + +#endif /* PORTABLE_MEM_PTR_ACCESS */ + + +#ifndef UINT8_MAX +# include +#endif + +/* `mem_copy_word` implements optimized non-overlapping memory copies of + 1, 2, 4, 8, or 16 bytes, noting that C23 introduces uin128_t. + Other sizes are not defined even if some implementation might support them. + `mem_copy_word` of 16 bytes are supported even if uint128_t is not available. + + Ideally call `mem_copy_word` with known constant lengths for best optimization. + + The objective is both to support type punning where a binary representation is + reinterpreted, and to read and write integers and floats safely from memory without + risking undefined behaviour from strict aliasing rules. + + `memcpy` is supposed to handle this efficiently given small constant powers of 2, but + this evidently fails on some platforms since even small constants lengths with -O2 + level optimization can issue a function call. On such platforms, `__builtin_memcpy` + tends to work better, if it can be detected. + + A pointer cast can and will, albeit uncommon, lead to undefined behaviour + such as reading from uninitialized stack memory when strict aliasing is the default + optimization strategy. + + Note: __has_builtin is not necessarily defined on platforms with __builtin_memcpy support, + so detection can be improved. Feel free to contribute. + + Note: `mem_copy_word_` is a macro that may call `mem_copy_word` but it is guaranteed to + be called with a literal length argument, so it could be redefined to forward calls + to e.g. my_mem_copy_word_2 via token pasting. It is used with the `mem_read/write_nn` + functions below. */ + +#ifndef mem_copy_word +# if defined(__has_builtin) +# if __has_builtin(__builtin_memcpy) +# define mem_copy_word(d, s, n) __builtin_memcpy((d), (s), (n)) +# if PORTABLE_MEM_ACCESS_DEBUG +# error mem_copy_word using: __builtin_memcpy +# endif +# endif +# endif +#endif + +#ifndef mem_copy_word + #include "pinline.h" + #include "prestrict.h" + /* Sometimes `memcpy` is a call even when optimized and given small constant length arguments, + so this is more likely to be optimized. `int len` is used to avoid dependency. + Also, by not using `memcpy`, we avoid depending on . + + As an alternative consider PORTABLE_MEM_PTR_ACCESS=1 with `mem_read/write_nn` for some older + platforms that might not care about strict aliasing, and which also might not optimize well. */ + static inline void mem_copy_word(void * restrict dest, const void * restrict src, int len) + { + char *d = (char *)dest; + const char *s = (const char *)src; + while(len--) *d++ = *s++; + } + #if PORTABLE_MEM_ACCESS_DEBUG + # error mem_copy_word using: inline memcpy + #endif +#endif + + +#if PORTABLE_MEM_PTR_ACCESS + +#define mem_read_8(p) (*(uint8_t*)(p)) +#define mem_read_16(p) (*(uint16_t*)(p)) +#define mem_read_32(p) (*(uint32_t*)(p)) +#define mem_read_64(p) (*(uint64_t*)(p)) + +#define mem_write_8(p, v) ((void)(*(uint8_t*)(p) = (uint8_t)(v))) +#define mem_write_16(p, v) ((void)(*(uint16_t*)(p) = (uint16_t)(v))) +#define mem_write_32(p, v) ((void)(*(uint32_t*)(p) = (uint32_t)(v))) +#define mem_write_64(p, v) ((void)(*(uint64_t*)(p) = (uint64_t)(v))) + +#define mem_read_float_32(p) (*(float*)(p)) +#define mem_read_float_64(p) (*(double*)(p)) + +#define mem_write_float_32(p, v) ((void)(*(float*)(p) = (float)(v))) +#define mem_write_float_64(p, v) ((void)(*(double*)(p) = (double)(v))) + +#ifdef UINT128_MAX + +#define mem_read_128(p) (*(uint128_t*)(p)) + +#define mem_write_128(p, v) ((void)(*(uint128_t*)(p) = (uint128_t)(v))) + +#endif + +#if PORTABLE_MEM_ACCESS_DEBUG +# error mem_read/write_nn using: pointer cast +#endif + +#else /* PORTABLE_MEM_PTR_ACCESS */ + +/* mem_copy_word_ is guaranteed to receive literal `n` arguments + so operations can be optimized via token pasting if necessary. */ +#ifndef mem_copy_word_ +#define mem_copy_word_(d, s, n) mem_copy_word(d, s, n) +#endif + +#define mem_read_8(p) (*(uint8_t*)(p)) +#define mem_write_8(p, v) ((void)(*(uint8_t*)(p) = (uint8_t)(v))) + +static inline uint16_t mem_read_16(const void *p) { uint16_t v; mem_copy_word_(&v, p, 2); return v; } +static inline uint32_t mem_read_32(const void *p) { uint32_t v; mem_copy_word_(&v, p, 4); return v; } +static inline uint64_t mem_read_64(const void *p) { uint64_t v; mem_copy_word_(&v, p, 8); return v; } + +#define mem_write_16(p, v) do { const uint16_t x = (uint16_t)(v); mem_copy_word_((p), &x, 2); } while(0) +#define mem_write_32(p, v) do { const uint32_t x = (uint32_t)(v); mem_copy_word_((p), &x, 4); } while(0) +#define mem_write_64(p, v) do { const uint64_t x = (uint64_t)(v); mem_copy_word_((p), &x, 8); } while(0) + +static inline float mem_read_float_32(const void *p) { float v; mem_copy_word_(&v, p, 4); return v; } +static inline double mem_read_float_64(const void *p) { double v; mem_copy_word_(&v, p, 8); return v; } + +#define mem_write_float_32(p, v) do { const float x = (float)(v); mem_copy_word_((p), &x, 4); } while(0) +#define mem_write_float_64(p, v) do { const double x = (double)(v); mem_copy_word_((p), &x, 8); } while(0) + +#ifdef UINT128_MAX + +static inline uint128_t mem_read_128(const void *p) { uint128_t v; mem_copy_word_(&v, p, 16); return v; } + +#define mem_write_128(p, v) do { const uint128_t x = (uint128_t)(v); mem_copy_word_((p), &x, 128); } while(0) + +#endif + +#if PORTABLE_MEM_ACCESS_DEBUG +# error mem_read/write_nn using: mem_copy_word +#endif + +#endif /* PORTABLE_MEM_PTR_ACCESS */ + + +#ifdef __cplusplus +} +#endif + +#endif /* PMEMACCESS_H */ diff --git a/3rd_party/nanoarrow/flatcc/portable/portable.h b/3rd_party/nanoarrow/flatcc/portable/portable.h new file mode 100644 index 0000000..7a6a484 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/portable/portable.h @@ -0,0 +1,2 @@ +/* portable.h is widely used, so we redirect to a less conflicting name. */ +#include "portable_basic.h" diff --git a/3rd_party/nanoarrow/flatcc/portable/portable_basic.h b/3rd_party/nanoarrow/flatcc/portable/portable_basic.h new file mode 100644 index 0000000..86cbff4 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/portable/portable_basic.h @@ -0,0 +1,27 @@ +#ifndef PORTABLE_BASIC_H +#define PORTABLE_BASIC_H + +/* + * Basic features need to make compilers support the most common moden C + * features, and endian / unligned read support as well. + * + * It is not assumed that this file is always included. + * Other include files are independent or include what they need. + */ + +#include "pversion.h" +#include "pwarnings.h" + +/* Featutures that ought to be supported by C11, but some aren't. */ +#include "pinttypes.h" +#include "pstdalign.h" +#include "pinline.h" +#include "pstatic_assert.h" + +/* These are not supported by C11 and are general platform abstractions. */ +#include "pendian.h" +#include "punaligned.h" +#include "pmemaccess.h" + + +#endif /* PORTABLE_BASIC_H */ diff --git a/3rd_party/nanoarrow/flatcc/portable/prestrict.h b/3rd_party/nanoarrow/flatcc/portable/prestrict.h new file mode 100644 index 0000000..a3c2aa0 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/portable/prestrict.h @@ -0,0 +1,39 @@ + +/* + * Copyright (c) 2024 Mikkel Fahnøe Jørgensen, dvide.com + * + * (MIT License) + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * - The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * - The Software is provided "as is", without warranty of any kind, express or + * implied, including but not limited to the warranties of merchantability, + * fitness for a particular purpose and noninfringement. In no event shall the + * authors or copyright holders be liable for any claim, damages or other + * liability, whether in an action of contract, tort or otherwise, arising from, + * out of or in connection with the Software or the use or other dealings in the + * Software. + */ + +#ifndef PRESTRICT_H +#define PRESTRICT_H + + +#if (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) +/* C99 or newer */ +#elif defined(__restrict) +/* Some C/C++ compilers use alternative syntax. If these are defines, we can detect them. */ +#define restrict __restrict +#elif defined(__restrict__) +#define restrict __restrict__ +#else +#define restrict +#endif + + +#endif /* PRESTRICT_H */ diff --git a/3rd_party/nanoarrow/flatcc/portable/pstatic_assert.h b/3rd_party/nanoarrow/flatcc/portable/pstatic_assert.h new file mode 100644 index 0000000..24d5634 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/portable/pstatic_assert.h @@ -0,0 +1,67 @@ +#ifndef PSTATIC_ASSERT_H +#define PSTATIC_ASSERT_H + +#include + +/* Handle clang */ +#ifndef __has_feature + #define __has_feature(x) 0 +#endif + +#if defined(static_assert) +#ifndef __static_assert_is_defined +#define __static_assert_is_defined 1 +#endif +#endif + +/* Handle static_assert as a keyword in C++ and compiler specifics. */ +#if !defined(__static_assert_is_defined) + +#if defined(__cplusplus) + +#if __cplusplus >= 201103L +#define __static_assert_is_defined 1 +#elif __has_feature(cxx_static_assert) +#define __static_assert_is_defined 1 +#elif defined(_MSC_VER) && (_MSC_VER >= 1600) +#define __static_assert_is_defined 1 +#endif + +#else + +#if defined(_MSC_VER) && (_MSC_VER >= 1600) +#define __static_assert_is_defined 1 +#elif __has_feature(c_static_assert) +#define static_assert(pred, msg) _Static_assert(pred, msg) +#define __static_assert_is_defined 1 +#elif defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) +/* In case the clib headers are not compliant. */ +#define static_assert(pred, msg) _Static_assert(pred, msg) +#define __static_assert_is_defined 1 +#endif + +#endif /* __cplusplus */ +#endif /* __static_assert_is_defined */ + + +#if !defined(__static_assert_is_defined) + +#define __PSTATIC_ASSERT_CONCAT_(a, b) static_assert_scope_##a##_line_##b +#define __PSTATIC_ASSERT_CONCAT(a, b) __PSTATIC_ASSERT_CONCAT_(a, b) +#ifdef __COUNTER__ +#define static_assert(e, msg) enum { __PSTATIC_ASSERT_CONCAT(__COUNTER__, __LINE__) = 1/(!!(e)) } +#else +#include "pstatic_assert_scope.h" +#define static_assert(e, msg) enum { __PSTATIC_ASSERT_CONCAT(__PSTATIC_ASSERT_COUNTER, __LINE__) = 1/(int)(!!(e)) } +#endif + +#define __static_assert_is_defined 1 + +#endif /* __static_assert_is_defined */ + +#endif /* PSTATIC_ASSERT_H */ + +/* Update scope counter outside of include guard. */ +#ifdef __PSTATIC_ASSERT_COUNTER +#include "pstatic_assert_scope.h" +#endif diff --git a/3rd_party/nanoarrow/flatcc/portable/pstdalign.h b/3rd_party/nanoarrow/flatcc/portable/pstdalign.h new file mode 100644 index 0000000..169fe27 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/portable/pstdalign.h @@ -0,0 +1,162 @@ +#ifndef PSTDALIGN_H +#define PSTDALIGN_H + +/* + * NOTE: aligned_alloc is defined via paligned_alloc.h + * and requires aligned_free to be fully portable although + * free also works on C11 and platforms with posix_memalign. + * + * NOTE: C++11 defines alignas as a keyword but then also defines + * __alignas_is_defined. + * + * C++14 does not define __alignas_is_defined, at least sometimes. + * + * GCC 8.3 reverts on this and makes C++11 behave the same as C++14 + * preventing a simple __cplusplus version check from working. + * + * Clang C++ without std=c++11 or std=c++14 does define alignas + * but does so incorrectly wrt. C11 and C++11 semantics because + * `alignas(4) float x;` is not recognized. + * To fix such issues, either move to a std version, or + * include a working stdalign.h for the given compiler before + * this file. + * + * newlib defines _Alignas and _Alignof in sys/cdefs but rely on + * gcc version for which can lead to conflicts if + * stdalign is not included. + * + * newlibs need for conflicts with broken C++ stdalign + * but this can be fixed be using std=C++11 or newer. + * + * MSVC does not support at least up to MSVC 2015, + * but does appear to support alignas and alignof keywords in + * recent standard C++. + * + * TCC only supports alignas with a numeric argument like + * `alignas(4)`, but not `alignas(float)`. + * + * If stdalign.h is supported but heuristics in this file are + * insufficient to detect this, try including manually + * or define HAVE_STDALIGN_H. + */ + +/* https://github.com/dvidelabs/flatcc/issues/130 */ +#ifndef __alignas_is_defined +#if defined(__cplusplus) +#if __cplusplus == 201103 && !defined(__clang__) && ((__GNUC__ > 8) || (__GNUC__ == 8 && __GNUC_MINOR__ >= 3)) +#define __alignas_is_defined 1 +#define __alignof_is_defined 1 +#include +#endif +#endif +#endif + +/* Allow for alternative solution to be included first. */ +#ifndef __alignas_is_defined + +#ifdef __cplusplus +#if defined(PORTABLE_PATCH_CPLUSPLUS_STDALIGN) +#include +#undef alignas +#define alignas(t) __attribute__((__aligned__(t))) +#endif +#endif + +#if !defined(PORTABLE_HAS_INCLUDE_STDALIGN) +#if defined(__has_include) +#if __has_include() +#define PORTABLE_HAS_INCLUDE_STDALIGN 1 +#else +#define PORTABLE_HAS_INCLUDE_STDALIGN 0 +#endif +#endif +#endif + + /* https://lists.gnu.org/archive/html/bug-gnulib/2015-08/msg00003.html */ +#if defined(__cplusplus) +#if !defined(_MSC_VER) +#include +#endif +#if __cplusplus > 201103 +#define __alignas_is_defined 1 +#define __alignof_is_defined 1 +#endif +#elif PORTABLE_HAS_INCLUDE_STDALIGN +#include +#elif !defined(__clang__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) +#include +#elif defined(HAVE_STDALIGN_H) +#include +#endif + +#endif /* __alignas_is_defined */ + +#ifndef __alignas_is_defined + +#ifdef __cplusplus +extern "C" { +#endif + +#if (!defined(__clang__) && defined(__GNUC__) && \ + ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 7))) +#undef PORTABLE_C11_STDALIGN_MISSING +#define PORTABLE_C11_STDALIGN_MISSING +#endif + +#if defined(__IBMC__) +#undef PORTABLE_C11_STDALIGN_MISSING +#define PORTABLE_C11_STDALIGN_MISSING +#endif + +#if ((defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && \ + !defined(PORTABLE_C11_STDALIGN_MISSING)) +/* C11 or newer */ +#include +#else +#if defined(__GNUC__) || defined(__IBM_ALIGNOF__) || defined(__clang__) + +#ifndef _Alignas +#define _Alignas(t) __attribute__((__aligned__(t))) +#endif + +#ifndef _Alignof +#define _Alignof(t) __alignof__(t) +#endif + +#elif defined(_MSC_VER) + +#define _Alignas(t) __declspec (align(t)) +#define _Alignof(t) __alignof(t) + +#elif defined(__TINYC__) + +/* Supports `_Alignas(integer-expression)`, but not `_Alignas(type)`. */ +#define _Alignas(t) __attribute__(aligned(t)) +#define _Alignof(t) __alignof__(t) + +#else +#error please update pstdalign.h with support for current compiler and library +#endif + +#endif /* __STDC__ */ + +#ifndef alignas +#define alignas _Alignas +#endif + +#ifndef alignof +#define alignof _Alignof +#endif + +#define __alignas_is_defined 1 +#define __alignof_is_defined 1 + +#ifdef __cplusplus +} +#endif + +#endif /* __alignas__is_defined */ + +#include "paligned_alloc.h" + +#endif /* PSTDALIGN_H */ diff --git a/3rd_party/nanoarrow/flatcc/portable/pstdint.h b/3rd_party/nanoarrow/flatcc/portable/pstdint.h new file mode 100644 index 0000000..14444aa --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/portable/pstdint.h @@ -0,0 +1,898 @@ +/* A portable stdint.h + **************************************************************************** + * BSD License: + **************************************************************************** + * + * Copyright (c) 2005-2016 Paul Hsieh + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + **************************************************************************** + * + * Version 0.1.15.2 + * + * The ANSI C standard committee, for the C99 standard, specified the + * inclusion of a new standard include file called stdint.h. This is + * a very useful and long desired include file which contains several + * very precise definitions for integer scalar types that is + * critically important for making portable several classes of + * applications including cryptography, hashing, variable length + * integer libraries and so on. But for most developers its likely + * useful just for programming sanity. + * + * The problem is that some compiler vendors chose to ignore the C99 + * standard and some older compilers have no opportunity to be updated. + * Because of this situation, simply including stdint.h in your code + * makes it unportable. + * + * So that's what this file is all about. Its an attempt to build a + * single universal include file that works on as many platforms as + * possible to deliver what stdint.h is supposed to. Even compilers + * that already come with stdint.h can use this file instead without + * any loss of functionality. A few things that should be noted about + * this file: + * + * 1) It is not guaranteed to be portable and/or present an identical + * interface on all platforms. The extreme variability of the + * ANSI C standard makes this an impossibility right from the + * very get go. Its really only meant to be useful for the vast + * majority of platforms that possess the capability of + * implementing usefully and precisely defined, standard sized + * integer scalars. Systems which are not intrinsically 2s + * complement may produce invalid constants. + * + * 2) There is an unavoidable use of non-reserved symbols. + * + * 3) Other standard include files are invoked. + * + * 4) This file may come in conflict with future platforms that do + * include stdint.h. The hope is that one or the other can be + * used with no real difference. + * + * 5) In the current verison, if your platform can't represent + * int32_t, int16_t and int8_t, it just dumps out with a compiler + * error. + * + * 6) 64 bit integers may or may not be defined. Test for their + * presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX. + * Note that this is different from the C99 specification which + * requires the existence of 64 bit support in the compiler. If + * this is not defined for your platform, yet it is capable of + * dealing with 64 bits then it is because this file has not yet + * been extended to cover all of your system's capabilities. + * + * 7) (u)intptr_t may or may not be defined. Test for its presence + * with the test: #ifdef PTRDIFF_MAX. If this is not defined + * for your platform, then it is because this file has not yet + * been extended to cover all of your system's capabilities, not + * because its optional. + * + * 8) The following might not been defined even if your platform is + * capable of defining it: + * + * WCHAR_MIN + * WCHAR_MAX + * (u)int64_t + * PTRDIFF_MIN + * PTRDIFF_MAX + * (u)intptr_t + * + * 9) The following have not been defined: + * + * WINT_MIN + * WINT_MAX + * + * 10) The criteria for defining (u)int_least(*)_t isn't clear, + * except for systems which don't have a type that precisely + * defined 8, 16, or 32 bit types (which this include file does + * not support anyways). Default definitions have been given. + * + * 11) The criteria for defining (u)int_fast(*)_t isn't something I + * would trust to any particular compiler vendor or the ANSI C + * committee. It is well known that "compatible systems" are + * commonly created that have very different performance + * characteristics from the systems they are compatible with, + * especially those whose vendors make both the compiler and the + * system. Default definitions have been given, but its strongly + * recommended that users never use these definitions for any + * reason (they do *NOT* deliver any serious guarantee of + * improved performance -- not in this file, nor any vendor's + * stdint.h). + * + * 12) The following macros: + * + * PRINTF_INTMAX_MODIFIER + * PRINTF_INT64_MODIFIER + * PRINTF_INT32_MODIFIER + * PRINTF_INT16_MODIFIER + * PRINTF_LEAST64_MODIFIER + * PRINTF_LEAST32_MODIFIER + * PRINTF_LEAST16_MODIFIER + * PRINTF_INTPTR_MODIFIER + * + * are strings which have been defined as the modifiers required + * for the "d", "u" and "x" printf formats to correctly output + * (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t, + * (u)least32_t, (u)least16_t and (u)intptr_t types respectively. + * PRINTF_INTPTR_MODIFIER is not defined for some systems which + * provide their own stdint.h. PRINTF_INT64_MODIFIER is not + * defined if INT64_MAX is not defined. These are an extension + * beyond what C99 specifies must be in stdint.h. + * + * In addition, the following macros are defined: + * + * PRINTF_INTMAX_HEX_WIDTH + * PRINTF_INT64_HEX_WIDTH + * PRINTF_INT32_HEX_WIDTH + * PRINTF_INT16_HEX_WIDTH + * PRINTF_INT8_HEX_WIDTH + * PRINTF_INTMAX_DEC_WIDTH + * PRINTF_INT64_DEC_WIDTH + * PRINTF_INT32_DEC_WIDTH + * PRINTF_INT16_DEC_WIDTH + * PRINTF_UINT8_DEC_WIDTH + * PRINTF_UINTMAX_DEC_WIDTH + * PRINTF_UINT64_DEC_WIDTH + * PRINTF_UINT32_DEC_WIDTH + * PRINTF_UINT16_DEC_WIDTH + * PRINTF_UINT8_DEC_WIDTH + * + * Which specifies the maximum number of characters required to + * print the number of that type in either hexadecimal or decimal. + * These are an extension beyond what C99 specifies must be in + * stdint.h. + * + * Compilers tested (all with 0 warnings at their highest respective + * settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32 + * bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio + * .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3 + * + * This file should be considered a work in progress. Suggestions for + * improvements, especially those which increase coverage are strongly + * encouraged. + * + * Acknowledgements + * + * The following people have made significant contributions to the + * development and testing of this file: + * + * Chris Howie + * John Steele Scott + * Dave Thorup + * John Dill + * Florian Wobbe + * Christopher Sean Morrison + * Mikkel Fahnoe Jorgensen + * + */ + +#include +#include +#include + +/* + * For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and + * do nothing else. On the Mac OS X version of gcc this is _STDINT_H_. + */ + +#if ((defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (__GNUC__ > 3 || defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED) +#include +#define _PSTDINT_H_INCLUDED +# if defined(__GNUC__) && (defined(__x86_64__) || defined(__ppc64__)) && !(defined(__APPLE__) && defined(__MACH__)) +# ifndef PRINTF_INT64_MODIFIER +# define PRINTF_INT64_MODIFIER "l" +# endif +# ifndef PRINTF_INT32_MODIFIER +# define PRINTF_INT32_MODIFIER "" +# endif +# else +# ifndef PRINTF_INT64_MODIFIER +# define PRINTF_INT64_MODIFIER "ll" +# endif +# ifndef PRINTF_INT32_MODIFIER +# if (UINT_MAX == UINT32_MAX) +# define PRINTF_INT32_MODIFIER "" +# else +# define PRINTF_INT32_MODIFIER "l" +# endif +# endif +# endif +# ifndef PRINTF_INT16_MODIFIER +# define PRINTF_INT16_MODIFIER "h" +# endif +# ifndef PRINTF_INTMAX_MODIFIER +# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER +# endif +# ifndef PRINTF_INT64_HEX_WIDTH +# define PRINTF_INT64_HEX_WIDTH "16" +# endif +# ifndef PRINTF_UINT64_HEX_WIDTH +# define PRINTF_UINT64_HEX_WIDTH "16" +# endif +# ifndef PRINTF_INT32_HEX_WIDTH +# define PRINTF_INT32_HEX_WIDTH "8" +# endif +# ifndef PRINTF_UINT32_HEX_WIDTH +# define PRINTF_UINT32_HEX_WIDTH "8" +# endif +# ifndef PRINTF_INT16_HEX_WIDTH +# define PRINTF_INT16_HEX_WIDTH "4" +# endif +# ifndef PRINTF_UINT16_HEX_WIDTH +# define PRINTF_UINT16_HEX_WIDTH "4" +# endif +# ifndef PRINTF_INT8_HEX_WIDTH +# define PRINTF_INT8_HEX_WIDTH "2" +# endif +# ifndef PRINTF_UINT8_HEX_WIDTH +# define PRINTF_UINT8_HEX_WIDTH "2" +# endif +# ifndef PRINTF_INT64_DEC_WIDTH +# define PRINTF_INT64_DEC_WIDTH "19" +# endif +# ifndef PRINTF_UINT64_DEC_WIDTH +# define PRINTF_UINT64_DEC_WIDTH "20" +# endif +# ifndef PRINTF_INT32_DEC_WIDTH +# define PRINTF_INT32_DEC_WIDTH "10" +# endif +# ifndef PRINTF_UINT32_DEC_WIDTH +# define PRINTF_UINT32_DEC_WIDTH "10" +# endif +# ifndef PRINTF_INT16_DEC_WIDTH +# define PRINTF_INT16_DEC_WIDTH "5" +# endif +# ifndef PRINTF_UINT16_DEC_WIDTH +# define PRINTF_UINT16_DEC_WIDTH "5" +# endif +# ifndef PRINTF_INT8_DEC_WIDTH +# define PRINTF_INT8_DEC_WIDTH "3" +# endif +# ifndef PRINTF_UINT8_DEC_WIDTH +# define PRINTF_UINT8_DEC_WIDTH "3" +# endif +# ifndef PRINTF_INTMAX_HEX_WIDTH +# define PRINTF_INTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH +# endif +# ifndef PRINTF_UINTMAX_HEX_WIDTH +# define PRINTF_UINTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH +# endif +# ifndef PRINTF_INTMAX_DEC_WIDTH +# define PRINTF_INTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH +# endif +# ifndef PRINTF_UINTMAX_DEC_WIDTH +# define PRINTF_UINTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH +# endif + +/* + * Something really weird is going on with Open Watcom. Just pull some of + * these duplicated definitions from Open Watcom's stdint.h file for now. + */ + +# if defined (__WATCOMC__) && __WATCOMC__ >= 1250 +# if !defined (INT64_C) +# define INT64_C(x) (x + (INT64_MAX - INT64_MAX)) +# endif +# if !defined (UINT64_C) +# define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX)) +# endif +# if !defined (INT32_C) +# define INT32_C(x) (x + (INT32_MAX - INT32_MAX)) +# endif +# if !defined (UINT32_C) +# define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX)) +# endif +# if !defined (INT16_C) +# define INT16_C(x) (x) +# endif +# if !defined (UINT16_C) +# define UINT16_C(x) (x) +# endif +# if !defined (INT8_C) +# define INT8_C(x) (x) +# endif +# if !defined (UINT8_C) +# define UINT8_C(x) (x) +# endif +# if !defined (UINT64_MAX) +# define UINT64_MAX 18446744073709551615ULL +# endif +# if !defined (INT64_MAX) +# define INT64_MAX 9223372036854775807LL +# endif +# if !defined (UINT32_MAX) +# define UINT32_MAX 4294967295UL +# endif +# if !defined (INT32_MAX) +# define INT32_MAX 2147483647L +# endif +# if !defined (INTMAX_MAX) +# define INTMAX_MAX INT64_MAX +# endif +# if !defined (INTMAX_MIN) +# define INTMAX_MIN INT64_MIN +# endif +# endif +#endif + +#ifndef _PSTDINT_H_INCLUDED +#define _PSTDINT_H_INCLUDED + +#ifndef SIZE_MAX +# define SIZE_MAX (~(size_t)0) +#endif + +/* + * Deduce the type assignments from limits.h under the assumption that + * integer sizes in bits are powers of 2, and follow the ANSI + * definitions. + */ + +#ifndef UINT8_MAX +# define UINT8_MAX 0xff +#endif +#if !defined(uint8_t) && !defined(_UINT8_T) +# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S) + typedef unsigned char uint8_t; +# define UINT8_C(v) ((uint8_t) v) +# else +# error "Platform not supported" +# endif +#endif + +#ifndef INT8_MAX +# define INT8_MAX 0x7f +#endif +#ifndef INT8_MIN +# define INT8_MIN INT8_C(0x80) +#endif +#if !defined(int8_t) && !defined(_INT8_T) +# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S) + typedef signed char int8_t; +# define INT8_C(v) ((int8_t) v) +# else +# error "Platform not supported" +# endif +#endif + +#ifndef UINT16_MAX +# define UINT16_MAX 0xffff +#endif +#if !defined(uint16_t) && !defined(_UINT16_T) +#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S) + typedef unsigned int uint16_t; +# ifndef PRINTF_INT16_MODIFIER +# define PRINTF_INT16_MODIFIER "" +# endif +# define UINT16_C(v) ((uint16_t) (v)) +#elif (USHRT_MAX == UINT16_MAX) + typedef unsigned short uint16_t; +# define UINT16_C(v) ((uint16_t) (v)) +# ifndef PRINTF_INT16_MODIFIER +# define PRINTF_INT16_MODIFIER "h" +# endif +#else +#error "Platform not supported" +#endif +#endif + +#ifndef INT16_MAX +# define INT16_MAX 0x7fff +#endif +#ifndef INT16_MIN +# define INT16_MIN INT16_C(0x8000) +#endif +#if !defined(int16_t) && !defined(_INT16_T) +#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S) + typedef signed int int16_t; +# define INT16_C(v) ((int16_t) (v)) +# ifndef PRINTF_INT16_MODIFIER +# define PRINTF_INT16_MODIFIER "" +# endif +#elif (SHRT_MAX == INT16_MAX) + typedef signed short int16_t; +# define INT16_C(v) ((int16_t) (v)) +# ifndef PRINTF_INT16_MODIFIER +# define PRINTF_INT16_MODIFIER "h" +# endif +#else +#error "Platform not supported" +#endif +#endif + +#ifndef UINT32_MAX +# define UINT32_MAX (0xffffffffUL) +#endif +#if !defined(uint32_t) && !defined(_UINT32_T) +#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S) + typedef unsigned long uint32_t; +# define UINT32_C(v) v ## UL +# ifndef PRINTF_INT32_MODIFIER +# define PRINTF_INT32_MODIFIER "l" +# endif +#elif (UINT_MAX == UINT32_MAX) + typedef unsigned int uint32_t; +# ifndef PRINTF_INT32_MODIFIER +# define PRINTF_INT32_MODIFIER "" +# endif +# define UINT32_C(v) v ## U +#elif (USHRT_MAX == UINT32_MAX) + typedef unsigned short uint32_t; +# define UINT32_C(v) ((unsigned short) (v)) +# ifndef PRINTF_INT32_MODIFIER +# define PRINTF_INT32_MODIFIER "" +# endif +#else +#error "Platform not supported" +#endif +#endif + +#ifndef INT32_MAX +# define INT32_MAX (0x7fffffffL) +#endif +#ifndef INT32_MIN +# define INT32_MIN INT32_C(0x80000000) +#endif +#if !defined(int32_t) && !defined(_INT32_T) +#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S) + typedef signed long int32_t; +# define INT32_C(v) v ## L +# ifndef PRINTF_INT32_MODIFIER +# define PRINTF_INT32_MODIFIER "l" +# endif +#elif (INT_MAX == INT32_MAX) + typedef signed int int32_t; +# define INT32_C(v) v +# ifndef PRINTF_INT32_MODIFIER +# define PRINTF_INT32_MODIFIER "" +# endif +#elif (SHRT_MAX == INT32_MAX) + typedef signed short int32_t; +# define INT32_C(v) ((short) (v)) +# ifndef PRINTF_INT32_MODIFIER +# define PRINTF_INT32_MODIFIER "" +# endif +#else +#error "Platform not supported" +#endif +#endif + +/* + * The macro stdint_int64_defined is temporarily used to record + * whether or not 64 integer support is available. It must be + * defined for any 64 integer extensions for new platforms that are + * added. + */ + +#undef stdint_int64_defined +#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S) +# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S) +# define stdint_int64_defined + typedef long long int64_t; + typedef unsigned long long uint64_t; +# define UINT64_C(v) v ## ULL +# define INT64_C(v) v ## LL +# ifndef PRINTF_INT64_MODIFIER +# define PRINTF_INT64_MODIFIER "ll" +# endif +# endif +#endif + +#if !defined (stdint_int64_defined) +# if defined(__GNUC__) +# define stdint_int64_defined + __extension__ typedef long long int64_t; + __extension__ typedef unsigned long long uint64_t; +# define UINT64_C(v) v ## ULL +# define INT64_C(v) v ## LL +# ifndef PRINTF_INT64_MODIFIER +# define PRINTF_INT64_MODIFIER "ll" +# endif +# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S) +# define stdint_int64_defined + typedef long long int64_t; + typedef unsigned long long uint64_t; +# define UINT64_C(v) v ## ULL +# define INT64_C(v) v ## LL +# ifndef PRINTF_INT64_MODIFIER +# define PRINTF_INT64_MODIFIER "ll" +# endif +# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC) +# define stdint_int64_defined + typedef __int64 int64_t; + typedef unsigned __int64 uint64_t; +# define UINT64_C(v) v ## UI64 +# define INT64_C(v) v ## I64 +# ifndef PRINTF_INT64_MODIFIER +# define PRINTF_INT64_MODIFIER "I64" +# endif +# endif +#endif + +#if !defined (LONG_LONG_MAX) && defined (INT64_C) +# define LONG_LONG_MAX INT64_C (9223372036854775807) +#endif +#ifndef ULONG_LONG_MAX +# define ULONG_LONG_MAX UINT64_C (18446744073709551615) +#endif + +#if !defined (INT64_MAX) && defined (INT64_C) +# define INT64_MAX INT64_C (9223372036854775807) +#endif +#if !defined (INT64_MIN) && defined (INT64_C) +# define INT64_MIN INT64_C (-9223372036854775808) +#endif +#if !defined (UINT64_MAX) && defined (INT64_C) +# define UINT64_MAX UINT64_C (18446744073709551615) +#endif + +/* + * Width of hexadecimal for number field. + */ + +#ifndef PRINTF_INT64_HEX_WIDTH +# define PRINTF_INT64_HEX_WIDTH "16" +#endif +#ifndef PRINTF_INT32_HEX_WIDTH +# define PRINTF_INT32_HEX_WIDTH "8" +#endif +#ifndef PRINTF_INT16_HEX_WIDTH +# define PRINTF_INT16_HEX_WIDTH "4" +#endif +#ifndef PRINTF_INT8_HEX_WIDTH +# define PRINTF_INT8_HEX_WIDTH "2" +#endif +#ifndef PRINTF_INT64_DEC_WIDTH +# define PRINTF_INT64_DEC_WIDTH "19" +#endif +#ifndef PRINTF_INT32_DEC_WIDTH +# define PRINTF_INT32_DEC_WIDTH "10" +#endif +#ifndef PRINTF_INT16_DEC_WIDTH +# define PRINTF_INT16_DEC_WIDTH "5" +#endif +#ifndef PRINTF_INT8_DEC_WIDTH +# define PRINTF_INT8_DEC_WIDTH "3" +#endif +#ifndef PRINTF_UINT64_DEC_WIDTH +# define PRINTF_UINT64_DEC_WIDTH "20" +#endif +#ifndef PRINTF_UINT32_DEC_WIDTH +# define PRINTF_UINT32_DEC_WIDTH "10" +#endif +#ifndef PRINTF_UINT16_DEC_WIDTH +# define PRINTF_UINT16_DEC_WIDTH "5" +#endif +#ifndef PRINTF_UINT8_DEC_WIDTH +# define PRINTF_UINT8_DEC_WIDTH "3" +#endif + +/* + * Ok, lets not worry about 128 bit integers for now. Moore's law says + * we don't need to worry about that until about 2040 at which point + * we'll have bigger things to worry about. + */ + +#ifdef stdint_int64_defined + typedef int64_t intmax_t; + typedef uint64_t uintmax_t; +# define INTMAX_MAX INT64_MAX +# define INTMAX_MIN INT64_MIN +# define UINTMAX_MAX UINT64_MAX +# define UINTMAX_C(v) UINT64_C(v) +# define INTMAX_C(v) INT64_C(v) +# ifndef PRINTF_INTMAX_MODIFIER +# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER +# endif +# ifndef PRINTF_INTMAX_HEX_WIDTH +# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH +# endif +# ifndef PRINTF_INTMAX_DEC_WIDTH +# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH +# endif +#else + typedef int32_t intmax_t; + typedef uint32_t uintmax_t; +# define INTMAX_MAX INT32_MAX +# define UINTMAX_MAX UINT32_MAX +# define UINTMAX_C(v) UINT32_C(v) +# define INTMAX_C(v) INT32_C(v) +# ifndef PRINTF_INTMAX_MODIFIER +# define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER +# endif +# ifndef PRINTF_INTMAX_HEX_WIDTH +# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH +# endif +# ifndef PRINTF_INTMAX_DEC_WIDTH +# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH +# endif +#endif + +/* + * Because this file currently only supports platforms which have + * precise powers of 2 as bit sizes for the default integers, the + * least definitions are all trivial. Its possible that a future + * version of this file could have different definitions. + */ + +#ifndef stdint_least_defined + typedef int8_t int_least8_t; + typedef uint8_t uint_least8_t; + typedef int16_t int_least16_t; + typedef uint16_t uint_least16_t; + typedef int32_t int_least32_t; + typedef uint32_t uint_least32_t; +# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER +# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER +# define UINT_LEAST8_MAX UINT8_MAX +# define INT_LEAST8_MAX INT8_MAX +# define UINT_LEAST16_MAX UINT16_MAX +# define INT_LEAST16_MAX INT16_MAX +# define UINT_LEAST32_MAX UINT32_MAX +# define INT_LEAST32_MAX INT32_MAX +# define INT_LEAST8_MIN INT8_MIN +# define INT_LEAST16_MIN INT16_MIN +# define INT_LEAST32_MIN INT32_MIN +# ifdef stdint_int64_defined + typedef int64_t int_least64_t; + typedef uint64_t uint_least64_t; +# define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER +# define UINT_LEAST64_MAX UINT64_MAX +# define INT_LEAST64_MAX INT64_MAX +# define INT_LEAST64_MIN INT64_MIN +# endif +#endif +#undef stdint_least_defined + +/* + * The ANSI C committee pretending to know or specify anything about + * performance is the epitome of misguided arrogance. The mandate of + * this file is to *ONLY* ever support that absolute minimum + * definition of the fast integer types, for compatibility purposes. + * No extensions, and no attempt to suggest what may or may not be a + * faster integer type will ever be made in this file. Developers are + * warned to stay away from these types when using this or any other + * stdint.h. + */ + +typedef int_least8_t int_fast8_t; +typedef uint_least8_t uint_fast8_t; +typedef int_least16_t int_fast16_t; +typedef uint_least16_t uint_fast16_t; +typedef int_least32_t int_fast32_t; +typedef uint_least32_t uint_fast32_t; +#define UINT_FAST8_MAX UINT_LEAST8_MAX +#define INT_FAST8_MAX INT_LEAST8_MAX +#define UINT_FAST16_MAX UINT_LEAST16_MAX +#define INT_FAST16_MAX INT_LEAST16_MAX +#define UINT_FAST32_MAX UINT_LEAST32_MAX +#define INT_FAST32_MAX INT_LEAST32_MAX +#define INT_FAST8_MIN INT_LEAST8_MIN +#define INT_FAST16_MIN INT_LEAST16_MIN +#define INT_FAST32_MIN INT_LEAST32_MIN +#ifdef stdint_int64_defined + typedef int_least64_t int_fast64_t; + typedef uint_least64_t uint_fast64_t; +# define UINT_FAST64_MAX UINT_LEAST64_MAX +# define INT_FAST64_MAX INT_LEAST64_MAX +# define INT_FAST64_MIN INT_LEAST64_MIN +#endif + +#undef stdint_int64_defined + +/* + * Whatever piecemeal, per compiler thing we can do about the wchar_t + * type limits. + */ + +#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) +# include +# ifndef WCHAR_MIN +# define WCHAR_MIN 0 +# endif +# ifndef WCHAR_MAX +# define WCHAR_MAX ((wchar_t)-1) +# endif +#endif + +/* + * Whatever piecemeal, per compiler/platform thing we can do about the + * (u)intptr_t types and limits. + */ + +#if (defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)) || defined (_UINTPTR_T) +# define STDINT_H_UINTPTR_T_DEFINED +#endif + +#ifndef STDINT_H_UINTPTR_T_DEFINED +# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) || defined (__ppc64__) +# define stdint_intptr_bits 64 +# elif defined (__WATCOMC__) || defined (__TURBOC__) +# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__) +# define stdint_intptr_bits 16 +# else +# define stdint_intptr_bits 32 +# endif +# elif defined (__i386__) || defined (_WIN32) || defined (WIN32) || defined (__ppc64__) +# define stdint_intptr_bits 32 +# elif defined (__INTEL_COMPILER) +/* TODO -- what did Intel do about x86-64? */ +# else +/* #error "This platform might not be supported yet" */ +# endif + +# ifdef stdint_intptr_bits +# define stdint_intptr_glue3_i(a,b,c) a##b##c +# define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c) +# ifndef PRINTF_INTPTR_MODIFIER +# define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER) +# endif +# ifndef PTRDIFF_MAX +# define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX) +# endif +# ifndef PTRDIFF_MIN +# define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN) +# endif +# ifndef UINTPTR_MAX +# define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX) +# endif +# ifndef INTPTR_MAX +# define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX) +# endif +# ifndef INTPTR_MIN +# define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN) +# endif +# ifndef INTPTR_C +# define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x) +# endif +# ifndef UINTPTR_C +# define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x) +# endif + typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t; + typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t; +# else +/* TODO -- This following is likely wrong for some platforms, and does + nothing for the definition of uintptr_t. */ + typedef ptrdiff_t intptr_t; +# endif +# define STDINT_H_UINTPTR_T_DEFINED +#endif + +/* + * Assumes sig_atomic_t is signed and we have a 2s complement machine. + */ + +#ifndef SIG_ATOMIC_MAX +# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1) +#endif + +#endif + +#if defined (__TEST_PSTDINT_FOR_CORRECTNESS) + +/* + * Please compile with the maximum warning settings to make sure macros are + * not defined more than once. + */ + +#include +#include +#include + +#define glue3_aux(x,y,z) x ## y ## z +#define glue3(x,y,z) glue3_aux(x,y,z) + +#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,) = glue3(UINT,bits,_C) (0); +#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,) = glue3(INT,bits,_C) (0); + +#define DECL(us,bits) glue3(DECL,us,) (bits) + +#define TESTUMAX(bits) glue3(u,bits,) = ~glue3(u,bits,); if (glue3(UINT,bits,_MAX) != glue3(u,bits,)) printf ("Something wrong with UINT%d_MAX\n", bits) + +#define REPORTERROR(msg) { err_n++; if (err_first <= 0) err_first = __LINE__; printf msg; } + +int main () { + int err_n = 0; + int err_first = 0; + DECL(I,8) + DECL(U,8) + DECL(I,16) + DECL(U,16) + DECL(I,32) + DECL(U,32) +#ifdef INT64_MAX + DECL(I,64) + DECL(U,64) +#endif + intmax_t imax = INTMAX_C(0); + uintmax_t umax = UINTMAX_C(0); + char str0[256], str1[256]; + + sprintf (str0, "%" PRINTF_INT32_MODIFIER "d", INT32_C(2147483647)); + if (0 != strcmp (str0, "2147483647")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0)); + if (atoi(PRINTF_INT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_INT32_DEC_WIDTH : %s\n", PRINTF_INT32_DEC_WIDTH)); + sprintf (str0, "%" PRINTF_INT32_MODIFIER "u", UINT32_C(4294967295)); + if (0 != strcmp (str0, "4294967295")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0)); + if (atoi(PRINTF_UINT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_UINT32_DEC_WIDTH : %s\n", PRINTF_UINT32_DEC_WIDTH)); +#ifdef INT64_MAX + sprintf (str1, "%" PRINTF_INT64_MODIFIER "d", INT64_C(9223372036854775807)); + if (0 != strcmp (str1, "9223372036854775807")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1)); + if (atoi(PRINTF_INT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_INT64_DEC_WIDTH : %s, %d\n", PRINTF_INT64_DEC_WIDTH, (int) strlen(str1))); + sprintf (str1, "%" PRINTF_INT64_MODIFIER "u", UINT64_C(18446744073709550591)); + if (0 != strcmp (str1, "18446744073709550591")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1)); + if (atoi(PRINTF_UINT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_UINT64_DEC_WIDTH : %s, %d\n", PRINTF_UINT64_DEC_WIDTH, (int) strlen(str1))); +#endif + + sprintf (str0, "%d %x\n", 0, ~0); + + sprintf (str1, "%d %x\n", i8, ~0); + if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i8 : %s\n", str1)); + sprintf (str1, "%u %x\n", u8, ~0); + if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u8 : %s\n", str1)); + sprintf (str1, "%d %x\n", i16, ~0); + if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i16 : %s\n", str1)); + sprintf (str1, "%u %x\n", u16, ~0); + if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u16 : %s\n", str1)); + sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0); + if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i32 : %s\n", str1)); + sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0); + if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u32 : %s\n", str1)); +#ifdef INT64_MAX + sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0); + if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i64 : %s\n", str1)); +#endif + sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0); + if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with imax : %s\n", str1)); + sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0); + if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with umax : %s\n", str1)); + + TESTUMAX(8); + TESTUMAX(16); + TESTUMAX(32); +#ifdef INT64_MAX + TESTUMAX(64); +#endif + +#define STR(v) #v +#define Q(v) printf ("sizeof " STR(v) " = %u\n", (unsigned) sizeof (v)); + if (err_n) { + printf ("pstdint.h is not correct. Please use sizes below to correct it:\n"); + } + + Q(int) + Q(unsigned) + Q(long int) + Q(short int) + Q(int8_t) + Q(int16_t) + Q(int32_t) +#ifdef INT64_MAX + Q(int64_t) +#endif + + return EXIT_SUCCESS; +} + +#endif diff --git a/3rd_party/nanoarrow/flatcc/portable/punaligned.h b/3rd_party/nanoarrow/flatcc/portable/punaligned.h new file mode 100644 index 0000000..a7e1f23 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/portable/punaligned.h @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2016 Mikkel Fahnøe Jørgensen, dvide.com + * + * (MIT License) + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * - The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * - The Software is provided "as is", without warranty of any kind, express or + * implied, including but not limited to the warranties of merchantability, + * fitness for a particular purpose and noninfringement. In no event shall the + * authors or copyright holders be liable for any claim, damages or other + * liability, whether in an action of contract, tort or otherwise, arising from, + * out of or in connection with the Software or the use or other dealings in the + * Software. + */ + +#ifndef PUNLIGNED_H +#define PUNLIGNED_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef PORTABLE_UNALIGNED_ACCESS + +#if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64) +#define PORTABLE_UNALIGNED_ACCESS 1 +#else +#define PORTABLE_UNALIGNED_ACCESS 0 +#endif + +#endif + +/* `unaligned_read_16` might not be defined if endianness was not determined. */ +#if !defined(unaligned_read_le16toh) + +#include "pendian.h" + +#ifndef UINT8_MAX +#include +#endif + +#if PORTABLE_UNALIGNED_ACCESS + +#define unaligned_read_16(p) (*(uint16_t*)(p)) +#define unaligned_read_32(p) (*(uint32_t*)(p)) +#define unaligned_read_64(p) (*(uint64_t*)(p)) + +#define unaligned_read_le16toh(p) le16toh(*(uint16_t*)(p)) +#define unaligned_read_le32toh(p) le32toh(*(uint32_t*)(p)) +#define unaligned_read_le64toh(p) le64toh(*(uint64_t*)(p)) + +#define unaligned_read_be16toh(p) be16toh(*(uint16_t*)(p)) +#define unaligned_read_be32toh(p) be32toh(*(uint32_t*)(p)) +#define unaligned_read_be64toh(p) be64toh(*(uint64_t*)(p)) + +#define unaligned_write_16(p, v) (*(uint16_t*)(p) = (uint16_t)(v)) +#define unaligned_write_32(p, v) (*(uint32_t*)(p) = (uint32_t)(v)) +#define unaligned_write_64(p, v) (*(uint64_t*)(p) = (uint64_t)(v)) + +#define unaligned_write_htole16(p, v) (*(uint16_t*)(p) = htole16(v)) +#define unaligned_write_htole32(p, v) (*(uint32_t*)(p) = htole32(v)) +#define unaligned_write_htole64(p, v) (*(uint64_t*)(p) = htole64(v)) + +#define unaligned_write_htobe16(p, v) (*(uint16_t*)(p) = htobe16(v)) +#define unaligned_write_htobe32(p, v) (*(uint32_t*)(p) = htobe32(v)) +#define unaligned_write_htobe64(p, v) (*(uint64_t*)(p) = htobe64(v)) + +#else + +#define unaligned_read_le16toh(p) ( \ + (((uint16_t)(((uint8_t *)(p))[0])) << 0) | \ + (((uint16_t)(((uint8_t *)(p))[1])) << 8)) + +#define unaligned_read_le32toh(p) ( \ + (((uint32_t)(((uint8_t *)(p))[0])) << 0) | \ + (((uint32_t)(((uint8_t *)(p))[1])) << 8) | \ + (((uint32_t)(((uint8_t *)(p))[2])) << 16) | \ + (((uint32_t)(((uint8_t *)(p))[3])) << 24)) + +#define unaligned_read_le64toh(p) ( \ + (((uint64_t)(((uint8_t *)(p))[0])) << 0) | \ + (((uint64_t)(((uint8_t *)(p))[1])) << 8) | \ + (((uint64_t)(((uint8_t *)(p))[2])) << 16) | \ + (((uint64_t)(((uint8_t *)(p))[3])) << 24) | \ + (((uint64_t)(((uint8_t *)(p))[4])) << 32) | \ + (((uint64_t)(((uint8_t *)(p))[5])) << 40) | \ + (((uint64_t)(((uint8_t *)(p))[6])) << 48) | \ + (((uint64_t)(((uint8_t *)(p))[7])) << 56)) + +#define unaligned_read_be16toh(p) ( \ + (((uint16_t)(((uint8_t *)(p))[0])) << 8) | \ + (((uint16_t)(((uint8_t *)(p))[1])) << 0)) + +#define unaligned_read_be32toh(p) ( \ + (((uint32_t)(((uint8_t *)(p))[0])) << 24) | \ + (((uint32_t)(((uint8_t *)(p))[1])) << 16) | \ + (((uint32_t)(((uint8_t *)(p))[2])) << 8) | \ + (((uint32_t)(((uint8_t *)(p))[3])) << 0)) + +#define unaligned_read_be64toh(p) ( \ + (((uint64_t)(((uint8_t *)(p))[0])) << 56) | \ + (((uint64_t)(((uint8_t *)(p))[1])) << 48) | \ + (((uint64_t)(((uint8_t *)(p))[2])) << 40) | \ + (((uint64_t)(((uint8_t *)(p))[3])) << 32) | \ + (((uint64_t)(((uint8_t *)(p))[4])) << 24) | \ + (((uint64_t)(((uint8_t *)(p))[5])) << 16) | \ + (((uint64_t)(((uint8_t *)(p))[6])) << 8) | \ + (((uint64_t)(((uint8_t *)(p))[7])) << 0)) + +#define unaligned_write_htole16(p, v) do { \ + ((uint8_t *)(p))[0] = (uint8_t)(((uint16_t)(v)) >> 0); \ + ((uint8_t *)(p))[1] = (uint8_t)(((uint16_t)(v)) >> 8); \ + } while (0) + +#define unaligned_write_htole32(p, v) do { \ + ((uint8_t *)(p))[0] = (uint8_t)(((uint32_t)(v)) >> 0); \ + ((uint8_t *)(p))[1] = (uint8_t)(((uint32_t)(v)) >> 8); \ + ((uint8_t *)(p))[2] = (uint8_t)(((uint32_t)(v)) >> 16); \ + ((uint8_t *)(p))[3] = (uint8_t)(((uint32_t)(v)) >> 24); \ + } while (0) + +#define unaligned_write_htole64(p, v) do { \ + ((uint8_t *)(p))[0] = (uint8_t)(((uint64_t)(v)) >> 0); \ + ((uint8_t *)(p))[1] = (uint8_t)(((uint64_t)(v)) >> 8); \ + ((uint8_t *)(p))[2] = (uint8_t)(((uint64_t)(v)) >> 16); \ + ((uint8_t *)(p))[3] = (uint8_t)(((uint64_t)(v)) >> 24); \ + ((uint8_t *)(p))[4] = (uint8_t)(((uint64_t)(v)) >> 32); \ + ((uint8_t *)(p))[5] = (uint8_t)(((uint64_t)(v)) >> 40); \ + ((uint8_t *)(p))[6] = (uint8_t)(((uint64_t)(v)) >> 48); \ + ((uint8_t *)(p))[7] = (uint8_t)(((uint64_t)(v)) >> 56); \ + } while (0) + +#define unaligned_write_htobe16(p, v) do { \ + ((uint8_t *)(p))[0] = (uint8_t)(((uint16_t)(v)) >> 8); \ + ((uint8_t *)(p))[1] = (uint8_t)(((uint16_t)(v)) >> 0); \ + } while (0) + +#define unaligned_write_htobe32(p, v) do { \ + ((uint8_t *)(p))[0] = (uint8_t)(((uint32_t)(v)) >> 24); \ + ((uint8_t *)(p))[1] = (uint8_t)(((uint32_t)(v)) >> 16); \ + ((uint8_t *)(p))[2] = (uint8_t)(((uint32_t)(v)) >> 8); \ + ((uint8_t *)(p))[3] = (uint8_t)(((uint32_t)(v)) >> 0); \ + } while (0) + +#define unaligned_write_htobe64(p) do { \ + ((uint8_t *)(p))[0] = (uint8_t)(((uint64_t)(v)) >> 56); \ + ((uint8_t *)(p))[1] = (uint8_t)(((uint64_t)(v)) >> 48); \ + ((uint8_t *)(p))[2] = (uint8_t)(((uint64_t)(v)) >> 40); \ + ((uint8_t *)(p))[3] = (uint8_t)(((uint64_t)(v)) >> 32); \ + ((uint8_t *)(p))[4] = (uint8_t)(((uint64_t)(v)) >> 24); \ + ((uint8_t *)(p))[5] = (uint8_t)(((uint64_t)(v)) >> 16); \ + ((uint8_t *)(p))[6] = (uint8_t)(((uint64_t)(v)) >> 8); \ + ((uint8_t *)(p))[7] = (uint8_t)(((uint64_t)(v)) >> 0); \ + } while (0) + +#if __LITTLE_ENDIAN__ +#define unaligned_read_16(p) unaligned_read_le16toh(p) +#define unaligned_read_32(p) unaligned_read_le32toh(p) +#define unaligned_read_64(p) unaligned_read_le64toh(p) + +#define unaligned_write_16(p) unaligned_write_htole16(p) +#define unaligned_write_32(p) unaligned_write_htole32(p) +#define unaligned_write_64(p) unaligned_write_htole64(p) +#endif + +#if __BIG_ENDIAN__ +#define unaligned_read_16(p) unaligned_read_be16toh(p) +#define unaligned_read_32(p) unaligned_read_be32toh(p) +#define unaligned_read_64(p) unaligned_read_be64toh(p) + +#define unaligned_write_16(p) unaligned_write_htobe16(p) +#define unaligned_write_32(p) unaligned_write_htobe32(p) +#define unaligned_write_64(p) unaligned_write_htobe64(p) +#endif + +#endif + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* PUNALIGNED_H */ diff --git a/3rd_party/nanoarrow/flatcc/portable/pversion.h b/3rd_party/nanoarrow/flatcc/portable/pversion.h new file mode 100644 index 0000000..d434104 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/portable/pversion.h @@ -0,0 +1,6 @@ +#define PORTABLE_VERSION_TEXT "0.2.6-pre" +#define PORTABLE_VERSION_MAJOR 0 +#define PORTABLE_VERSION_MINOR 2 +#define PORTABLE_VERSION_PATCH 6 +/* 1 or 0 */ +#define PORTABLE_VERSION_RELEASED 0 diff --git a/3rd_party/nanoarrow/flatcc/portable/pwarnings.h b/3rd_party/nanoarrow/flatcc/portable/pwarnings.h new file mode 100644 index 0000000..f420861 --- /dev/null +++ b/3rd_party/nanoarrow/flatcc/portable/pwarnings.h @@ -0,0 +1,52 @@ +#ifndef PWARNINGS_H +#define PWARNINGS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * See also pdiagnostics.h headers for per file control of common + * warnings. + * + * This file is intended for global disabling of warnings that shouldn't + * be present in C11 or perhaps C99, or a generally just noise where + * recent clang / gcc compile cleanly with high warning levels. + */ + +#if defined(_MSC_VER) +/* Needed when flagging code in or out and more. */ +#pragma warning(disable: 4127) /* conditional expression is constant */ +/* happens also in MS's own headers. */ +#pragma warning(disable: 4668) /* preprocessor name not defined */ +/* MSVC does not respect double parenthesis for intent */ +#pragma warning(disable: 4706) /* assignment within conditional expression */ +/* `inline` only advisory anyway. */ +#pragma warning(disable: 4710) /* function not inlined */ +/* Well, we don't intend to add the padding manually. */ +#pragma warning(disable: 4820) /* x bytes padding added in struct */ + +/* + * Don't warn that fopen etc. are unsafe + * + * Define a compiler flag like `-D_CRT_SECURE_NO_WARNINGS` in the build. + * For some reason it doesn't work when defined here. + * + * #define _CRT_SECURE_NO_WARNINGS + */ + +/* + * Anonymous union in struct is valid in C11 and has been supported in + * GCC and Clang for a while, but it is not C99. MSVC also handles it, + * but warns. Truly portable code should perhaps not use this feature, + * but this is not the place to complain about it. + */ +#pragma warning(disable: 4201) /* nonstandard extension used: nameless struct/union */ + +#endif /* _MSV_VER */ + +#ifdef __cplusplus +} +#endif + +#endif /* PWARNINGS_H */ diff --git a/3rd_party/nanoarrow/nanoarrow.c b/3rd_party/nanoarrow/nanoarrow.c new file mode 100644 index 0000000..d71b1ab --- /dev/null +++ b/3rd_party/nanoarrow/nanoarrow.c @@ -0,0 +1,3872 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include +#include +#include +#include +#include +#include + +#include "nanoarrow/nanoarrow.h" + +const char* ArrowNanoarrowVersion(void) { return NANOARROW_VERSION; } + +int ArrowNanoarrowVersionInt(void) { return NANOARROW_VERSION_INT; } + +ArrowErrorCode ArrowErrorSet(struct ArrowError* error, const char* fmt, ...) { + if (error == NULL) { + return NANOARROW_OK; + } + + memset(error->message, 0, sizeof(error->message)); + + va_list args; + va_start(args, fmt); + int chars_needed = vsnprintf(error->message, sizeof(error->message), fmt, args); + va_end(args); + + if (chars_needed < 0) { + return EINVAL; + } else if (((size_t)chars_needed) >= sizeof(error->message)) { + return ERANGE; + } else { + return NANOARROW_OK; + } +} + +void ArrowLayoutInit(struct ArrowLayout* layout, enum ArrowType storage_type) { + layout->buffer_type[0] = NANOARROW_BUFFER_TYPE_VALIDITY; + layout->buffer_data_type[0] = NANOARROW_TYPE_BOOL; + layout->buffer_type[1] = NANOARROW_BUFFER_TYPE_DATA; + layout->buffer_data_type[1] = storage_type; + layout->buffer_type[2] = NANOARROW_BUFFER_TYPE_NONE; + layout->buffer_data_type[2] = NANOARROW_TYPE_UNINITIALIZED; + + layout->element_size_bits[0] = 1; + layout->element_size_bits[1] = 0; + layout->element_size_bits[2] = 0; + + layout->child_size_elements = 0; + + switch (storage_type) { + case NANOARROW_TYPE_UNINITIALIZED: + case NANOARROW_TYPE_NA: + case NANOARROW_TYPE_RUN_END_ENCODED: + layout->buffer_type[0] = NANOARROW_BUFFER_TYPE_NONE; + layout->buffer_data_type[0] = NANOARROW_TYPE_UNINITIALIZED; + layout->buffer_type[1] = NANOARROW_BUFFER_TYPE_NONE; + layout->buffer_data_type[1] = NANOARROW_TYPE_UNINITIALIZED; + layout->element_size_bits[0] = 0; + break; + + case NANOARROW_TYPE_LIST: + case NANOARROW_TYPE_MAP: + layout->buffer_type[1] = NANOARROW_BUFFER_TYPE_DATA_OFFSET; + layout->buffer_data_type[1] = NANOARROW_TYPE_INT32; + layout->element_size_bits[1] = 32; + break; + + case NANOARROW_TYPE_LARGE_LIST: + layout->buffer_type[1] = NANOARROW_BUFFER_TYPE_DATA_OFFSET; + layout->buffer_data_type[1] = NANOARROW_TYPE_INT64; + layout->element_size_bits[1] = 64; + break; + + case NANOARROW_TYPE_STRUCT: + case NANOARROW_TYPE_FIXED_SIZE_LIST: + layout->buffer_type[1] = NANOARROW_BUFFER_TYPE_NONE; + layout->buffer_data_type[1] = NANOARROW_TYPE_UNINITIALIZED; + break; + + case NANOARROW_TYPE_BOOL: + layout->element_size_bits[1] = 1; + break; + + case NANOARROW_TYPE_UINT8: + case NANOARROW_TYPE_INT8: + layout->element_size_bits[1] = 8; + break; + + case NANOARROW_TYPE_UINT16: + case NANOARROW_TYPE_INT16: + case NANOARROW_TYPE_HALF_FLOAT: + layout->element_size_bits[1] = 16; + break; + + case NANOARROW_TYPE_UINT32: + case NANOARROW_TYPE_INT32: + case NANOARROW_TYPE_FLOAT: + layout->element_size_bits[1] = 32; + break; + case NANOARROW_TYPE_INTERVAL_MONTHS: + layout->buffer_data_type[1] = NANOARROW_TYPE_INT32; + layout->element_size_bits[1] = 32; + break; + + case NANOARROW_TYPE_UINT64: + case NANOARROW_TYPE_INT64: + case NANOARROW_TYPE_DOUBLE: + case NANOARROW_TYPE_INTERVAL_DAY_TIME: + layout->element_size_bits[1] = 64; + break; + + case NANOARROW_TYPE_DECIMAL128: + case NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO: + layout->element_size_bits[1] = 128; + break; + + case NANOARROW_TYPE_DECIMAL256: + layout->element_size_bits[1] = 256; + break; + + case NANOARROW_TYPE_FIXED_SIZE_BINARY: + layout->buffer_data_type[1] = NANOARROW_TYPE_BINARY; + break; + + case NANOARROW_TYPE_DENSE_UNION: + layout->buffer_type[0] = NANOARROW_BUFFER_TYPE_TYPE_ID; + layout->buffer_data_type[0] = NANOARROW_TYPE_INT8; + layout->element_size_bits[0] = 8; + layout->buffer_type[1] = NANOARROW_BUFFER_TYPE_UNION_OFFSET; + layout->buffer_data_type[1] = NANOARROW_TYPE_INT32; + layout->element_size_bits[1] = 32; + break; + + case NANOARROW_TYPE_SPARSE_UNION: + layout->buffer_type[0] = NANOARROW_BUFFER_TYPE_TYPE_ID; + layout->buffer_data_type[0] = NANOARROW_TYPE_INT8; + layout->element_size_bits[0] = 8; + layout->buffer_type[1] = NANOARROW_BUFFER_TYPE_NONE; + layout->buffer_data_type[1] = NANOARROW_TYPE_UNINITIALIZED; + break; + + case NANOARROW_TYPE_STRING: + case NANOARROW_TYPE_BINARY: + layout->buffer_type[1] = NANOARROW_BUFFER_TYPE_DATA_OFFSET; + layout->buffer_data_type[1] = NANOARROW_TYPE_INT32; + layout->element_size_bits[1] = 32; + layout->buffer_type[2] = NANOARROW_BUFFER_TYPE_DATA; + layout->buffer_data_type[2] = storage_type; + break; + + case NANOARROW_TYPE_LARGE_STRING: + layout->buffer_type[1] = NANOARROW_BUFFER_TYPE_DATA_OFFSET; + layout->buffer_data_type[1] = NANOARROW_TYPE_INT64; + layout->element_size_bits[1] = 64; + layout->buffer_type[2] = NANOARROW_BUFFER_TYPE_DATA; + layout->buffer_data_type[2] = NANOARROW_TYPE_STRING; + break; + case NANOARROW_TYPE_LARGE_BINARY: + layout->buffer_type[1] = NANOARROW_BUFFER_TYPE_DATA_OFFSET; + layout->buffer_data_type[1] = NANOARROW_TYPE_INT64; + layout->element_size_bits[1] = 64; + layout->buffer_type[2] = NANOARROW_BUFFER_TYPE_DATA; + layout->buffer_data_type[2] = NANOARROW_TYPE_BINARY; + break; + + case NANOARROW_TYPE_BINARY_VIEW: + layout->buffer_type[1] = NANOARROW_BUFFER_TYPE_DATA; + layout->buffer_data_type[1] = NANOARROW_TYPE_BINARY_VIEW; + layout->element_size_bits[1] = 128; + break; + case NANOARROW_TYPE_STRING_VIEW: + layout->buffer_type[1] = NANOARROW_BUFFER_TYPE_DATA; + layout->buffer_data_type[1] = NANOARROW_TYPE_STRING_VIEW; + layout->element_size_bits[1] = 128; + + default: + break; + } +} + +void* ArrowMalloc(int64_t size) { return malloc(size); } + +void* ArrowRealloc(void* ptr, int64_t size) { return realloc(ptr, size); } + +void ArrowFree(void* ptr) { free(ptr); } + +static uint8_t* ArrowBufferAllocatorMallocReallocate( + struct ArrowBufferAllocator* allocator, uint8_t* ptr, int64_t old_size, + int64_t new_size) { + NANOARROW_UNUSED(allocator); + NANOARROW_UNUSED(old_size); + return (uint8_t*)ArrowRealloc(ptr, new_size); +} + +static void ArrowBufferAllocatorMallocFree(struct ArrowBufferAllocator* allocator, + uint8_t* ptr, int64_t size) { + NANOARROW_UNUSED(allocator); + NANOARROW_UNUSED(size); + if (ptr != NULL) { + ArrowFree(ptr); + } +} + +static struct ArrowBufferAllocator ArrowBufferAllocatorMalloc = { + &ArrowBufferAllocatorMallocReallocate, &ArrowBufferAllocatorMallocFree, NULL}; + +struct ArrowBufferAllocator ArrowBufferAllocatorDefault(void) { + return ArrowBufferAllocatorMalloc; +} + +static uint8_t* ArrowBufferDeallocatorReallocate(struct ArrowBufferAllocator* allocator, + uint8_t* ptr, int64_t old_size, + int64_t new_size) { + NANOARROW_UNUSED(new_size); + + // Attempting to reallocate a buffer with a custom deallocator is + // a programming error. In debug mode, crash here. +#if defined(NANOARROW_DEBUG) + NANOARROW_PRINT_AND_DIE(ENOMEM, + "It is an error to reallocate a buffer whose allocator is " + "ArrowBufferDeallocator()"); +#endif + + // In release mode, ensure the the deallocator is called exactly + // once using the pointer it was given and return NULL, which + // will trigger the caller to return ENOMEM. + allocator->free(allocator, ptr, old_size); + *allocator = ArrowBufferAllocatorDefault(); + return NULL; +} + +struct ArrowBufferAllocator ArrowBufferDeallocator( + void (*custom_free)(struct ArrowBufferAllocator* allocator, uint8_t* ptr, + int64_t size), + void* private_data) { + struct ArrowBufferAllocator allocator; + allocator.reallocate = &ArrowBufferDeallocatorReallocate; + allocator.free = custom_free; + allocator.private_data = private_data; + return allocator; +} + +static const int kInt32DecimalDigits = 9; + +static const uint64_t kUInt32PowersOfTen[] = { + 1ULL, 10ULL, 100ULL, 1000ULL, 10000ULL, + 100000ULL, 1000000ULL, 10000000ULL, 100000000ULL, 1000000000ULL}; + +// Adapted from Arrow C++ to use 32-bit words for better C portability +// https://github.com/apache/arrow/blob/cd3321b28b0c9703e5d7105d6146c1270bbadd7f/cpp/src/arrow/util/decimal.cc#L524-L544 +static void ShiftAndAdd(struct ArrowStringView value, uint32_t* out, int64_t out_size) { + // We use strtoll for parsing, which needs input that is null-terminated + char chunk_string[16]; + + for (int64_t posn = 0; posn < value.size_bytes;) { + int64_t remaining = value.size_bytes - posn; + + int64_t group_size; + if (remaining > kInt32DecimalDigits) { + group_size = kInt32DecimalDigits; + } else { + group_size = remaining; + } + + const uint64_t multiple = kUInt32PowersOfTen[group_size]; + + memcpy(chunk_string, value.data + posn, group_size); + chunk_string[group_size] = '\0'; + uint32_t chunk = (uint32_t)strtoll(chunk_string, NULL, 10); + + for (int64_t i = 0; i < out_size; i++) { + uint64_t tmp = out[i]; + tmp *= multiple; + tmp += chunk; + out[i] = (uint32_t)(tmp & 0xFFFFFFFFULL); + chunk = (uint32_t)(tmp >> 32); + } + posn += group_size; + } +} + +ArrowErrorCode ArrowDecimalSetDigits(struct ArrowDecimal* decimal, + struct ArrowStringView value) { + // Check for sign + int is_negative = value.data[0] == '-'; + int has_sign = is_negative || value.data[0] == '+'; + value.data += has_sign; + value.size_bytes -= has_sign; + + // Check all characters are digits that are not the negative sign + for (int64_t i = 0; i < value.size_bytes; i++) { + char c = value.data[i]; + if (c < '0' || c > '9') { + return EINVAL; + } + } + + // Skip over leading 0s + int64_t n_leading_zeroes = 0; + for (int64_t i = 0; i < value.size_bytes; i++) { + if (value.data[i] == '0') { + n_leading_zeroes++; + } else { + break; + } + } + + value.data += n_leading_zeroes; + value.size_bytes -= n_leading_zeroes; + + // Use 32-bit words for portability + uint32_t words32[8]; + int n_words32 = decimal->n_words * 2; + NANOARROW_DCHECK(n_words32 <= 8); + memset(words32, 0, sizeof(words32)); + + ShiftAndAdd(value, words32, n_words32); + + if (decimal->low_word_index == 0) { + memcpy(decimal->words, words32, sizeof(uint32_t) * n_words32); + } else { + uint64_t lo; + uint64_t hi; + + for (int i = 0; i < decimal->n_words; i++) { + lo = (uint64_t)words32[i * 2]; + hi = (uint64_t)words32[i * 2 + 1] << 32; + decimal->words[decimal->n_words - i - 1] = lo | hi; + } + } + + if (is_negative) { + ArrowDecimalNegate(decimal); + } + + return NANOARROW_OK; +} + +// Adapted from Arrow C++ for C +// https://github.com/apache/arrow/blob/cd3321b28b0c9703e5d7105d6146c1270bbadd7f/cpp/src/arrow/util/decimal.cc#L365 +ArrowErrorCode ArrowDecimalAppendDigitsToBuffer(const struct ArrowDecimal* decimal, + struct ArrowBuffer* buffer) { + NANOARROW_DCHECK(decimal->n_words == 2 || decimal->n_words == 4); + int is_negative = ArrowDecimalSign(decimal) < 0; + + uint64_t words_little_endian[4]; + if (decimal->low_word_index == 0) { + memcpy(words_little_endian, decimal->words, decimal->n_words * sizeof(uint64_t)); + } else { + for (int i = 0; i < decimal->n_words; i++) { + words_little_endian[i] = decimal->words[decimal->n_words - i - 1]; + } + } + + // We've already made a copy, so negate that if needed + if (is_negative) { + uint64_t carry = 1; + for (int i = 0; i < decimal->n_words; i++) { + uint64_t elem = words_little_endian[i]; + elem = ~elem + carry; + carry &= (elem == 0); + words_little_endian[i] = elem; + } + } + + // Find the most significant word that is non-zero + int most_significant_elem_idx = -1; + for (int i = decimal->n_words - 1; i >= 0; i--) { + if (words_little_endian[i] != 0) { + most_significant_elem_idx = i; + break; + } + } + + // If they are all zero, the output is just '0' + if (most_significant_elem_idx == -1) { + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendInt8(buffer, '0')); + return NANOARROW_OK; + } + + // Define segments such that each segment represents 9 digits with the + // least significant group of 9 digits first. For example, if the input represents + // 9876543210123456789, then segments will be [123456789, 876543210, 9]. + // We handle at most a signed 256 bit integer, whose maximum value occupies 77 + // characters. Thus, we need at most 9 segments. + const uint32_t k1e9 = 1000000000U; + int num_segments = 0; + uint32_t segments[9]; + memset(segments, 0, sizeof(segments)); + uint64_t* most_significant_elem = words_little_endian + most_significant_elem_idx; + + do { + // Compute remainder = words_little_endian % 1e9 and words_little_endian = + // words_little_endian / 1e9. + uint32_t remainder = 0; + uint64_t* elem = most_significant_elem; + + do { + // Compute dividend = (remainder << 32) | *elem (a virtual 96-bit integer); + // *elem = dividend / 1e9; + // remainder = dividend % 1e9. + uint32_t hi = (uint32_t)(*elem >> 32); + uint32_t lo = (uint32_t)(*elem & 0xFFFFFFFFULL); + uint64_t dividend_hi = ((uint64_t)(remainder) << 32) | hi; + uint64_t quotient_hi = dividend_hi / k1e9; + remainder = (uint32_t)(dividend_hi % k1e9); + uint64_t dividend_lo = ((uint64_t)(remainder) << 32) | lo; + uint64_t quotient_lo = dividend_lo / k1e9; + remainder = (uint32_t)(dividend_lo % k1e9); + + *elem = (quotient_hi << 32) | quotient_lo; + } while (elem-- != words_little_endian); + + segments[num_segments++] = remainder; + } while (*most_significant_elem != 0 || most_significant_elem-- != words_little_endian); + + // We know our output has no more than 9 digits per segment, plus a negative sign, + // plus any further digits between our output of 9 digits plus enough + // extra characters to ensure that snprintf() with n = 21 (maximum length of %lu + // including a the null terminator) is bounded properly. + NANOARROW_RETURN_NOT_OK(ArrowBufferReserve(buffer, num_segments * 9 + 1 + 21 - 9)); + if (is_negative) { + buffer->data[buffer->size_bytes++] = '-'; + } + + // The most significant segment should have no leading zeroes + int n_chars = snprintf((char*)buffer->data + buffer->size_bytes, 21, "%lu", + (unsigned long)segments[num_segments - 1]); + + // Ensure that an encoding error from snprintf() does not result + // in an out-of-bounds access. + if (n_chars < 0) { + return ERANGE; + } + + buffer->size_bytes += n_chars; + + // Subsequent output needs to be left-padded with zeroes such that each segment + // takes up exactly 9 digits. + for (int i = num_segments - 2; i >= 0; i--) { + int n_chars = snprintf((char*)buffer->data + buffer->size_bytes, 21, "%09lu", + (unsigned long)segments[i]); + buffer->size_bytes += n_chars; + NANOARROW_DCHECK(buffer->size_bytes <= buffer->capacity_bytes); + } + + return NANOARROW_OK; +} +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include +#include +#include +#include +#include + +#include "nanoarrow/nanoarrow.h" + +static void ArrowSchemaReleaseInternal(struct ArrowSchema* schema) { + if (schema->format != NULL) ArrowFree((void*)schema->format); + if (schema->name != NULL) ArrowFree((void*)schema->name); + if (schema->metadata != NULL) ArrowFree((void*)schema->metadata); + + // This object owns the memory for all the children, but those + // children may have been generated elsewhere and might have + // their own release() callback. + if (schema->children != NULL) { + for (int64_t i = 0; i < schema->n_children; i++) { + if (schema->children[i] != NULL) { + if (schema->children[i]->release != NULL) { + ArrowSchemaRelease(schema->children[i]); + } + + ArrowFree(schema->children[i]); + } + } + + ArrowFree(schema->children); + } + + // This object owns the memory for the dictionary but it + // may have been generated somewhere else and have its own + // release() callback. + if (schema->dictionary != NULL) { + if (schema->dictionary->release != NULL) { + ArrowSchemaRelease(schema->dictionary); + } + + ArrowFree(schema->dictionary); + } + + // private data not currently used + if (schema->private_data != NULL) { + ArrowFree(schema->private_data); + } + + schema->release = NULL; +} + +static const char* ArrowSchemaFormatTemplate(enum ArrowType type) { + switch (type) { + case NANOARROW_TYPE_UNINITIALIZED: + return NULL; + case NANOARROW_TYPE_NA: + return "n"; + case NANOARROW_TYPE_BOOL: + return "b"; + + case NANOARROW_TYPE_UINT8: + return "C"; + case NANOARROW_TYPE_INT8: + return "c"; + case NANOARROW_TYPE_UINT16: + return "S"; + case NANOARROW_TYPE_INT16: + return "s"; + case NANOARROW_TYPE_UINT32: + return "I"; + case NANOARROW_TYPE_INT32: + return "i"; + case NANOARROW_TYPE_UINT64: + return "L"; + case NANOARROW_TYPE_INT64: + return "l"; + + case NANOARROW_TYPE_HALF_FLOAT: + return "e"; + case NANOARROW_TYPE_FLOAT: + return "f"; + case NANOARROW_TYPE_DOUBLE: + return "g"; + + case NANOARROW_TYPE_STRING: + return "u"; + case NANOARROW_TYPE_LARGE_STRING: + return "U"; + case NANOARROW_TYPE_STRING_VIEW: + return "vu"; + case NANOARROW_TYPE_BINARY: + return "z"; + case NANOARROW_TYPE_BINARY_VIEW: + return "vz"; + case NANOARROW_TYPE_LARGE_BINARY: + return "Z"; + + case NANOARROW_TYPE_DATE32: + return "tdD"; + case NANOARROW_TYPE_DATE64: + return "tdm"; + case NANOARROW_TYPE_INTERVAL_MONTHS: + return "tiM"; + case NANOARROW_TYPE_INTERVAL_DAY_TIME: + return "tiD"; + case NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO: + return "tin"; + + case NANOARROW_TYPE_LIST: + return "+l"; + case NANOARROW_TYPE_LARGE_LIST: + return "+L"; + case NANOARROW_TYPE_STRUCT: + return "+s"; + case NANOARROW_TYPE_MAP: + return "+m"; + case NANOARROW_TYPE_RUN_END_ENCODED: + return "+r"; + + default: + return NULL; + } +} + +static int ArrowSchemaInitChildrenIfNeeded(struct ArrowSchema* schema, + enum ArrowType type) { + switch (type) { + case NANOARROW_TYPE_LIST: + case NANOARROW_TYPE_LARGE_LIST: + case NANOARROW_TYPE_FIXED_SIZE_LIST: + NANOARROW_RETURN_NOT_OK(ArrowSchemaAllocateChildren(schema, 1)); + ArrowSchemaInit(schema->children[0]); + NANOARROW_RETURN_NOT_OK(ArrowSchemaSetName(schema->children[0], "item")); + break; + case NANOARROW_TYPE_MAP: + NANOARROW_RETURN_NOT_OK(ArrowSchemaAllocateChildren(schema, 1)); + NANOARROW_RETURN_NOT_OK( + ArrowSchemaInitFromType(schema->children[0], NANOARROW_TYPE_STRUCT)); + NANOARROW_RETURN_NOT_OK(ArrowSchemaSetName(schema->children[0], "entries")); + schema->children[0]->flags &= ~ARROW_FLAG_NULLABLE; + NANOARROW_RETURN_NOT_OK(ArrowSchemaAllocateChildren(schema->children[0], 2)); + ArrowSchemaInit(schema->children[0]->children[0]); + ArrowSchemaInit(schema->children[0]->children[1]); + NANOARROW_RETURN_NOT_OK( + ArrowSchemaSetName(schema->children[0]->children[0], "key")); + schema->children[0]->children[0]->flags &= ~ARROW_FLAG_NULLABLE; + NANOARROW_RETURN_NOT_OK( + ArrowSchemaSetName(schema->children[0]->children[1], "value")); + break; + case NANOARROW_TYPE_RUN_END_ENCODED: + NANOARROW_RETURN_NOT_OK(ArrowSchemaAllocateChildren(schema, 2)); + ArrowSchemaInit(schema->children[0]); + NANOARROW_RETURN_NOT_OK(ArrowSchemaSetName(schema->children[0], "run_ends")); + schema->children[0]->flags &= ~ARROW_FLAG_NULLABLE; + ArrowSchemaInit(schema->children[1]); + NANOARROW_RETURN_NOT_OK(ArrowSchemaSetName(schema->children[1], "values")); + default: + break; + } + + return NANOARROW_OK; +} + +void ArrowSchemaInit(struct ArrowSchema* schema) { + schema->format = NULL; + schema->name = NULL; + schema->metadata = NULL; + schema->flags = ARROW_FLAG_NULLABLE; + schema->n_children = 0; + schema->children = NULL; + schema->dictionary = NULL; + schema->private_data = NULL; + schema->release = &ArrowSchemaReleaseInternal; +} + +ArrowErrorCode ArrowSchemaSetType(struct ArrowSchema* schema, enum ArrowType type) { + // We don't allocate the dictionary because it has to be nullptr + // for non-dictionary-encoded arrays. + + // Set the format to a valid format string for type + const char* template_format = ArrowSchemaFormatTemplate(type); + + // If type isn't recognized and not explicitly unset + if (template_format == NULL && type != NANOARROW_TYPE_UNINITIALIZED) { + return EINVAL; + } + + NANOARROW_RETURN_NOT_OK(ArrowSchemaSetFormat(schema, template_format)); + + // For types with an umabiguous child structure, allocate children + return ArrowSchemaInitChildrenIfNeeded(schema, type); +} + +ArrowErrorCode ArrowSchemaSetTypeStruct(struct ArrowSchema* schema, int64_t n_children) { + NANOARROW_RETURN_NOT_OK(ArrowSchemaSetType(schema, NANOARROW_TYPE_STRUCT)); + NANOARROW_RETURN_NOT_OK(ArrowSchemaAllocateChildren(schema, n_children)); + for (int64_t i = 0; i < n_children; i++) { + ArrowSchemaInit(schema->children[i]); + } + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowSchemaInitFromType(struct ArrowSchema* schema, enum ArrowType type) { + ArrowSchemaInit(schema); + + int result = ArrowSchemaSetType(schema, type); + if (result != NANOARROW_OK) { + ArrowSchemaRelease(schema); + return result; + } + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowSchemaSetTypeFixedSize(struct ArrowSchema* schema, + enum ArrowType type, int32_t fixed_size) { + if (fixed_size <= 0) { + return EINVAL; + } + + char buffer[64]; + int n_chars; + switch (type) { + case NANOARROW_TYPE_FIXED_SIZE_BINARY: + n_chars = snprintf(buffer, sizeof(buffer), "w:%" PRId32, fixed_size); + break; + case NANOARROW_TYPE_FIXED_SIZE_LIST: + n_chars = snprintf(buffer, sizeof(buffer), "+w:%" PRId32, fixed_size); + break; + default: + return EINVAL; + } + + if (((size_t)n_chars) >= sizeof(buffer) || n_chars < 0) { + return ERANGE; + } + + buffer[n_chars] = '\0'; + NANOARROW_RETURN_NOT_OK(ArrowSchemaSetFormat(schema, buffer)); + + if (type == NANOARROW_TYPE_FIXED_SIZE_LIST) { + NANOARROW_RETURN_NOT_OK(ArrowSchemaInitChildrenIfNeeded(schema, type)); + } + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowSchemaSetTypeDecimal(struct ArrowSchema* schema, enum ArrowType type, + int32_t decimal_precision, + int32_t decimal_scale) { + if (decimal_precision <= 0) { + return EINVAL; + } + + char buffer[64]; + int n_chars; + switch (type) { + case NANOARROW_TYPE_DECIMAL128: + n_chars = + snprintf(buffer, sizeof(buffer), "d:%d,%d", decimal_precision, decimal_scale); + break; + case NANOARROW_TYPE_DECIMAL256: + n_chars = snprintf(buffer, sizeof(buffer), "d:%d,%d,256", decimal_precision, + decimal_scale); + break; + default: + return EINVAL; + } + + if (((size_t)n_chars) >= sizeof(buffer) || n_chars < 0) { + return ERANGE; + } + + buffer[n_chars] = '\0'; + return ArrowSchemaSetFormat(schema, buffer); +} + +ArrowErrorCode ArrowSchemaSetTypeRunEndEncoded(struct ArrowSchema* schema, + enum ArrowType run_end_type) { + switch (run_end_type) { + case NANOARROW_TYPE_INT16: + case NANOARROW_TYPE_INT32: + case NANOARROW_TYPE_INT64: + break; + default: + return EINVAL; + } + + NANOARROW_RETURN_NOT_OK(ArrowSchemaSetFormat( + schema, ArrowSchemaFormatTemplate(NANOARROW_TYPE_RUN_END_ENCODED))); + NANOARROW_RETURN_NOT_OK( + ArrowSchemaInitChildrenIfNeeded(schema, NANOARROW_TYPE_RUN_END_ENCODED)); + NANOARROW_RETURN_NOT_OK(ArrowSchemaSetType(schema->children[0], run_end_type)); + NANOARROW_RETURN_NOT_OK( + ArrowSchemaSetType(schema->children[1], NANOARROW_TYPE_UNINITIALIZED)); + + return NANOARROW_OK; +} + +static const char* ArrowTimeUnitFormatString(enum ArrowTimeUnit time_unit) { + switch (time_unit) { + case NANOARROW_TIME_UNIT_SECOND: + return "s"; + case NANOARROW_TIME_UNIT_MILLI: + return "m"; + case NANOARROW_TIME_UNIT_MICRO: + return "u"; + case NANOARROW_TIME_UNIT_NANO: + return "n"; + default: + return NULL; + } +} + +ArrowErrorCode ArrowSchemaSetTypeDateTime(struct ArrowSchema* schema, enum ArrowType type, + enum ArrowTimeUnit time_unit, + const char* timezone) { + const char* time_unit_str = ArrowTimeUnitFormatString(time_unit); + if (time_unit_str == NULL) { + return EINVAL; + } + + char buffer[128]; + int n_chars; + switch (type) { + case NANOARROW_TYPE_TIME32: + if (timezone != NULL) { + return EINVAL; + } + + switch (time_unit) { + case NANOARROW_TIME_UNIT_MICRO: + case NANOARROW_TIME_UNIT_NANO: + return EINVAL; + default: + break; + } + + n_chars = snprintf(buffer, sizeof(buffer), "tt%s", time_unit_str); + break; + case NANOARROW_TYPE_TIME64: + if (timezone != NULL) { + return EINVAL; + } + + switch (time_unit) { + case NANOARROW_TIME_UNIT_SECOND: + case NANOARROW_TIME_UNIT_MILLI: + return EINVAL; + default: + break; + } + + n_chars = snprintf(buffer, sizeof(buffer), "tt%s", time_unit_str); + break; + case NANOARROW_TYPE_TIMESTAMP: + if (timezone == NULL) { + timezone = ""; + } + n_chars = snprintf(buffer, sizeof(buffer), "ts%s:%s", time_unit_str, timezone); + break; + case NANOARROW_TYPE_DURATION: + if (timezone != NULL) { + return EINVAL; + } + n_chars = snprintf(buffer, sizeof(buffer), "tD%s", time_unit_str); + break; + default: + return EINVAL; + } + + if (((size_t)n_chars) >= sizeof(buffer) || n_chars < 0) { + return ERANGE; + } + + buffer[n_chars] = '\0'; + + return ArrowSchemaSetFormat(schema, buffer); +} + +ArrowErrorCode ArrowSchemaSetTypeUnion(struct ArrowSchema* schema, enum ArrowType type, + int64_t n_children) { + if (n_children < 0 || n_children > 127) { + return EINVAL; + } + + // Max valid size would be +ud:0,1,...126 = 401 characters + null terminator + char format_out[512]; + int64_t format_out_size = 512; + memset(format_out, 0, format_out_size); + int n_chars; + char* format_cursor = format_out; + + switch (type) { + case NANOARROW_TYPE_SPARSE_UNION: + n_chars = snprintf(format_cursor, format_out_size, "+us:"); + format_cursor += n_chars; + format_out_size -= n_chars; + break; + case NANOARROW_TYPE_DENSE_UNION: + n_chars = snprintf(format_cursor, format_out_size, "+ud:"); + format_cursor += n_chars; + format_out_size -= n_chars; + break; + default: + return EINVAL; + } + + // Ensure that an encoding error from snprintf() does not result + // in an out-of-bounds access. + if (n_chars < 0) { + return ERANGE; + } + + if (n_children > 0) { + n_chars = snprintf(format_cursor, format_out_size, "0"); + format_cursor += n_chars; + format_out_size -= n_chars; + + for (int64_t i = 1; i < n_children; i++) { + n_chars = snprintf(format_cursor, format_out_size, ",%" PRId64, i); + format_cursor += n_chars; + format_out_size -= n_chars; + } + } + + // Ensure that an encoding error from snprintf() does not result + // in an out-of-bounds access. + if (n_chars < 0) { + return ERANGE; + } + + NANOARROW_RETURN_NOT_OK(ArrowSchemaSetFormat(schema, format_out)); + + NANOARROW_RETURN_NOT_OK(ArrowSchemaAllocateChildren(schema, n_children)); + for (int64_t i = 0; i < n_children; i++) { + ArrowSchemaInit(schema->children[i]); + } + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowSchemaSetFormat(struct ArrowSchema* schema, const char* format) { + if (schema->format != NULL) { + ArrowFree((void*)schema->format); + } + + if (format != NULL) { + size_t format_size = strlen(format) + 1; + schema->format = (const char*)ArrowMalloc(format_size); + if (schema->format == NULL) { + return ENOMEM; + } + + memcpy((void*)schema->format, format, format_size); + } else { + schema->format = NULL; + } + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowSchemaSetName(struct ArrowSchema* schema, const char* name) { + if (schema->name != NULL) { + ArrowFree((void*)schema->name); + } + + if (name != NULL) { + size_t name_size = strlen(name) + 1; + schema->name = (const char*)ArrowMalloc(name_size); + if (schema->name == NULL) { + return ENOMEM; + } + + memcpy((void*)schema->name, name, name_size); + } else { + schema->name = NULL; + } + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowSchemaSetMetadata(struct ArrowSchema* schema, const char* metadata) { + if (schema->metadata != NULL) { + ArrowFree((void*)schema->metadata); + } + + if (metadata != NULL) { + size_t metadata_size = ArrowMetadataSizeOf(metadata); + schema->metadata = (const char*)ArrowMalloc(metadata_size); + if (schema->metadata == NULL) { + return ENOMEM; + } + + memcpy((void*)schema->metadata, metadata, metadata_size); + } else { + schema->metadata = NULL; + } + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowSchemaAllocateChildren(struct ArrowSchema* schema, + int64_t n_children) { + if (schema->children != NULL) { + return EEXIST; + } + + if (n_children > 0) { + schema->children = + (struct ArrowSchema**)ArrowMalloc(n_children * sizeof(struct ArrowSchema*)); + + if (schema->children == NULL) { + return ENOMEM; + } + + schema->n_children = n_children; + + memset(schema->children, 0, n_children * sizeof(struct ArrowSchema*)); + + for (int64_t i = 0; i < n_children; i++) { + schema->children[i] = (struct ArrowSchema*)ArrowMalloc(sizeof(struct ArrowSchema)); + + if (schema->children[i] == NULL) { + return ENOMEM; + } + + schema->children[i]->release = NULL; + } + } + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowSchemaAllocateDictionary(struct ArrowSchema* schema) { + if (schema->dictionary != NULL) { + return EEXIST; + } + + schema->dictionary = (struct ArrowSchema*)ArrowMalloc(sizeof(struct ArrowSchema)); + if (schema->dictionary == NULL) { + return ENOMEM; + } + + schema->dictionary->release = NULL; + return NANOARROW_OK; +} + +ArrowErrorCode ArrowSchemaDeepCopy(const struct ArrowSchema* schema, + struct ArrowSchema* schema_out) { + ArrowSchemaInit(schema_out); + + int result = ArrowSchemaSetFormat(schema_out, schema->format); + if (result != NANOARROW_OK) { + ArrowSchemaRelease(schema_out); + return result; + } + + schema_out->flags = schema->flags; + + result = ArrowSchemaSetName(schema_out, schema->name); + if (result != NANOARROW_OK) { + ArrowSchemaRelease(schema_out); + return result; + } + + result = ArrowSchemaSetMetadata(schema_out, schema->metadata); + if (result != NANOARROW_OK) { + ArrowSchemaRelease(schema_out); + return result; + } + + result = ArrowSchemaAllocateChildren(schema_out, schema->n_children); + if (result != NANOARROW_OK) { + ArrowSchemaRelease(schema_out); + return result; + } + + for (int64_t i = 0; i < schema->n_children; i++) { + result = ArrowSchemaDeepCopy(schema->children[i], schema_out->children[i]); + if (result != NANOARROW_OK) { + ArrowSchemaRelease(schema_out); + return result; + } + } + + if (schema->dictionary != NULL) { + result = ArrowSchemaAllocateDictionary(schema_out); + if (result != NANOARROW_OK) { + ArrowSchemaRelease(schema_out); + return result; + } + + result = ArrowSchemaDeepCopy(schema->dictionary, schema_out->dictionary); + if (result != NANOARROW_OK) { + ArrowSchemaRelease(schema_out); + return result; + } + } + + return NANOARROW_OK; +} + +static void ArrowSchemaViewSetPrimitive(struct ArrowSchemaView* schema_view, + enum ArrowType type) { + schema_view->type = type; + schema_view->storage_type = type; +} + +static ArrowErrorCode ArrowSchemaViewParse(struct ArrowSchemaView* schema_view, + const char* format, + const char** format_end_out, + struct ArrowError* error) { + *format_end_out = format; + + // needed for decimal parsing + const char* parse_start; + char* parse_end; + + switch (format[0]) { + case 'n': + schema_view->type = NANOARROW_TYPE_NA; + schema_view->storage_type = NANOARROW_TYPE_NA; + *format_end_out = format + 1; + return NANOARROW_OK; + case 'b': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_BOOL); + *format_end_out = format + 1; + return NANOARROW_OK; + case 'c': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INT8); + *format_end_out = format + 1; + return NANOARROW_OK; + case 'C': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_UINT8); + *format_end_out = format + 1; + return NANOARROW_OK; + case 's': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INT16); + *format_end_out = format + 1; + return NANOARROW_OK; + case 'S': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_UINT16); + *format_end_out = format + 1; + return NANOARROW_OK; + case 'i': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INT32); + *format_end_out = format + 1; + return NANOARROW_OK; + case 'I': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_UINT32); + *format_end_out = format + 1; + return NANOARROW_OK; + case 'l': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INT64); + *format_end_out = format + 1; + return NANOARROW_OK; + case 'L': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_UINT64); + *format_end_out = format + 1; + return NANOARROW_OK; + case 'e': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_HALF_FLOAT); + *format_end_out = format + 1; + return NANOARROW_OK; + case 'f': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_FLOAT); + *format_end_out = format + 1; + return NANOARROW_OK; + case 'g': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_DOUBLE); + *format_end_out = format + 1; + return NANOARROW_OK; + + // decimal + case 'd': + if (format[1] != ':' || format[2] == '\0') { + ArrowErrorSet(error, "Expected ':precision,scale[,bitwidth]' following 'd'"); + return EINVAL; + } + + parse_start = format + 2; + schema_view->decimal_precision = (int32_t)strtol(parse_start, &parse_end, 10); + if (parse_end == parse_start || parse_end[0] != ',') { + ArrowErrorSet(error, "Expected 'precision,scale[,bitwidth]' following 'd:'"); + return EINVAL; + } + + parse_start = parse_end + 1; + schema_view->decimal_scale = (int32_t)strtol(parse_start, &parse_end, 10); + if (parse_end == parse_start) { + ArrowErrorSet(error, "Expected 'scale[,bitwidth]' following 'd:precision,'"); + return EINVAL; + } else if (parse_end[0] != ',') { + schema_view->decimal_bitwidth = 128; + } else { + parse_start = parse_end + 1; + schema_view->decimal_bitwidth = (int32_t)strtol(parse_start, &parse_end, 10); + if (parse_start == parse_end) { + ArrowErrorSet(error, "Expected precision following 'd:precision,scale,'"); + return EINVAL; + } + } + + *format_end_out = parse_end; + + switch (schema_view->decimal_bitwidth) { + case 128: + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_DECIMAL128); + return NANOARROW_OK; + case 256: + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_DECIMAL256); + return NANOARROW_OK; + default: + ArrowErrorSet(error, + "Expected decimal bitwidth of 128 or 256 but found %" PRId32, + schema_view->decimal_bitwidth); + return EINVAL; + } + + // validity + data + case 'w': + schema_view->type = NANOARROW_TYPE_FIXED_SIZE_BINARY; + schema_view->storage_type = NANOARROW_TYPE_FIXED_SIZE_BINARY; + if (format[1] != ':' || format[2] == '\0') { + ArrowErrorSet(error, "Expected ':' following 'w'"); + return EINVAL; + } + + schema_view->fixed_size = (int32_t)strtol(format + 2, (char**)format_end_out, 10); + return NANOARROW_OK; + + // validity + offset + data + case 'z': + schema_view->type = NANOARROW_TYPE_BINARY; + schema_view->storage_type = NANOARROW_TYPE_BINARY; + *format_end_out = format + 1; + return NANOARROW_OK; + case 'u': + schema_view->type = NANOARROW_TYPE_STRING; + schema_view->storage_type = NANOARROW_TYPE_STRING; + *format_end_out = format + 1; + return NANOARROW_OK; + + // validity + large_offset + data + case 'Z': + schema_view->type = NANOARROW_TYPE_LARGE_BINARY; + schema_view->storage_type = NANOARROW_TYPE_LARGE_BINARY; + *format_end_out = format + 1; + return NANOARROW_OK; + case 'U': + schema_view->type = NANOARROW_TYPE_LARGE_STRING; + schema_view->storage_type = NANOARROW_TYPE_LARGE_STRING; + *format_end_out = format + 1; + return NANOARROW_OK; + + // nested types + case '+': + switch (format[1]) { + // list has validity + offset or offset + case 'l': + schema_view->storage_type = NANOARROW_TYPE_LIST; + schema_view->type = NANOARROW_TYPE_LIST; + *format_end_out = format + 2; + return NANOARROW_OK; + + // large list has validity + large_offset or large_offset + case 'L': + schema_view->storage_type = NANOARROW_TYPE_LARGE_LIST; + schema_view->type = NANOARROW_TYPE_LARGE_LIST; + *format_end_out = format + 2; + return NANOARROW_OK; + + // run end encoded has no buffer at all + case 'r': + schema_view->storage_type = NANOARROW_TYPE_RUN_END_ENCODED; + schema_view->type = NANOARROW_TYPE_RUN_END_ENCODED; + *format_end_out = format + 2; + return NANOARROW_OK; + + // just validity buffer + case 'w': + if (format[2] != ':' || format[3] == '\0') { + ArrowErrorSet(error, "Expected ':' following '+w'"); + return EINVAL; + } + + schema_view->storage_type = NANOARROW_TYPE_FIXED_SIZE_LIST; + schema_view->type = NANOARROW_TYPE_FIXED_SIZE_LIST; + schema_view->fixed_size = + (int32_t)strtol(format + 3, (char**)format_end_out, 10); + return NANOARROW_OK; + case 's': + schema_view->storage_type = NANOARROW_TYPE_STRUCT; + schema_view->type = NANOARROW_TYPE_STRUCT; + *format_end_out = format + 2; + return NANOARROW_OK; + case 'm': + schema_view->storage_type = NANOARROW_TYPE_MAP; + schema_view->type = NANOARROW_TYPE_MAP; + *format_end_out = format + 2; + return NANOARROW_OK; + + // unions + case 'u': + switch (format[2]) { + case 'd': + schema_view->storage_type = NANOARROW_TYPE_DENSE_UNION; + schema_view->type = NANOARROW_TYPE_DENSE_UNION; + break; + case 's': + schema_view->storage_type = NANOARROW_TYPE_SPARSE_UNION; + schema_view->type = NANOARROW_TYPE_SPARSE_UNION; + break; + default: + ArrowErrorSet(error, + "Expected union format string +us: or " + "+ud: but found '%s'", + format); + return EINVAL; + } + + if (format[3] == ':') { + schema_view->union_type_ids = format + 4; + int64_t n_type_ids = + _ArrowParseUnionTypeIds(schema_view->union_type_ids, NULL); + if (n_type_ids != schema_view->schema->n_children) { + ArrowErrorSet(error, + "Expected union type_ids parameter to be a comma-separated " + "list of %" PRId64 " values between 0 and 127 but found '%s'", + schema_view->schema->n_children, schema_view->union_type_ids); + return EINVAL; + } + *format_end_out = format + strlen(format); + return NANOARROW_OK; + } else { + ArrowErrorSet(error, + "Expected union format string +us: or +ud: " + "but found '%s'", + format); + return EINVAL; + } + + default: + ArrowErrorSet(error, "Expected nested type format string but found '%s'", + format); + return EINVAL; + } + + // date/time types + case 't': + switch (format[1]) { + // date + case 'd': + switch (format[2]) { + case 'D': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INT32); + schema_view->type = NANOARROW_TYPE_DATE32; + *format_end_out = format + 3; + return NANOARROW_OK; + case 'm': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INT64); + schema_view->type = NANOARROW_TYPE_DATE64; + *format_end_out = format + 3; + return NANOARROW_OK; + default: + ArrowErrorSet(error, "Expected 'D' or 'm' following 'td' but found '%s'", + format + 2); + return EINVAL; + } + + // time of day + case 't': + switch (format[2]) { + case 's': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INT32); + schema_view->type = NANOARROW_TYPE_TIME32; + schema_view->time_unit = NANOARROW_TIME_UNIT_SECOND; + *format_end_out = format + 3; + return NANOARROW_OK; + case 'm': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INT32); + schema_view->type = NANOARROW_TYPE_TIME32; + schema_view->time_unit = NANOARROW_TIME_UNIT_MILLI; + *format_end_out = format + 3; + return NANOARROW_OK; + case 'u': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INT64); + schema_view->type = NANOARROW_TYPE_TIME64; + schema_view->time_unit = NANOARROW_TIME_UNIT_MICRO; + *format_end_out = format + 3; + return NANOARROW_OK; + case 'n': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INT64); + schema_view->type = NANOARROW_TYPE_TIME64; + schema_view->time_unit = NANOARROW_TIME_UNIT_NANO; + *format_end_out = format + 3; + return NANOARROW_OK; + default: + ArrowErrorSet( + error, "Expected 's', 'm', 'u', or 'n' following 'tt' but found '%s'", + format + 2); + return EINVAL; + } + + // timestamp + case 's': + switch (format[2]) { + case 's': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INT64); + schema_view->type = NANOARROW_TYPE_TIMESTAMP; + schema_view->time_unit = NANOARROW_TIME_UNIT_SECOND; + break; + case 'm': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INT64); + schema_view->type = NANOARROW_TYPE_TIMESTAMP; + schema_view->time_unit = NANOARROW_TIME_UNIT_MILLI; + break; + case 'u': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INT64); + schema_view->type = NANOARROW_TYPE_TIMESTAMP; + schema_view->time_unit = NANOARROW_TIME_UNIT_MICRO; + break; + case 'n': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INT64); + schema_view->type = NANOARROW_TYPE_TIMESTAMP; + schema_view->time_unit = NANOARROW_TIME_UNIT_NANO; + break; + default: + ArrowErrorSet( + error, "Expected 's', 'm', 'u', or 'n' following 'ts' but found '%s'", + format + 2); + return EINVAL; + } + + if (format[3] != ':') { + ArrowErrorSet(error, "Expected ':' following '%.3s' but found '%s'", format, + format + 3); + return EINVAL; + } + + schema_view->timezone = format + 4; + *format_end_out = format + strlen(format); + return NANOARROW_OK; + + // duration + case 'D': + switch (format[2]) { + case 's': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INT64); + schema_view->type = NANOARROW_TYPE_DURATION; + schema_view->time_unit = NANOARROW_TIME_UNIT_SECOND; + *format_end_out = format + 3; + return NANOARROW_OK; + case 'm': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INT64); + schema_view->type = NANOARROW_TYPE_DURATION; + schema_view->time_unit = NANOARROW_TIME_UNIT_MILLI; + *format_end_out = format + 3; + return NANOARROW_OK; + case 'u': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INT64); + schema_view->type = NANOARROW_TYPE_DURATION; + schema_view->time_unit = NANOARROW_TIME_UNIT_MICRO; + *format_end_out = format + 3; + return NANOARROW_OK; + case 'n': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INT64); + schema_view->type = NANOARROW_TYPE_DURATION; + schema_view->time_unit = NANOARROW_TIME_UNIT_NANO; + *format_end_out = format + 3; + return NANOARROW_OK; + default: + ArrowErrorSet(error, + "Expected 's', 'm', u', or 'n' following 'tD' but found '%s'", + format + 2); + return EINVAL; + } + + // interval + case 'i': + switch (format[2]) { + case 'M': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INTERVAL_MONTHS); + *format_end_out = format + 3; + return NANOARROW_OK; + case 'D': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_INTERVAL_DAY_TIME); + *format_end_out = format + 3; + return NANOARROW_OK; + case 'n': + ArrowSchemaViewSetPrimitive(schema_view, + NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO); + *format_end_out = format + 3; + return NANOARROW_OK; + default: + ArrowErrorSet(error, + "Expected 'M', 'D', or 'n' following 'ti' but found '%s'", + format + 2); + return EINVAL; + } + + default: + ArrowErrorSet( + error, "Expected 'd', 't', 's', 'D', or 'i' following 't' but found '%s'", + format + 1); + return EINVAL; + } + + // view types + case 'v': { + switch (format[1]) { + case 'u': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_STRING_VIEW); + *format_end_out = format + 2; + return NANOARROW_OK; + case 'z': + ArrowSchemaViewSetPrimitive(schema_view, NANOARROW_TYPE_BINARY_VIEW); + *format_end_out = format + 2; + return NANOARROW_OK; + default: + ArrowErrorSet(error, "Expected 'u', or 'z' following 'v' but found '%s'", + format + 1); + return EINVAL; + } + } + + default: + ArrowErrorSet(error, "Unknown format: '%s'", format); + return EINVAL; + } +} + +static ArrowErrorCode ArrowSchemaViewValidateNChildren( + struct ArrowSchemaView* schema_view, int64_t n_children, struct ArrowError* error) { + if (n_children != -1 && schema_view->schema->n_children != n_children) { + ArrowErrorSet( + error, "Expected schema with %" PRId64 " children but found %" PRId64 " children", + n_children, schema_view->schema->n_children); + return EINVAL; + } + + // Don't do a full validation of children but do check that they won't + // segfault if inspected + struct ArrowSchema* child; + for (int64_t i = 0; i < schema_view->schema->n_children; i++) { + child = schema_view->schema->children[i]; + if (child == NULL) { + ArrowErrorSet( + error, "Expected valid schema at schema->children[%" PRId64 "] but found NULL", + i); + return EINVAL; + } else if (child->release == NULL) { + ArrowErrorSet(error, + "Expected valid schema at schema->children[%" PRId64 + "] but found a released schema", + i); + return EINVAL; + } + } + + return NANOARROW_OK; +} + +static ArrowErrorCode ArrowSchemaViewValidateUnion(struct ArrowSchemaView* schema_view, + struct ArrowError* error) { + return ArrowSchemaViewValidateNChildren(schema_view, -1, error); +} + +static ArrowErrorCode ArrowSchemaViewValidateMap(struct ArrowSchemaView* schema_view, + struct ArrowError* error) { + NANOARROW_RETURN_NOT_OK(ArrowSchemaViewValidateNChildren(schema_view, 1, error)); + + if (schema_view->schema->children[0]->n_children != 2) { + ArrowErrorSet(error, + "Expected child of map type to have 2 children but found %" PRId64, + schema_view->schema->children[0]->n_children); + return EINVAL; + } + + if (strcmp(schema_view->schema->children[0]->format, "+s") != 0) { + ArrowErrorSet(error, "Expected format of child of map type to be '+s' but found '%s'", + schema_view->schema->children[0]->format); + return EINVAL; + } + + if (schema_view->schema->children[0]->flags & ARROW_FLAG_NULLABLE) { + ArrowErrorSet(error, + "Expected child of map type to be non-nullable but was nullable"); + return EINVAL; + } + + if (schema_view->schema->children[0]->children[0]->flags & ARROW_FLAG_NULLABLE) { + ArrowErrorSet(error, "Expected key of map type to be non-nullable but was nullable"); + return EINVAL; + } + + return NANOARROW_OK; +} + +static ArrowErrorCode ArrowSchemaViewValidateDictionary( + struct ArrowSchemaView* schema_view, struct ArrowError* error) { + // check for valid index type + switch (schema_view->storage_type) { + case NANOARROW_TYPE_UINT8: + case NANOARROW_TYPE_INT8: + case NANOARROW_TYPE_UINT16: + case NANOARROW_TYPE_INT16: + case NANOARROW_TYPE_UINT32: + case NANOARROW_TYPE_INT32: + case NANOARROW_TYPE_UINT64: + case NANOARROW_TYPE_INT64: + break; + default: + ArrowErrorSet( + error, + "Expected dictionary schema index type to be an integral type but found '%s'", + schema_view->schema->format); + return EINVAL; + } + + struct ArrowSchemaView dictionary_schema_view; + return ArrowSchemaViewInit(&dictionary_schema_view, schema_view->schema->dictionary, + error); +} + +static ArrowErrorCode ArrowSchemaViewValidate(struct ArrowSchemaView* schema_view, + enum ArrowType type, + struct ArrowError* error) { + switch (type) { + case NANOARROW_TYPE_NA: + case NANOARROW_TYPE_BOOL: + case NANOARROW_TYPE_UINT8: + case NANOARROW_TYPE_INT8: + case NANOARROW_TYPE_UINT16: + case NANOARROW_TYPE_INT16: + case NANOARROW_TYPE_UINT32: + case NANOARROW_TYPE_INT32: + case NANOARROW_TYPE_UINT64: + case NANOARROW_TYPE_INT64: + case NANOARROW_TYPE_HALF_FLOAT: + case NANOARROW_TYPE_FLOAT: + case NANOARROW_TYPE_DOUBLE: + case NANOARROW_TYPE_DECIMAL128: + case NANOARROW_TYPE_DECIMAL256: + case NANOARROW_TYPE_STRING: + case NANOARROW_TYPE_LARGE_STRING: + case NANOARROW_TYPE_BINARY: + case NANOARROW_TYPE_LARGE_BINARY: + case NANOARROW_TYPE_DATE32: + case NANOARROW_TYPE_DATE64: + case NANOARROW_TYPE_INTERVAL_MONTHS: + case NANOARROW_TYPE_INTERVAL_DAY_TIME: + case NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO: + case NANOARROW_TYPE_TIMESTAMP: + case NANOARROW_TYPE_TIME32: + case NANOARROW_TYPE_TIME64: + case NANOARROW_TYPE_DURATION: + case NANOARROW_TYPE_BINARY_VIEW: + case NANOARROW_TYPE_STRING_VIEW: + return ArrowSchemaViewValidateNChildren(schema_view, 0, error); + + case NANOARROW_TYPE_FIXED_SIZE_BINARY: + if (schema_view->fixed_size <= 0) { + ArrowErrorSet(error, "Expected size > 0 for fixed size binary but found size %d", + schema_view->fixed_size); + return EINVAL; + } + return ArrowSchemaViewValidateNChildren(schema_view, 0, error); + + case NANOARROW_TYPE_LIST: + case NANOARROW_TYPE_LARGE_LIST: + case NANOARROW_TYPE_FIXED_SIZE_LIST: + return ArrowSchemaViewValidateNChildren(schema_view, 1, error); + + case NANOARROW_TYPE_RUN_END_ENCODED: + return ArrowSchemaViewValidateNChildren(schema_view, 2, error); + + case NANOARROW_TYPE_STRUCT: + return ArrowSchemaViewValidateNChildren(schema_view, -1, error); + + case NANOARROW_TYPE_SPARSE_UNION: + case NANOARROW_TYPE_DENSE_UNION: + return ArrowSchemaViewValidateUnion(schema_view, error); + + case NANOARROW_TYPE_MAP: + return ArrowSchemaViewValidateMap(schema_view, error); + + case NANOARROW_TYPE_DICTIONARY: + return ArrowSchemaViewValidateDictionary(schema_view, error); + + default: + ArrowErrorSet(error, "Expected a valid enum ArrowType value but found %d", + schema_view->type); + return EINVAL; + } + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowSchemaViewInit(struct ArrowSchemaView* schema_view, + const struct ArrowSchema* schema, + struct ArrowError* error) { + if (schema == NULL) { + ArrowErrorSet(error, "Expected non-NULL schema"); + return EINVAL; + } + + if (schema->release == NULL) { + ArrowErrorSet(error, "Expected non-released schema"); + return EINVAL; + } + + schema_view->schema = schema; + + const char* format = schema->format; + if (format == NULL) { + ArrowErrorSet( + error, + "Error parsing schema->format: Expected a null-terminated string but found NULL"); + return EINVAL; + } + + size_t format_len = strlen(format); + if (format_len == 0) { + ArrowErrorSet(error, "Error parsing schema->format: Expected a string with size > 0"); + return EINVAL; + } + + const char* format_end_out; + int result = ArrowSchemaViewParse(schema_view, format, &format_end_out, error); + + if (result != NANOARROW_OK) { + if (error != NULL) { + char child_error[1024]; + memcpy(child_error, ArrowErrorMessage(error), 1024); + ArrowErrorSet(error, "Error parsing schema->format: %s", child_error); + } + + return result; + } + + if ((format + format_len) != format_end_out) { + ArrowErrorSet(error, "Error parsing schema->format '%s': parsed %d/%zu characters", + format, (int)(format_end_out - format), format_len); + return EINVAL; + } + + if (schema->dictionary != NULL) { + schema_view->type = NANOARROW_TYPE_DICTIONARY; + } + + NANOARROW_RETURN_NOT_OK( + ArrowSchemaViewValidate(schema_view, schema_view->storage_type, error)); + + if (schema_view->storage_type != schema_view->type) { + NANOARROW_RETURN_NOT_OK( + ArrowSchemaViewValidate(schema_view, schema_view->type, error)); + } + + int64_t unknown_flags = schema->flags & ~NANOARROW_FLAG_ALL_SUPPORTED; + if (unknown_flags != 0) { + ArrowErrorSet(error, "Unknown ArrowSchema flag"); + return EINVAL; + } + + if (schema->flags & ARROW_FLAG_DICTIONARY_ORDERED && + schema_view->type != NANOARROW_TYPE_DICTIONARY) { + ArrowErrorSet(error, + "ARROW_FLAG_DICTIONARY_ORDERED is only relevant for dictionaries"); + return EINVAL; + } + + if (schema->flags & ARROW_FLAG_MAP_KEYS_SORTED && + schema_view->type != NANOARROW_TYPE_MAP) { + ArrowErrorSet(error, "ARROW_FLAG_MAP_KEYS_SORTED is only relevant for a map type"); + return EINVAL; + } + + ArrowLayoutInit(&schema_view->layout, schema_view->storage_type); + if (schema_view->storage_type == NANOARROW_TYPE_FIXED_SIZE_BINARY) { + schema_view->layout.element_size_bits[1] = schema_view->fixed_size * 8; + } else if (schema_view->storage_type == NANOARROW_TYPE_FIXED_SIZE_LIST) { + schema_view->layout.child_size_elements = schema_view->fixed_size; + } + + schema_view->extension_name = ArrowCharView(NULL); + schema_view->extension_metadata = ArrowCharView(NULL); + NANOARROW_RETURN_NOT_OK(ArrowMetadataGetValue(schema->metadata, + ArrowCharView("ARROW:extension:name"), + &schema_view->extension_name)); + NANOARROW_RETURN_NOT_OK(ArrowMetadataGetValue(schema->metadata, + ArrowCharView("ARROW:extension:metadata"), + &schema_view->extension_metadata)); + + return NANOARROW_OK; +} + +static int64_t ArrowSchemaTypeToStringInternal(struct ArrowSchemaView* schema_view, + char* out, int64_t n) { + const char* type_string = ArrowTypeString(schema_view->type); + switch (schema_view->type) { + case NANOARROW_TYPE_DECIMAL128: + case NANOARROW_TYPE_DECIMAL256: + return snprintf(out, n, "%s(%" PRId32 ", %" PRId32 ")", type_string, + schema_view->decimal_precision, schema_view->decimal_scale); + case NANOARROW_TYPE_TIMESTAMP: + return snprintf(out, n, "%s('%s', '%s')", type_string, + ArrowTimeUnitString(schema_view->time_unit), schema_view->timezone); + case NANOARROW_TYPE_TIME32: + case NANOARROW_TYPE_TIME64: + case NANOARROW_TYPE_DURATION: + return snprintf(out, n, "%s('%s')", type_string, + ArrowTimeUnitString(schema_view->time_unit)); + case NANOARROW_TYPE_FIXED_SIZE_BINARY: + case NANOARROW_TYPE_FIXED_SIZE_LIST: + return snprintf(out, n, "%s(%" PRId32 ")", type_string, schema_view->fixed_size); + case NANOARROW_TYPE_SPARSE_UNION: + case NANOARROW_TYPE_DENSE_UNION: + return snprintf(out, n, "%s([%s])", type_string, schema_view->union_type_ids); + default: + return snprintf(out, n, "%s", type_string); + } +} + +// Helper for bookkeeping to emulate sprintf()-like behaviour spread +// among multiple sprintf calls. +static inline void ArrowToStringLogChars(char** out, int64_t n_chars_last, + int64_t* n_remaining, int64_t* n_chars) { + // In the unlikely snprintf() returning a negative value (encoding error), + // ensure the result won't cause an out-of-bounds access. + if (n_chars_last < 0) { + n_chars_last = 0; + } + + *n_chars += n_chars_last; + *n_remaining -= n_chars_last; + + // n_remaining is never less than 0 + if (*n_remaining < 0) { + *n_remaining = 0; + } + + // Can't do math on a NULL pointer + if (*out != NULL) { + *out += n_chars_last; + } +} + +int64_t ArrowSchemaToString(const struct ArrowSchema* schema, char* out, int64_t n, + char recursive) { + if (schema == NULL) { + return snprintf(out, n, "[invalid: pointer is null]"); + } + + if (schema->release == NULL) { + return snprintf(out, n, "[invalid: schema is released]"); + } + + struct ArrowSchemaView schema_view; + struct ArrowError error; + + if (ArrowSchemaViewInit(&schema_view, schema, &error) != NANOARROW_OK) { + return snprintf(out, n, "[invalid: %s]", ArrowErrorMessage(&error)); + } + + // Extension type and dictionary should include both the top-level type + // and the storage type. + int is_extension = schema_view.extension_name.size_bytes > 0; + int is_dictionary = schema->dictionary != NULL; + int64_t n_chars = 0; + int64_t n_chars_last = 0; + + // Uncommon but not technically impossible that both are true + if (is_extension && is_dictionary) { + n_chars_last = snprintf( + out, n, "%.*s{dictionary(%s)<", (int)schema_view.extension_name.size_bytes, + schema_view.extension_name.data, ArrowTypeString(schema_view.storage_type)); + } else if (is_extension) { + n_chars_last = snprintf(out, n, "%.*s{", (int)schema_view.extension_name.size_bytes, + schema_view.extension_name.data); + } else if (is_dictionary) { + n_chars_last = + snprintf(out, n, "dictionary(%s)<", ArrowTypeString(schema_view.storage_type)); + } + + ArrowToStringLogChars(&out, n_chars_last, &n, &n_chars); + + if (!is_dictionary) { + n_chars_last = ArrowSchemaTypeToStringInternal(&schema_view, out, n); + } else { + n_chars_last = ArrowSchemaToString(schema->dictionary, out, n, recursive); + } + + ArrowToStringLogChars(&out, n_chars_last, &n, &n_chars); + + if (recursive && schema->format[0] == '+') { + n_chars_last = snprintf(out, n, "<"); + ArrowToStringLogChars(&out, n_chars_last, &n, &n_chars); + + for (int64_t i = 0; i < schema->n_children; i++) { + if (i > 0) { + n_chars_last = snprintf(out, n, ", "); + ArrowToStringLogChars(&out, n_chars_last, &n, &n_chars); + } + + // ArrowSchemaToStringInternal() will validate the child and print the error, + // but we need the name first + if (schema->children[i] != NULL && schema->children[i]->release != NULL && + schema->children[i]->name != NULL) { + n_chars_last = snprintf(out, n, "%s: ", schema->children[i]->name); + ArrowToStringLogChars(&out, n_chars_last, &n, &n_chars); + } + + n_chars_last = ArrowSchemaToString(schema->children[i], out, n, recursive); + ArrowToStringLogChars(&out, n_chars_last, &n, &n_chars); + } + + n_chars_last = snprintf(out, n, ">"); + ArrowToStringLogChars(&out, n_chars_last, &n, &n_chars); + } + + if (is_extension && is_dictionary) { + n_chars += snprintf(out, n, ">}"); + } else if (is_extension) { + n_chars += snprintf(out, n, "}"); + } else if (is_dictionary) { + n_chars += snprintf(out, n, ">"); + } + + // Ensure that we always return a positive result + if (n_chars > 0) { + return n_chars; + } else { + return 0; + } +} + +ArrowErrorCode ArrowMetadataReaderInit(struct ArrowMetadataReader* reader, + const char* metadata) { + reader->metadata = metadata; + + if (reader->metadata == NULL) { + reader->offset = 0; + reader->remaining_keys = 0; + } else { + memcpy(&reader->remaining_keys, reader->metadata, sizeof(int32_t)); + reader->offset = sizeof(int32_t); + } + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowMetadataReaderRead(struct ArrowMetadataReader* reader, + struct ArrowStringView* key_out, + struct ArrowStringView* value_out) { + if (reader->remaining_keys <= 0) { + return EINVAL; + } + + int64_t pos = 0; + + int32_t key_size; + memcpy(&key_size, reader->metadata + reader->offset + pos, sizeof(int32_t)); + pos += sizeof(int32_t); + + key_out->data = reader->metadata + reader->offset + pos; + key_out->size_bytes = key_size; + pos += key_size; + + int32_t value_size; + memcpy(&value_size, reader->metadata + reader->offset + pos, sizeof(int32_t)); + pos += sizeof(int32_t); + + value_out->data = reader->metadata + reader->offset + pos; + value_out->size_bytes = value_size; + pos += value_size; + + reader->offset += pos; + reader->remaining_keys--; + return NANOARROW_OK; +} + +int64_t ArrowMetadataSizeOf(const char* metadata) { + if (metadata == NULL) { + return 0; + } + + struct ArrowMetadataReader reader; + struct ArrowStringView key; + struct ArrowStringView value; + if (ArrowMetadataReaderInit(&reader, metadata) != NANOARROW_OK) { + return 0; + } + + int64_t size = sizeof(int32_t); + while (ArrowMetadataReaderRead(&reader, &key, &value) == NANOARROW_OK) { + size += sizeof(int32_t) + key.size_bytes + sizeof(int32_t) + value.size_bytes; + } + + return size; +} + +static ArrowErrorCode ArrowMetadataGetValueInternal(const char* metadata, + struct ArrowStringView* key, + struct ArrowStringView* value_out) { + struct ArrowMetadataReader reader; + struct ArrowStringView existing_key; + struct ArrowStringView existing_value; + NANOARROW_RETURN_NOT_OK(ArrowMetadataReaderInit(&reader, metadata)); + + while (ArrowMetadataReaderRead(&reader, &existing_key, &existing_value) == + NANOARROW_OK) { + int key_equal = key->size_bytes == existing_key.size_bytes && + strncmp(key->data, existing_key.data, existing_key.size_bytes) == 0; + if (key_equal) { + value_out->data = existing_value.data; + value_out->size_bytes = existing_value.size_bytes; + break; + } + } + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowMetadataGetValue(const char* metadata, struct ArrowStringView key, + struct ArrowStringView* value_out) { + if (value_out == NULL) { + return EINVAL; + } + + return ArrowMetadataGetValueInternal(metadata, &key, value_out); +} + +char ArrowMetadataHasKey(const char* metadata, struct ArrowStringView key) { + struct ArrowStringView value = ArrowCharView(NULL); + if (ArrowMetadataGetValue(metadata, key, &value) != NANOARROW_OK) { + return 0; + } + + return value.data != NULL; +} + +ArrowErrorCode ArrowMetadataBuilderInit(struct ArrowBuffer* buffer, + const char* metadata) { + ArrowBufferInit(buffer); + return ArrowBufferAppend(buffer, metadata, ArrowMetadataSizeOf(metadata)); +} + +static ArrowErrorCode ArrowMetadataBuilderAppendInternal(struct ArrowBuffer* buffer, + struct ArrowStringView* key, + struct ArrowStringView* value) { + if (value == NULL) { + return NANOARROW_OK; + } + + if (buffer->capacity_bytes == 0) { + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendInt32(buffer, 0)); + } + + if (((size_t)buffer->capacity_bytes) < sizeof(int32_t)) { + return EINVAL; + } + + int32_t n_keys; + memcpy(&n_keys, buffer->data, sizeof(int32_t)); + + int32_t key_size = (int32_t)key->size_bytes; + int32_t value_size = (int32_t)value->size_bytes; + NANOARROW_RETURN_NOT_OK(ArrowBufferReserve( + buffer, sizeof(int32_t) + key_size + sizeof(int32_t) + value_size)); + + ArrowBufferAppendUnsafe(buffer, &key_size, sizeof(int32_t)); + ArrowBufferAppendUnsafe(buffer, key->data, key_size); + ArrowBufferAppendUnsafe(buffer, &value_size, sizeof(int32_t)); + ArrowBufferAppendUnsafe(buffer, value->data, value_size); + + n_keys++; + memcpy(buffer->data, &n_keys, sizeof(int32_t)); + + return NANOARROW_OK; +} + +static ArrowErrorCode ArrowMetadataBuilderSetInternal(struct ArrowBuffer* buffer, + struct ArrowStringView* key, + struct ArrowStringView* value) { + // Inspect the current value to see if we can avoid copying the buffer + struct ArrowStringView current_value = ArrowCharView(NULL); + NANOARROW_RETURN_NOT_OK( + ArrowMetadataGetValueInternal((const char*)buffer->data, key, ¤t_value)); + + // The key should be removed but no key exists + if (value == NULL && current_value.data == NULL) { + return NANOARROW_OK; + } + + // The key/value can be appended because no key exists + if (value != NULL && current_value.data == NULL) { + return ArrowMetadataBuilderAppendInternal(buffer, key, value); + } + + struct ArrowMetadataReader reader; + struct ArrowStringView existing_key; + struct ArrowStringView existing_value; + NANOARROW_RETURN_NOT_OK(ArrowMetadataReaderInit(&reader, (const char*)buffer->data)); + + struct ArrowBuffer new_buffer; + NANOARROW_RETURN_NOT_OK(ArrowMetadataBuilderInit(&new_buffer, NULL)); + + while (reader.remaining_keys > 0) { + int result = ArrowMetadataReaderRead(&reader, &existing_key, &existing_value); + if (result != NANOARROW_OK) { + ArrowBufferReset(&new_buffer); + return result; + } + + if (key->size_bytes == existing_key.size_bytes && + strncmp((const char*)key->data, (const char*)existing_key.data, + existing_key.size_bytes) == 0) { + result = ArrowMetadataBuilderAppendInternal(&new_buffer, key, value); + value = NULL; + } else { + result = + ArrowMetadataBuilderAppendInternal(&new_buffer, &existing_key, &existing_value); + } + + if (result != NANOARROW_OK) { + ArrowBufferReset(&new_buffer); + return result; + } + } + + ArrowBufferReset(buffer); + ArrowBufferMove(&new_buffer, buffer); + return NANOARROW_OK; +} + +ArrowErrorCode ArrowMetadataBuilderAppend(struct ArrowBuffer* buffer, + struct ArrowStringView key, + struct ArrowStringView value) { + return ArrowMetadataBuilderAppendInternal(buffer, &key, &value); +} + +ArrowErrorCode ArrowMetadataBuilderSet(struct ArrowBuffer* buffer, + struct ArrowStringView key, + struct ArrowStringView value) { + return ArrowMetadataBuilderSetInternal(buffer, &key, &value); +} + +ArrowErrorCode ArrowMetadataBuilderRemove(struct ArrowBuffer* buffer, + struct ArrowStringView key) { + return ArrowMetadataBuilderSetInternal(buffer, &key, NULL); +} +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include +#include +#include +#include +#include +#include +#include + +#include "nanoarrow/nanoarrow.h" + +static void ArrowArrayReleaseInternal(struct ArrowArray* array) { + // Release buffers held by this array + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + if (private_data != NULL) { + ArrowBitmapReset(&private_data->bitmap); + ArrowBufferReset(&private_data->buffers[0]); + ArrowBufferReset(&private_data->buffers[1]); + ArrowFree(private_data->buffer_data); + for (int32_t i = 0; i < private_data->n_variadic_buffers; ++i) { + ArrowBufferReset(&private_data->variadic_buffers[i]); + } + ArrowFree(private_data->variadic_buffers); + ArrowFree(private_data->variadic_buffer_sizes); + ArrowFree(private_data); + } + + // This object owns the memory for all the children, but those + // children may have been generated elsewhere and might have + // their own release() callback. + if (array->children != NULL) { + for (int64_t i = 0; i < array->n_children; i++) { + if (array->children[i] != NULL) { + if (array->children[i]->release != NULL) { + ArrowArrayRelease(array->children[i]); + } + + ArrowFree(array->children[i]); + } + } + + ArrowFree(array->children); + } + + // This object owns the memory for the dictionary but it + // may have been generated somewhere else and have its own + // release() callback. + if (array->dictionary != NULL) { + if (array->dictionary->release != NULL) { + ArrowArrayRelease(array->dictionary); + } + + ArrowFree(array->dictionary); + } + + // Mark released + array->release = NULL; +} + +static ArrowErrorCode ArrowArraySetStorageType(struct ArrowArray* array, + enum ArrowType storage_type) { + switch (storage_type) { + case NANOARROW_TYPE_UNINITIALIZED: + case NANOARROW_TYPE_NA: + case NANOARROW_TYPE_RUN_END_ENCODED: + array->n_buffers = 0; + break; + + case NANOARROW_TYPE_FIXED_SIZE_LIST: + case NANOARROW_TYPE_STRUCT: + case NANOARROW_TYPE_SPARSE_UNION: + array->n_buffers = 1; + break; + + case NANOARROW_TYPE_LIST: + case NANOARROW_TYPE_LARGE_LIST: + case NANOARROW_TYPE_MAP: + case NANOARROW_TYPE_BOOL: + case NANOARROW_TYPE_UINT8: + case NANOARROW_TYPE_INT8: + case NANOARROW_TYPE_UINT16: + case NANOARROW_TYPE_INT16: + case NANOARROW_TYPE_UINT32: + case NANOARROW_TYPE_INT32: + case NANOARROW_TYPE_UINT64: + case NANOARROW_TYPE_INT64: + case NANOARROW_TYPE_HALF_FLOAT: + case NANOARROW_TYPE_FLOAT: + case NANOARROW_TYPE_DOUBLE: + case NANOARROW_TYPE_DECIMAL128: + case NANOARROW_TYPE_DECIMAL256: + case NANOARROW_TYPE_INTERVAL_MONTHS: + case NANOARROW_TYPE_INTERVAL_DAY_TIME: + case NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO: + case NANOARROW_TYPE_FIXED_SIZE_BINARY: + case NANOARROW_TYPE_DENSE_UNION: + array->n_buffers = 2; + break; + case NANOARROW_TYPE_BINARY_VIEW: + case NANOARROW_TYPE_STRING_VIEW: + array->n_buffers = NANOARROW_BINARY_VIEW_FIXED_BUFFERS + 1; + break; + case NANOARROW_TYPE_STRING: + case NANOARROW_TYPE_LARGE_STRING: + case NANOARROW_TYPE_BINARY: + case NANOARROW_TYPE_LARGE_BINARY: + array->n_buffers = 3; + break; + + default: + return EINVAL; + + return NANOARROW_OK; + } + + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + private_data->storage_type = storage_type; + return NANOARROW_OK; +} + +ArrowErrorCode ArrowArrayInitFromType(struct ArrowArray* array, + enum ArrowType storage_type) { + array->length = 0; + array->null_count = 0; + array->offset = 0; + array->n_buffers = 0; + array->n_children = 0; + array->buffers = NULL; + array->children = NULL; + array->dictionary = NULL; + array->release = &ArrowArrayReleaseInternal; + array->private_data = NULL; + + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)ArrowMalloc(sizeof(struct ArrowArrayPrivateData)); + if (private_data == NULL) { + array->release = NULL; + return ENOMEM; + } + + ArrowBitmapInit(&private_data->bitmap); + ArrowBufferInit(&private_data->buffers[0]); + ArrowBufferInit(&private_data->buffers[1]); + private_data->buffer_data = + (const void**)ArrowMalloc(sizeof(void*) * NANOARROW_MAX_FIXED_BUFFERS); + for (int i = 0; i < NANOARROW_MAX_FIXED_BUFFERS; ++i) { + private_data->buffer_data[i] = NULL; + } + private_data->n_variadic_buffers = 0; + private_data->variadic_buffers = NULL; + private_data->variadic_buffer_sizes = NULL; + + array->private_data = private_data; + array->buffers = (const void**)(private_data->buffer_data); + + // These are not technically "storage" in the sense that they do not appear + // in the ArrowSchemaView's storage_type member; however, allowing them here + // is helpful to maximize the number of types that can avoid going through + // ArrowArrayInitFromSchema(). + switch (storage_type) { + case NANOARROW_TYPE_DURATION: + case NANOARROW_TYPE_TIMESTAMP: + case NANOARROW_TYPE_TIME64: + case NANOARROW_TYPE_DATE64: + storage_type = NANOARROW_TYPE_INT64; + break; + case NANOARROW_TYPE_TIME32: + case NANOARROW_TYPE_DATE32: + storage_type = NANOARROW_TYPE_INT32; + break; + default: + break; + } + + int result = ArrowArraySetStorageType(array, storage_type); + if (result != NANOARROW_OK) { + ArrowArrayRelease(array); + return result; + } + + ArrowLayoutInit(&private_data->layout, storage_type); + // We can only know this not to be true when initializing based on a schema + // so assume this to be true. + private_data->union_type_id_is_child_index = 1; + return NANOARROW_OK; +} + +ArrowErrorCode ArrowArrayInitFromArrayView(struct ArrowArray* array, + const struct ArrowArrayView* array_view, + struct ArrowError* error) { + NANOARROW_RETURN_NOT_OK_WITH_ERROR( + ArrowArrayInitFromType(array, array_view->storage_type), error); + int result; + + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + private_data->layout = array_view->layout; + + if (array_view->n_children > 0) { + result = ArrowArrayAllocateChildren(array, array_view->n_children); + if (result != NANOARROW_OK) { + ArrowArrayRelease(array); + return result; + } + + for (int64_t i = 0; i < array_view->n_children; i++) { + result = + ArrowArrayInitFromArrayView(array->children[i], array_view->children[i], error); + if (result != NANOARROW_OK) { + ArrowArrayRelease(array); + return result; + } + } + } + + if (array_view->dictionary != NULL) { + result = ArrowArrayAllocateDictionary(array); + if (result != NANOARROW_OK) { + ArrowArrayRelease(array); + return result; + } + + result = + ArrowArrayInitFromArrayView(array->dictionary, array_view->dictionary, error); + if (result != NANOARROW_OK) { + ArrowArrayRelease(array); + return result; + } + } + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowArrayInitFromSchema(struct ArrowArray* array, + const struct ArrowSchema* schema, + struct ArrowError* error) { + struct ArrowArrayView array_view; + NANOARROW_RETURN_NOT_OK(ArrowArrayViewInitFromSchema(&array_view, schema, error)); + NANOARROW_RETURN_NOT_OK(ArrowArrayInitFromArrayView(array, &array_view, error)); + if (array_view.storage_type == NANOARROW_TYPE_DENSE_UNION || + array_view.storage_type == NANOARROW_TYPE_SPARSE_UNION) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + // We can still build arrays if this isn't true; however, the append + // functions won't work. Instead, we store this value and error only + // when StartAppending is called. + private_data->union_type_id_is_child_index = + _ArrowUnionTypeIdsWillEqualChildIndices(schema->format + 4, schema->n_children); + } + + ArrowArrayViewReset(&array_view); + return NANOARROW_OK; +} + +ArrowErrorCode ArrowArrayAllocateChildren(struct ArrowArray* array, int64_t n_children) { + if (array->children != NULL) { + return EINVAL; + } + + if (n_children == 0) { + return NANOARROW_OK; + } + + array->children = + (struct ArrowArray**)ArrowMalloc(n_children * sizeof(struct ArrowArray*)); + if (array->children == NULL) { + return ENOMEM; + } + + memset(array->children, 0, n_children * sizeof(struct ArrowArray*)); + + for (int64_t i = 0; i < n_children; i++) { + array->children[i] = (struct ArrowArray*)ArrowMalloc(sizeof(struct ArrowArray)); + if (array->children[i] == NULL) { + return ENOMEM; + } + array->children[i]->release = NULL; + } + + array->n_children = n_children; + return NANOARROW_OK; +} + +ArrowErrorCode ArrowArrayAllocateDictionary(struct ArrowArray* array) { + if (array->dictionary != NULL) { + return EINVAL; + } + + array->dictionary = (struct ArrowArray*)ArrowMalloc(sizeof(struct ArrowArray)); + if (array->dictionary == NULL) { + return ENOMEM; + } + + array->dictionary->release = NULL; + return NANOARROW_OK; +} + +void ArrowArraySetValidityBitmap(struct ArrowArray* array, struct ArrowBitmap* bitmap) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + ArrowBufferMove(&bitmap->buffer, &private_data->bitmap.buffer); + private_data->bitmap.size_bits = bitmap->size_bits; + bitmap->size_bits = 0; + private_data->buffer_data[0] = private_data->bitmap.buffer.data; + array->null_count = -1; +} + +ArrowErrorCode ArrowArraySetBuffer(struct ArrowArray* array, int64_t i, + struct ArrowBuffer* buffer) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + + switch (i) { + case 0: + ArrowBufferMove(buffer, &private_data->bitmap.buffer); + private_data->buffer_data[i] = private_data->bitmap.buffer.data; + break; + case 1: + case 2: + ArrowBufferMove(buffer, &private_data->buffers[i - 1]); + private_data->buffer_data[i] = private_data->buffers[i - 1].data; + break; + default: + return EINVAL; + } + + return NANOARROW_OK; +} + +static ArrowErrorCode ArrowArrayViewInitFromArray(struct ArrowArrayView* array_view, + struct ArrowArray* array) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + + ArrowArrayViewInitFromType(array_view, private_data->storage_type); + array_view->layout = private_data->layout; + array_view->array = array; + array_view->length = array->length; + array_view->offset = array->offset; + array_view->null_count = array->null_count; + + array_view->buffer_views[0].data.as_uint8 = private_data->bitmap.buffer.data; + array_view->buffer_views[0].size_bytes = private_data->bitmap.buffer.size_bytes; + array_view->buffer_views[1].data.as_uint8 = private_data->buffers[0].data; + array_view->buffer_views[1].size_bytes = private_data->buffers[0].size_bytes; + array_view->buffer_views[2].data.as_uint8 = private_data->buffers[1].data; + array_view->buffer_views[2].size_bytes = private_data->buffers[1].size_bytes; + + int result = ArrowArrayViewAllocateChildren(array_view, array->n_children); + if (result != NANOARROW_OK) { + ArrowArrayViewReset(array_view); + return result; + } + + for (int64_t i = 0; i < array->n_children; i++) { + result = ArrowArrayViewInitFromArray(array_view->children[i], array->children[i]); + if (result != NANOARROW_OK) { + ArrowArrayViewReset(array_view); + return result; + } + } + + if (array->dictionary != NULL) { + result = ArrowArrayViewAllocateDictionary(array_view); + if (result != NANOARROW_OK) { + ArrowArrayViewReset(array_view); + return result; + } + + result = ArrowArrayViewInitFromArray(array_view->dictionary, array->dictionary); + if (result != NANOARROW_OK) { + ArrowArrayViewReset(array_view); + return result; + } + } + + return NANOARROW_OK; +} + +static ArrowErrorCode ArrowArrayReserveInternal(struct ArrowArray* array, + struct ArrowArrayView* array_view) { + // Loop through buffers and reserve the extra space that we know about + for (int64_t i = 0; i < array->n_buffers; i++) { + // Don't reserve on a validity buffer that hasn't been allocated yet + if (array_view->layout.buffer_type[i] == NANOARROW_BUFFER_TYPE_VALIDITY && + ArrowArrayBuffer(array, i)->data == NULL) { + continue; + } + + int64_t additional_size_bytes = + array_view->buffer_views[i].size_bytes - ArrowArrayBuffer(array, i)->size_bytes; + + if (additional_size_bytes > 0) { + NANOARROW_RETURN_NOT_OK( + ArrowBufferReserve(ArrowArrayBuffer(array, i), additional_size_bytes)); + } + } + + // Recursively reserve children + for (int64_t i = 0; i < array->n_children; i++) { + NANOARROW_RETURN_NOT_OK( + ArrowArrayReserveInternal(array->children[i], array_view->children[i])); + } + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowArrayReserve(struct ArrowArray* array, + int64_t additional_size_elements) { + struct ArrowArrayView array_view; + NANOARROW_RETURN_NOT_OK(ArrowArrayViewInitFromArray(&array_view, array)); + + // Calculate theoretical buffer sizes (recursively) + ArrowArrayViewSetLength(&array_view, array->length + additional_size_elements); + + // Walk the structure (recursively) + int result = ArrowArrayReserveInternal(array, &array_view); + ArrowArrayViewReset(&array_view); + if (result != NANOARROW_OK) { + return result; + } + + return NANOARROW_OK; +} + +static ArrowErrorCode ArrowArrayFinalizeBuffers(struct ArrowArray* array) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + + for (int i = 0; i < NANOARROW_MAX_FIXED_BUFFERS; i++) { + if (private_data->layout.buffer_type[i] == NANOARROW_BUFFER_TYPE_VALIDITY || + private_data->layout.buffer_type[i] == NANOARROW_BUFFER_TYPE_NONE) { + continue; + } + + struct ArrowBuffer* buffer = ArrowArrayBuffer(array, i); + if (buffer->data == NULL) { + NANOARROW_RETURN_NOT_OK((ArrowBufferReserve(buffer, 1))); + } + } + + for (int64_t i = 0; i < array->n_children; i++) { + NANOARROW_RETURN_NOT_OK(ArrowArrayFinalizeBuffers(array->children[i])); + } + + if (array->dictionary != NULL) { + NANOARROW_RETURN_NOT_OK(ArrowArrayFinalizeBuffers(array->dictionary)); + } + + return NANOARROW_OK; +} + +static void ArrowArrayFlushInternalPointers(struct ArrowArray* array) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + + const bool is_binary_view = private_data->storage_type == NANOARROW_TYPE_STRING_VIEW || + private_data->storage_type == NANOARROW_TYPE_BINARY_VIEW; + const int32_t nfixed_buf = is_binary_view ? 2 : NANOARROW_MAX_FIXED_BUFFERS; + + for (int32_t i = 0; i < nfixed_buf; i++) { + private_data->buffer_data[i] = ArrowArrayBuffer(array, i)->data; + } + + if (is_binary_view) { + const int32_t nvirt_buf = private_data->n_variadic_buffers; + private_data->buffer_data = (const void**)ArrowRealloc( + private_data->buffer_data, sizeof(void*) * (nfixed_buf + nvirt_buf + 1)); + for (int32_t i = 0; i < nvirt_buf; i++) { + private_data->buffer_data[nfixed_buf + i] = private_data->variadic_buffers[i].data; + } + private_data->buffer_data[nfixed_buf + nvirt_buf] = + private_data->variadic_buffer_sizes; + array->buffers = (const void**)(private_data->buffer_data); + } + + for (int64_t i = 0; i < array->n_children; i++) { + ArrowArrayFlushInternalPointers(array->children[i]); + } + + if (array->dictionary != NULL) { + ArrowArrayFlushInternalPointers(array->dictionary); + } +} + +ArrowErrorCode ArrowArrayFinishBuilding(struct ArrowArray* array, + enum ArrowValidationLevel validation_level, + struct ArrowError* error) { + // Even if the data buffer is size zero, the pointer value needed to be non-null + // in some implementations (at least one version of Arrow C++ at the time this + // was added and C# as later discovered). Only do this fix if we can assume + // CPU data access. + if (validation_level >= NANOARROW_VALIDATION_LEVEL_DEFAULT) { + NANOARROW_RETURN_NOT_OK_WITH_ERROR(ArrowArrayFinalizeBuffers(array), error); + } + + // Make sure the value we get with array->buffers[i] is set to the actual + // pointer (which may have changed from the original due to reallocation) + ArrowArrayFlushInternalPointers(array); + + if (validation_level == NANOARROW_VALIDATION_LEVEL_NONE) { + return NANOARROW_OK; + } + + // For validation, initialize an ArrowArrayView with our known buffer sizes + struct ArrowArrayView array_view; + NANOARROW_RETURN_NOT_OK_WITH_ERROR(ArrowArrayViewInitFromArray(&array_view, array), + error); + int result = ArrowArrayViewValidate(&array_view, validation_level, error); + ArrowArrayViewReset(&array_view); + return result; +} + +ArrowErrorCode ArrowArrayFinishBuildingDefault(struct ArrowArray* array, + struct ArrowError* error) { + return ArrowArrayFinishBuilding(array, NANOARROW_VALIDATION_LEVEL_DEFAULT, error); +} + +void ArrowArrayViewInitFromType(struct ArrowArrayView* array_view, + enum ArrowType storage_type) { + memset(array_view, 0, sizeof(struct ArrowArrayView)); + array_view->storage_type = storage_type; + ArrowLayoutInit(&array_view->layout, storage_type); +} + +ArrowErrorCode ArrowArrayViewAllocateChildren(struct ArrowArrayView* array_view, + int64_t n_children) { + if (array_view->children != NULL) { + return EINVAL; + } + + if (n_children == 0) { + array_view->n_children = 0; + return NANOARROW_OK; + } + + array_view->children = + (struct ArrowArrayView**)ArrowMalloc(n_children * sizeof(struct ArrowArrayView*)); + if (array_view->children == NULL) { + return ENOMEM; + } + + for (int64_t i = 0; i < n_children; i++) { + array_view->children[i] = NULL; + } + + array_view->n_children = n_children; + + for (int64_t i = 0; i < n_children; i++) { + array_view->children[i] = + (struct ArrowArrayView*)ArrowMalloc(sizeof(struct ArrowArrayView)); + if (array_view->children[i] == NULL) { + return ENOMEM; + } + ArrowArrayViewInitFromType(array_view->children[i], NANOARROW_TYPE_UNINITIALIZED); + } + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowArrayViewAllocateDictionary(struct ArrowArrayView* array_view) { + if (array_view->dictionary != NULL) { + return EINVAL; + } + + array_view->dictionary = + (struct ArrowArrayView*)ArrowMalloc(sizeof(struct ArrowArrayView)); + if (array_view->dictionary == NULL) { + return ENOMEM; + } + + ArrowArrayViewInitFromType(array_view->dictionary, NANOARROW_TYPE_UNINITIALIZED); + return NANOARROW_OK; +} + +ArrowErrorCode ArrowArrayViewInitFromSchema(struct ArrowArrayView* array_view, + const struct ArrowSchema* schema, + struct ArrowError* error) { + struct ArrowSchemaView schema_view; + int result = ArrowSchemaViewInit(&schema_view, schema, error); + if (result != NANOARROW_OK) { + return result; + } + + ArrowArrayViewInitFromType(array_view, schema_view.storage_type); + array_view->layout = schema_view.layout; + + result = ArrowArrayViewAllocateChildren(array_view, schema->n_children); + if (result != NANOARROW_OK) { + ArrowErrorSet(error, "ArrowArrayViewAllocateChildren() failed"); + ArrowArrayViewReset(array_view); + return result; + } + + for (int64_t i = 0; i < schema->n_children; i++) { + result = + ArrowArrayViewInitFromSchema(array_view->children[i], schema->children[i], error); + if (result != NANOARROW_OK) { + ArrowArrayViewReset(array_view); + return result; + } + } + + if (schema->dictionary != NULL) { + result = ArrowArrayViewAllocateDictionary(array_view); + if (result != NANOARROW_OK) { + ArrowArrayViewReset(array_view); + return result; + } + + result = + ArrowArrayViewInitFromSchema(array_view->dictionary, schema->dictionary, error); + if (result != NANOARROW_OK) { + ArrowArrayViewReset(array_view); + return result; + } + } + + if (array_view->storage_type == NANOARROW_TYPE_SPARSE_UNION || + array_view->storage_type == NANOARROW_TYPE_DENSE_UNION) { + array_view->union_type_id_map = (int8_t*)ArrowMalloc(256 * sizeof(int8_t)); + if (array_view->union_type_id_map == NULL) { + return ENOMEM; + } + + memset(array_view->union_type_id_map, -1, 256); + int32_t n_type_ids = _ArrowParseUnionTypeIds(schema_view.union_type_ids, + array_view->union_type_id_map + 128); + for (int8_t child_index = 0; child_index < n_type_ids; child_index++) { + int8_t type_id = array_view->union_type_id_map[128 + child_index]; + array_view->union_type_id_map[type_id] = child_index; + } + } + + return NANOARROW_OK; +} + +void ArrowArrayViewReset(struct ArrowArrayView* array_view) { + if (array_view->children != NULL) { + for (int64_t i = 0; i < array_view->n_children; i++) { + if (array_view->children[i] != NULL) { + ArrowArrayViewReset(array_view->children[i]); + ArrowFree(array_view->children[i]); + } + } + + ArrowFree(array_view->children); + } + + if (array_view->dictionary != NULL) { + ArrowArrayViewReset(array_view->dictionary); + ArrowFree(array_view->dictionary); + } + + if (array_view->union_type_id_map != NULL) { + ArrowFree(array_view->union_type_id_map); + } + + ArrowArrayViewInitFromType(array_view, NANOARROW_TYPE_UNINITIALIZED); +} + +void ArrowArrayViewSetLength(struct ArrowArrayView* array_view, int64_t length) { + for (int i = 0; i < NANOARROW_MAX_FIXED_BUFFERS; i++) { + int64_t element_size_bytes = array_view->layout.element_size_bits[i] / 8; + + switch (array_view->layout.buffer_type[i]) { + case NANOARROW_BUFFER_TYPE_VALIDITY: + array_view->buffer_views[i].size_bytes = _ArrowBytesForBits(length); + continue; + case NANOARROW_BUFFER_TYPE_DATA_OFFSET: + // Probably don't want/need to rely on the producer to have allocated an + // offsets buffer of length 1 for a zero-size array + array_view->buffer_views[i].size_bytes = + (length != 0) * element_size_bytes * (length + 1); + continue; + case NANOARROW_BUFFER_TYPE_DATA: + array_view->buffer_views[i].size_bytes = + _ArrowRoundUpToMultipleOf8(array_view->layout.element_size_bits[i] * length) / + 8; + continue; + case NANOARROW_BUFFER_TYPE_TYPE_ID: + case NANOARROW_BUFFER_TYPE_UNION_OFFSET: + array_view->buffer_views[i].size_bytes = element_size_bytes * length; + continue; + case NANOARROW_BUFFER_TYPE_VARIADIC_DATA: + case NANOARROW_BUFFER_TYPE_VARIADIC_SIZE: + case NANOARROW_BUFFER_TYPE_NONE: + array_view->buffer_views[i].size_bytes = 0; + continue; + } + } + + switch (array_view->storage_type) { + case NANOARROW_TYPE_STRUCT: + case NANOARROW_TYPE_SPARSE_UNION: + for (int64_t i = 0; i < array_view->n_children; i++) { + ArrowArrayViewSetLength(array_view->children[i], length); + } + break; + case NANOARROW_TYPE_FIXED_SIZE_LIST: + if (array_view->n_children >= 1) { + ArrowArrayViewSetLength(array_view->children[0], + length * array_view->layout.child_size_elements); + } + default: + break; + } +} + +// This version recursively extracts information from the array and stores it +// in the array view, performing any checks that require the original array. +static int ArrowArrayViewSetArrayInternal(struct ArrowArrayView* array_view, + const struct ArrowArray* array, + struct ArrowError* error) { + array_view->array = array; + array_view->offset = array->offset; + array_view->length = array->length; + array_view->null_count = array->null_count; + array_view->variadic_buffer_sizes = NULL; + array_view->variadic_buffers = NULL; + array_view->n_variadic_buffers = 0; + + int64_t buffers_required = 0; + const int nfixed_buf = array_view->storage_type == NANOARROW_TYPE_STRING_VIEW || + array_view->storage_type == NANOARROW_TYPE_BINARY_VIEW + ? NANOARROW_BINARY_VIEW_FIXED_BUFFERS + : NANOARROW_MAX_FIXED_BUFFERS; + for (int i = 0; i < nfixed_buf; i++) { + if (array_view->layout.buffer_type[i] == NANOARROW_BUFFER_TYPE_NONE) { + break; + } + + buffers_required++; + + // Set buffer pointer + array_view->buffer_views[i].data.data = array->buffers[i]; + + // If non-null, set buffer size to unknown. + if (array->buffers[i] == NULL) { + array_view->buffer_views[i].size_bytes = 0; + } else { + array_view->buffer_views[i].size_bytes = -1; + } + } + + if (array_view->storage_type == NANOARROW_TYPE_STRING_VIEW || + array_view->storage_type == NANOARROW_TYPE_BINARY_VIEW) { + const int64_t n_buffers = array->n_buffers; + const int32_t nfixed_buf = NANOARROW_BINARY_VIEW_FIXED_BUFFERS; + + const int32_t nvariadic_buf = (int32_t)(n_buffers - nfixed_buf - 1); + array_view->n_variadic_buffers = nvariadic_buf; + buffers_required += nvariadic_buf + 1; + array_view->variadic_buffers = array->buffers + NANOARROW_BINARY_VIEW_FIXED_BUFFERS; + array_view->variadic_buffer_sizes = (int64_t*)array->buffers[n_buffers - 1]; + } + + if (buffers_required != array->n_buffers) { + ArrowErrorSet(error, + "Expected array with %" PRId64 " buffer(s) but found %" PRId64 + " buffer(s)", + buffers_required, array->n_buffers); + return EINVAL; + } + + // Check number of children + if (array_view->n_children != array->n_children) { + ArrowErrorSet(error, "Expected %" PRId64 " children but found %" PRId64 " children", + array_view->n_children, array->n_children); + return EINVAL; + } + + // Recurse for children + for (int64_t i = 0; i < array_view->n_children; i++) { + NANOARROW_RETURN_NOT_OK(ArrowArrayViewSetArrayInternal(array_view->children[i], + array->children[i], error)); + } + + // Check dictionary + if (array->dictionary == NULL && array_view->dictionary != NULL) { + ArrowErrorSet(error, "Expected dictionary but found NULL"); + return EINVAL; + } + + if (array->dictionary != NULL && array_view->dictionary == NULL) { + ArrowErrorSet(error, "Expected NULL dictionary but found dictionary member"); + return EINVAL; + } + + if (array->dictionary != NULL) { + NANOARROW_RETURN_NOT_OK( + ArrowArrayViewSetArrayInternal(array_view->dictionary, array->dictionary, error)); + } + + return NANOARROW_OK; +} + +static int ArrowArrayViewValidateMinimal(struct ArrowArrayView* array_view, + struct ArrowError* error) { + if (array_view->length < 0) { + ArrowErrorSet(error, "Expected length >= 0 but found length %" PRId64, + array_view->length); + return EINVAL; + } + + if (array_view->offset < 0) { + ArrowErrorSet(error, "Expected offset >= 0 but found offset %" PRId64, + array_view->offset); + return EINVAL; + } + + // Ensure that offset + length fits within an int64 before a possible overflow + if ((uint64_t)array_view->offset + (uint64_t)array_view->length > (uint64_t)INT64_MAX) { + ArrowErrorSet(error, "Offset + length is > INT64_MAX"); + return EINVAL; + } + + // Calculate buffer sizes that do not require buffer access. If marked as + // unknown, assign the buffer size; otherwise, validate it. + int64_t offset_plus_length = array_view->offset + array_view->length; + + // Only loop over the first two buffers because the size of the third buffer + // is always data dependent for all current Arrow types. + for (int i = 0; i < 2; i++) { + int64_t element_size_bytes = array_view->layout.element_size_bits[i] / 8; + // Initialize with a value that will cause an error if accidentally used uninitialized + // Need to suppress the clang-tidy warning because gcc warns for possible use + int64_t min_buffer_size_bytes = // NOLINT(clang-analyzer-deadcode.DeadStores) + array_view->buffer_views[i].size_bytes + 1; + + switch (array_view->layout.buffer_type[i]) { + case NANOARROW_BUFFER_TYPE_VALIDITY: + if (array_view->null_count == 0 && array_view->buffer_views[i].size_bytes == 0) { + continue; + } + + min_buffer_size_bytes = _ArrowBytesForBits(offset_plus_length); + break; + case NANOARROW_BUFFER_TYPE_DATA_OFFSET: + // Probably don't want/need to rely on the producer to have allocated an + // offsets buffer of length 1 for a zero-size array + min_buffer_size_bytes = + (offset_plus_length != 0) * element_size_bytes * (offset_plus_length + 1); + break; + case NANOARROW_BUFFER_TYPE_DATA: + min_buffer_size_bytes = + _ArrowRoundUpToMultipleOf8(array_view->layout.element_size_bits[i] * + offset_plus_length) / + 8; + break; + case NANOARROW_BUFFER_TYPE_TYPE_ID: + case NANOARROW_BUFFER_TYPE_UNION_OFFSET: + min_buffer_size_bytes = element_size_bytes * offset_plus_length; + break; + case NANOARROW_BUFFER_TYPE_VARIADIC_DATA: + case NANOARROW_BUFFER_TYPE_VARIADIC_SIZE: + case NANOARROW_BUFFER_TYPE_NONE: + continue; + } + + // Assign or validate buffer size + if (array_view->buffer_views[i].size_bytes == -1) { + array_view->buffer_views[i].size_bytes = min_buffer_size_bytes; + } else if (array_view->buffer_views[i].size_bytes < min_buffer_size_bytes) { + ArrowErrorSet(error, + "Expected %s array buffer %d to have size >= %" PRId64 + " bytes but found " + "buffer with %" PRId64 " bytes", + ArrowTypeString(array_view->storage_type), i, min_buffer_size_bytes, + array_view->buffer_views[i].size_bytes); + return EINVAL; + } + } + + // For list, fixed-size list and map views, we can validate the number of children + switch (array_view->storage_type) { + case NANOARROW_TYPE_LIST: + case NANOARROW_TYPE_LARGE_LIST: + case NANOARROW_TYPE_FIXED_SIZE_LIST: + case NANOARROW_TYPE_MAP: + if (array_view->n_children != 1) { + ArrowErrorSet(error, + "Expected 1 child of %s array but found %" PRId64 " child arrays", + ArrowTypeString(array_view->storage_type), array_view->n_children); + return EINVAL; + } + break; + case NANOARROW_TYPE_RUN_END_ENCODED: + if (array_view->n_children != 2) { + ArrowErrorSet( + error, "Expected 2 children for %s array but found %" PRId64 " child arrays", + ArrowTypeString(array_view->storage_type), array_view->n_children); + return EINVAL; + } + break; + default: + break; + } + + // For struct, the sparse union, and the fixed-size list views, we can validate child + // lengths. + int64_t child_min_length; + switch (array_view->storage_type) { + case NANOARROW_TYPE_SPARSE_UNION: + case NANOARROW_TYPE_STRUCT: + child_min_length = (array_view->offset + array_view->length); + for (int64_t i = 0; i < array_view->n_children; i++) { + if (array_view->children[i]->length < child_min_length) { + ArrowErrorSet(error, + "Expected struct child %" PRId64 " to have length >= %" PRId64 + " but found child with " + "length %" PRId64, + i + 1, child_min_length, array_view->children[i]->length); + return EINVAL; + } + } + break; + + case NANOARROW_TYPE_FIXED_SIZE_LIST: + child_min_length = (array_view->offset + array_view->length) * + array_view->layout.child_size_elements; + if (array_view->children[0]->length < child_min_length) { + ArrowErrorSet(error, + "Expected child of fixed_size_list array to have length >= %" PRId64 + " but " + "found array with length %" PRId64, + child_min_length, array_view->children[0]->length); + return EINVAL; + } + break; + + case NANOARROW_TYPE_RUN_END_ENCODED: { + if (array_view->n_children != 2) { + ArrowErrorSet(error, + "Expected 2 children for run-end encoded array but found %" PRId64, + array_view->n_children); + return EINVAL; + } + struct ArrowArrayView* run_ends_view = array_view->children[0]; + struct ArrowArrayView* values_view = array_view->children[1]; + int64_t max_length; + switch (run_ends_view->storage_type) { + case NANOARROW_TYPE_INT16: + max_length = INT16_MAX; + break; + case NANOARROW_TYPE_INT32: + max_length = INT32_MAX; + break; + case NANOARROW_TYPE_INT64: + max_length = INT64_MAX; + break; + default: + ArrowErrorSet( + error, + "Run-end encoded array only supports INT16, INT32 or INT64 run-ends " + "but found run-ends type %s", + ArrowTypeString(run_ends_view->storage_type)); + return EINVAL; + } + + // There is already a check above that offset_plus_length < INT64_MAX + if (offset_plus_length > max_length) { + ArrowErrorSet(error, + "Offset + length of a run-end encoded array must fit in a value" + " of the run end type %s but is %" PRId64 " + %" PRId64, + ArrowTypeString(run_ends_view->storage_type), array_view->offset, + array_view->length); + return EINVAL; + } + + if (run_ends_view->length > values_view->length) { + ArrowErrorSet(error, + "Length of run_ends is greater than the length of values: %" PRId64 + " > %" PRId64, + run_ends_view->length, values_view->length); + return EINVAL; + } + + if (run_ends_view->length == 0 && values_view->length != 0) { + ArrowErrorSet(error, + "Run-end encoded array has zero length %" PRId64 + ", but values array has " + "non-zero length", + values_view->length); + return EINVAL; + } + + if (run_ends_view->null_count != 0) { + ArrowErrorSet(error, "Null count must be 0 for run ends array, but is %" PRId64, + run_ends_view->null_count); + return EINVAL; + } + break; + } + + default: + break; + } + + // Recurse for children + for (int64_t i = 0; i < array_view->n_children; i++) { + NANOARROW_RETURN_NOT_OK( + ArrowArrayViewValidateMinimal(array_view->children[i], error)); + } + + // Recurse for dictionary + if (array_view->dictionary != NULL) { + NANOARROW_RETURN_NOT_OK(ArrowArrayViewValidateMinimal(array_view->dictionary, error)); + } + + return NANOARROW_OK; +} + +static int ArrowArrayViewValidateDefault(struct ArrowArrayView* array_view, + struct ArrowError* error) { + // Perform minimal validation. This will validate or assign + // buffer sizes as long as buffer access is not required. + NANOARROW_RETURN_NOT_OK(ArrowArrayViewValidateMinimal(array_view, error)); + + // Calculate buffer sizes or child lengths that require accessing the offsets + // buffer. Where appropriate, validate that the first offset is >= 0. + // If a buffer size is marked as unknown, assign it; otherwise, validate it. + int64_t offset_plus_length = array_view->offset + array_view->length; + + int64_t first_offset; + int64_t last_offset; + switch (array_view->storage_type) { + case NANOARROW_TYPE_STRING: + case NANOARROW_TYPE_BINARY: + if (array_view->buffer_views[1].size_bytes != 0) { + first_offset = array_view->buffer_views[1].data.as_int32[array_view->offset]; + if (first_offset < 0) { + ArrowErrorSet(error, "Expected first offset >= 0 but found %" PRId64, + first_offset); + return EINVAL; + } + + last_offset = array_view->buffer_views[1].data.as_int32[offset_plus_length]; + if (last_offset < 0) { + ArrowErrorSet(error, "Expected last offset >= 0 but found %" PRId64, + last_offset); + return EINVAL; + } + + // If the data buffer size is unknown, assign it; otherwise, check it + if (array_view->buffer_views[2].size_bytes == -1) { + array_view->buffer_views[2].size_bytes = last_offset; + } else if (array_view->buffer_views[2].size_bytes < last_offset) { + ArrowErrorSet(error, + "Expected %s array buffer 2 to have size >= %" PRId64 + " bytes but found " + "buffer with %" PRId64 " bytes", + ArrowTypeString(array_view->storage_type), last_offset, + array_view->buffer_views[2].size_bytes); + return EINVAL; + } + } else if (array_view->buffer_views[2].size_bytes == -1) { + // If the data buffer size is unknown and there are no bytes in the offset buffer, + // set the data buffer size to 0. + array_view->buffer_views[2].size_bytes = 0; + } + break; + + case NANOARROW_TYPE_LARGE_STRING: + case NANOARROW_TYPE_LARGE_BINARY: + if (array_view->buffer_views[1].size_bytes != 0) { + first_offset = array_view->buffer_views[1].data.as_int64[array_view->offset]; + if (first_offset < 0) { + ArrowErrorSet(error, "Expected first offset >= 0 but found %" PRId64, + first_offset); + return EINVAL; + } + + last_offset = array_view->buffer_views[1].data.as_int64[offset_plus_length]; + if (last_offset < 0) { + ArrowErrorSet(error, "Expected last offset >= 0 but found %" PRId64, + last_offset); + return EINVAL; + } + + // If the data buffer size is unknown, assign it; otherwise, check it + if (array_view->buffer_views[2].size_bytes == -1) { + array_view->buffer_views[2].size_bytes = last_offset; + } else if (array_view->buffer_views[2].size_bytes < last_offset) { + ArrowErrorSet(error, + "Expected %s array buffer 2 to have size >= %" PRId64 + " bytes but found " + "buffer with %" PRId64 " bytes", + ArrowTypeString(array_view->storage_type), last_offset, + array_view->buffer_views[2].size_bytes); + return EINVAL; + } + } else if (array_view->buffer_views[2].size_bytes == -1) { + // If the data buffer size is unknown and there are no bytes in the offset + // buffer, set the data buffer size to 0. + array_view->buffer_views[2].size_bytes = 0; + } + break; + + case NANOARROW_TYPE_STRUCT: + for (int64_t i = 0; i < array_view->n_children; i++) { + if (array_view->children[i]->length < offset_plus_length) { + ArrowErrorSet(error, + "Expected struct child %" PRId64 " to have length >= %" PRId64 + " but found child with " + "length %" PRId64, + i + 1, offset_plus_length, array_view->children[i]->length); + return EINVAL; + } + } + break; + + case NANOARROW_TYPE_LIST: + case NANOARROW_TYPE_MAP: + if (array_view->buffer_views[1].size_bytes != 0) { + first_offset = array_view->buffer_views[1].data.as_int32[array_view->offset]; + if (first_offset < 0) { + ArrowErrorSet(error, "Expected first offset >= 0 but found %" PRId64, + first_offset); + return EINVAL; + } + + last_offset = array_view->buffer_views[1].data.as_int32[offset_plus_length]; + if (last_offset < 0) { + ArrowErrorSet(error, "Expected last offset >= 0 but found %" PRId64, + last_offset); + return EINVAL; + } + + if (array_view->children[0]->length < last_offset) { + ArrowErrorSet(error, + "Expected child of %s array to have length >= %" PRId64 + " but found array with " + "length %" PRId64, + ArrowTypeString(array_view->storage_type), last_offset, + array_view->children[0]->length); + return EINVAL; + } + } + break; + + case NANOARROW_TYPE_LARGE_LIST: + if (array_view->buffer_views[1].size_bytes != 0) { + first_offset = array_view->buffer_views[1].data.as_int64[array_view->offset]; + if (first_offset < 0) { + ArrowErrorSet(error, "Expected first offset >= 0 but found %" PRId64, + first_offset); + return EINVAL; + } + + last_offset = array_view->buffer_views[1].data.as_int64[offset_plus_length]; + if (last_offset < 0) { + ArrowErrorSet(error, "Expected last offset >= 0 but found %" PRId64, + last_offset); + return EINVAL; + } + + if (array_view->children[0]->length < last_offset) { + ArrowErrorSet(error, + "Expected child of large list array to have length >= %" PRId64 + " but found array " + "with length %" PRId64, + last_offset, array_view->children[0]->length); + return EINVAL; + } + } + break; + + case NANOARROW_TYPE_RUN_END_ENCODED: { + struct ArrowArrayView* run_ends_view = array_view->children[0]; + if (run_ends_view->length == 0) { + break; + } + + int64_t first_run_end = ArrowArrayViewGetIntUnsafe(run_ends_view, 0); + if (first_run_end < 1) { + ArrowErrorSet( + error, + "All run ends must be greater than 0 but the first run end is %" PRId64, + first_run_end); + return EINVAL; + } + + // offset + length < INT64_MAX is checked in ArrowArrayViewValidateMinimal() + int64_t last_run_end = + ArrowArrayViewGetIntUnsafe(run_ends_view, run_ends_view->length - 1); + if (last_run_end < offset_plus_length) { + ArrowErrorSet(error, + "Last run end is %" PRId64 " but it should be >= (%" PRId64 + " + %" PRId64 ")", + last_run_end, array_view->offset, array_view->length); + return EINVAL; + } + break; + } + default: + break; + } + + // Recurse for children + for (int64_t i = 0; i < array_view->n_children; i++) { + NANOARROW_RETURN_NOT_OK( + ArrowArrayViewValidateDefault(array_view->children[i], error)); + } + + // Recurse for dictionary + if (array_view->dictionary != NULL) { + NANOARROW_RETURN_NOT_OK(ArrowArrayViewValidateDefault(array_view->dictionary, error)); + } + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowArrayViewSetArray(struct ArrowArrayView* array_view, + const struct ArrowArray* array, + struct ArrowError* error) { + // Extract information from the array into the array view + NANOARROW_RETURN_NOT_OK(ArrowArrayViewSetArrayInternal(array_view, array, error)); + + // Run default validation. Because we've marked all non-NULL buffers as having unknown + // size, validation will also update the buffer sizes as it goes. + NANOARROW_RETURN_NOT_OK(ArrowArrayViewValidateDefault(array_view, error)); + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowArrayViewSetArrayMinimal(struct ArrowArrayView* array_view, + const struct ArrowArray* array, + struct ArrowError* error) { + // Extract information from the array into the array view + NANOARROW_RETURN_NOT_OK(ArrowArrayViewSetArrayInternal(array_view, array, error)); + + // Run default validation. Because we've marked all non-NULL buffers as having unknown + // size, validation will also update the buffer sizes as it goes. + NANOARROW_RETURN_NOT_OK(ArrowArrayViewValidateMinimal(array_view, error)); + + return NANOARROW_OK; +} + +static int ArrowAssertIncreasingInt32(struct ArrowBufferView view, + struct ArrowError* error) { + if (view.size_bytes <= (int64_t)sizeof(int32_t)) { + return NANOARROW_OK; + } + + for (int64_t i = 1; i < view.size_bytes / (int64_t)sizeof(int32_t); i++) { + if (view.data.as_int32[i] < view.data.as_int32[i - 1]) { + ArrowErrorSet(error, "[%" PRId64 "] Expected element size >= 0", i); + return EINVAL; + } + } + + return NANOARROW_OK; +} + +static int ArrowAssertIncreasingInt64(struct ArrowBufferView view, + struct ArrowError* error) { + if (view.size_bytes <= (int64_t)sizeof(int64_t)) { + return NANOARROW_OK; + } + + for (int64_t i = 1; i < view.size_bytes / (int64_t)sizeof(int64_t); i++) { + if (view.data.as_int64[i] < view.data.as_int64[i - 1]) { + ArrowErrorSet(error, "[%" PRId64 "] Expected element size >= 0", i); + return EINVAL; + } + } + + return NANOARROW_OK; +} + +static int ArrowAssertRangeInt8(struct ArrowBufferView view, int8_t min_value, + int8_t max_value, struct ArrowError* error) { + for (int64_t i = 0; i < view.size_bytes; i++) { + if (view.data.as_int8[i] < min_value || view.data.as_int8[i] > max_value) { + ArrowErrorSet(error, + "[%" PRId64 "] Expected buffer value between %" PRId8 " and %" PRId8 + " but found value %" PRId8, + i, min_value, max_value, view.data.as_int8[i]); + return EINVAL; + } + } + + return NANOARROW_OK; +} + +static int ArrowAssertInt8In(struct ArrowBufferView view, const int8_t* values, + int64_t n_values, struct ArrowError* error) { + for (int64_t i = 0; i < view.size_bytes; i++) { + int item_found = 0; + for (int64_t j = 0; j < n_values; j++) { + if (view.data.as_int8[i] == values[j]) { + item_found = 1; + break; + } + } + + if (!item_found) { + ArrowErrorSet(error, "[%" PRId64 "] Unexpected buffer value %" PRId8, i, + view.data.as_int8[i]); + return EINVAL; + } + } + + return NANOARROW_OK; +} + +static int ArrowArrayViewValidateFull(struct ArrowArrayView* array_view, + struct ArrowError* error) { + for (int i = 0; i < NANOARROW_MAX_FIXED_BUFFERS; i++) { + switch (array_view->layout.buffer_type[i]) { + // Only validate the portion of the buffer that is strictly required, + // which includes not validating the offset buffer of a zero-length array. + case NANOARROW_BUFFER_TYPE_DATA_OFFSET: + if (array_view->length == 0) { + continue; + } + if (array_view->layout.element_size_bits[i] == 32) { + struct ArrowBufferView sliced_offsets; + sliced_offsets.data.as_int32 = + array_view->buffer_views[i].data.as_int32 + array_view->offset; + sliced_offsets.size_bytes = (array_view->length + 1) * sizeof(int32_t); + NANOARROW_RETURN_NOT_OK(ArrowAssertIncreasingInt32(sliced_offsets, error)); + } else { + struct ArrowBufferView sliced_offsets; + sliced_offsets.data.as_int64 = + array_view->buffer_views[i].data.as_int64 + array_view->offset; + sliced_offsets.size_bytes = (array_view->length + 1) * sizeof(int64_t); + NANOARROW_RETURN_NOT_OK(ArrowAssertIncreasingInt64(sliced_offsets, error)); + } + break; + default: + break; + } + } + + if (array_view->storage_type == NANOARROW_TYPE_DENSE_UNION || + array_view->storage_type == NANOARROW_TYPE_SPARSE_UNION) { + struct ArrowBufferView sliced_type_ids; + sliced_type_ids.size_bytes = array_view->length * sizeof(int8_t); + if (array_view->length > 0) { + sliced_type_ids.data.as_int8 = + array_view->buffer_views[0].data.as_int8 + array_view->offset; + } else { + sliced_type_ids.data.as_int8 = NULL; + } + + if (array_view->union_type_id_map == NULL) { + // If the union_type_id map is NULL (e.g., when using ArrowArrayInitFromType() + + // ArrowArrayAllocateChildren() + ArrowArrayFinishBuilding()), we don't have enough + // information to validate this buffer. + ArrowErrorSet(error, + "Insufficient information provided for validation of union array"); + return EINVAL; + } else if (_ArrowParsedUnionTypeIdsWillEqualChildIndices( + array_view->union_type_id_map, array_view->n_children, + array_view->n_children)) { + NANOARROW_RETURN_NOT_OK(ArrowAssertRangeInt8( + sliced_type_ids, 0, (int8_t)(array_view->n_children - 1), error)); + } else { + NANOARROW_RETURN_NOT_OK(ArrowAssertInt8In(sliced_type_ids, + array_view->union_type_id_map + 128, + array_view->n_children, error)); + } + } + + if (array_view->storage_type == NANOARROW_TYPE_DENSE_UNION && + array_view->union_type_id_map != NULL) { + // Check that offsets refer to child elements that actually exist + for (int64_t i = 0; i < array_view->length; i++) { + int8_t child_id = ArrowArrayViewUnionChildIndex(array_view, i); + int64_t offset = ArrowArrayViewUnionChildOffset(array_view, i); + int64_t child_length = array_view->children[child_id]->length; + if (offset < 0 || offset > child_length) { + ArrowErrorSet(error, + "[%" PRId64 "] Expected union offset for child id %" PRId8 + " to be between 0 and %" PRId64 + " but " + "found offset value %" PRId64, + i, child_id, child_length, offset); + return EINVAL; + } + } + } + + if (array_view->storage_type == NANOARROW_TYPE_RUN_END_ENCODED) { + struct ArrowArrayView* run_ends_view = array_view->children[0]; + if (run_ends_view->length > 0) { + int64_t last_run_end = ArrowArrayViewGetIntUnsafe(run_ends_view, 0); + for (int64_t i = 1; i < run_ends_view->length; i++) { + const int64_t run_end = ArrowArrayViewGetIntUnsafe(run_ends_view, i); + if (run_end <= last_run_end) { + ArrowErrorSet( + error, + "Every run end must be strictly greater than the previous run end, " + "but run_ends[%" PRId64 " is %" PRId64 " and run_ends[%" PRId64 + "] is %" PRId64, + i, run_end, i - 1, last_run_end); + return EINVAL; + } + last_run_end = run_end; + } + } + } + + // Recurse for children + for (int64_t i = 0; i < array_view->n_children; i++) { + NANOARROW_RETURN_NOT_OK(ArrowArrayViewValidateFull(array_view->children[i], error)); + } + + // Dictionary valiation not implemented + if (array_view->dictionary != NULL) { + NANOARROW_RETURN_NOT_OK(ArrowArrayViewValidateFull(array_view->dictionary, error)); + // TODO: validate the indices + } + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowArrayViewValidate(struct ArrowArrayView* array_view, + enum ArrowValidationLevel validation_level, + struct ArrowError* error) { + switch (validation_level) { + case NANOARROW_VALIDATION_LEVEL_NONE: + return NANOARROW_OK; + case NANOARROW_VALIDATION_LEVEL_MINIMAL: + return ArrowArrayViewValidateMinimal(array_view, error); + case NANOARROW_VALIDATION_LEVEL_DEFAULT: + return ArrowArrayViewValidateDefault(array_view, error); + case NANOARROW_VALIDATION_LEVEL_FULL: + NANOARROW_RETURN_NOT_OK(ArrowArrayViewValidateDefault(array_view, error)); + return ArrowArrayViewValidateFull(array_view, error); + } + + ArrowErrorSet(error, "validation_level not recognized"); + return EINVAL; +} + +struct ArrowComparisonInternalState { + enum ArrowCompareLevel level; + int is_equal; + struct ArrowError* reason; +}; + +NANOARROW_CHECK_PRINTF_ATTRIBUTE static void ArrowComparePrependPath( + struct ArrowError* out, const char* fmt, ...) { + if (out == NULL) { + return; + } + + char prefix[128]; + prefix[0] = '\0'; + va_list args; + va_start(args, fmt); + int prefix_len = vsnprintf(prefix, sizeof(prefix), fmt, args); + va_end(args); + + if (prefix_len <= 0) { + return; + } + + size_t out_len = strlen(out->message); + size_t out_len_to_move = sizeof(struct ArrowError) - prefix_len - 1; + if (out_len_to_move > out_len) { + out_len_to_move = out_len; + } + + memmove(out->message + prefix_len, out->message, out_len_to_move); + memcpy(out->message, prefix, prefix_len); + out->message[out_len + prefix_len] = '\0'; +} + +#define SET_NOT_EQUAL_AND_RETURN_IF_IMPL(cond_, state_, reason_) \ + do { \ + if (cond_) { \ + ArrowErrorSet(state_->reason, ": %s", reason_); \ + state_->is_equal = 0; \ + return; \ + } \ + } while (0) + +#define SET_NOT_EQUAL_AND_RETURN_IF(condition_, state_) \ + SET_NOT_EQUAL_AND_RETURN_IF_IMPL(condition_, state_, #condition_) + +static void ArrowArrayViewCompareBuffer(const struct ArrowArrayView* actual, + const struct ArrowArrayView* expected, int i, + struct ArrowComparisonInternalState* state) { + SET_NOT_EQUAL_AND_RETURN_IF( + actual->buffer_views[i].size_bytes != expected->buffer_views[i].size_bytes, state); + + int64_t buffer_size = actual->buffer_views[i].size_bytes; + if (buffer_size > 0) { + SET_NOT_EQUAL_AND_RETURN_IF( + memcmp(actual->buffer_views[i].data.data, expected->buffer_views[i].data.data, + buffer_size) != 0, + state); + } +} + +static void ArrowArrayViewCompareIdentical(const struct ArrowArrayView* actual, + const struct ArrowArrayView* expected, + struct ArrowComparisonInternalState* state) { + SET_NOT_EQUAL_AND_RETURN_IF(actual->storage_type != expected->storage_type, state); + SET_NOT_EQUAL_AND_RETURN_IF(actual->n_children != expected->n_children, state); + SET_NOT_EQUAL_AND_RETURN_IF(actual->dictionary == NULL && expected->dictionary != NULL, + state); + SET_NOT_EQUAL_AND_RETURN_IF(actual->dictionary != NULL && expected->dictionary == NULL, + state); + + SET_NOT_EQUAL_AND_RETURN_IF(actual->length != expected->length, state); + SET_NOT_EQUAL_AND_RETURN_IF(actual->offset != expected->offset, state); + SET_NOT_EQUAL_AND_RETURN_IF(actual->null_count != expected->null_count, state); + + for (int i = 0; i < NANOARROW_MAX_FIXED_BUFFERS; i++) { + ArrowArrayViewCompareBuffer(actual, expected, i, state); + if (!state->is_equal) { + ArrowComparePrependPath(state->reason, ".buffers[%d]", i); + return; + } + } + + for (int64_t i = 0; i < actual->n_children; i++) { + ArrowArrayViewCompareIdentical(actual->children[i], expected->children[i], state); + if (!state->is_equal) { + ArrowComparePrependPath(state->reason, ".children[%" PRId64 "]", i); + return; + } + } + + if (actual->dictionary != NULL) { + ArrowArrayViewCompareIdentical(actual->dictionary, expected->dictionary, state); + if (!state->is_equal) { + ArrowComparePrependPath(state->reason, ".dictionary"); + return; + } + } +} + +// Top-level entry point to take care of creating, cleaning up, and +// propagating the ArrowComparisonInternalState to the caller +ArrowErrorCode ArrowArrayViewCompare(const struct ArrowArrayView* actual, + const struct ArrowArrayView* expected, + enum ArrowCompareLevel level, int* out, + struct ArrowError* reason) { + struct ArrowComparisonInternalState state; + state.level = level; + state.is_equal = 1; + state.reason = reason; + + switch (level) { + case NANOARROW_COMPARE_IDENTICAL: + ArrowArrayViewCompareIdentical(actual, expected, &state); + break; + default: + return EINVAL; + } + + *out = state.is_equal; + if (!state.is_equal) { + ArrowComparePrependPath(state.reason, "root"); + } + + return NANOARROW_OK; +} + +#undef SET_NOT_EQUAL_AND_RETURN_IF +#undef SET_NOT_EQUAL_AND_RETURN_IF_IMPL +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include + +#include "nanoarrow/nanoarrow.h" + +struct BasicArrayStreamPrivate { + struct ArrowSchema schema; + int64_t n_arrays; + struct ArrowArray* arrays; + int64_t arrays_i; +}; + +static int ArrowBasicArrayStreamGetSchema(struct ArrowArrayStream* array_stream, + struct ArrowSchema* schema) { + if (array_stream == NULL || array_stream->release == NULL) { + return EINVAL; + } + + struct BasicArrayStreamPrivate* private_data = + (struct BasicArrayStreamPrivate*)array_stream->private_data; + return ArrowSchemaDeepCopy(&private_data->schema, schema); +} + +static int ArrowBasicArrayStreamGetNext(struct ArrowArrayStream* array_stream, + struct ArrowArray* array) { + if (array_stream == NULL || array_stream->release == NULL) { + return EINVAL; + } + + struct BasicArrayStreamPrivate* private_data = + (struct BasicArrayStreamPrivate*)array_stream->private_data; + + if (private_data->arrays_i == private_data->n_arrays) { + array->release = NULL; + return NANOARROW_OK; + } + + ArrowArrayMove(&private_data->arrays[private_data->arrays_i++], array); + return NANOARROW_OK; +} + +static const char* ArrowBasicArrayStreamGetLastError( + struct ArrowArrayStream* array_stream) { + NANOARROW_UNUSED(array_stream); + return NULL; +} + +static void ArrowBasicArrayStreamRelease(struct ArrowArrayStream* array_stream) { + if (array_stream == NULL || array_stream->release == NULL) { + return; + } + + struct BasicArrayStreamPrivate* private_data = + (struct BasicArrayStreamPrivate*)array_stream->private_data; + + if (private_data->schema.release != NULL) { + ArrowSchemaRelease(&private_data->schema); + } + + for (int64_t i = 0; i < private_data->n_arrays; i++) { + if (private_data->arrays[i].release != NULL) { + ArrowArrayRelease(&private_data->arrays[i]); + } + } + + if (private_data->arrays != NULL) { + ArrowFree(private_data->arrays); + } + + ArrowFree(private_data); + array_stream->release = NULL; +} + +ArrowErrorCode ArrowBasicArrayStreamInit(struct ArrowArrayStream* array_stream, + struct ArrowSchema* schema, int64_t n_arrays) { + struct BasicArrayStreamPrivate* private_data = + (struct BasicArrayStreamPrivate*)ArrowMalloc( + sizeof(struct BasicArrayStreamPrivate)); + if (private_data == NULL) { + return ENOMEM; + } + + ArrowSchemaMove(schema, &private_data->schema); + + private_data->n_arrays = n_arrays; + private_data->arrays = NULL; + private_data->arrays_i = 0; + + if (n_arrays > 0) { + private_data->arrays = + (struct ArrowArray*)ArrowMalloc(n_arrays * sizeof(struct ArrowArray)); + if (private_data->arrays == NULL) { + ArrowBasicArrayStreamRelease(array_stream); + return ENOMEM; + } + } + + for (int64_t i = 0; i < private_data->n_arrays; i++) { + private_data->arrays[i].release = NULL; + } + + array_stream->get_schema = &ArrowBasicArrayStreamGetSchema; + array_stream->get_next = &ArrowBasicArrayStreamGetNext; + array_stream->get_last_error = ArrowBasicArrayStreamGetLastError; + array_stream->release = ArrowBasicArrayStreamRelease; + array_stream->private_data = private_data; + return NANOARROW_OK; +} + +void ArrowBasicArrayStreamSetArray(struct ArrowArrayStream* array_stream, int64_t i, + struct ArrowArray* array) { + struct BasicArrayStreamPrivate* private_data = + (struct BasicArrayStreamPrivate*)array_stream->private_data; + ArrowArrayMove(array, &private_data->arrays[i]); +} + +ArrowErrorCode ArrowBasicArrayStreamValidate(const struct ArrowArrayStream* array_stream, + struct ArrowError* error) { + struct BasicArrayStreamPrivate* private_data = + (struct BasicArrayStreamPrivate*)array_stream->private_data; + + struct ArrowArrayView array_view; + NANOARROW_RETURN_NOT_OK( + ArrowArrayViewInitFromSchema(&array_view, &private_data->schema, error)); + + for (int64_t i = 0; i < private_data->n_arrays; i++) { + if (private_data->arrays[i].release != NULL) { + int result = ArrowArrayViewSetArray(&array_view, &private_data->arrays[i], error); + if (result != NANOARROW_OK) { + ArrowArrayViewReset(&array_view); + return result; + } + } + } + + ArrowArrayViewReset(&array_view); + return NANOARROW_OK; +} diff --git a/3rd_party/nanoarrow/nanoarrow/nanoarrow.h b/3rd_party/nanoarrow/nanoarrow/nanoarrow.h new file mode 100644 index 0000000..fcf61f7 --- /dev/null +++ b/3rd_party/nanoarrow/nanoarrow/nanoarrow.h @@ -0,0 +1,4279 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#ifndef NANOARROW_BUILD_ID_H_INCLUDED +#define NANOARROW_BUILD_ID_H_INCLUDED + +#define NANOARROW_VERSION_MAJOR 0 +#define NANOARROW_VERSION_MINOR 6 +#define NANOARROW_VERSION_PATCH 0 +#define NANOARROW_VERSION "0.6.0" + +#define NANOARROW_VERSION_INT \ + (NANOARROW_VERSION_MAJOR * 10000 + NANOARROW_VERSION_MINOR * 100 + \ + NANOARROW_VERSION_PATCH) + +// #define NANOARROW_NAMESPACE YourNamespaceHere + +#endif +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#ifndef NANOARROW_NANOARROW_TYPES_H_INCLUDED +#define NANOARROW_NANOARROW_TYPES_H_INCLUDED + +#include +#include + + + +#if defined(NANOARROW_DEBUG) && !defined(NANOARROW_PRINT_AND_DIE) +#include +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// Extra guard for versions of Arrow without the canonical guard +#ifndef ARROW_FLAG_DICTIONARY_ORDERED + +/// \defgroup nanoarrow-arrow-cdata Arrow C Data interface +/// +/// The Arrow C Data (https://arrow.apache.org/docs/format/CDataInterface.html) +/// and Arrow C Stream (https://arrow.apache.org/docs/format/CStreamInterface.html) +/// interfaces are part of the +/// Arrow Columnar Format specification +/// (https://arrow.apache.org/docs/format/Columnar.html). See the Arrow documentation for +/// documentation of these structures. +/// +/// @{ + +#ifndef ARROW_C_DATA_INTERFACE +#define ARROW_C_DATA_INTERFACE + +#define ARROW_FLAG_DICTIONARY_ORDERED 1 +#define ARROW_FLAG_NULLABLE 2 +#define ARROW_FLAG_MAP_KEYS_SORTED 4 + +struct ArrowSchema { + // Array type description + const char* format; + const char* name; + const char* metadata; + int64_t flags; + int64_t n_children; + struct ArrowSchema** children; + struct ArrowSchema* dictionary; + + // Release callback + void (*release)(struct ArrowSchema*); + // Opaque producer-specific data + void* private_data; +}; + +struct ArrowArray { + // Array data description + int64_t length; + int64_t null_count; + int64_t offset; + int64_t n_buffers; + int64_t n_children; + const void** buffers; + struct ArrowArray** children; + struct ArrowArray* dictionary; + + // Release callback + void (*release)(struct ArrowArray*); + // Opaque producer-specific data + void* private_data; +}; + +#endif // ARROW_C_DATA_INTERFACE + +#ifndef ARROW_C_STREAM_INTERFACE +#define ARROW_C_STREAM_INTERFACE + +struct ArrowArrayStream { + // Callback to get the stream type + // (will be the same for all arrays in the stream). + // + // Return value: 0 if successful, an `errno`-compatible error code otherwise. + // + // If successful, the ArrowSchema must be released independently from the stream. + int (*get_schema)(struct ArrowArrayStream*, struct ArrowSchema* out); + + // Callback to get the next array + // (if no error and the array is released, the stream has ended) + // + // Return value: 0 if successful, an `errno`-compatible error code otherwise. + // + // If successful, the ArrowArray must be released independently from the stream. + int (*get_next)(struct ArrowArrayStream*, struct ArrowArray* out); + + // Callback to get optional detailed error information. + // This must only be called if the last stream operation failed + // with a non-0 return code. + // + // Return value: pointer to a null-terminated character array describing + // the last error, or NULL if no description is available. + // + // The returned pointer is only valid until the next operation on this stream + // (including release). + const char* (*get_last_error)(struct ArrowArrayStream*); + + // Release callback: release the stream's own resources. + // Note that arrays returned by `get_next` must be individually released. + void (*release)(struct ArrowArrayStream*); + + // Opaque producer-specific data + void* private_data; +}; + +#endif // ARROW_C_STREAM_INTERFACE +#endif // ARROW_FLAG_DICTIONARY_ORDERED + +/// @} + +// Utility macros +#define _NANOARROW_CONCAT(x, y) x##y +#define _NANOARROW_MAKE_NAME(x, y) _NANOARROW_CONCAT(x, y) + +#define _NANOARROW_RETURN_NOT_OK_IMPL(NAME, EXPR) \ + do { \ + const int NAME = (EXPR); \ + if (NAME) return NAME; \ + } while (0) + +#define _NANOARROW_CHECK_RANGE(x_, min_, max_) \ + NANOARROW_RETURN_NOT_OK((x_ >= min_ && x_ <= max_) ? NANOARROW_OK : EINVAL) + +#define _NANOARROW_CHECK_UPPER_LIMIT(x_, max_) \ + NANOARROW_RETURN_NOT_OK((x_ <= max_) ? NANOARROW_OK : EINVAL) + +#if defined(NANOARROW_DEBUG) +#define _NANOARROW_RETURN_NOT_OK_WITH_ERROR_IMPL(NAME, EXPR, ERROR_PTR_EXPR, EXPR_STR) \ + do { \ + const int NAME = (EXPR); \ + if (NAME) { \ + ArrowErrorSet((ERROR_PTR_EXPR), "%s failed with errno %d(%s)\n* %s:%d", EXPR_STR, \ + NAME, strerror(NAME), __FILE__, __LINE__); \ + return NAME; \ + } \ + } while (0) +#else +#define _NANOARROW_RETURN_NOT_OK_WITH_ERROR_IMPL(NAME, EXPR, ERROR_PTR_EXPR, EXPR_STR) \ + do { \ + const int NAME = (EXPR); \ + if (NAME) { \ + ArrowErrorSet((ERROR_PTR_EXPR), "%s failed with errno %d", EXPR_STR, NAME); \ + return NAME; \ + } \ + } while (0) +#endif + +#if defined(NANOARROW_DEBUG) +// For checking ArrowErrorSet() calls for valid printf format strings/arguments +// If using mingw's c99-compliant printf, we need a different format-checking attribute +#if defined(__USE_MINGW_ANSI_STDIO) && defined(__MINGW_PRINTF_FORMAT) +#define NANOARROW_CHECK_PRINTF_ATTRIBUTE \ + __attribute__((format(__MINGW_PRINTF_FORMAT, 2, 3))) +#elif defined(__GNUC__) +#define NANOARROW_CHECK_PRINTF_ATTRIBUTE __attribute__((format(printf, 2, 3))) +#else +#define NANOARROW_CHECK_PRINTF_ATTRIBUTE +#endif + +// For checking calls to functions that return ArrowErrorCode +#if defined(__GNUC__) && (__GNUC__ >= 4) +#define NANOARROW_CHECK_RETURN_ATTRIBUTE __attribute__((warn_unused_result)) +#elif defined(_MSC_VER) && (_MSC_VER >= 1700) +#define NANOARROW_CHECK_RETURN_ATTRIBUTE _Check_return_ +#else +#define NANOARROW_CHECK_RETURN_ATTRIBUTE +#endif + +#else +#define NANOARROW_CHECK_RETURN_ATTRIBUTE +#define NANOARROW_CHECK_PRINTF_ATTRIBUTE +#endif + +#define NANOARROW_UNUSED(x) (void)(x) + +/// \brief Return code for success. +/// \ingroup nanoarrow-errors +#define NANOARROW_OK 0 + +/// \brief Represents an errno-compatible error code +/// \ingroup nanoarrow-errors +typedef int ArrowErrorCode; + +#if defined(NANOARROW_DEBUG) +#define ArrowErrorCode NANOARROW_CHECK_RETURN_ATTRIBUTE ArrowErrorCode +#endif + +/// \brief Flags supported by ArrowSchemaViewInit() +/// \ingroup nanoarrow-schema-view +#define NANOARROW_FLAG_ALL_SUPPORTED \ + (ARROW_FLAG_DICTIONARY_ORDERED | ARROW_FLAG_NULLABLE | ARROW_FLAG_MAP_KEYS_SORTED) + +/// \brief Error type containing a UTF-8 encoded message. +/// \ingroup nanoarrow-errors +struct ArrowError { + /// \brief A character buffer with space for an error message. + char message[1024]; +}; + +/// \brief Ensure an ArrowError is null-terminated by zeroing the first character. +/// \ingroup nanoarrow-errors +/// +/// If error is NULL, this function does nothing. +static inline void ArrowErrorInit(struct ArrowError* error) { + if (error != NULL) { + error->message[0] = '\0'; + } +} + +/// \brief Get the contents of an error +/// \ingroup nanoarrow-errors +/// +/// If error is NULL, returns "", or returns the contents of the error message +/// otherwise. +static inline const char* ArrowErrorMessage(struct ArrowError* error) { + if (error == NULL) { + return ""; + } else { + return error->message; + } +} + +/// \brief Set the contents of an error from an existing null-terminated string +/// \ingroup nanoarrow-errors +/// +/// If error is NULL, this function does nothing. +static inline void ArrowErrorSetString(struct ArrowError* error, const char* src) { + if (error == NULL) { + return; + } + + int64_t src_len = strlen(src); + if (src_len >= ((int64_t)sizeof(error->message))) { + memcpy(error->message, src, sizeof(error->message) - 1); + error->message[sizeof(error->message) - 1] = '\0'; + } else { + memcpy(error->message, src, src_len); + error->message[src_len] = '\0'; + } +} + +/// \brief Check the result of an expression and return it if not NANOARROW_OK +/// \ingroup nanoarrow-errors +#define NANOARROW_RETURN_NOT_OK(EXPR) \ + _NANOARROW_RETURN_NOT_OK_IMPL(_NANOARROW_MAKE_NAME(errno_status_, __COUNTER__), EXPR) + +/// \brief Check the result of an expression and return it if not NANOARROW_OK, +/// adding an auto-generated message to an ArrowError. +/// \ingroup nanoarrow-errors +/// +/// This macro is used to ensure that functions that accept an ArrowError +/// as input always set its message when returning an error code (e.g., when calling +/// a nanoarrow function that does *not* accept ArrowError). +#define NANOARROW_RETURN_NOT_OK_WITH_ERROR(EXPR, ERROR_EXPR) \ + _NANOARROW_RETURN_NOT_OK_WITH_ERROR_IMPL( \ + _NANOARROW_MAKE_NAME(errno_status_, __COUNTER__), EXPR, ERROR_EXPR, #EXPR) + +#if defined(NANOARROW_DEBUG) && !defined(NANOARROW_PRINT_AND_DIE) +#define NANOARROW_PRINT_AND_DIE(VALUE, EXPR_STR) \ + do { \ + fprintf(stderr, "%s failed with code %d\n* %s:%d\n", EXPR_STR, (int)(VALUE), \ + __FILE__, (int)__LINE__); \ + abort(); \ + } while (0) +#endif + +#if defined(NANOARROW_DEBUG) +#define _NANOARROW_ASSERT_OK_IMPL(NAME, EXPR, EXPR_STR) \ + do { \ + const int NAME = (EXPR); \ + if (NAME) NANOARROW_PRINT_AND_DIE(NAME, EXPR_STR); \ + } while (0) + +/// \brief Assert that an expression's value is NANOARROW_OK +/// \ingroup nanoarrow-errors +/// +/// If nanoarrow was built in debug mode (i.e., defined(NANOARROW_DEBUG) is true), +/// print a message to stderr and abort. If nanoarrow was built in release mode, +/// this statement has no effect. You can customize fatal error behaviour +/// be defining the NANOARROW_PRINT_AND_DIE macro before including nanoarrow.h +/// This macro is provided as a convenience for users and is not used internally. +#define NANOARROW_ASSERT_OK(EXPR) \ + _NANOARROW_ASSERT_OK_IMPL(_NANOARROW_MAKE_NAME(errno_status_, __COUNTER__), EXPR, #EXPR) + +#define _NANOARROW_DCHECK_IMPL(EXPR, EXPR_STR) \ + do { \ + if (!(EXPR)) NANOARROW_PRINT_AND_DIE(-1, EXPR_STR); \ + } while (0) + +#define NANOARROW_DCHECK(EXPR) _NANOARROW_DCHECK_IMPL(EXPR, #EXPR) +#else +#define NANOARROW_ASSERT_OK(EXPR) (void)(EXPR) +#define NANOARROW_DCHECK(EXPR) +#endif + +static inline void ArrowSchemaMove(struct ArrowSchema* src, struct ArrowSchema* dst) { + NANOARROW_DCHECK(src != NULL); + NANOARROW_DCHECK(dst != NULL); + + memcpy(dst, src, sizeof(struct ArrowSchema)); + src->release = NULL; +} + +static inline void ArrowSchemaRelease(struct ArrowSchema* schema) { + NANOARROW_DCHECK(schema != NULL); + schema->release(schema); + NANOARROW_DCHECK(schema->release == NULL); +} + +static inline void ArrowArrayMove(struct ArrowArray* src, struct ArrowArray* dst) { + NANOARROW_DCHECK(src != NULL); + NANOARROW_DCHECK(dst != NULL); + + memcpy(dst, src, sizeof(struct ArrowArray)); + src->release = NULL; +} + +static inline void ArrowArrayRelease(struct ArrowArray* array) { + NANOARROW_DCHECK(array != NULL); + array->release(array); + NANOARROW_DCHECK(array->release == NULL); +} + +static inline void ArrowArrayStreamMove(struct ArrowArrayStream* src, + struct ArrowArrayStream* dst) { + NANOARROW_DCHECK(src != NULL); + NANOARROW_DCHECK(dst != NULL); + + memcpy(dst, src, sizeof(struct ArrowArrayStream)); + src->release = NULL; +} + +static inline const char* ArrowArrayStreamGetLastError( + struct ArrowArrayStream* array_stream) { + NANOARROW_DCHECK(array_stream != NULL); + + const char* value = array_stream->get_last_error(array_stream); + if (value == NULL) { + return ""; + } else { + return value; + } +} + +static inline ArrowErrorCode ArrowArrayStreamGetSchema( + struct ArrowArrayStream* array_stream, struct ArrowSchema* out, + struct ArrowError* error) { + NANOARROW_DCHECK(array_stream != NULL); + + int result = array_stream->get_schema(array_stream, out); + if (result != NANOARROW_OK && error != NULL) { + ArrowErrorSetString(error, ArrowArrayStreamGetLastError(array_stream)); + } + + return result; +} + +static inline ArrowErrorCode ArrowArrayStreamGetNext( + struct ArrowArrayStream* array_stream, struct ArrowArray* out, + struct ArrowError* error) { + NANOARROW_DCHECK(array_stream != NULL); + + int result = array_stream->get_next(array_stream, out); + if (result != NANOARROW_OK && error != NULL) { + ArrowErrorSetString(error, ArrowArrayStreamGetLastError(array_stream)); + } + + return result; +} + +static inline void ArrowArrayStreamRelease(struct ArrowArrayStream* array_stream) { + NANOARROW_DCHECK(array_stream != NULL); + array_stream->release(array_stream); + NANOARROW_DCHECK(array_stream->release == NULL); +} + +static char _ArrowIsLittleEndian(void) { + uint32_t check = 1; + char first_byte; + memcpy(&first_byte, &check, sizeof(char)); + return first_byte; +} + +/// \brief Arrow type enumerator +/// \ingroup nanoarrow-utils +/// +/// These names are intended to map to the corresponding arrow::Type::type +/// enumerator; however, the numeric values are specifically not equal +/// (i.e., do not rely on numeric comparison). +enum ArrowType { + NANOARROW_TYPE_UNINITIALIZED = 0, + NANOARROW_TYPE_NA = 1, + NANOARROW_TYPE_BOOL, + NANOARROW_TYPE_UINT8, + NANOARROW_TYPE_INT8, + NANOARROW_TYPE_UINT16, + NANOARROW_TYPE_INT16, + NANOARROW_TYPE_UINT32, + NANOARROW_TYPE_INT32, + NANOARROW_TYPE_UINT64, + NANOARROW_TYPE_INT64, + NANOARROW_TYPE_HALF_FLOAT, + NANOARROW_TYPE_FLOAT, + NANOARROW_TYPE_DOUBLE, + NANOARROW_TYPE_STRING, + NANOARROW_TYPE_BINARY, + NANOARROW_TYPE_FIXED_SIZE_BINARY, + NANOARROW_TYPE_DATE32, + NANOARROW_TYPE_DATE64, + NANOARROW_TYPE_TIMESTAMP, + NANOARROW_TYPE_TIME32, + NANOARROW_TYPE_TIME64, + NANOARROW_TYPE_INTERVAL_MONTHS, + NANOARROW_TYPE_INTERVAL_DAY_TIME, + NANOARROW_TYPE_DECIMAL128, + NANOARROW_TYPE_DECIMAL256, + NANOARROW_TYPE_LIST, + NANOARROW_TYPE_STRUCT, + NANOARROW_TYPE_SPARSE_UNION, + NANOARROW_TYPE_DENSE_UNION, + NANOARROW_TYPE_DICTIONARY, + NANOARROW_TYPE_MAP, + NANOARROW_TYPE_EXTENSION, + NANOARROW_TYPE_FIXED_SIZE_LIST, + NANOARROW_TYPE_DURATION, + NANOARROW_TYPE_LARGE_STRING, + NANOARROW_TYPE_LARGE_BINARY, + NANOARROW_TYPE_LARGE_LIST, + NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO, + NANOARROW_TYPE_RUN_END_ENCODED, + NANOARROW_TYPE_BINARY_VIEW, + NANOARROW_TYPE_STRING_VIEW +}; + +/// \brief Get a string value of an enum ArrowType value +/// \ingroup nanoarrow-utils +/// +/// Returns NULL for invalid values for type +static inline const char* ArrowTypeString(enum ArrowType type); + +static inline const char* ArrowTypeString(enum ArrowType type) { + switch (type) { + case NANOARROW_TYPE_NA: + return "na"; + case NANOARROW_TYPE_BOOL: + return "bool"; + case NANOARROW_TYPE_UINT8: + return "uint8"; + case NANOARROW_TYPE_INT8: + return "int8"; + case NANOARROW_TYPE_UINT16: + return "uint16"; + case NANOARROW_TYPE_INT16: + return "int16"; + case NANOARROW_TYPE_UINT32: + return "uint32"; + case NANOARROW_TYPE_INT32: + return "int32"; + case NANOARROW_TYPE_UINT64: + return "uint64"; + case NANOARROW_TYPE_INT64: + return "int64"; + case NANOARROW_TYPE_HALF_FLOAT: + return "half_float"; + case NANOARROW_TYPE_FLOAT: + return "float"; + case NANOARROW_TYPE_DOUBLE: + return "double"; + case NANOARROW_TYPE_STRING: + return "string"; + case NANOARROW_TYPE_BINARY: + return "binary"; + case NANOARROW_TYPE_FIXED_SIZE_BINARY: + return "fixed_size_binary"; + case NANOARROW_TYPE_DATE32: + return "date32"; + case NANOARROW_TYPE_DATE64: + return "date64"; + case NANOARROW_TYPE_TIMESTAMP: + return "timestamp"; + case NANOARROW_TYPE_TIME32: + return "time32"; + case NANOARROW_TYPE_TIME64: + return "time64"; + case NANOARROW_TYPE_INTERVAL_MONTHS: + return "interval_months"; + case NANOARROW_TYPE_INTERVAL_DAY_TIME: + return "interval_day_time"; + case NANOARROW_TYPE_DECIMAL128: + return "decimal128"; + case NANOARROW_TYPE_DECIMAL256: + return "decimal256"; + case NANOARROW_TYPE_LIST: + return "list"; + case NANOARROW_TYPE_STRUCT: + return "struct"; + case NANOARROW_TYPE_SPARSE_UNION: + return "sparse_union"; + case NANOARROW_TYPE_DENSE_UNION: + return "dense_union"; + case NANOARROW_TYPE_DICTIONARY: + return "dictionary"; + case NANOARROW_TYPE_MAP: + return "map"; + case NANOARROW_TYPE_EXTENSION: + return "extension"; + case NANOARROW_TYPE_FIXED_SIZE_LIST: + return "fixed_size_list"; + case NANOARROW_TYPE_DURATION: + return "duration"; + case NANOARROW_TYPE_LARGE_STRING: + return "large_string"; + case NANOARROW_TYPE_LARGE_BINARY: + return "large_binary"; + case NANOARROW_TYPE_LARGE_LIST: + return "large_list"; + case NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO: + return "interval_month_day_nano"; + case NANOARROW_TYPE_RUN_END_ENCODED: + return "run_end_encoded"; + case NANOARROW_TYPE_BINARY_VIEW: + return "binary_view"; + case NANOARROW_TYPE_STRING_VIEW: + return "string_view"; + default: + return NULL; + } +} + +/// \brief Arrow time unit enumerator +/// \ingroup nanoarrow-utils +/// +/// These names and values map to the corresponding arrow::TimeUnit::type +/// enumerator. +enum ArrowTimeUnit { + NANOARROW_TIME_UNIT_SECOND = 0, + NANOARROW_TIME_UNIT_MILLI = 1, + NANOARROW_TIME_UNIT_MICRO = 2, + NANOARROW_TIME_UNIT_NANO = 3 +}; + +/// \brief Validation level enumerator +/// \ingroup nanoarrow-array +enum ArrowValidationLevel { + /// \brief Do not validate buffer sizes or content. + NANOARROW_VALIDATION_LEVEL_NONE = 0, + + /// \brief Validate buffer sizes that depend on array length but do not validate buffer + /// sizes that depend on buffer data access. + NANOARROW_VALIDATION_LEVEL_MINIMAL = 1, + + /// \brief Validate all buffer sizes, including those that require buffer data access, + /// but do not perform any checks that are O(1) along the length of the buffers. + NANOARROW_VALIDATION_LEVEL_DEFAULT = 2, + + /// \brief Validate all buffer sizes and all buffer content. This is useful in the + /// context of untrusted input or input that may have been corrupted in transit. + NANOARROW_VALIDATION_LEVEL_FULL = 3 +}; + +/// \brief Comparison level enumerator +/// \ingroup nanoarrow-utils +enum ArrowCompareLevel { + /// \brief Consider arrays equal if buffers contain identical content + /// and have identical offset, null count, and length. Note that this is + /// a much stricter check than logical equality, which would take into + /// account potentially different content of null slots, arrays with a + /// non-zero offset, and other considerations. + NANOARROW_COMPARE_IDENTICAL, +}; + +/// \brief Get a string value of an enum ArrowTimeUnit value +/// \ingroup nanoarrow-utils +/// +/// Returns NULL for invalid values for time_unit +static inline const char* ArrowTimeUnitString(enum ArrowTimeUnit time_unit); + +static inline const char* ArrowTimeUnitString(enum ArrowTimeUnit time_unit) { + switch (time_unit) { + case NANOARROW_TIME_UNIT_SECOND: + return "s"; + case NANOARROW_TIME_UNIT_MILLI: + return "ms"; + case NANOARROW_TIME_UNIT_MICRO: + return "us"; + case NANOARROW_TIME_UNIT_NANO: + return "ns"; + default: + return NULL; + } +} + +/// \brief Functional types of buffers as described in the Arrow Columnar Specification +/// \ingroup nanoarrow-array-view +enum ArrowBufferType { + NANOARROW_BUFFER_TYPE_NONE, + NANOARROW_BUFFER_TYPE_VALIDITY, + NANOARROW_BUFFER_TYPE_TYPE_ID, + NANOARROW_BUFFER_TYPE_UNION_OFFSET, + NANOARROW_BUFFER_TYPE_DATA_OFFSET, + NANOARROW_BUFFER_TYPE_DATA, + NANOARROW_BUFFER_TYPE_VARIADIC_DATA, + NANOARROW_BUFFER_TYPE_VARIADIC_SIZE +}; + +/// \brief The maximum number of fixed buffers in an ArrowArrayView or ArrowLayout +/// \ingroup nanoarrow-array-view +#define NANOARROW_MAX_FIXED_BUFFERS 3 + +/// \brief An non-owning view of a string +/// \ingroup nanoarrow-utils +struct ArrowStringView { + /// \brief A pointer to the start of the string + /// + /// If size_bytes is 0, this value may be NULL. + const char* data; + + /// \brief The size of the string in bytes, + /// + /// (Not including the null terminator.) + int64_t size_bytes; +}; + +/// \brief Return a view of a const C string +/// \ingroup nanoarrow-utils +static inline struct ArrowStringView ArrowCharView(const char* value); + +static inline struct ArrowStringView ArrowCharView(const char* value) { + struct ArrowStringView out; + + out.data = value; + if (value) { + out.size_bytes = (int64_t)strlen(value); + } else { + out.size_bytes = 0; + } + + return out; +} + +union ArrowBufferViewData { + const void* data; + const int8_t* as_int8; + const uint8_t* as_uint8; + const int16_t* as_int16; + const uint16_t* as_uint16; + const int32_t* as_int32; + const uint32_t* as_uint32; + const int64_t* as_int64; + const uint64_t* as_uint64; + const double* as_double; + const float* as_float; + const char* as_char; + const union ArrowBinaryView* as_binary_view; +}; + +/// \brief An non-owning view of a buffer +/// \ingroup nanoarrow-utils +struct ArrowBufferView { + /// \brief A pointer to the start of the buffer + /// + /// If size_bytes is 0, this value may be NULL. + union ArrowBufferViewData data; + + /// \brief The size of the buffer in bytes + int64_t size_bytes; +}; + +/// \brief Array buffer allocation and deallocation +/// \ingroup nanoarrow-buffer +/// +/// Container for allocate, reallocate, and free methods that can be used +/// to customize allocation and deallocation of buffers when constructing +/// an ArrowArray. +struct ArrowBufferAllocator { + /// \brief Reallocate a buffer or return NULL if it cannot be reallocated + uint8_t* (*reallocate)(struct ArrowBufferAllocator* allocator, uint8_t* ptr, + int64_t old_size, int64_t new_size); + + /// \brief Deallocate a buffer allocated by this allocator + void (*free)(struct ArrowBufferAllocator* allocator, uint8_t* ptr, int64_t size); + + /// \brief Opaque data specific to the allocator + void* private_data; +}; + +typedef void (*ArrowBufferDeallocatorCallback)(struct ArrowBufferAllocator* allocator, + uint8_t* ptr, int64_t size); + +/// \brief An owning mutable view of a buffer +/// \ingroup nanoarrow-buffer +struct ArrowBuffer { + /// \brief A pointer to the start of the buffer + /// + /// If capacity_bytes is 0, this value may be NULL. + uint8_t* data; + + /// \brief The size of the buffer in bytes + int64_t size_bytes; + + /// \brief The capacity of the buffer in bytes + int64_t capacity_bytes; + + /// \brief The allocator that will be used to reallocate and/or free the buffer + struct ArrowBufferAllocator allocator; +}; + +/// \brief An owning mutable view of a bitmap +/// \ingroup nanoarrow-bitmap +struct ArrowBitmap { + /// \brief An ArrowBuffer to hold the allocated memory + struct ArrowBuffer buffer; + + /// \brief The number of bits that have been appended to the bitmap + int64_t size_bits; +}; + +/// \brief A description of an arrangement of buffers +/// \ingroup nanoarrow-utils +/// +/// Contains the minimum amount of information required to +/// calculate the size of each buffer in an ArrowArray knowing only +/// the length and offset of the array. +struct ArrowLayout { + /// \brief The function of each buffer + enum ArrowBufferType buffer_type[NANOARROW_MAX_FIXED_BUFFERS]; + + /// \brief The data type of each buffer + enum ArrowType buffer_data_type[NANOARROW_MAX_FIXED_BUFFERS]; + + /// \brief The size of an element each buffer or 0 if this size is variable or unknown + int64_t element_size_bits[NANOARROW_MAX_FIXED_BUFFERS]; + + /// \brief The number of elements in the child array per element in this array for a + /// fixed-size list + int64_t child_size_elements; +}; + +/// \brief A non-owning view of an ArrowArray +/// \ingroup nanoarrow-array-view +/// +/// This data structure provides access to the values contained within +/// an ArrowArray with fields provided in a more readily-extractible +/// form. You can re-use an ArrowArrayView for multiple ArrowArrays +/// with the same storage type, use it to represent a hypothetical +/// ArrowArray that does not exist yet, or use it to validate the buffers +/// of a future ArrowArray. +struct ArrowArrayView { + /// \brief The underlying ArrowArray or NULL if it has not been set or + /// if the buffers in this ArrowArrayView are not backed by an ArrowArray. + const struct ArrowArray* array; + + /// \brief The number of elements from the physical start of the buffers. + int64_t offset; + + /// \brief The number of elements in this view. + int64_t length; + + /// \brief A cached null count or -1 to indicate that this value is unknown. + int64_t null_count; + + /// \brief The type used to store values in this array + /// + /// This type represents only the minimum required information to + /// extract values from the array buffers (e.g., for a Date32 array, + /// this value will be NANOARROW_TYPE_INT32). For dictionary-encoded + /// arrays, this will be the index type. + enum ArrowType storage_type; + + /// \brief The buffer types, strides, and sizes of this Array's buffers + struct ArrowLayout layout; + + /// \brief This Array's buffers as ArrowBufferView objects + struct ArrowBufferView buffer_views[NANOARROW_MAX_FIXED_BUFFERS]; + + /// \brief The number of children of this view + int64_t n_children; + + /// \brief Pointers to views of this array's children + struct ArrowArrayView** children; + + /// \brief Pointer to a view of this array's dictionary + struct ArrowArrayView* dictionary; + + /// \brief Union type id to child index mapping + /// + /// If storage_type is a union type, a 256-byte ArrowMalloc()ed buffer + /// such that child_index == union_type_id_map[type_id] and + /// type_id == union_type_id_map[128 + child_index]. This value may be + /// NULL in the case where child_id == type_id. + int8_t* union_type_id_map; + + /// \brief Number of variadic buffers + int32_t n_variadic_buffers; + + /// \brief Pointers to variadic buffers of binary/string_view arrays + const void** variadic_buffers; + + /// \brief Size of each variadic buffer + int64_t* variadic_buffer_sizes; +}; + +// Used as the private data member for ArrowArrays allocated here and accessed +// internally within inline ArrowArray* helpers. +struct ArrowArrayPrivateData { + // Holder for the validity buffer (or first buffer for union types, which are + // the only type whose first buffer is not a valdiity buffer) + struct ArrowBitmap bitmap; + + // Holder for additional buffers as required + struct ArrowBuffer buffers[NANOARROW_MAX_FIXED_BUFFERS - 1]; + + // The array of pointers to buffers. This must be updated after a sequence + // of appends to synchronize its values with the actual buffer addresses + // (which may have been reallocated during that time) + const void** buffer_data; + + // The storage data type, or NANOARROW_TYPE_UNINITIALIZED if unknown + enum ArrowType storage_type; + + // The buffer arrangement for the storage type + struct ArrowLayout layout; + + // Flag to indicate if there are non-sequence union type ids. + // In the future this could be replaced with a type id<->child mapping + // to support constructing unions in append mode where type_id != child_index + int8_t union_type_id_is_child_index; + + // Number of variadic buffers for binary view types + int32_t n_variadic_buffers; + + // Variadic buffers for binary view types + struct ArrowBuffer* variadic_buffers; + + // Size of each variadic buffer in bytes + int64_t* variadic_buffer_sizes; +}; + +/// \brief A representation of an interval. +/// \ingroup nanoarrow-utils +struct ArrowInterval { + /// \brief The type of interval being used + enum ArrowType type; + /// \brief The number of months represented by the interval + int32_t months; + /// \brief The number of days represented by the interval + int32_t days; + /// \brief The number of ms represented by the interval + int32_t ms; + /// \brief The number of ns represented by the interval + int64_t ns; +}; + +/// \brief Zero initialize an Interval with a given unit +/// \ingroup nanoarrow-utils +static inline void ArrowIntervalInit(struct ArrowInterval* interval, + enum ArrowType type) { + memset(interval, 0, sizeof(struct ArrowInterval)); + interval->type = type; +} + +/// \brief A representation of a fixed-precision decimal number +/// \ingroup nanoarrow-utils +/// +/// This structure should be initialized with ArrowDecimalInit() once and +/// values set using ArrowDecimalSetInt(), ArrowDecimalSetBytes128(), +/// or ArrowDecimalSetBytes256(). +struct ArrowDecimal { + /// \brief An array of 64-bit integers of n_words length defined in native-endian order + uint64_t words[4]; + + /// \brief The number of significant digits this decimal number can represent + int32_t precision; + + /// \brief The number of digits after the decimal point. This can be negative. + int32_t scale; + + /// \brief The number of words in the words array + int n_words; + + /// \brief Cached value used by the implementation + int high_word_index; + + /// \brief Cached value used by the implementation + int low_word_index; +}; + +/// \brief Initialize a decimal with a given set of type parameters +/// \ingroup nanoarrow-utils +static inline void ArrowDecimalInit(struct ArrowDecimal* decimal, int32_t bitwidth, + int32_t precision, int32_t scale) { + memset(decimal->words, 0, sizeof(decimal->words)); + decimal->precision = precision; + decimal->scale = scale; + decimal->n_words = (int)(bitwidth / 8 / sizeof(uint64_t)); + + if (_ArrowIsLittleEndian()) { + decimal->low_word_index = 0; + decimal->high_word_index = decimal->n_words - 1; + } else { + decimal->low_word_index = decimal->n_words - 1; + decimal->high_word_index = 0; + } +} + +/// \brief Get a signed integer value of a sufficiently small ArrowDecimal +/// +/// This does not check if the decimal's precision sufficiently small to fit +/// within the signed 64-bit integer range (A precision less than or equal +/// to 18 is sufficiently small). +static inline int64_t ArrowDecimalGetIntUnsafe(const struct ArrowDecimal* decimal) { + return (int64_t)decimal->words[decimal->low_word_index]; +} + +/// \brief Copy the bytes of this decimal into a sufficiently large buffer +/// \ingroup nanoarrow-utils +static inline void ArrowDecimalGetBytes(const struct ArrowDecimal* decimal, + uint8_t* out) { + memcpy(out, decimal->words, decimal->n_words * sizeof(uint64_t)); +} + +/// \brief Returns 1 if the value represented by decimal is >= 0 or -1 otherwise +/// \ingroup nanoarrow-utils +static inline int64_t ArrowDecimalSign(const struct ArrowDecimal* decimal) { + return 1 | ((int64_t)(decimal->words[decimal->high_word_index]) >> 63); +} + +/// \brief Sets the integer value of this decimal +/// \ingroup nanoarrow-utils +static inline void ArrowDecimalSetInt(struct ArrowDecimal* decimal, int64_t value) { + if (value < 0) { + memset(decimal->words, 0xff, decimal->n_words * sizeof(uint64_t)); + } else { + memset(decimal->words, 0, decimal->n_words * sizeof(uint64_t)); + } + + decimal->words[decimal->low_word_index] = value; +} + +/// \brief Negate the value of this decimal in place +/// \ingroup nanoarrow-utils +static inline void ArrowDecimalNegate(struct ArrowDecimal* decimal) { + uint64_t carry = 1; + + if (decimal->low_word_index == 0) { + for (int i = 0; i < decimal->n_words; i++) { + uint64_t elem = decimal->words[i]; + elem = ~elem + carry; + carry &= (elem == 0); + decimal->words[i] = elem; + } + } else { + for (int i = decimal->low_word_index; i >= 0; i--) { + uint64_t elem = decimal->words[i]; + elem = ~elem + carry; + carry &= (elem == 0); + decimal->words[i] = elem; + } + } +} + +/// \brief Copy bytes from a buffer into this decimal +/// \ingroup nanoarrow-utils +static inline void ArrowDecimalSetBytes(struct ArrowDecimal* decimal, + const uint8_t* value) { + memcpy(decimal->words, value, decimal->n_words * sizeof(uint64_t)); +} + +#ifdef __cplusplus +} +#endif + +#endif +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#ifndef NANOARROW_H_INCLUDED +#define NANOARROW_H_INCLUDED + +#include +#include +#include + + + +// If using CMake, optionally pass -DNANOARROW_NAMESPACE=MyNamespace which will set this +// define in nanoarrow_config.h. If not, you can optionally #define NANOARROW_NAMESPACE +// MyNamespace here. + +// This section remaps the non-prefixed symbols to the prefixed symbols so that +// code written against this build can be used independent of the value of +// NANOARROW_NAMESPACE. +#ifdef NANOARROW_NAMESPACE +#define NANOARROW_CAT(A, B) A##B +#define NANOARROW_SYMBOL(A, B) NANOARROW_CAT(A, B) + +#define ArrowNanoarrowVersion NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowNanoarrowVersion) +#define ArrowNanoarrowVersionInt \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowNanoarrowVersionInt) +#define ArrowMalloc NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowMalloc) +#define ArrowRealloc NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowRealloc) +#define ArrowFree NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowFree) +#define ArrowBufferAllocatorDefault \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowBufferAllocatorDefault) +#define ArrowBufferDeallocator \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowBufferDeallocator) +#define ArrowErrorSet NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowErrorSet) +#define ArrowLayoutInit NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowLayoutInit) +#define ArrowDecimalSetDigits NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowDecimalSetDigits) +#define ArrowDecimalAppendDigitsToBuffer \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowDecimalAppendDigitsToBuffer) +#define ArrowSchemaInit NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowSchemaInit) +#define ArrowSchemaInitFromType \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowSchemaInitFromType) +#define ArrowSchemaSetType NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowSchemaSetType) +#define ArrowSchemaSetTypeStruct \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowSchemaSetTypeStruct) +#define ArrowSchemaSetTypeFixedSize \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowSchemaSetTypeFixedSize) +#define ArrowSchemaSetTypeDecimal \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowSchemaSetTypeDecimal) +#define ArrowSchemaSetTypeRunEndEncoded \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowSchemaSetTypeRunEndEncoded) +#define ArrowSchemaSetTypeDateTime \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowSchemaSetTypeDateTime) +#define ArrowSchemaSetTypeUnion \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowSchemaSetTypeUnion) +#define ArrowSchemaDeepCopy NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowSchemaDeepCopy) +#define ArrowSchemaSetFormat NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowSchemaSetFormat) +#define ArrowSchemaSetName NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowSchemaSetName) +#define ArrowSchemaSetMetadata \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowSchemaSetMetadata) +#define ArrowSchemaAllocateChildren \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowSchemaAllocateChildren) +#define ArrowSchemaAllocateDictionary \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowSchemaAllocateDictionary) +#define ArrowMetadataReaderInit \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowMetadataReaderInit) +#define ArrowMetadataReaderRead \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowMetadataReaderRead) +#define ArrowMetadataSizeOf NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowMetadataSizeOf) +#define ArrowMetadataHasKey NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowMetadataHasKey) +#define ArrowMetadataGetValue NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowMetadataGetValue) +#define ArrowMetadataBuilderInit \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowMetadataBuilderInit) +#define ArrowMetadataBuilderAppend \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowMetadataBuilderAppend) +#define ArrowMetadataBuilderSet \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowMetadataBuilderSet) +#define ArrowMetadataBuilderRemove \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowMetadataBuilderRemove) +#define ArrowSchemaViewInit NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowSchemaViewInit) +#define ArrowSchemaToString NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowSchemaToString) +#define ArrowArrayInitFromType \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArrayInitFromType) +#define ArrowArrayInitFromSchema \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArrayInitFromSchema) +#define ArrowArrayInitFromArrayView \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArrayInitFromArrayView) +#define ArrowArrayInitFromArrayView \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArrayInitFromArrayView) +#define ArrowArrayAllocateChildren \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArrayAllocateChildren) +#define ArrowArrayAllocateDictionary \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArrayAllocateDictionary) +#define ArrowArraySetValidityBitmap \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArraySetValidityBitmap) +#define ArrowArraySetBuffer NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArraySetBuffer) +#define ArrowArrayReserve NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArrayReserve) +#define ArrowArrayFinishBuilding \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArrayFinishBuilding) +#define ArrowArrayFinishBuildingDefault \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArrayFinishBuildingDefault) +#define ArrowArrayViewInitFromType \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArrayViewInitFromType) +#define ArrowArrayViewInitFromSchema \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArrayViewInitFromSchema) +#define ArrowArrayViewAllocateChildren \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArrayViewAllocateChildren) +#define ArrowArrayViewAllocateDictionary \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArrayViewAllocateDictionary) +#define ArrowArrayViewSetLength \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArrayViewSetLength) +#define ArrowArrayViewSetArray \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArrayViewSetArray) +#define ArrowArrayViewSetArrayMinimal \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArrayViewSetArrayMinimal) +#define ArrowArrayViewValidate \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArrayViewValidate) +#define ArrowArrayViewCompare NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArrayViewCompare) +#define ArrowArrayViewReset NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowArrayViewReset) +#define ArrowBasicArrayStreamInit \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowBasicArrayStreamInit) +#define ArrowBasicArrayStreamSetArray \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowBasicArrayStreamSetArray) +#define ArrowBasicArrayStreamValidate \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowBasicArrayStreamValidate) + +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/// \defgroup nanoarrow Nanoarrow C library +/// +/// Except where noted, objects are not thread-safe and clients should +/// take care to serialize accesses to methods. +/// +/// Because this library is intended to be vendored, it provides full type +/// definitions and encourages clients to stack or statically allocate +/// where convenient. + +/// \defgroup nanoarrow-malloc Memory management +/// +/// Non-buffer members of a struct ArrowSchema and struct ArrowArray +/// must be allocated using ArrowMalloc() or ArrowRealloc() and freed +/// using ArrowFree() for schemas and arrays allocated here. Buffer members +/// are allocated using an ArrowBufferAllocator. +/// +/// @{ + +/// \brief Allocate like malloc() +void* ArrowMalloc(int64_t size); + +/// \brief Reallocate like realloc() +void* ArrowRealloc(void* ptr, int64_t size); + +/// \brief Free a pointer allocated using ArrowMalloc() or ArrowRealloc(). +void ArrowFree(void* ptr); + +/// \brief Return the default allocator +/// +/// The default allocator uses ArrowMalloc(), ArrowRealloc(), and +/// ArrowFree(). +struct ArrowBufferAllocator ArrowBufferAllocatorDefault(void); + +/// \brief Create a custom deallocator +/// +/// Creates a buffer allocator with only a free method that can be used to +/// attach a custom deallocator to an ArrowBuffer. This may be used to +/// avoid copying an existing buffer that was not allocated using the +/// infrastructure provided here (e.g., by an R or Python object). +struct ArrowBufferAllocator ArrowBufferDeallocator(ArrowBufferDeallocatorCallback, + void* private_data); + +/// @} + +/// \brief Move the contents of an src ArrowSchema into dst and set src->release to NULL +/// \ingroup nanoarrow-arrow-cdata +static inline void ArrowSchemaMove(struct ArrowSchema* src, struct ArrowSchema* dst); + +/// \brief Call the release callback of an ArrowSchema +/// \ingroup nanoarrow-arrow-cdata +static inline void ArrowSchemaRelease(struct ArrowSchema* schema); + +/// \brief Move the contents of an src ArrowArray into dst and set src->release to NULL +/// \ingroup nanoarrow-arrow-cdata +static inline void ArrowArrayMove(struct ArrowArray* src, struct ArrowArray* dst); + +/// \brief Call the release callback of an ArrowArray +static inline void ArrowArrayRelease(struct ArrowArray* array); + +/// \brief Move the contents of an src ArrowArrayStream into dst and set src->release to +/// NULL \ingroup nanoarrow-arrow-cdata +static inline void ArrowArrayStreamMove(struct ArrowArrayStream* src, + struct ArrowArrayStream* dst); + +/// \brief Call the get_schema callback of an ArrowArrayStream +/// \ingroup nanoarrow-arrow-cdata +/// +/// Unlike the get_schema callback, this wrapper checks the return code +/// and propagates the error reported by get_last_error into error. This +/// makes it significantly less verbose to iterate over array streams +/// using NANOARROW_RETURN_NOT_OK()-style error handling. +static inline ArrowErrorCode ArrowArrayStreamGetSchema( + struct ArrowArrayStream* array_stream, struct ArrowSchema* out, + struct ArrowError* error); + +/// \brief Call the get_schema callback of an ArrowArrayStream +/// \ingroup nanoarrow-arrow-cdata +/// +/// Unlike the get_next callback, this wrapper checks the return code +/// and propagates the error reported by get_last_error into error. This +/// makes it significantly less verbose to iterate over array streams +/// using NANOARROW_RETURN_NOT_OK()-style error handling. +static inline ArrowErrorCode ArrowArrayStreamGetNext( + struct ArrowArrayStream* array_stream, struct ArrowArray* out, + struct ArrowError* error); + +/// \brief Call the get_next callback of an ArrowArrayStream +/// \ingroup nanoarrow-arrow-cdata +/// +/// Unlike the get_next callback, this function never returns NULL (i.e., its +/// result is safe to use in printf-style error formatters). Null values from the +/// original callback are reported as "". +static inline const char* ArrowArrayStreamGetLastError( + struct ArrowArrayStream* array_stream); + +/// \brief Call the release callback of an ArrowArrayStream +static inline void ArrowArrayStreamRelease(struct ArrowArrayStream* array_stream); + +/// \defgroup nanoarrow-errors Error handling +/// +/// Functions generally return an errno-compatible error code; functions that +/// need to communicate more verbose error information accept a pointer +/// to an ArrowError. This can be stack or statically allocated. The +/// content of the message is undefined unless an error code has been +/// returned. If a nanoarrow function is passed a non-null ArrowError pointer, the +/// ArrowError pointed to by the argument will be propagated with a +/// null-terminated error message. It is safe to pass a NULL ArrowError anywhere +/// in the nanoarrow API. +/// +/// Except where documented, it is generally not safe to continue after a +/// function has returned a non-zero ArrowErrorCode. The NANOARROW_RETURN_NOT_OK and +/// NANOARROW_ASSERT_OK macros are provided to help propagate errors. C++ clients can use +/// the helpers provided in the nanoarrow.hpp header to facilitate using C++ idioms +/// for memory management and error propgagtion. +/// +/// @{ + +/// \brief Set the contents of an error using printf syntax. +/// +/// If error is NULL, this function does nothing and returns NANOARROW_OK. +NANOARROW_CHECK_PRINTF_ATTRIBUTE int ArrowErrorSet(struct ArrowError* error, + const char* fmt, ...); + +/// @} + +/// \defgroup nanoarrow-utils Utility data structures +/// +/// @{ + +/// \brief Return a version string in the form "major.minor.patch" +const char* ArrowNanoarrowVersion(void); + +/// \brief Return an integer that can be used to compare versions sequentially +int ArrowNanoarrowVersionInt(void); + +/// \brief Initialize a description of buffer arrangements from a storage type +void ArrowLayoutInit(struct ArrowLayout* layout, enum ArrowType storage_type); + +/// \brief Create a string view from a null-terminated string +static inline struct ArrowStringView ArrowCharView(const char* value); + +/// \brief Sets the integer value of an ArrowDecimal from a string +ArrowErrorCode ArrowDecimalSetDigits(struct ArrowDecimal* decimal, + struct ArrowStringView value); + +/// \brief Get the integer value of an ArrowDecimal as string +ArrowErrorCode ArrowDecimalAppendDigitsToBuffer(const struct ArrowDecimal* decimal, + struct ArrowBuffer* buffer); + +/// \brief Get the half float value of a float +static inline uint16_t ArrowFloatToHalfFloat(float value); + +/// \brief Get the float value of a half float +static inline float ArrowHalfFloatToFloat(uint16_t value); + +/// \brief Resolve a chunk index from increasing int64_t offsets +/// +/// Given a buffer of increasing int64_t offsets that begin with 0 (e.g., offset buffer +/// of a large type, run ends of a chunked array implementation), resolve a value v +/// where lo <= v < hi such that offsets[v] <= index < offsets[v + 1]. +static inline int64_t ArrowResolveChunk64(int64_t index, const int64_t* offsets, + int64_t lo, int64_t hi); + +/// @} + +/// \defgroup nanoarrow-schema Creating schemas +/// +/// These functions allocate, copy, and destroy ArrowSchema structures +/// +/// @{ + +/// \brief Initialize an ArrowSchema +/// +/// Initializes the fields and release callback of schema_out. Caller +/// is responsible for calling the schema->release callback if +/// NANOARROW_OK is returned. +void ArrowSchemaInit(struct ArrowSchema* schema); + +/// \brief Initialize an ArrowSchema from an ArrowType +/// +/// A convenience constructor for that calls ArrowSchemaInit() and +/// ArrowSchemaSetType() for the common case of constructing an +/// unparameterized type. The caller is responsible for calling the schema->release +/// callback if NANOARROW_OK is returned. +ArrowErrorCode ArrowSchemaInitFromType(struct ArrowSchema* schema, enum ArrowType type); + +/// \brief Get a human-readable summary of a Schema +/// +/// Writes a summary of an ArrowSchema to out (up to n - 1 characters) +/// and returns the number of characters required for the output if +/// n were sufficiently large. If recursive is non-zero, the result will +/// also include children. +int64_t ArrowSchemaToString(const struct ArrowSchema* schema, char* out, int64_t n, + char recursive); + +/// \brief Set the format field of a schema from an ArrowType +/// +/// Initializes the fields and release callback of schema_out. For +/// NANOARROW_TYPE_LIST, NANOARROW_TYPE_LARGE_LIST, and +/// NANOARROW_TYPE_MAP, the appropriate number of children are +/// allocated, initialized, and named; however, the caller must +/// ArrowSchemaSetType() on the preinitialized children. Schema must have been initialized +/// using ArrowSchemaInit() or ArrowSchemaDeepCopy(). +ArrowErrorCode ArrowSchemaSetType(struct ArrowSchema* schema, enum ArrowType type); + +/// \brief Set the format field and initialize children of a struct schema +/// +/// The specified number of children are initialized; however, the caller is responsible +/// for calling ArrowSchemaSetType() and ArrowSchemaSetName() on each child. +/// Schema must have been initialized using ArrowSchemaInit() or ArrowSchemaDeepCopy(). +ArrowErrorCode ArrowSchemaSetTypeStruct(struct ArrowSchema* schema, int64_t n_children); + +/// \brief Set the format field of a fixed-size schema +/// +/// Returns EINVAL for fixed_size <= 0 or for type that is not +/// NANOARROW_TYPE_FIXED_SIZE_BINARY or NANOARROW_TYPE_FIXED_SIZE_LIST. +/// For NANOARROW_TYPE_FIXED_SIZE_LIST, the appropriate number of children are +/// allocated, initialized, and named; however, the caller must +/// ArrowSchemaSetType() the first child. Schema must have been initialized using +/// ArrowSchemaInit() or ArrowSchemaDeepCopy(). +ArrowErrorCode ArrowSchemaSetTypeFixedSize(struct ArrowSchema* schema, + enum ArrowType type, int32_t fixed_size); + +/// \brief Set the format field of a decimal schema +/// +/// Returns EINVAL for scale <= 0 or for type that is not +/// NANOARROW_TYPE_DECIMAL128 or NANOARROW_TYPE_DECIMAL256. Schema must have been +/// initialized using ArrowSchemaInit() or ArrowSchemaDeepCopy(). +ArrowErrorCode ArrowSchemaSetTypeDecimal(struct ArrowSchema* schema, enum ArrowType type, + int32_t decimal_precision, + int32_t decimal_scale); + +/// \brief Set the format field of a run-end encoded schema +/// +/// Returns EINVAL for run_end_type that is not +/// NANOARROW_TYPE_INT16, NANOARROW_TYPE_INT32 or NANOARROW_TYPE_INT64. +/// Schema must have been initialized using ArrowSchemaInit() or ArrowSchemaDeepCopy(). +/// The caller must call `ArrowSchemaSetTypeXXX(schema->children[1])` to +/// set the value type. Note that when building arrays using the `ArrowArrayAppendXXX()` +/// functions, the run-end encoded array's logical length must be updated manually. +ArrowErrorCode ArrowSchemaSetTypeRunEndEncoded(struct ArrowSchema* schema, + enum ArrowType run_end_type); + +/// \brief Set the format field of a time, timestamp, or duration schema +/// +/// Returns EINVAL for type that is not +/// NANOARROW_TYPE_TIME32, NANOARROW_TYPE_TIME64, +/// NANOARROW_TYPE_TIMESTAMP, or NANOARROW_TYPE_DURATION. The +/// timezone parameter must be NULL for a non-timestamp type. Schema must have been +/// initialized using ArrowSchemaInit() or ArrowSchemaDeepCopy(). +ArrowErrorCode ArrowSchemaSetTypeDateTime(struct ArrowSchema* schema, enum ArrowType type, + enum ArrowTimeUnit time_unit, + const char* timezone); + +/// \brief Set the format field of a union schema +/// +/// Returns EINVAL for a type that is not NANOARROW_TYPE_DENSE_UNION +/// or NANOARROW_TYPE_SPARSE_UNION. The specified number of children are +/// allocated, and initialized. +ArrowErrorCode ArrowSchemaSetTypeUnion(struct ArrowSchema* schema, enum ArrowType type, + int64_t n_children); + +/// \brief Make a (recursive) copy of a schema +/// +/// Allocates and copies fields of schema into schema_out. +ArrowErrorCode ArrowSchemaDeepCopy(const struct ArrowSchema* schema, + struct ArrowSchema* schema_out); + +/// \brief Copy format into schema->format +/// +/// schema must have been allocated using ArrowSchemaInitFromType() or +/// ArrowSchemaDeepCopy(). +ArrowErrorCode ArrowSchemaSetFormat(struct ArrowSchema* schema, const char* format); + +/// \brief Copy name into schema->name +/// +/// schema must have been allocated using ArrowSchemaInitFromType() or +/// ArrowSchemaDeepCopy(). +ArrowErrorCode ArrowSchemaSetName(struct ArrowSchema* schema, const char* name); + +/// \brief Copy metadata into schema->metadata +/// +/// schema must have been allocated using ArrowSchemaInitFromType() or +/// ArrowSchemaDeepCopy. +ArrowErrorCode ArrowSchemaSetMetadata(struct ArrowSchema* schema, const char* metadata); + +/// \brief Allocate the schema->children array +/// +/// Includes the memory for each child struct ArrowSchema. +/// schema must have been allocated using ArrowSchemaInitFromType() or +/// ArrowSchemaDeepCopy(). +ArrowErrorCode ArrowSchemaAllocateChildren(struct ArrowSchema* schema, + int64_t n_children); + +/// \brief Allocate the schema->dictionary member +/// +/// schema must have been allocated using ArrowSchemaInitFromType() or +/// ArrowSchemaDeepCopy(). +ArrowErrorCode ArrowSchemaAllocateDictionary(struct ArrowSchema* schema); + +/// @} + +/// \defgroup nanoarrow-metadata Create, read, and modify schema metadata +/// +/// @{ + +/// \brief Reader for key/value pairs in schema metadata +/// +/// The ArrowMetadataReader does not own any data and is only valid +/// for the lifetime of the underlying metadata pointer. +struct ArrowMetadataReader { + /// \brief A metadata string from a schema->metadata field. + const char* metadata; + + /// \brief The current offset into the metadata string + int64_t offset; + + /// \brief The number of remaining keys + int32_t remaining_keys; +}; + +/// \brief Initialize an ArrowMetadataReader +ArrowErrorCode ArrowMetadataReaderInit(struct ArrowMetadataReader* reader, + const char* metadata); + +/// \brief Read the next key/value pair from an ArrowMetadataReader +ArrowErrorCode ArrowMetadataReaderRead(struct ArrowMetadataReader* reader, + struct ArrowStringView* key_out, + struct ArrowStringView* value_out); + +/// \brief The number of bytes in in a key/value metadata string +int64_t ArrowMetadataSizeOf(const char* metadata); + +/// \brief Check for a key in schema metadata +char ArrowMetadataHasKey(const char* metadata, struct ArrowStringView key); + +/// \brief Extract a value from schema metadata +/// +/// If key does not exist in metadata, value_out is unmodified +ArrowErrorCode ArrowMetadataGetValue(const char* metadata, struct ArrowStringView key, + struct ArrowStringView* value_out); + +/// \brief Initialize a builder for schema metadata from key/value pairs +/// +/// metadata can be an existing metadata string or NULL to initialize +/// an empty metadata string. +ArrowErrorCode ArrowMetadataBuilderInit(struct ArrowBuffer* buffer, const char* metadata); + +/// \brief Append a key/value pair to a buffer containing serialized metadata +ArrowErrorCode ArrowMetadataBuilderAppend(struct ArrowBuffer* buffer, + struct ArrowStringView key, + struct ArrowStringView value); + +/// \brief Set a key/value pair to a buffer containing serialized metadata +/// +/// Ensures that the only entry for key in the metadata is set to value. +/// This function maintains the existing position of (the first instance of) +/// key if present in the data. +ArrowErrorCode ArrowMetadataBuilderSet(struct ArrowBuffer* buffer, + struct ArrowStringView key, + struct ArrowStringView value); + +/// \brief Remove a key from a buffer containing serialized metadata +ArrowErrorCode ArrowMetadataBuilderRemove(struct ArrowBuffer* buffer, + struct ArrowStringView key); + +/// @} + +/// \defgroup nanoarrow-schema-view Reading schemas +/// +/// @{ + +/// \brief A non-owning view of a parsed ArrowSchema +/// +/// Contains more readily extractable values than a raw ArrowSchema. +/// Clients can stack or statically allocate this structure but are +/// encouraged to use the provided getters to ensure forward +/// compatibility. +struct ArrowSchemaView { + /// \brief A pointer to the schema represented by this view + const struct ArrowSchema* schema; + + /// \brief The data type represented by the schema + /// + /// This value may be NANOARROW_TYPE_DICTIONARY if the schema has a + /// non-null dictionary member; datetime types are valid values. + /// This value will never be NANOARROW_TYPE_EXTENSION (see + /// extension_name and/or extension_metadata to check for + /// an extension type). + enum ArrowType type; + + /// \brief The storage data type represented by the schema + /// + /// This value will never be NANOARROW_TYPE_DICTIONARY, NANOARROW_TYPE_EXTENSION + /// or any datetime type. This value represents only the type required to + /// interpret the buffers in the array. + enum ArrowType storage_type; + + /// \brief The storage layout represented by the schema + struct ArrowLayout layout; + + /// \brief The extension type name if it exists + /// + /// If the ARROW:extension:name key is present in schema.metadata, + /// extension_name.data will be non-NULL. + struct ArrowStringView extension_name; + + /// \brief The extension type metadata if it exists + /// + /// If the ARROW:extension:metadata key is present in schema.metadata, + /// extension_metadata.data will be non-NULL. + struct ArrowStringView extension_metadata; + + /// \brief Format fixed size parameter + /// + /// This value is set when parsing a fixed-size binary or fixed-size + /// list schema; this value is undefined for other types. For a + /// fixed-size binary schema this value is in bytes; for a fixed-size + /// list schema this value refers to the number of child elements for + /// each element of the parent. + int32_t fixed_size; + + /// \brief Decimal bitwidth + /// + /// This value is set when parsing a decimal type schema; + /// this value is undefined for other types. + int32_t decimal_bitwidth; + + /// \brief Decimal precision + /// + /// This value is set when parsing a decimal type schema; + /// this value is undefined for other types. + int32_t decimal_precision; + + /// \brief Decimal scale + /// + /// This value is set when parsing a decimal type schema; + /// this value is undefined for other types. + int32_t decimal_scale; + + /// \brief Format time unit parameter + /// + /// This value is set when parsing a date/time type. The value is + /// undefined for other types. + enum ArrowTimeUnit time_unit; + + /// \brief Format timezone parameter + /// + /// This value is set when parsing a timestamp type and represents + /// the timezone format parameter. This value points to + /// data within the schema and is undefined for other types. + const char* timezone; + + /// \brief Union type ids parameter + /// + /// This value is set when parsing a union type and represents + /// type ids parameter. This value points to + /// data within the schema and is undefined for other types. + const char* union_type_ids; +}; + +/// \brief Initialize an ArrowSchemaView +ArrowErrorCode ArrowSchemaViewInit(struct ArrowSchemaView* schema_view, + const struct ArrowSchema* schema, + struct ArrowError* error); + +/// @} + +/// \defgroup nanoarrow-buffer Owning, growable buffers +/// +/// @{ + +/// \brief Initialize an ArrowBuffer +/// +/// Initialize a buffer with a NULL, zero-size buffer using the default +/// buffer allocator. +static inline void ArrowBufferInit(struct ArrowBuffer* buffer); + +/// \brief Set a newly-initialized buffer's allocator +/// +/// Returns EINVAL if the buffer has already been allocated. +static inline ArrowErrorCode ArrowBufferSetAllocator( + struct ArrowBuffer* buffer, struct ArrowBufferAllocator allocator); + +/// \brief Reset an ArrowBuffer +/// +/// Releases the buffer using the allocator's free method if +/// the buffer's data member is non-null, sets the data member +/// to NULL, and sets the buffer's size and capacity to 0. +static inline void ArrowBufferReset(struct ArrowBuffer* buffer); + +/// \brief Move an ArrowBuffer +/// +/// Transfers the buffer data and lifecycle management to another +/// address and resets buffer. +static inline void ArrowBufferMove(struct ArrowBuffer* src, struct ArrowBuffer* dst); + +/// \brief Grow or shrink a buffer to a given size +/// +/// When shrinking the size of the buffer, the buffer is only reallocated +/// if shrink_to_fit is non-zero. +static inline ArrowErrorCode ArrowBufferResize(struct ArrowBuffer* buffer, + int64_t new_size_bytes, + char shrink_to_fit); + +/// \brief Ensure a buffer has at least a given additional capacity +/// +/// Ensures that the buffer has space to append at least +/// additional_size_bytes, overallocating when required. +static inline ArrowErrorCode ArrowBufferReserve(struct ArrowBuffer* buffer, + int64_t additional_size_bytes); + +/// \brief Write data to buffer and increment the buffer size +/// +/// This function does not check that buffer has the required capacity +static inline void ArrowBufferAppendUnsafe(struct ArrowBuffer* buffer, const void* data, + int64_t size_bytes); + +/// \brief Write data to buffer and increment the buffer size +/// +/// This function writes and ensures that the buffer has the required capacity, +/// possibly by reallocating the buffer. Like ArrowBufferReserve, this will +/// overallocate when reallocation is required. +static inline ArrowErrorCode ArrowBufferAppend(struct ArrowBuffer* buffer, + const void* data, int64_t size_bytes); + +/// \brief Write fill to buffer and increment the buffer size +/// +/// This function writes the specified number of fill bytes and +/// ensures that the buffer has the required capacity, +static inline ArrowErrorCode ArrowBufferAppendFill(struct ArrowBuffer* buffer, + uint8_t value, int64_t size_bytes); + +/// \brief Write an 8-bit integer to a buffer +static inline ArrowErrorCode ArrowBufferAppendInt8(struct ArrowBuffer* buffer, + int8_t value); + +/// \brief Write an unsigned 8-bit integer to a buffer +static inline ArrowErrorCode ArrowBufferAppendUInt8(struct ArrowBuffer* buffer, + uint8_t value); + +/// \brief Write a 16-bit integer to a buffer +static inline ArrowErrorCode ArrowBufferAppendInt16(struct ArrowBuffer* buffer, + int16_t value); + +/// \brief Write an unsigned 16-bit integer to a buffer +static inline ArrowErrorCode ArrowBufferAppendUInt16(struct ArrowBuffer* buffer, + uint16_t value); + +/// \brief Write a 32-bit integer to a buffer +static inline ArrowErrorCode ArrowBufferAppendInt32(struct ArrowBuffer* buffer, + int32_t value); + +/// \brief Write an unsigned 32-bit integer to a buffer +static inline ArrowErrorCode ArrowBufferAppendUInt32(struct ArrowBuffer* buffer, + uint32_t value); + +/// \brief Write a 64-bit integer to a buffer +static inline ArrowErrorCode ArrowBufferAppendInt64(struct ArrowBuffer* buffer, + int64_t value); + +/// \brief Write an unsigned 64-bit integer to a buffer +static inline ArrowErrorCode ArrowBufferAppendUInt64(struct ArrowBuffer* buffer, + uint64_t value); + +/// \brief Write a double to a buffer +static inline ArrowErrorCode ArrowBufferAppendDouble(struct ArrowBuffer* buffer, + double value); + +/// \brief Write a float to a buffer +static inline ArrowErrorCode ArrowBufferAppendFloat(struct ArrowBuffer* buffer, + float value); + +/// \brief Write an ArrowStringView to a buffer +static inline ArrowErrorCode ArrowBufferAppendStringView(struct ArrowBuffer* buffer, + struct ArrowStringView value); + +/// \brief Write an ArrowBufferView to a buffer +static inline ArrowErrorCode ArrowBufferAppendBufferView(struct ArrowBuffer* buffer, + struct ArrowBufferView value); + +/// @} + +/// \defgroup nanoarrow-bitmap Bitmap utilities +/// +/// @{ + +/// \brief Extract a boolean value from a bitmap +static inline int8_t ArrowBitGet(const uint8_t* bits, int64_t i); + +/// \brief Set a boolean value to a bitmap to true +static inline void ArrowBitSet(uint8_t* bits, int64_t i); + +/// \brief Set a boolean value to a bitmap to false +static inline void ArrowBitClear(uint8_t* bits, int64_t i); + +/// \brief Set a boolean value to a bitmap +static inline void ArrowBitSetTo(uint8_t* bits, int64_t i, uint8_t value); + +/// \brief Set a boolean value to a range in a bitmap +static inline void ArrowBitsSetTo(uint8_t* bits, int64_t start_offset, int64_t length, + uint8_t bits_are_set); + +/// \brief Count true values in a bitmap +static inline int64_t ArrowBitCountSet(const uint8_t* bits, int64_t i_from, int64_t i_to); + +/// \brief Extract int8 boolean values from a range in a bitmap +static inline void ArrowBitsUnpackInt8(const uint8_t* bits, int64_t start_offset, + int64_t length, int8_t* out); + +/// \brief Extract int32 boolean values from a range in a bitmap +static inline void ArrowBitsUnpackInt32(const uint8_t* bits, int64_t start_offset, + int64_t length, int32_t* out); + +/// \brief Initialize an ArrowBitmap +/// +/// Initialize the builder's buffer, empty its cache, and reset the size to zero +static inline void ArrowBitmapInit(struct ArrowBitmap* bitmap); + +/// \brief Move an ArrowBitmap +/// +/// Transfers the underlying buffer data and lifecycle management to another +/// address and resets the bitmap. +static inline void ArrowBitmapMove(struct ArrowBitmap* src, struct ArrowBitmap* dst); + +/// \brief Ensure a bitmap builder has at least a given additional capacity +/// +/// Ensures that the buffer has space to append at least +/// additional_size_bits, overallocating when required. +static inline ArrowErrorCode ArrowBitmapReserve(struct ArrowBitmap* bitmap, + int64_t additional_size_bits); + +/// \brief Grow or shrink a bitmap to a given size +/// +/// When shrinking the size of the bitmap, the bitmap is only reallocated +/// if shrink_to_fit is non-zero. +static inline ArrowErrorCode ArrowBitmapResize(struct ArrowBitmap* bitmap, + int64_t new_size_bits, char shrink_to_fit); + +/// \brief Reserve space for and append zero or more of the same boolean value to a bitmap +static inline ArrowErrorCode ArrowBitmapAppend(struct ArrowBitmap* bitmap, + uint8_t bits_are_set, int64_t length); + +/// \brief Append zero or more of the same boolean value to a bitmap +static inline void ArrowBitmapAppendUnsafe(struct ArrowBitmap* bitmap, + uint8_t bits_are_set, int64_t length); + +/// \brief Append boolean values encoded as int8_t to a bitmap +/// +/// The values must all be 0 or 1. +static inline void ArrowBitmapAppendInt8Unsafe(struct ArrowBitmap* bitmap, + const int8_t* values, int64_t n_values); + +/// \brief Append boolean values encoded as int32_t to a bitmap +/// +/// The values must all be 0 or 1. +static inline void ArrowBitmapAppendInt32Unsafe(struct ArrowBitmap* bitmap, + const int32_t* values, int64_t n_values); + +/// \brief Reset a bitmap builder +/// +/// Releases any memory held by buffer, empties the cache, and resets the size to zero +static inline void ArrowBitmapReset(struct ArrowBitmap* bitmap); + +/// @} + +/// \defgroup nanoarrow-array Creating arrays +/// +/// These functions allocate, copy, and destroy ArrowArray structures. +/// Once an ArrowArray has been initialized via ArrowArrayInitFromType() +/// or ArrowArrayInitFromSchema(), the caller is responsible for releasing +/// it using the embedded release callback. +/// +/// @{ + +/// \brief Initialize the fields of an array +/// +/// Initializes the fields and release callback of array. Caller +/// is responsible for calling the array->release callback if +/// NANOARROW_OK is returned. +ArrowErrorCode ArrowArrayInitFromType(struct ArrowArray* array, + enum ArrowType storage_type); + +/// \brief Initialize the contents of an ArrowArray from an ArrowSchema +/// +/// Caller is responsible for calling the array->release callback if +/// NANOARROW_OK is returned. +ArrowErrorCode ArrowArrayInitFromSchema(struct ArrowArray* array, + const struct ArrowSchema* schema, + struct ArrowError* error); + +/// \brief Initialize the contents of an ArrowArray from an ArrowArrayView +/// +/// Caller is responsible for calling the array->release callback if +/// NANOARROW_OK is returned. +ArrowErrorCode ArrowArrayInitFromArrayView(struct ArrowArray* array, + const struct ArrowArrayView* array_view, + struct ArrowError* error); + +/// \brief Allocate the array->children array +/// +/// Includes the memory for each child struct ArrowArray, +/// whose members are marked as released and may be subsequently initialized +/// with ArrowArrayInitFromType() or moved from an existing ArrowArray. +/// schema must have been allocated using ArrowArrayInitFromType(). +ArrowErrorCode ArrowArrayAllocateChildren(struct ArrowArray* array, int64_t n_children); + +/// \brief Allocate the array->dictionary member +/// +/// Includes the memory for the struct ArrowArray, whose contents +/// is marked as released and may be subsequently initialized +/// with ArrowArrayInitFromType() or moved from an existing ArrowArray. +/// array must have been allocated using ArrowArrayInitFromType() +ArrowErrorCode ArrowArrayAllocateDictionary(struct ArrowArray* array); + +/// \brief Set the validity bitmap of an ArrowArray +/// +/// array must have been allocated using ArrowArrayInitFromType() +void ArrowArraySetValidityBitmap(struct ArrowArray* array, struct ArrowBitmap* bitmap); + +/// \brief Set a buffer of an ArrowArray +/// +/// array must have been allocated using ArrowArrayInitFromType() +ArrowErrorCode ArrowArraySetBuffer(struct ArrowArray* array, int64_t i, + struct ArrowBuffer* buffer); + +/// \brief Get the validity bitmap of an ArrowArray +/// +/// array must have been allocated using ArrowArrayInitFromType() +static inline struct ArrowBitmap* ArrowArrayValidityBitmap(struct ArrowArray* array); + +/// \brief Get a buffer of an ArrowArray +/// +/// array must have been allocated using ArrowArrayInitFromType() +static inline struct ArrowBuffer* ArrowArrayBuffer(struct ArrowArray* array, int64_t i); + +/// \brief Start element-wise appending to an ArrowArray +/// +/// Initializes any values needed to use ArrowArrayAppend*() functions. +/// All element-wise appenders append by value and return EINVAL if the exact value +/// cannot be represented by the underlying storage type. +/// array must have been allocated using ArrowArrayInitFromType() +static inline ArrowErrorCode ArrowArrayStartAppending(struct ArrowArray* array); + +/// \brief Reserve space for future appends +/// +/// For buffer sizes that can be calculated (i.e., not string data buffers or +/// child array sizes for non-fixed-size arrays), recursively reserve space for +/// additional elements. This is useful for reducing the number of reallocations +/// that occur using the item-wise appenders. +ArrowErrorCode ArrowArrayReserve(struct ArrowArray* array, + int64_t additional_size_elements); + +/// \brief Append a null value to an array +static inline ArrowErrorCode ArrowArrayAppendNull(struct ArrowArray* array, int64_t n); + +/// \brief Append an empty, non-null value to an array +static inline ArrowErrorCode ArrowArrayAppendEmpty(struct ArrowArray* array, int64_t n); + +/// \brief Append a signed integer value to an array +/// +/// Returns NANOARROW_OK if value can be exactly represented by +/// the underlying storage type or EINVAL otherwise (e.g., value +/// is outside the valid array range). +static inline ArrowErrorCode ArrowArrayAppendInt(struct ArrowArray* array, int64_t value); + +/// \brief Append an unsigned integer value to an array +/// +/// Returns NANOARROW_OK if value can be exactly represented by +/// the underlying storage type or EINVAL otherwise (e.g., value +/// is outside the valid array range). +static inline ArrowErrorCode ArrowArrayAppendUInt(struct ArrowArray* array, + uint64_t value); + +/// \brief Append a double value to an array +/// +/// Returns NANOARROW_OK if value can be exactly represented by +/// the underlying storage type or EINVAL otherwise (e.g., value +/// is outside the valid array range or there is an attempt to append +/// a non-integer to an array with an integer storage type). +static inline ArrowErrorCode ArrowArrayAppendDouble(struct ArrowArray* array, + double value); + +/// \brief Append a string of bytes to an array +/// +/// Returns NANOARROW_OK if value can be exactly represented by +/// the underlying storage type, EOVERFLOW if appending value would overflow +/// the offset type (e.g., if the data buffer would be larger than 2 GB for a +/// non-large string type), or EINVAL otherwise (e.g., the underlying array is not a +/// binary, string, large binary, large string, or fixed-size binary array, or value is +/// the wrong size for a fixed-size binary array). +static inline ArrowErrorCode ArrowArrayAppendBytes(struct ArrowArray* array, + struct ArrowBufferView value); + +/// \brief Append a string value to an array +/// +/// Returns NANOARROW_OK if value can be exactly represented by +/// the underlying storage type, EOVERFLOW if appending value would overflow +/// the offset type (e.g., if the data buffer would be larger than 2 GB for a +/// non-large string type), or EINVAL otherwise (e.g., the underlying array is not a +/// string or large string array). +static inline ArrowErrorCode ArrowArrayAppendString(struct ArrowArray* array, + struct ArrowStringView value); + +/// \brief Append a Interval to an array +/// +/// Returns NANOARROW_OK if value can be exactly represented by +/// the underlying storage type or EINVAL otherwise. +static inline ArrowErrorCode ArrowArrayAppendInterval(struct ArrowArray* array, + const struct ArrowInterval* value); + +/// \brief Append a decimal value to an array +/// +/// Returns NANOARROW_OK if array is a decimal array with the appropriate +/// bitwidth or EINVAL otherwise. +static inline ArrowErrorCode ArrowArrayAppendDecimal(struct ArrowArray* array, + const struct ArrowDecimal* value); + +/// \brief Finish a nested array element +/// +/// Appends a non-null element to the array based on the first child's current +/// length. Returns NANOARROW_OK if the item was successfully added, EOVERFLOW +/// if the child of a list or map array would exceed INT_MAX elements, or EINVAL +/// if the underlying storage type is not a struct, list, large list, or fixed-size +/// list, or if there was an attempt to add a struct or fixed-size list element where the +/// length of the child array(s) did not match the expected length. +static inline ArrowErrorCode ArrowArrayFinishElement(struct ArrowArray* array); + +/// \brief Finish a union array element +/// +/// Appends an element to the union type ids buffer and increments array->length. +/// For sparse unions, up to one element is added to non type-id children. Returns +/// EINVAL if the underlying storage type is not a union, if type_id is not valid, +/// or if child sizes after appending are inconsistent. +static inline ArrowErrorCode ArrowArrayFinishUnionElement(struct ArrowArray* array, + int8_t type_id); + +/// \brief Shrink buffer capacity to the size required +/// +/// Also applies shrinking to any child arrays. array must have been allocated using +/// ArrowArrayInitFromType +static inline ArrowErrorCode ArrowArrayShrinkToFit(struct ArrowArray* array); + +/// \brief Finish building an ArrowArray +/// +/// Flushes any pointers from internal buffers that may have been reallocated +/// into array->buffers and checks the actual size of the buffers +/// against the expected size based on the final length. +/// array must have been allocated using ArrowArrayInitFromType() +ArrowErrorCode ArrowArrayFinishBuildingDefault(struct ArrowArray* array, + struct ArrowError* error); + +/// \brief Finish building an ArrowArray with explicit validation +/// +/// Finish building with an explicit validation level. This could perform less validation +/// (i.e. NANOARROW_VALIDATION_LEVEL_NONE or NANOARROW_VALIDATION_LEVEL_MINIMAL) if CPU +/// buffer data access is not possible or more validation (i.e., +/// NANOARROW_VALIDATION_LEVEL_FULL) if buffer content was obtained from an untrusted or +/// corruptible source. +ArrowErrorCode ArrowArrayFinishBuilding(struct ArrowArray* array, + enum ArrowValidationLevel validation_level, + struct ArrowError* error); + +/// @} + +/// \defgroup nanoarrow-array-view Reading arrays +/// +/// These functions read and validate the contents ArrowArray structures. +/// +/// @{ + +/// \brief Initialize the contents of an ArrowArrayView +void ArrowArrayViewInitFromType(struct ArrowArrayView* array_view, + enum ArrowType storage_type); + +/// \brief Move an ArrowArrayView +/// +/// Transfers the ArrowArrayView data and lifecycle management to another +/// address and resets the contents of src. +static inline void ArrowArrayViewMove(struct ArrowArrayView* src, + struct ArrowArrayView* dst); + +/// \brief Initialize the contents of an ArrowArrayView from an ArrowSchema +ArrowErrorCode ArrowArrayViewInitFromSchema(struct ArrowArrayView* array_view, + const struct ArrowSchema* schema, + struct ArrowError* error); + +/// \brief Allocate the array_view->children array +/// +/// Includes the memory for each child struct ArrowArrayView +ArrowErrorCode ArrowArrayViewAllocateChildren(struct ArrowArrayView* array_view, + int64_t n_children); + +/// \brief Allocate array_view->dictionary +ArrowErrorCode ArrowArrayViewAllocateDictionary(struct ArrowArrayView* array_view); + +/// \brief Set data-independent buffer sizes from length +void ArrowArrayViewSetLength(struct ArrowArrayView* array_view, int64_t length); + +/// \brief Set buffer sizes and data pointers from an ArrowArray +ArrowErrorCode ArrowArrayViewSetArray(struct ArrowArrayView* array_view, + const struct ArrowArray* array, + struct ArrowError* error); + +/// \brief Set buffer sizes and data pointers from an ArrowArray except for those +/// that require dereferencing buffer content. +ArrowErrorCode ArrowArrayViewSetArrayMinimal(struct ArrowArrayView* array_view, + const struct ArrowArray* array, + struct ArrowError* error); + +/// \brief Get the number of buffers +/// +/// The number of buffers referred to by this ArrowArrayView. In may cases this can also +/// be calculated from the ArrowLayout member of the ArrowArrayView or ArrowSchemaView; +/// however, for binary view and string view types, the number of total buffers depends on +/// the number of variadic buffers. +static inline int64_t ArrowArrayViewGetNumBuffers(struct ArrowArrayView* array_view); + +/// \brief Get a view of a specific buffer from an ArrowArrayView +/// +/// This is the ArrowArrayView equivalent of ArrowArray::buffers[i] that includes +/// size information (if known). +static inline struct ArrowBufferView ArrowArrayViewGetBufferView( + struct ArrowArrayView* array_view, int64_t i); + +/// \brief Get the function of a specific buffer in an ArrowArrayView +/// +/// In may cases this can also be obtained from the ArrowLayout member of the +/// ArrowArrayView or ArrowSchemaView; however, for binary view and string view types, +/// the function of each buffer may be different between two arrays of the same type +/// depending on the number of variadic buffers. +static inline enum ArrowBufferType ArrowArrayViewGetBufferType( + struct ArrowArrayView* array_view, int64_t i); + +/// \brief Get the data type of a specific buffer in an ArrowArrayView +/// +/// In may cases this can also be obtained from the ArrowLayout member of the +/// ArrowArrayView or ArrowSchemaView; however, for binary view and string view types, +/// the data type of each buffer may be different between two arrays of the same type +/// depending on the number of variadic buffers. +static inline enum ArrowType ArrowArrayViewGetBufferDataType( + struct ArrowArrayView* array_view, int64_t i); + +/// \brief Get the element size (in bits) of a specific buffer in an ArrowArrayView +/// +/// In may cases this can also be obtained from the ArrowLayout member of the +/// ArrowArrayView or ArrowSchemaView; however, for binary view and string view types, +/// the element width of each buffer may be different between two arrays of the same type +/// depending on the number of variadic buffers. +static inline int64_t ArrowArrayViewGetBufferElementSizeBits( + struct ArrowArrayView* array_view, int64_t i); + +/// \brief Performs checks on the content of an ArrowArrayView +/// +/// If using ArrowArrayViewSetArray() to back array_view with an ArrowArray, +/// the buffer sizes and some content (fist and last offset) have already +/// been validated at the "default" level. If setting the buffer pointers +/// and sizes otherwise, you may wish to perform checks at a different level. See +/// documentation for ArrowValidationLevel for the details of checks performed +/// at each level. +ArrowErrorCode ArrowArrayViewValidate(struct ArrowArrayView* array_view, + enum ArrowValidationLevel validation_level, + struct ArrowError* error); + +/// \brief Compare two ArrowArrayView objects for equality +/// +/// Given two ArrowArrayView instances, place either 0 (not equal) and +/// 1 (equal) at the address pointed to by out. If the comparison determines +/// that actual and expected are not equal, a reason will be communicated via +/// error if error is non-NULL. +/// +/// Returns NANOARROW_OK if the comparison completed successfully. +ArrowErrorCode ArrowArrayViewCompare(const struct ArrowArrayView* actual, + const struct ArrowArrayView* expected, + enum ArrowCompareLevel level, int* out, + struct ArrowError* reason); + +/// \brief Reset the contents of an ArrowArrayView and frees resources +void ArrowArrayViewReset(struct ArrowArrayView* array_view); + +/// \brief Check for a null element in an ArrowArrayView +static inline int8_t ArrowArrayViewIsNull(const struct ArrowArrayView* array_view, + int64_t i); + +/// \brief Compute null count for an ArrowArrayView +static inline int64_t ArrowArrayViewComputeNullCount( + const struct ArrowArrayView* array_view); + +/// \brief Get the type id of a union array element +static inline int8_t ArrowArrayViewUnionTypeId(const struct ArrowArrayView* array_view, + int64_t i); + +/// \brief Get the child index of a union array element +static inline int8_t ArrowArrayViewUnionChildIndex( + const struct ArrowArrayView* array_view, int64_t i); + +/// \brief Get the index to use into the relevant union child array +static inline int64_t ArrowArrayViewUnionChildOffset( + const struct ArrowArrayView* array_view, int64_t i); + +/// \brief Get an element in an ArrowArrayView as an integer +/// +/// This function does not check for null values, that values are actually integers, or +/// that values are within a valid range for an int64. +static inline int64_t ArrowArrayViewGetIntUnsafe(const struct ArrowArrayView* array_view, + int64_t i); + +/// \brief Get an element in an ArrowArrayView as an unsigned integer +/// +/// This function does not check for null values, that values are actually integers, or +/// that values are within a valid range for a uint64. +static inline uint64_t ArrowArrayViewGetUIntUnsafe( + const struct ArrowArrayView* array_view, int64_t i); + +/// \brief Get an element in an ArrowArrayView as a double +/// +/// This function does not check for null values, or +/// that values are within a valid range for a double. +static inline double ArrowArrayViewGetDoubleUnsafe( + const struct ArrowArrayView* array_view, int64_t i); + +/// \brief Get an element in an ArrowArrayView as an ArrowStringView +/// +/// This function does not check for null values. +static inline struct ArrowStringView ArrowArrayViewGetStringUnsafe( + const struct ArrowArrayView* array_view, int64_t i); + +/// \brief Get an element in an ArrowArrayView as an ArrowBufferView +/// +/// This function does not check for null values. +static inline struct ArrowBufferView ArrowArrayViewGetBytesUnsafe( + const struct ArrowArrayView* array_view, int64_t i); + +/// \brief Get an element in an ArrowArrayView as an ArrowDecimal +/// +/// This function does not check for null values. The out parameter must +/// be initialized with ArrowDecimalInit() with the proper parameters for this +/// type before calling this for the first time. +static inline void ArrowArrayViewGetDecimalUnsafe(const struct ArrowArrayView* array_view, + int64_t i, struct ArrowDecimal* out); + +/// @} + +/// \defgroup nanoarrow-basic-array-stream Basic ArrowArrayStream implementation +/// +/// An implementation of an ArrowArrayStream based on a collection of +/// zero or more previously-existing ArrowArray objects. Users should +/// initialize and/or validate the contents before transferring the +/// responsibility of the ArrowArrayStream elsewhere. +/// +/// @{ + +/// \brief Initialize an ArrowArrayStream backed by this implementation +/// +/// This function moves the ownership of schema to the array_stream. If +/// this function returns NANOARROW_OK, the caller is responsible for +/// releasing the ArrowArrayStream. +ArrowErrorCode ArrowBasicArrayStreamInit(struct ArrowArrayStream* array_stream, + struct ArrowSchema* schema, int64_t n_arrays); + +/// \brief Set the ith ArrowArray in this ArrowArrayStream. +/// +/// array_stream must have been initialized with ArrowBasicArrayStreamInit(). +/// This function move the ownership of array to the array_stream. i must +/// be greater than zero and less than the value of n_arrays passed in +/// ArrowBasicArrayStreamInit(). Callers are not required to fill all +/// n_arrays members (i.e., n_arrays is a maximum bound). +void ArrowBasicArrayStreamSetArray(struct ArrowArrayStream* array_stream, int64_t i, + struct ArrowArray* array); + +/// \brief Validate the contents of this ArrowArrayStream +/// +/// array_stream must have been initialized with ArrowBasicArrayStreamInit(). +/// This function uses ArrowArrayStreamInitFromSchema() and ArrowArrayStreamSetArray() +/// to validate the contents of the arrays. +ArrowErrorCode ArrowBasicArrayStreamValidate(const struct ArrowArrayStream* array_stream, + struct ArrowError* error); + +/// @} + +// Undefine ArrowErrorCode, which may have been defined to annotate functions that return +// it to warn for an unused result. +#if defined(ArrowErrorCode) +#undef ArrowErrorCode +#endif + +// Inline function definitions + + + +#ifdef __cplusplus +} +#endif + +#endif +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#ifndef NANOARROW_BUFFER_INLINE_H_INCLUDED +#define NANOARROW_BUFFER_INLINE_H_INCLUDED + +#include +#include +#include + + + +#ifdef __cplusplus +extern "C" { +#endif + +// Modified from Arrow C++ (1eb46f76) cpp/src/arrow/chunk_resolver.h#L133-L162 +static inline int64_t ArrowResolveChunk64(int64_t index, const int64_t* offsets, + int64_t lo, int64_t hi) { + // Similar to std::upper_bound(), but slightly different as our offsets + // array always starts with 0. + int64_t n = hi - lo; + // First iteration does not need to check for n > 1 + // (lo < hi is guaranteed by the precondition). + NANOARROW_DCHECK(n > 1); + do { + const int64_t m = n >> 1; + const int64_t mid = lo + m; + if (index >= offsets[mid]) { + lo = mid; + n -= m; + } else { + n = m; + } + } while (n > 1); + return lo; +} + +static inline int64_t ArrowResolveChunk32(int32_t index, const int32_t* offsets, + int32_t lo, int32_t hi) { + // Similar to std::upper_bound(), but slightly different as our offsets + // array always starts with 0. + int32_t n = hi - lo; + // First iteration does not need to check for n > 1 + // (lo < hi is guaranteed by the precondition). + NANOARROW_DCHECK(n > 1); + do { + const int32_t m = n >> 1; + const int32_t mid = lo + m; + if (index >= offsets[mid]) { + lo = mid; + n -= m; + } else { + n = m; + } + } while (n > 1); + return lo; +} + +static inline int64_t _ArrowGrowByFactor(int64_t current_capacity, int64_t new_capacity) { + int64_t doubled_capacity = current_capacity * 2; + if (doubled_capacity > new_capacity) { + return doubled_capacity; + } else { + return new_capacity; + } +} + +// float to half float conversion, adapted from Arrow Go +// https://github.com/apache/arrow/blob/main/go/arrow/float16/float16.go +static inline uint16_t ArrowFloatToHalfFloat(float value) { + union { + float f; + uint32_t b; + } u; + u.f = value; + + uint16_t sn = (uint16_t)((u.b >> 31) & 0x1); + uint16_t exp = (u.b >> 23) & 0xff; + int16_t res = (int16_t)(exp - 127 + 15); + uint16_t fc = (uint16_t)(u.b >> 13) & 0x3ff; + + if (exp == 0) { + res = 0; + } else if (exp == 0xff) { + res = 0x1f; + } else if (res > 0x1e) { + res = 0x1f; + fc = 0; + } else if (res < 0x01) { + res = 0; + fc = 0; + } + + return (uint16_t)((sn << 15) | (uint16_t)(res << 10) | fc); +} + +// half float to float conversion, adapted from Arrow Go +// https://github.com/apache/arrow/blob/main/go/arrow/float16/float16.go +static inline float ArrowHalfFloatToFloat(uint16_t value) { + uint32_t sn = (uint32_t)((value >> 15) & 0x1); + uint32_t exp = (value >> 10) & 0x1f; + uint32_t res = exp + 127 - 15; + uint32_t fc = value & 0x3ff; + + if (exp == 0) { + res = 0; + } else if (exp == 0x1f) { + res = 0xff; + } + + union { + float f; + uint32_t b; + } u; + u.b = (uint32_t)(sn << 31) | (uint32_t)(res << 23) | (uint32_t)(fc << 13); + return u.f; +} + +static inline void ArrowBufferInit(struct ArrowBuffer* buffer) { + buffer->data = NULL; + buffer->size_bytes = 0; + buffer->capacity_bytes = 0; + buffer->allocator = ArrowBufferAllocatorDefault(); +} + +static inline ArrowErrorCode ArrowBufferSetAllocator( + struct ArrowBuffer* buffer, struct ArrowBufferAllocator allocator) { + // This is not a perfect test for "has a buffer already been allocated" + // but is likely to catch most cases. + if (buffer->data == NULL) { + buffer->allocator = allocator; + return NANOARROW_OK; + } else { + return EINVAL; + } +} + +static inline void ArrowBufferReset(struct ArrowBuffer* buffer) { + buffer->allocator.free(&buffer->allocator, (uint8_t*)buffer->data, + buffer->capacity_bytes); + ArrowBufferInit(buffer); +} + +static inline void ArrowBufferMove(struct ArrowBuffer* src, struct ArrowBuffer* dst) { + memcpy(dst, src, sizeof(struct ArrowBuffer)); + src->data = NULL; + ArrowBufferInit(src); +} + +static inline ArrowErrorCode ArrowBufferResize(struct ArrowBuffer* buffer, + int64_t new_size_bytes, + char shrink_to_fit) { + if (new_size_bytes < 0) { + return EINVAL; + } + + int needs_reallocation = new_size_bytes > buffer->capacity_bytes || + (shrink_to_fit && new_size_bytes < buffer->capacity_bytes); + + if (needs_reallocation) { + buffer->data = buffer->allocator.reallocate(&buffer->allocator, buffer->data, + buffer->capacity_bytes, new_size_bytes); + + if (buffer->data == NULL && new_size_bytes > 0) { + buffer->capacity_bytes = 0; + buffer->size_bytes = 0; + return ENOMEM; + } + + buffer->capacity_bytes = new_size_bytes; + } + + buffer->size_bytes = new_size_bytes; + return NANOARROW_OK; +} + +static inline ArrowErrorCode ArrowBufferReserve(struct ArrowBuffer* buffer, + int64_t additional_size_bytes) { + int64_t min_capacity_bytes = buffer->size_bytes + additional_size_bytes; + if (min_capacity_bytes <= buffer->capacity_bytes) { + return NANOARROW_OK; + } + + int64_t new_capacity_bytes = + _ArrowGrowByFactor(buffer->capacity_bytes, min_capacity_bytes); + buffer->data = buffer->allocator.reallocate(&buffer->allocator, buffer->data, + buffer->capacity_bytes, new_capacity_bytes); + + if (buffer->data == NULL && new_capacity_bytes > 0) { + buffer->capacity_bytes = 0; + buffer->size_bytes = 0; + return ENOMEM; + } + + buffer->capacity_bytes = new_capacity_bytes; + return NANOARROW_OK; +} + +static inline void ArrowBufferAppendUnsafe(struct ArrowBuffer* buffer, const void* data, + int64_t size_bytes) { + if (size_bytes > 0) { + NANOARROW_DCHECK(buffer->data != NULL); + memcpy(buffer->data + buffer->size_bytes, data, size_bytes); + buffer->size_bytes += size_bytes; + } +} + +static inline ArrowErrorCode ArrowBufferAppend(struct ArrowBuffer* buffer, + const void* data, int64_t size_bytes) { + NANOARROW_RETURN_NOT_OK(ArrowBufferReserve(buffer, size_bytes)); + + ArrowBufferAppendUnsafe(buffer, data, size_bytes); + return NANOARROW_OK; +} + +static inline ArrowErrorCode ArrowBufferAppendInt8(struct ArrowBuffer* buffer, + int8_t value) { + return ArrowBufferAppend(buffer, &value, sizeof(int8_t)); +} + +static inline ArrowErrorCode ArrowBufferAppendUInt8(struct ArrowBuffer* buffer, + uint8_t value) { + return ArrowBufferAppend(buffer, &value, sizeof(uint8_t)); +} + +static inline ArrowErrorCode ArrowBufferAppendInt16(struct ArrowBuffer* buffer, + int16_t value) { + return ArrowBufferAppend(buffer, &value, sizeof(int16_t)); +} + +static inline ArrowErrorCode ArrowBufferAppendUInt16(struct ArrowBuffer* buffer, + uint16_t value) { + return ArrowBufferAppend(buffer, &value, sizeof(uint16_t)); +} + +static inline ArrowErrorCode ArrowBufferAppendInt32(struct ArrowBuffer* buffer, + int32_t value) { + return ArrowBufferAppend(buffer, &value, sizeof(int32_t)); +} + +static inline ArrowErrorCode ArrowBufferAppendUInt32(struct ArrowBuffer* buffer, + uint32_t value) { + return ArrowBufferAppend(buffer, &value, sizeof(uint32_t)); +} + +static inline ArrowErrorCode ArrowBufferAppendInt64(struct ArrowBuffer* buffer, + int64_t value) { + return ArrowBufferAppend(buffer, &value, sizeof(int64_t)); +} + +static inline ArrowErrorCode ArrowBufferAppendUInt64(struct ArrowBuffer* buffer, + uint64_t value) { + return ArrowBufferAppend(buffer, &value, sizeof(uint64_t)); +} + +static inline ArrowErrorCode ArrowBufferAppendDouble(struct ArrowBuffer* buffer, + double value) { + return ArrowBufferAppend(buffer, &value, sizeof(double)); +} + +static inline ArrowErrorCode ArrowBufferAppendFloat(struct ArrowBuffer* buffer, + float value) { + return ArrowBufferAppend(buffer, &value, sizeof(float)); +} + +static inline ArrowErrorCode ArrowBufferAppendStringView(struct ArrowBuffer* buffer, + struct ArrowStringView value) { + return ArrowBufferAppend(buffer, value.data, value.size_bytes); +} + +static inline ArrowErrorCode ArrowBufferAppendBufferView(struct ArrowBuffer* buffer, + struct ArrowBufferView value) { + return ArrowBufferAppend(buffer, value.data.data, value.size_bytes); +} + +static inline ArrowErrorCode ArrowBufferAppendFill(struct ArrowBuffer* buffer, + uint8_t value, int64_t size_bytes) { + if (size_bytes == 0) { + return NANOARROW_OK; + } + + NANOARROW_RETURN_NOT_OK(ArrowBufferReserve(buffer, size_bytes)); + + NANOARROW_DCHECK(buffer->data != NULL); // To help clang-tidy + memset(buffer->data + buffer->size_bytes, value, size_bytes); + buffer->size_bytes += size_bytes; + + return NANOARROW_OK; +} + +static const uint8_t _ArrowkBitmask[] = {1, 2, 4, 8, 16, 32, 64, 128}; +static const uint8_t _ArrowkFlippedBitmask[] = {254, 253, 251, 247, 239, 223, 191, 127}; +static const uint8_t _ArrowkPrecedingBitmask[] = {0, 1, 3, 7, 15, 31, 63, 127}; +static const uint8_t _ArrowkTrailingBitmask[] = {255, 254, 252, 248, 240, 224, 192, 128}; + +static const uint8_t _ArrowkBytePopcount[] = { + 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, + 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, + 4, 5, 4, 5, 5, 6, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, + 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, + 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, + 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, + 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, + 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, + 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8}; + +static inline int64_t _ArrowRoundUpToMultipleOf8(int64_t value) { + return (value + 7) & ~((int64_t)7); +} + +static inline int64_t _ArrowRoundDownToMultipleOf8(int64_t value) { + return (value / 8) * 8; +} + +static inline int64_t _ArrowBytesForBits(int64_t bits) { + return (bits >> 3) + ((bits & 7) != 0); +} + +static inline void _ArrowBitsUnpackInt8(const uint8_t word, int8_t* out) { + out[0] = (word & 0x1) != 0; + out[1] = (word & 0x2) != 0; + out[2] = (word & 0x4) != 0; + out[3] = (word & 0x8) != 0; + out[4] = (word & 0x10) != 0; + out[5] = (word & 0x20) != 0; + out[6] = (word & 0x40) != 0; + out[7] = (word & 0x80) != 0; +} + +static inline void _ArrowBitsUnpackInt32(const uint8_t word, int32_t* out) { + out[0] = (word & 0x1) != 0; + out[1] = (word & 0x2) != 0; + out[2] = (word & 0x4) != 0; + out[3] = (word & 0x8) != 0; + out[4] = (word & 0x10) != 0; + out[5] = (word & 0x20) != 0; + out[6] = (word & 0x40) != 0; + out[7] = (word & 0x80) != 0; +} + +static inline void _ArrowBitmapPackInt8(const int8_t* values, uint8_t* out) { + *out = (uint8_t)(values[0] | ((values[1] + 0x1) & 0x2) | ((values[2] + 0x3) & 0x4) | + ((values[3] + 0x7) & 0x8) | ((values[4] + 0xf) & 0x10) | + ((values[5] + 0x1f) & 0x20) | ((values[6] + 0x3f) & 0x40) | + ((values[7] + 0x7f) & 0x80)); +} + +static inline void _ArrowBitmapPackInt32(const int32_t* values, uint8_t* out) { + *out = (uint8_t)(values[0] | ((values[1] + 0x1) & 0x2) | ((values[2] + 0x3) & 0x4) | + ((values[3] + 0x7) & 0x8) | ((values[4] + 0xf) & 0x10) | + ((values[5] + 0x1f) & 0x20) | ((values[6] + 0x3f) & 0x40) | + ((values[7] + 0x7f) & 0x80)); +} + +static inline int8_t ArrowBitGet(const uint8_t* bits, int64_t i) { + return (bits[i >> 3] >> (i & 0x07)) & 1; +} + +static inline void ArrowBitsUnpackInt8(const uint8_t* bits, int64_t start_offset, + int64_t length, int8_t* out) { + if (length == 0) { + return; + } + + const int64_t i_begin = start_offset; + const int64_t i_end = start_offset + length; + const int64_t i_last_valid = i_end - 1; + + const int64_t bytes_begin = i_begin / 8; + const int64_t bytes_last_valid = i_last_valid / 8; + + if (bytes_begin == bytes_last_valid) { + for (int i = 0; i < length; i++) { + out[i] = ArrowBitGet(&bits[bytes_begin], i + i_begin % 8); + } + + return; + } + + // first byte + for (int i = 0; i < 8 - (i_begin % 8); i++) { + *out++ = ArrowBitGet(&bits[bytes_begin], i + i_begin % 8); + } + + // middle bytes + for (int64_t i = bytes_begin + 1; i < bytes_last_valid; i++) { + _ArrowBitsUnpackInt8(bits[i], out); + out += 8; + } + + // last byte + const int bits_remaining = (int)(i_end % 8 == 0 ? 8 : i_end % 8); + for (int i = 0; i < bits_remaining; i++) { + *out++ = ArrowBitGet(&bits[bytes_last_valid], i); + } +} + +static inline void ArrowBitsUnpackInt32(const uint8_t* bits, int64_t start_offset, + int64_t length, int32_t* out) { + if (length == 0) { + return; + } + + NANOARROW_DCHECK(bits != NULL && out != NULL); + + const int64_t i_begin = start_offset; + const int64_t i_end = start_offset + length; + const int64_t i_last_valid = i_end - 1; + + const int64_t bytes_begin = i_begin / 8; + const int64_t bytes_last_valid = i_last_valid / 8; + + if (bytes_begin == bytes_last_valid) { + for (int i = 0; i < length; i++) { + out[i] = ArrowBitGet(&bits[bytes_begin], i + i_begin % 8); + } + + return; + } + + // first byte + for (int i = 0; i < 8 - (i_begin % 8); i++) { + *out++ = ArrowBitGet(&bits[bytes_begin], i + i_begin % 8); + } + + // middle bytes + for (int64_t i = bytes_begin + 1; i < bytes_last_valid; i++) { + _ArrowBitsUnpackInt32(bits[i], out); + out += 8; + } + + // last byte + const int bits_remaining = (int)(i_end % 8 == 0 ? 8 : i_end % 8); + for (int i = 0; i < bits_remaining; i++) { + *out++ = ArrowBitGet(&bits[bytes_last_valid], i); + } +} + +static inline void ArrowBitSet(uint8_t* bits, int64_t i) { + bits[i / 8] |= _ArrowkBitmask[i % 8]; +} + +static inline void ArrowBitClear(uint8_t* bits, int64_t i) { + bits[i / 8] &= _ArrowkFlippedBitmask[i % 8]; +} + +static inline void ArrowBitSetTo(uint8_t* bits, int64_t i, uint8_t bit_is_set) { + bits[i / 8] ^= (uint8_t)(((uint8_t)(-((uint8_t)(bit_is_set != 0)) ^ bits[i / 8])) & + _ArrowkBitmask[i % 8]); +} + +static inline void ArrowBitsSetTo(uint8_t* bits, int64_t start_offset, int64_t length, + uint8_t bits_are_set) { + if (length == 0) { + return; + } + + NANOARROW_DCHECK(bits != NULL); + + const int64_t i_begin = start_offset; + const int64_t i_end = start_offset + length; + const uint8_t fill_byte = (uint8_t)(-bits_are_set); + + const int64_t bytes_begin = i_begin / 8; + const int64_t bytes_end = i_end / 8 + 1; + + const uint8_t first_byte_mask = _ArrowkPrecedingBitmask[i_begin % 8]; + const uint8_t last_byte_mask = _ArrowkTrailingBitmask[i_end % 8]; + + if (bytes_end == bytes_begin + 1) { + // set bits within a single byte + const uint8_t only_byte_mask = + i_end % 8 == 0 ? first_byte_mask : (uint8_t)(first_byte_mask | last_byte_mask); + bits[bytes_begin] &= only_byte_mask; + bits[bytes_begin] |= (uint8_t)(fill_byte & ~only_byte_mask); + return; + } + + // set/clear trailing bits of first byte + bits[bytes_begin] &= first_byte_mask; + bits[bytes_begin] |= (uint8_t)(fill_byte & ~first_byte_mask); + + if (bytes_end - bytes_begin > 2) { + // set/clear whole bytes + memset(bits + bytes_begin + 1, fill_byte, (size_t)(bytes_end - bytes_begin - 2)); + } + + if (i_end % 8 == 0) { + return; + } + + // set/clear leading bits of last byte + bits[bytes_end - 1] &= last_byte_mask; + bits[bytes_end - 1] |= (uint8_t)(fill_byte & ~last_byte_mask); +} + +static inline int64_t ArrowBitCountSet(const uint8_t* bits, int64_t start_offset, + int64_t length) { + if (length == 0) { + return 0; + } + + NANOARROW_DCHECK(bits != NULL); + + const int64_t i_begin = start_offset; + const int64_t i_end = start_offset + length; + const int64_t i_last_valid = i_end - 1; + + const int64_t bytes_begin = i_begin / 8; + const int64_t bytes_last_valid = i_last_valid / 8; + + if (bytes_begin == bytes_last_valid) { + // count bits within a single byte + const uint8_t first_byte_mask = _ArrowkPrecedingBitmask[i_end % 8]; + const uint8_t last_byte_mask = _ArrowkTrailingBitmask[i_begin % 8]; + + const uint8_t only_byte_mask = + i_end % 8 == 0 ? last_byte_mask : (uint8_t)(first_byte_mask & last_byte_mask); + + const uint8_t byte_masked = bits[bytes_begin] & only_byte_mask; + return _ArrowkBytePopcount[byte_masked]; + } + + const uint8_t first_byte_mask = _ArrowkPrecedingBitmask[i_begin % 8]; + const uint8_t last_byte_mask = i_end % 8 == 0 ? 0 : _ArrowkTrailingBitmask[i_end % 8]; + int64_t count = 0; + + // first byte + count += _ArrowkBytePopcount[bits[bytes_begin] & ~first_byte_mask]; + + // middle bytes + for (int64_t i = bytes_begin + 1; i < bytes_last_valid; i++) { + count += _ArrowkBytePopcount[bits[i]]; + } + + // last byte + count += _ArrowkBytePopcount[bits[bytes_last_valid] & ~last_byte_mask]; + + return count; +} + +static inline void ArrowBitmapInit(struct ArrowBitmap* bitmap) { + ArrowBufferInit(&bitmap->buffer); + bitmap->size_bits = 0; +} + +static inline void ArrowBitmapMove(struct ArrowBitmap* src, struct ArrowBitmap* dst) { + ArrowBufferMove(&src->buffer, &dst->buffer); + dst->size_bits = src->size_bits; + src->size_bits = 0; +} + +static inline ArrowErrorCode ArrowBitmapReserve(struct ArrowBitmap* bitmap, + int64_t additional_size_bits) { + int64_t min_capacity_bits = bitmap->size_bits + additional_size_bits; + int64_t min_capacity_bytes = _ArrowBytesForBits(min_capacity_bits); + int64_t current_size_bytes = bitmap->buffer.size_bytes; + int64_t current_capacity_bytes = bitmap->buffer.capacity_bytes; + + if (min_capacity_bytes <= current_capacity_bytes) { + return NANOARROW_OK; + } + + int64_t additional_capacity_bytes = min_capacity_bytes - current_size_bytes; + NANOARROW_RETURN_NOT_OK(ArrowBufferReserve(&bitmap->buffer, additional_capacity_bytes)); + + // Zero out the last byte for deterministic output in the common case + // of reserving a known remaining size. We should have returned above + // if there was not at least one additional byte to allocate; however, + // DCHECK() just to be sure. + NANOARROW_DCHECK(bitmap->buffer.capacity_bytes > current_capacity_bytes); + bitmap->buffer.data[bitmap->buffer.capacity_bytes - 1] = 0; + return NANOARROW_OK; +} + +static inline ArrowErrorCode ArrowBitmapResize(struct ArrowBitmap* bitmap, + int64_t new_size_bits, + char shrink_to_fit) { + if (new_size_bits < 0) { + return EINVAL; + } + + int64_t new_size_bytes = _ArrowBytesForBits(new_size_bits); + NANOARROW_RETURN_NOT_OK( + ArrowBufferResize(&bitmap->buffer, new_size_bytes, shrink_to_fit)); + + bitmap->size_bits = new_size_bits; + return NANOARROW_OK; +} + +static inline ArrowErrorCode ArrowBitmapAppend(struct ArrowBitmap* bitmap, + uint8_t bits_are_set, int64_t length) { + NANOARROW_RETURN_NOT_OK(ArrowBitmapReserve(bitmap, length)); + + ArrowBitmapAppendUnsafe(bitmap, bits_are_set, length); + return NANOARROW_OK; +} + +static inline void ArrowBitmapAppendUnsafe(struct ArrowBitmap* bitmap, + uint8_t bits_are_set, int64_t length) { + ArrowBitsSetTo(bitmap->buffer.data, bitmap->size_bits, length, bits_are_set); + bitmap->size_bits += length; + bitmap->buffer.size_bytes = _ArrowBytesForBits(bitmap->size_bits); +} + +static inline void ArrowBitmapAppendInt8Unsafe(struct ArrowBitmap* bitmap, + const int8_t* values, int64_t n_values) { + if (n_values == 0) { + return; + } + + const int8_t* values_cursor = values; + int64_t n_remaining = n_values; + int64_t out_i_cursor = bitmap->size_bits; + uint8_t* out_cursor = bitmap->buffer.data + bitmap->size_bits / 8; + + // First byte + if ((out_i_cursor % 8) != 0) { + int64_t n_partial_bits = _ArrowRoundUpToMultipleOf8(out_i_cursor) - out_i_cursor; + for (int i = 0; i < n_partial_bits; i++) { + ArrowBitSetTo(bitmap->buffer.data, out_i_cursor++, values[i]); + } + + out_cursor++; + values_cursor += n_partial_bits; + n_remaining -= n_partial_bits; + } + + // Middle bytes + int64_t n_full_bytes = n_remaining / 8; + for (int64_t i = 0; i < n_full_bytes; i++) { + _ArrowBitmapPackInt8(values_cursor, out_cursor); + values_cursor += 8; + out_cursor++; + } + + // Last byte + out_i_cursor += n_full_bytes * 8; + n_remaining -= n_full_bytes * 8; + if (n_remaining > 0) { + // Zero out the last byte + *out_cursor = 0x00; + for (int i = 0; i < n_remaining; i++) { + ArrowBitSetTo(bitmap->buffer.data, out_i_cursor++, values_cursor[i]); + } + out_cursor++; + } + + bitmap->size_bits += n_values; + bitmap->buffer.size_bytes = out_cursor - bitmap->buffer.data; +} + +static inline void ArrowBitmapAppendInt32Unsafe(struct ArrowBitmap* bitmap, + const int32_t* values, int64_t n_values) { + if (n_values == 0) { + return; + } + + const int32_t* values_cursor = values; + int64_t n_remaining = n_values; + int64_t out_i_cursor = bitmap->size_bits; + uint8_t* out_cursor = bitmap->buffer.data + bitmap->size_bits / 8; + + // First byte + if ((out_i_cursor % 8) != 0) { + int64_t n_partial_bits = _ArrowRoundUpToMultipleOf8(out_i_cursor) - out_i_cursor; + for (int i = 0; i < n_partial_bits; i++) { + ArrowBitSetTo(bitmap->buffer.data, out_i_cursor++, (uint8_t)values[i]); + } + + out_cursor++; + values_cursor += n_partial_bits; + n_remaining -= n_partial_bits; + } + + // Middle bytes + int64_t n_full_bytes = n_remaining / 8; + for (int64_t i = 0; i < n_full_bytes; i++) { + _ArrowBitmapPackInt32(values_cursor, out_cursor); + values_cursor += 8; + out_cursor++; + } + + // Last byte + out_i_cursor += n_full_bytes * 8; + n_remaining -= n_full_bytes * 8; + if (n_remaining > 0) { + // Zero out the last byte + *out_cursor = 0x00; + for (int i = 0; i < n_remaining; i++) { + ArrowBitSetTo(bitmap->buffer.data, out_i_cursor++, (uint8_t)values_cursor[i]); + } + out_cursor++; + } + + bitmap->size_bits += n_values; + bitmap->buffer.size_bytes = out_cursor - bitmap->buffer.data; +} + +static inline void ArrowBitmapReset(struct ArrowBitmap* bitmap) { + ArrowBufferReset(&bitmap->buffer); + bitmap->size_bits = 0; +} + +#ifdef __cplusplus +} +#endif + +#endif +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#ifndef NANOARROW_ARRAY_INLINE_H_INCLUDED +#define NANOARROW_ARRAY_INLINE_H_INCLUDED + +#include +#include +#include +#include +#include + + + + +#ifdef __cplusplus +extern "C" { +#endif + +static inline struct ArrowBitmap* ArrowArrayValidityBitmap(struct ArrowArray* array) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + return &private_data->bitmap; +} + +static inline struct ArrowBuffer* ArrowArrayBuffer(struct ArrowArray* array, int64_t i) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + switch (i) { + case 0: + return &private_data->bitmap.buffer; + default: + return private_data->buffers + i - 1; + } +} + +// We don't currently support the case of unions where type_id != child_index; +// however, these functions are used to keep track of where that assumption +// is made. +static inline int8_t _ArrowArrayUnionChildIndex(struct ArrowArray* array, + int8_t type_id) { + NANOARROW_UNUSED(array); + return type_id; +} + +static inline int8_t _ArrowArrayUnionTypeId(struct ArrowArray* array, + int8_t child_index) { + NANOARROW_UNUSED(array); + return child_index; +} + +static inline int32_t _ArrowParseUnionTypeIds(const char* type_ids, int8_t* out) { + if (*type_ids == '\0') { + return 0; + } + + int32_t i = 0; + long type_id; + char* end_ptr; + do { + type_id = strtol(type_ids, &end_ptr, 10); + if (end_ptr == type_ids || type_id < 0 || type_id > 127) { + return -1; + } + + if (out != NULL) { + out[i] = (int8_t)type_id; + } + + i++; + + type_ids = end_ptr; + if (*type_ids == '\0') { + return i; + } else if (*type_ids != ',') { + return -1; + } else { + type_ids++; + } + } while (1); + + return -1; +} + +static inline int8_t _ArrowParsedUnionTypeIdsWillEqualChildIndices(const int8_t* type_ids, + int64_t n_type_ids, + int64_t n_children) { + if (n_type_ids != n_children) { + return 0; + } + + for (int8_t i = 0; i < n_type_ids; i++) { + if (type_ids[i] != i) { + return 0; + } + } + + return 1; +} + +static inline int8_t _ArrowUnionTypeIdsWillEqualChildIndices(const char* type_id_str, + int64_t n_children) { + int8_t type_ids[128]; + int32_t n_type_ids = _ArrowParseUnionTypeIds(type_id_str, type_ids); + return _ArrowParsedUnionTypeIdsWillEqualChildIndices(type_ids, n_type_ids, n_children); +} + +static inline ArrowErrorCode ArrowArrayStartAppending(struct ArrowArray* array) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + + switch (private_data->storage_type) { + case NANOARROW_TYPE_UNINITIALIZED: + return EINVAL; + case NANOARROW_TYPE_SPARSE_UNION: + case NANOARROW_TYPE_DENSE_UNION: + // Note that this value could be -1 if the type_ids string was invalid + if (private_data->union_type_id_is_child_index != 1) { + return EINVAL; + } else { + break; + } + default: + break; + } + if (private_data->storage_type == NANOARROW_TYPE_UNINITIALIZED) { + return EINVAL; + } + + // Initialize any data offset buffer with a single zero + for (int i = 0; i < NANOARROW_MAX_FIXED_BUFFERS; i++) { + if (private_data->layout.buffer_type[i] == NANOARROW_BUFFER_TYPE_DATA_OFFSET && + private_data->layout.element_size_bits[i] == 64) { + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendInt64(ArrowArrayBuffer(array, i), 0)); + } else if (private_data->layout.buffer_type[i] == NANOARROW_BUFFER_TYPE_DATA_OFFSET && + private_data->layout.element_size_bits[i] == 32) { + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendInt32(ArrowArrayBuffer(array, i), 0)); + } + } + + // Start building any child arrays or dictionaries + for (int64_t i = 0; i < array->n_children; i++) { + NANOARROW_RETURN_NOT_OK(ArrowArrayStartAppending(array->children[i])); + } + + if (array->dictionary != NULL) { + NANOARROW_RETURN_NOT_OK(ArrowArrayStartAppending(array->dictionary)); + } + + return NANOARROW_OK; +} + +static inline ArrowErrorCode ArrowArrayShrinkToFit(struct ArrowArray* array) { + for (int64_t i = 0; i < NANOARROW_MAX_FIXED_BUFFERS; i++) { + struct ArrowBuffer* buffer = ArrowArrayBuffer(array, i); + NANOARROW_RETURN_NOT_OK(ArrowBufferResize(buffer, buffer->size_bytes, 1)); + } + + for (int64_t i = 0; i < array->n_children; i++) { + NANOARROW_RETURN_NOT_OK(ArrowArrayShrinkToFit(array->children[i])); + } + + if (array->dictionary != NULL) { + NANOARROW_RETURN_NOT_OK(ArrowArrayShrinkToFit(array->dictionary)); + } + + return NANOARROW_OK; +} + +static inline ArrowErrorCode _ArrowArrayAppendBits(struct ArrowArray* array, + int64_t buffer_i, uint8_t value, + int64_t n) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + struct ArrowBuffer* buffer = ArrowArrayBuffer(array, buffer_i); + int64_t bytes_required = + _ArrowRoundUpToMultipleOf8(private_data->layout.element_size_bits[buffer_i] * + (array->length + 1)) / + 8; + if (bytes_required > buffer->size_bytes) { + NANOARROW_RETURN_NOT_OK( + ArrowBufferAppendFill(buffer, 0, bytes_required - buffer->size_bytes)); + } + + ArrowBitsSetTo(buffer->data, array->length, n, value); + return NANOARROW_OK; +} + +static inline ArrowErrorCode _ArrowArrayAppendEmptyInternal(struct ArrowArray* array, + int64_t n, uint8_t is_valid) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + + if (n == 0) { + return NANOARROW_OK; + } + + // Some type-specific handling + switch (private_data->storage_type) { + case NANOARROW_TYPE_NA: + // (An empty value for a null array *is* a null) + array->null_count += n; + array->length += n; + return NANOARROW_OK; + + case NANOARROW_TYPE_DENSE_UNION: { + // Add one null to the first child and append n references to that child + int8_t type_id = _ArrowArrayUnionTypeId(array, 0); + NANOARROW_RETURN_NOT_OK( + _ArrowArrayAppendEmptyInternal(array->children[0], 1, is_valid)); + NANOARROW_RETURN_NOT_OK( + ArrowBufferAppendFill(ArrowArrayBuffer(array, 0), type_id, n)); + for (int64_t i = 0; i < n; i++) { + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendInt32( + ArrowArrayBuffer(array, 1), (int32_t)array->children[0]->length - 1)); + } + // For the purposes of array->null_count, union elements are never considered "null" + // even if some children contain nulls. + array->length += n; + return NANOARROW_OK; + } + + case NANOARROW_TYPE_SPARSE_UNION: { + // Add n nulls to the first child and append n references to that child + int8_t type_id = _ArrowArrayUnionTypeId(array, 0); + NANOARROW_RETURN_NOT_OK( + _ArrowArrayAppendEmptyInternal(array->children[0], n, is_valid)); + for (int64_t i = 1; i < array->n_children; i++) { + NANOARROW_RETURN_NOT_OK(ArrowArrayAppendEmpty(array->children[i], n)); + } + + NANOARROW_RETURN_NOT_OK( + ArrowBufferAppendFill(ArrowArrayBuffer(array, 0), type_id, n)); + // For the purposes of array->null_count, union elements are never considered "null" + // even if some children contain nulls. + array->length += n; + return NANOARROW_OK; + } + + case NANOARROW_TYPE_FIXED_SIZE_LIST: + NANOARROW_RETURN_NOT_OK(ArrowArrayAppendEmpty( + array->children[0], n * private_data->layout.child_size_elements)); + break; + case NANOARROW_TYPE_STRUCT: + for (int64_t i = 0; i < array->n_children; i++) { + NANOARROW_RETURN_NOT_OK(ArrowArrayAppendEmpty(array->children[i], n)); + } + break; + + default: + break; + } + + // Append n is_valid bits to the validity bitmap. If we haven't allocated a bitmap yet + // and we need to append nulls, do it now. + if (!is_valid && private_data->bitmap.buffer.data == NULL) { + NANOARROW_RETURN_NOT_OK(ArrowBitmapReserve(&private_data->bitmap, array->length + n)); + ArrowBitmapAppendUnsafe(&private_data->bitmap, 1, array->length); + ArrowBitmapAppendUnsafe(&private_data->bitmap, is_valid, n); + } else if (private_data->bitmap.buffer.data != NULL) { + NANOARROW_RETURN_NOT_OK(ArrowBitmapReserve(&private_data->bitmap, n)); + ArrowBitmapAppendUnsafe(&private_data->bitmap, is_valid, n); + } + + // Add appropriate buffer fill + struct ArrowBuffer* buffer; + int64_t size_bytes; + + for (int i = 0; i < NANOARROW_MAX_FIXED_BUFFERS; i++) { + buffer = ArrowArrayBuffer(array, i); + size_bytes = private_data->layout.element_size_bits[i] / 8; + + switch (private_data->layout.buffer_type[i]) { + case NANOARROW_BUFFER_TYPE_NONE: + case NANOARROW_BUFFER_TYPE_VARIADIC_DATA: + case NANOARROW_BUFFER_TYPE_VARIADIC_SIZE: + case NANOARROW_BUFFER_TYPE_VALIDITY: + continue; + case NANOARROW_BUFFER_TYPE_DATA_OFFSET: + // Append the current value at the end of the offset buffer for each element + NANOARROW_RETURN_NOT_OK(ArrowBufferReserve(buffer, size_bytes * n)); + + for (int64_t j = 0; j < n; j++) { + ArrowBufferAppendUnsafe(buffer, buffer->data + size_bytes * (array->length + j), + size_bytes); + } + + // Skip the data buffer + i++; + continue; + case NANOARROW_BUFFER_TYPE_DATA: + // Zero out the next bit of memory + if (private_data->layout.element_size_bits[i] % 8 == 0) { + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendFill(buffer, 0, size_bytes * n)); + } else { + NANOARROW_RETURN_NOT_OK(_ArrowArrayAppendBits(array, i, 0, n)); + } + continue; + + case NANOARROW_BUFFER_TYPE_TYPE_ID: + case NANOARROW_BUFFER_TYPE_UNION_OFFSET: + // These cases return above + return EINVAL; + } + } + + array->length += n; + array->null_count += n * !is_valid; + return NANOARROW_OK; +} + +static inline ArrowErrorCode ArrowArrayAppendNull(struct ArrowArray* array, int64_t n) { + return _ArrowArrayAppendEmptyInternal(array, n, 0); +} + +static inline ArrowErrorCode ArrowArrayAppendEmpty(struct ArrowArray* array, int64_t n) { + return _ArrowArrayAppendEmptyInternal(array, n, 1); +} + +static inline ArrowErrorCode ArrowArrayAppendInt(struct ArrowArray* array, + int64_t value) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + + struct ArrowBuffer* data_buffer = ArrowArrayBuffer(array, 1); + + switch (private_data->storage_type) { + case NANOARROW_TYPE_INT64: + NANOARROW_RETURN_NOT_OK(ArrowBufferAppend(data_buffer, &value, sizeof(int64_t))); + break; + case NANOARROW_TYPE_INT32: + _NANOARROW_CHECK_RANGE(value, INT32_MIN, INT32_MAX); + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendInt32(data_buffer, (int32_t)value)); + break; + case NANOARROW_TYPE_INT16: + _NANOARROW_CHECK_RANGE(value, INT16_MIN, INT16_MAX); + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendInt16(data_buffer, (int16_t)value)); + break; + case NANOARROW_TYPE_INT8: + _NANOARROW_CHECK_RANGE(value, INT8_MIN, INT8_MAX); + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendInt8(data_buffer, (int8_t)value)); + break; + case NANOARROW_TYPE_UINT64: + case NANOARROW_TYPE_UINT32: + case NANOARROW_TYPE_UINT16: + case NANOARROW_TYPE_UINT8: + _NANOARROW_CHECK_RANGE(value, 0, INT64_MAX); + return ArrowArrayAppendUInt(array, value); + case NANOARROW_TYPE_DOUBLE: + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendDouble(data_buffer, (double)value)); + break; + case NANOARROW_TYPE_FLOAT: + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendFloat(data_buffer, (float)value)); + break; + case NANOARROW_TYPE_HALF_FLOAT: + NANOARROW_RETURN_NOT_OK( + ArrowBufferAppendUInt16(data_buffer, ArrowFloatToHalfFloat((float)value))); + break; + case NANOARROW_TYPE_BOOL: + NANOARROW_RETURN_NOT_OK(_ArrowArrayAppendBits(array, 1, value != 0, 1)); + break; + default: + return EINVAL; + } + + if (private_data->bitmap.buffer.data != NULL) { + NANOARROW_RETURN_NOT_OK(ArrowBitmapAppend(ArrowArrayValidityBitmap(array), 1, 1)); + } + + array->length++; + return NANOARROW_OK; +} + +static inline ArrowErrorCode ArrowArrayAppendUInt(struct ArrowArray* array, + uint64_t value) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + + struct ArrowBuffer* data_buffer = ArrowArrayBuffer(array, 1); + + switch (private_data->storage_type) { + case NANOARROW_TYPE_UINT64: + NANOARROW_RETURN_NOT_OK(ArrowBufferAppend(data_buffer, &value, sizeof(uint64_t))); + break; + case NANOARROW_TYPE_UINT32: + _NANOARROW_CHECK_UPPER_LIMIT(value, UINT32_MAX); + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendUInt32(data_buffer, (uint32_t)value)); + break; + case NANOARROW_TYPE_UINT16: + _NANOARROW_CHECK_UPPER_LIMIT(value, UINT16_MAX); + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendUInt16(data_buffer, (uint16_t)value)); + break; + case NANOARROW_TYPE_UINT8: + _NANOARROW_CHECK_UPPER_LIMIT(value, UINT8_MAX); + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendUInt8(data_buffer, (uint8_t)value)); + break; + case NANOARROW_TYPE_INT64: + case NANOARROW_TYPE_INT32: + case NANOARROW_TYPE_INT16: + case NANOARROW_TYPE_INT8: + _NANOARROW_CHECK_UPPER_LIMIT(value, INT64_MAX); + return ArrowArrayAppendInt(array, value); + case NANOARROW_TYPE_DOUBLE: + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendDouble(data_buffer, (double)value)); + break; + case NANOARROW_TYPE_FLOAT: + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendFloat(data_buffer, (float)value)); + break; + case NANOARROW_TYPE_HALF_FLOAT: + NANOARROW_RETURN_NOT_OK( + ArrowBufferAppendUInt16(data_buffer, ArrowFloatToHalfFloat((float)value))); + break; + case NANOARROW_TYPE_BOOL: + NANOARROW_RETURN_NOT_OK(_ArrowArrayAppendBits(array, 1, value != 0, 1)); + break; + default: + return EINVAL; + } + + if (private_data->bitmap.buffer.data != NULL) { + NANOARROW_RETURN_NOT_OK(ArrowBitmapAppend(ArrowArrayValidityBitmap(array), 1, 1)); + } + + array->length++; + return NANOARROW_OK; +} + +static inline ArrowErrorCode ArrowArrayAppendDouble(struct ArrowArray* array, + double value) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + + struct ArrowBuffer* data_buffer = ArrowArrayBuffer(array, 1); + + switch (private_data->storage_type) { + case NANOARROW_TYPE_DOUBLE: + NANOARROW_RETURN_NOT_OK(ArrowBufferAppend(data_buffer, &value, sizeof(double))); + break; + case NANOARROW_TYPE_FLOAT: + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendFloat(data_buffer, (float)value)); + break; + case NANOARROW_TYPE_HALF_FLOAT: + NANOARROW_RETURN_NOT_OK( + ArrowBufferAppendUInt16(data_buffer, ArrowFloatToHalfFloat((float)value))); + break; + default: + return EINVAL; + } + + if (private_data->bitmap.buffer.data != NULL) { + NANOARROW_RETURN_NOT_OK(ArrowBitmapAppend(ArrowArrayValidityBitmap(array), 1, 1)); + } + + array->length++; + return NANOARROW_OK; +} + +// Binary views only have two fixed buffers, but be aware that they must also +// always have more 1 buffer to store variadic buffer sizes (even if there are none) +#define NANOARROW_BINARY_VIEW_FIXED_BUFFERS 2 +#define NANOARROW_BINARY_VIEW_INLINE_SIZE 12 +#define NANOARROW_BINARY_VIEW_PREFIX_SIZE 4 +#define NANOARROW_BINARY_VIEW_BLOCK_SIZE (32 << 10) // 32KB + +// The Arrow C++ implementation uses anonymous structs as members +// of the ArrowBinaryView. For Cython support in this library, we define +// those structs outside of the ArrowBinaryView +struct ArrowBinaryViewInlined { + int32_t size; + uint8_t data[NANOARROW_BINARY_VIEW_INLINE_SIZE]; +}; + +struct ArrowBinaryViewRef { + int32_t size; + uint8_t prefix[NANOARROW_BINARY_VIEW_PREFIX_SIZE]; + int32_t buffer_index; + int32_t offset; +}; + +union ArrowBinaryView { + struct ArrowBinaryViewInlined inlined; + struct ArrowBinaryViewRef ref; + int64_t alignment_dummy; +}; + +static inline int32_t ArrowArrayVariadicBufferCount(struct ArrowArray* array) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + + return private_data->n_variadic_buffers; +} + +static inline ArrowErrorCode ArrowArrayAddVariadicBuffers(struct ArrowArray* array, + int32_t nbuffers) { + const int32_t n_current_bufs = ArrowArrayVariadicBufferCount(array); + const int32_t nvariadic_bufs_needed = n_current_bufs + nbuffers; + + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + + private_data->variadic_buffers = (struct ArrowBuffer*)ArrowRealloc( + private_data->variadic_buffers, sizeof(struct ArrowBuffer) * nvariadic_bufs_needed); + if (private_data->variadic_buffers == NULL) { + return ENOMEM; + } + private_data->variadic_buffer_sizes = (int64_t*)ArrowRealloc( + private_data->variadic_buffer_sizes, sizeof(int64_t) * nvariadic_bufs_needed); + if (private_data->variadic_buffer_sizes == NULL) { + return ENOMEM; + } + + for (int32_t i = n_current_bufs; i < nvariadic_bufs_needed; i++) { + ArrowBufferInit(&private_data->variadic_buffers[i]); + private_data->variadic_buffer_sizes[i] = 0; + } + private_data->n_variadic_buffers = nvariadic_bufs_needed; + array->n_buffers = NANOARROW_BINARY_VIEW_FIXED_BUFFERS + 1 + nvariadic_bufs_needed; + + return NANOARROW_OK; +} + +static inline ArrowErrorCode ArrowArrayAppendBytes(struct ArrowArray* array, + struct ArrowBufferView value) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + + if (private_data->storage_type == NANOARROW_TYPE_STRING_VIEW || + private_data->storage_type == NANOARROW_TYPE_BINARY_VIEW) { + struct ArrowBuffer* data_buffer = ArrowArrayBuffer(array, 1); + union ArrowBinaryView bvt; + bvt.inlined.size = (int32_t)value.size_bytes; + + if (value.size_bytes <= NANOARROW_BINARY_VIEW_INLINE_SIZE) { + memcpy(bvt.inlined.data, value.data.as_char, value.size_bytes); + memset(bvt.inlined.data + bvt.inlined.size, 0, + NANOARROW_BINARY_VIEW_INLINE_SIZE - bvt.inlined.size); + } else { + int32_t current_n_vbufs = ArrowArrayVariadicBufferCount(array); + if (current_n_vbufs == 0 || + private_data->variadic_buffers[current_n_vbufs - 1].size_bytes + + value.size_bytes > + NANOARROW_BINARY_VIEW_BLOCK_SIZE) { + const int32_t additional_bufs_needed = 1; + NANOARROW_RETURN_NOT_OK( + ArrowArrayAddVariadicBuffers(array, additional_bufs_needed)); + current_n_vbufs += additional_bufs_needed; + } + + const int32_t buf_index = current_n_vbufs - 1; + struct ArrowBuffer* variadic_buf = &private_data->variadic_buffers[buf_index]; + memcpy(bvt.ref.prefix, value.data.as_char, NANOARROW_BINARY_VIEW_PREFIX_SIZE); + bvt.ref.buffer_index = (int32_t)buf_index; + bvt.ref.offset = (int32_t)variadic_buf->size_bytes; + NANOARROW_RETURN_NOT_OK( + ArrowBufferAppend(variadic_buf, value.data.as_char, value.size_bytes)); + private_data->variadic_buffer_sizes[buf_index] = variadic_buf->size_bytes; + } + NANOARROW_RETURN_NOT_OK(ArrowBufferAppend(data_buffer, &bvt, sizeof(bvt))); + } else { + struct ArrowBuffer* offset_buffer = ArrowArrayBuffer(array, 1); + struct ArrowBuffer* data_buffer = ArrowArrayBuffer( + array, 1 + (private_data->storage_type != NANOARROW_TYPE_FIXED_SIZE_BINARY)); + int32_t offset; + int64_t large_offset; + int64_t fixed_size_bytes = private_data->layout.element_size_bits[1] / 8; + + switch (private_data->storage_type) { + case NANOARROW_TYPE_STRING: + case NANOARROW_TYPE_BINARY: + offset = ((int32_t*)offset_buffer->data)[array->length]; + if ((((int64_t)offset) + value.size_bytes) > INT32_MAX) { + return EOVERFLOW; + } + + offset += (int32_t)value.size_bytes; + NANOARROW_RETURN_NOT_OK( + ArrowBufferAppend(offset_buffer, &offset, sizeof(int32_t))); + NANOARROW_RETURN_NOT_OK( + ArrowBufferAppend(data_buffer, value.data.data, value.size_bytes)); + break; + + case NANOARROW_TYPE_LARGE_STRING: + case NANOARROW_TYPE_LARGE_BINARY: + large_offset = ((int64_t*)offset_buffer->data)[array->length]; + large_offset += value.size_bytes; + NANOARROW_RETURN_NOT_OK( + ArrowBufferAppend(offset_buffer, &large_offset, sizeof(int64_t))); + NANOARROW_RETURN_NOT_OK( + ArrowBufferAppend(data_buffer, value.data.data, value.size_bytes)); + break; + + case NANOARROW_TYPE_FIXED_SIZE_BINARY: + if (value.size_bytes != fixed_size_bytes) { + return EINVAL; + } + + NANOARROW_RETURN_NOT_OK( + ArrowBufferAppend(data_buffer, value.data.data, value.size_bytes)); + break; + default: + return EINVAL; + } + } + + if (private_data->bitmap.buffer.data != NULL) { + NANOARROW_RETURN_NOT_OK(ArrowBitmapAppend(ArrowArrayValidityBitmap(array), 1, 1)); + } + + array->length++; + return NANOARROW_OK; +} + +static inline ArrowErrorCode ArrowArrayAppendString(struct ArrowArray* array, + struct ArrowStringView value) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + + struct ArrowBufferView buffer_view; + buffer_view.data.data = value.data; + buffer_view.size_bytes = value.size_bytes; + + switch (private_data->storage_type) { + case NANOARROW_TYPE_STRING: + case NANOARROW_TYPE_LARGE_STRING: + case NANOARROW_TYPE_STRING_VIEW: + case NANOARROW_TYPE_BINARY: + case NANOARROW_TYPE_LARGE_BINARY: + case NANOARROW_TYPE_BINARY_VIEW: + return ArrowArrayAppendBytes(array, buffer_view); + default: + return EINVAL; + } +} + +static inline ArrowErrorCode ArrowArrayAppendInterval(struct ArrowArray* array, + const struct ArrowInterval* value) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + + struct ArrowBuffer* data_buffer = ArrowArrayBuffer(array, 1); + + switch (private_data->storage_type) { + case NANOARROW_TYPE_INTERVAL_MONTHS: { + if (value->type != NANOARROW_TYPE_INTERVAL_MONTHS) { + return EINVAL; + } + + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendInt32(data_buffer, value->months)); + break; + } + case NANOARROW_TYPE_INTERVAL_DAY_TIME: { + if (value->type != NANOARROW_TYPE_INTERVAL_DAY_TIME) { + return EINVAL; + } + + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendInt32(data_buffer, value->days)); + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendInt32(data_buffer, value->ms)); + break; + } + case NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO: { + if (value->type != NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO) { + return EINVAL; + } + + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendInt32(data_buffer, value->months)); + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendInt32(data_buffer, value->days)); + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendInt64(data_buffer, value->ns)); + break; + } + default: + return EINVAL; + } + + if (private_data->bitmap.buffer.data != NULL) { + NANOARROW_RETURN_NOT_OK(ArrowBitmapAppend(ArrowArrayValidityBitmap(array), 1, 1)); + } + + array->length++; + return NANOARROW_OK; +} + +static inline ArrowErrorCode ArrowArrayAppendDecimal(struct ArrowArray* array, + const struct ArrowDecimal* value) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + struct ArrowBuffer* data_buffer = ArrowArrayBuffer(array, 1); + + switch (private_data->storage_type) { + case NANOARROW_TYPE_DECIMAL128: + if (value->n_words != 2) { + return EINVAL; + } else { + NANOARROW_RETURN_NOT_OK( + ArrowBufferAppend(data_buffer, value->words, 2 * sizeof(uint64_t))); + break; + } + case NANOARROW_TYPE_DECIMAL256: + if (value->n_words != 4) { + return EINVAL; + } else { + NANOARROW_RETURN_NOT_OK( + ArrowBufferAppend(data_buffer, value->words, 4 * sizeof(uint64_t))); + break; + } + default: + return EINVAL; + } + + if (private_data->bitmap.buffer.data != NULL) { + NANOARROW_RETURN_NOT_OK(ArrowBitmapAppend(ArrowArrayValidityBitmap(array), 1, 1)); + } + + array->length++; + return NANOARROW_OK; +} + +static inline ArrowErrorCode ArrowArrayFinishElement(struct ArrowArray* array) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + + int64_t child_length; + + switch (private_data->storage_type) { + case NANOARROW_TYPE_LIST: + case NANOARROW_TYPE_MAP: + child_length = array->children[0]->length; + if (child_length > INT32_MAX) { + return EOVERFLOW; + } + NANOARROW_RETURN_NOT_OK( + ArrowBufferAppendInt32(ArrowArrayBuffer(array, 1), (int32_t)child_length)); + break; + case NANOARROW_TYPE_LARGE_LIST: + child_length = array->children[0]->length; + NANOARROW_RETURN_NOT_OK( + ArrowBufferAppendInt64(ArrowArrayBuffer(array, 1), child_length)); + break; + case NANOARROW_TYPE_FIXED_SIZE_LIST: + child_length = array->children[0]->length; + if (child_length != + ((array->length + 1) * private_data->layout.child_size_elements)) { + return EINVAL; + } + break; + case NANOARROW_TYPE_STRUCT: + for (int64_t i = 0; i < array->n_children; i++) { + child_length = array->children[i]->length; + if (child_length != (array->length + 1)) { + return EINVAL; + } + } + break; + default: + return EINVAL; + } + + if (private_data->bitmap.buffer.data != NULL) { + NANOARROW_RETURN_NOT_OK(ArrowBitmapAppend(ArrowArrayValidityBitmap(array), 1, 1)); + } + + array->length++; + return NANOARROW_OK; +} + +static inline ArrowErrorCode ArrowArrayFinishUnionElement(struct ArrowArray* array, + int8_t type_id) { + struct ArrowArrayPrivateData* private_data = + (struct ArrowArrayPrivateData*)array->private_data; + + int64_t child_index = _ArrowArrayUnionChildIndex(array, type_id); + if (child_index < 0 || child_index >= array->n_children) { + return EINVAL; + } + + switch (private_data->storage_type) { + case NANOARROW_TYPE_DENSE_UNION: + // Append the target child length to the union offsets buffer + _NANOARROW_CHECK_RANGE(array->children[child_index]->length, 0, INT32_MAX); + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendInt32( + ArrowArrayBuffer(array, 1), (int32_t)array->children[child_index]->length - 1)); + break; + case NANOARROW_TYPE_SPARSE_UNION: + // Append one empty to any non-target column that isn't already the right length + // or abort if appending a null will result in a column with invalid length + for (int64_t i = 0; i < array->n_children; i++) { + if (i == child_index || array->children[i]->length == (array->length + 1)) { + continue; + } + + if (array->children[i]->length != array->length) { + return EINVAL; + } + + NANOARROW_RETURN_NOT_OK(ArrowArrayAppendEmpty(array->children[i], 1)); + } + + break; + default: + return EINVAL; + } + + // Write to the type_ids buffer + NANOARROW_RETURN_NOT_OK( + ArrowBufferAppendInt8(ArrowArrayBuffer(array, 0), (int8_t)type_id)); + array->length++; + return NANOARROW_OK; +} + +static inline void ArrowArrayViewMove(struct ArrowArrayView* src, + struct ArrowArrayView* dst) { + memcpy(dst, src, sizeof(struct ArrowArrayView)); + ArrowArrayViewInitFromType(src, NANOARROW_TYPE_UNINITIALIZED); +} + +static inline int64_t ArrowArrayViewGetNumBuffers(struct ArrowArrayView* array_view) { + switch (array_view->storage_type) { + case NANOARROW_TYPE_BINARY_VIEW: + case NANOARROW_TYPE_STRING_VIEW: + return NANOARROW_BINARY_VIEW_FIXED_BUFFERS + array_view->n_variadic_buffers + 1; + default: + break; + } + + int64_t n_buffers = 0; + for (int i = 0; i < NANOARROW_MAX_FIXED_BUFFERS; i++) { + if (array_view->layout.buffer_type[i] == NANOARROW_BUFFER_TYPE_NONE) { + break; + } + + n_buffers++; + } + + return n_buffers; +} + +static inline struct ArrowBufferView ArrowArrayViewGetBufferView( + struct ArrowArrayView* array_view, int64_t i) { + switch (array_view->storage_type) { + case NANOARROW_TYPE_BINARY_VIEW: + case NANOARROW_TYPE_STRING_VIEW: + if (i < NANOARROW_BINARY_VIEW_FIXED_BUFFERS) { + return array_view->buffer_views[i]; + } else if (i >= + (array_view->n_variadic_buffers + NANOARROW_BINARY_VIEW_FIXED_BUFFERS)) { + struct ArrowBufferView view; + view.data.as_int64 = array_view->variadic_buffer_sizes; + view.size_bytes = array_view->n_variadic_buffers * sizeof(double); + return view; + } else { + struct ArrowBufferView view; + view.data.data = + array_view->variadic_buffers[i - NANOARROW_BINARY_VIEW_FIXED_BUFFERS]; + view.size_bytes = + array_view->variadic_buffer_sizes[i - NANOARROW_BINARY_VIEW_FIXED_BUFFERS]; + return view; + } + default: + // We need this check to avoid -Warray-bounds from complaining + if (i >= NANOARROW_MAX_FIXED_BUFFERS) { + struct ArrowBufferView view; + view.data.data = NULL; + view.size_bytes = 0; + return view; + } else { + return array_view->buffer_views[i]; + } + } +} + +enum ArrowBufferType ArrowArrayViewGetBufferType(struct ArrowArrayView* array_view, + int64_t i) { + switch (array_view->storage_type) { + case NANOARROW_TYPE_BINARY_VIEW: + case NANOARROW_TYPE_STRING_VIEW: + if (i < NANOARROW_BINARY_VIEW_FIXED_BUFFERS) { + return array_view->layout.buffer_type[i]; + } else if (i == + (array_view->n_variadic_buffers + NANOARROW_BINARY_VIEW_FIXED_BUFFERS)) { + return NANOARROW_BUFFER_TYPE_VARIADIC_SIZE; + } else { + return NANOARROW_BUFFER_TYPE_VARIADIC_DATA; + } + default: + // We need this check to avoid -Warray-bounds from complaining + if (i >= NANOARROW_MAX_FIXED_BUFFERS) { + return NANOARROW_BUFFER_TYPE_NONE; + } else { + return array_view->layout.buffer_type[i]; + } + } +} + +static inline enum ArrowType ArrowArrayViewGetBufferDataType( + struct ArrowArrayView* array_view, int64_t i) { + switch (array_view->storage_type) { + case NANOARROW_TYPE_BINARY_VIEW: + case NANOARROW_TYPE_STRING_VIEW: + if (i < NANOARROW_BINARY_VIEW_FIXED_BUFFERS) { + return array_view->layout.buffer_data_type[i]; + } else if (i >= + (array_view->n_variadic_buffers + NANOARROW_BINARY_VIEW_FIXED_BUFFERS)) { + return NANOARROW_TYPE_INT64; + } else if (array_view->storage_type == NANOARROW_TYPE_BINARY_VIEW) { + return NANOARROW_TYPE_BINARY; + } else { + return NANOARROW_TYPE_STRING; + } + default: + // We need this check to avoid -Warray-bounds from complaining + if (i >= NANOARROW_MAX_FIXED_BUFFERS) { + return NANOARROW_TYPE_UNINITIALIZED; + } else { + return array_view->layout.buffer_data_type[i]; + } + } +} + +static inline int64_t ArrowArrayViewGetBufferElementSizeBits( + struct ArrowArrayView* array_view, int64_t i) { + switch (array_view->storage_type) { + case NANOARROW_TYPE_BINARY_VIEW: + case NANOARROW_TYPE_STRING_VIEW: + if (i < NANOARROW_BINARY_VIEW_FIXED_BUFFERS) { + return array_view->layout.element_size_bits[i]; + } else if (i >= + (array_view->n_variadic_buffers + NANOARROW_BINARY_VIEW_FIXED_BUFFERS)) { + return sizeof(int64_t) * 8; + } else { + return 0; + } + default: + // We need this check to avoid -Warray-bounds from complaining + if (i >= NANOARROW_MAX_FIXED_BUFFERS) { + return 0; + } else { + return array_view->layout.element_size_bits[i]; + } + } +} + +static inline int8_t ArrowArrayViewIsNull(const struct ArrowArrayView* array_view, + int64_t i) { + const uint8_t* validity_buffer = array_view->buffer_views[0].data.as_uint8; + i += array_view->offset; + switch (array_view->storage_type) { + case NANOARROW_TYPE_NA: + return 0x01; + case NANOARROW_TYPE_DENSE_UNION: + case NANOARROW_TYPE_SPARSE_UNION: + // Unions are "never null" in Arrow land + return 0x00; + default: + return validity_buffer != NULL && !ArrowBitGet(validity_buffer, i); + } +} + +static inline int64_t ArrowArrayViewComputeNullCount( + const struct ArrowArrayView* array_view) { + if (array_view->length == 0) { + return 0; + } + + switch (array_view->storage_type) { + case NANOARROW_TYPE_NA: + return array_view->length; + case NANOARROW_TYPE_DENSE_UNION: + case NANOARROW_TYPE_SPARSE_UNION: + // Unions are "never null" in Arrow land + return 0; + default: + break; + } + + const uint8_t* validity_buffer = array_view->buffer_views[0].data.as_uint8; + if (validity_buffer == NULL) { + return 0; + } + return array_view->length - + ArrowBitCountSet(validity_buffer, array_view->offset, array_view->length); +} + +static inline int8_t ArrowArrayViewUnionTypeId(const struct ArrowArrayView* array_view, + int64_t i) { + switch (array_view->storage_type) { + case NANOARROW_TYPE_DENSE_UNION: + case NANOARROW_TYPE_SPARSE_UNION: + return array_view->buffer_views[0].data.as_int8[array_view->offset + i]; + default: + return -1; + } +} + +static inline int8_t ArrowArrayViewUnionChildIndex( + const struct ArrowArrayView* array_view, int64_t i) { + int8_t type_id = ArrowArrayViewUnionTypeId(array_view, i); + if (array_view->union_type_id_map == NULL) { + return type_id; + } else { + return array_view->union_type_id_map[type_id]; + } +} + +static inline int64_t ArrowArrayViewUnionChildOffset( + const struct ArrowArrayView* array_view, int64_t i) { + switch (array_view->storage_type) { + case NANOARROW_TYPE_DENSE_UNION: + return array_view->buffer_views[1].data.as_int32[array_view->offset + i]; + case NANOARROW_TYPE_SPARSE_UNION: + return array_view->offset + i; + default: + return -1; + } +} + +static inline int64_t ArrowArrayViewListChildOffset( + const struct ArrowArrayView* array_view, int64_t i) { + switch (array_view->storage_type) { + case NANOARROW_TYPE_LIST: + return array_view->buffer_views[1].data.as_int32[i]; + case NANOARROW_TYPE_LARGE_LIST: + return array_view->buffer_views[1].data.as_int64[i]; + default: + return -1; + } +} + +static struct ArrowBufferView ArrowArrayViewGetBytesFromViewArrayUnsafe( + const struct ArrowArrayView* array_view, int64_t i) { + const union ArrowBinaryView* bv = &array_view->buffer_views[1].data.as_binary_view[i]; + struct ArrowBufferView out = {{NULL}, bv->inlined.size}; + if (bv->inlined.size <= NANOARROW_BINARY_VIEW_INLINE_SIZE) { + out.data.as_uint8 = bv->inlined.data; + return out; + } + + out.data.data = array_view->variadic_buffers[bv->ref.buffer_index]; + out.data.as_uint8 += bv->ref.offset; + return out; +} + +static inline int64_t ArrowArrayViewGetIntUnsafe(const struct ArrowArrayView* array_view, + int64_t i) { + const struct ArrowBufferView* data_view = &array_view->buffer_views[1]; + i += array_view->offset; + switch (array_view->storage_type) { + case NANOARROW_TYPE_INT64: + return data_view->data.as_int64[i]; + case NANOARROW_TYPE_UINT64: + return data_view->data.as_uint64[i]; + case NANOARROW_TYPE_INTERVAL_MONTHS: + case NANOARROW_TYPE_INT32: + return data_view->data.as_int32[i]; + case NANOARROW_TYPE_UINT32: + return data_view->data.as_uint32[i]; + case NANOARROW_TYPE_INT16: + return data_view->data.as_int16[i]; + case NANOARROW_TYPE_UINT16: + return data_view->data.as_uint16[i]; + case NANOARROW_TYPE_INT8: + return data_view->data.as_int8[i]; + case NANOARROW_TYPE_UINT8: + return data_view->data.as_uint8[i]; + case NANOARROW_TYPE_DOUBLE: + return (int64_t)data_view->data.as_double[i]; + case NANOARROW_TYPE_FLOAT: + return (int64_t)data_view->data.as_float[i]; + case NANOARROW_TYPE_HALF_FLOAT: + return (int64_t)ArrowHalfFloatToFloat(data_view->data.as_uint16[i]); + case NANOARROW_TYPE_BOOL: + return ArrowBitGet(data_view->data.as_uint8, i); + default: + return INT64_MAX; + } +} + +static inline uint64_t ArrowArrayViewGetUIntUnsafe( + const struct ArrowArrayView* array_view, int64_t i) { + i += array_view->offset; + const struct ArrowBufferView* data_view = &array_view->buffer_views[1]; + switch (array_view->storage_type) { + case NANOARROW_TYPE_INT64: + return data_view->data.as_int64[i]; + case NANOARROW_TYPE_UINT64: + return data_view->data.as_uint64[i]; + case NANOARROW_TYPE_INTERVAL_MONTHS: + case NANOARROW_TYPE_INT32: + return data_view->data.as_int32[i]; + case NANOARROW_TYPE_UINT32: + return data_view->data.as_uint32[i]; + case NANOARROW_TYPE_INT16: + return data_view->data.as_int16[i]; + case NANOARROW_TYPE_UINT16: + return data_view->data.as_uint16[i]; + case NANOARROW_TYPE_INT8: + return data_view->data.as_int8[i]; + case NANOARROW_TYPE_UINT8: + return data_view->data.as_uint8[i]; + case NANOARROW_TYPE_DOUBLE: + return (uint64_t)data_view->data.as_double[i]; + case NANOARROW_TYPE_FLOAT: + return (uint64_t)data_view->data.as_float[i]; + case NANOARROW_TYPE_HALF_FLOAT: + return (uint64_t)ArrowHalfFloatToFloat(data_view->data.as_uint16[i]); + case NANOARROW_TYPE_BOOL: + return ArrowBitGet(data_view->data.as_uint8, i); + default: + return UINT64_MAX; + } +} + +static inline double ArrowArrayViewGetDoubleUnsafe( + const struct ArrowArrayView* array_view, int64_t i) { + i += array_view->offset; + const struct ArrowBufferView* data_view = &array_view->buffer_views[1]; + switch (array_view->storage_type) { + case NANOARROW_TYPE_INT64: + return (double)data_view->data.as_int64[i]; + case NANOARROW_TYPE_UINT64: + return (double)data_view->data.as_uint64[i]; + case NANOARROW_TYPE_INT32: + return data_view->data.as_int32[i]; + case NANOARROW_TYPE_UINT32: + return data_view->data.as_uint32[i]; + case NANOARROW_TYPE_INT16: + return data_view->data.as_int16[i]; + case NANOARROW_TYPE_UINT16: + return data_view->data.as_uint16[i]; + case NANOARROW_TYPE_INT8: + return data_view->data.as_int8[i]; + case NANOARROW_TYPE_UINT8: + return data_view->data.as_uint8[i]; + case NANOARROW_TYPE_DOUBLE: + return data_view->data.as_double[i]; + case NANOARROW_TYPE_FLOAT: + return data_view->data.as_float[i]; + case NANOARROW_TYPE_HALF_FLOAT: + return ArrowHalfFloatToFloat(data_view->data.as_uint16[i]); + case NANOARROW_TYPE_BOOL: + return ArrowBitGet(data_view->data.as_uint8, i); + default: + return DBL_MAX; + } +} + +static inline struct ArrowStringView ArrowArrayViewGetStringUnsafe( + const struct ArrowArrayView* array_view, int64_t i) { + i += array_view->offset; + const struct ArrowBufferView* offsets_view = &array_view->buffer_views[1]; + const char* data_view = array_view->buffer_views[2].data.as_char; + + struct ArrowStringView view; + switch (array_view->storage_type) { + case NANOARROW_TYPE_STRING: + case NANOARROW_TYPE_BINARY: + view.data = data_view + offsets_view->data.as_int32[i]; + view.size_bytes = + offsets_view->data.as_int32[i + 1] - offsets_view->data.as_int32[i]; + break; + case NANOARROW_TYPE_LARGE_STRING: + case NANOARROW_TYPE_LARGE_BINARY: + view.data = data_view + offsets_view->data.as_int64[i]; + view.size_bytes = + offsets_view->data.as_int64[i + 1] - offsets_view->data.as_int64[i]; + break; + case NANOARROW_TYPE_FIXED_SIZE_BINARY: + view.size_bytes = array_view->layout.element_size_bits[1] / 8; + view.data = array_view->buffer_views[1].data.as_char + (i * view.size_bytes); + break; + case NANOARROW_TYPE_STRING_VIEW: + case NANOARROW_TYPE_BINARY_VIEW: { + struct ArrowBufferView buf_view = + ArrowArrayViewGetBytesFromViewArrayUnsafe(array_view, i); + view.data = buf_view.data.as_char; + view.size_bytes = buf_view.size_bytes; + break; + } + default: + view.data = NULL; + view.size_bytes = 0; + break; + } + + return view; +} + +static inline struct ArrowBufferView ArrowArrayViewGetBytesUnsafe( + const struct ArrowArrayView* array_view, int64_t i) { + i += array_view->offset; + const struct ArrowBufferView* offsets_view = &array_view->buffer_views[1]; + const uint8_t* data_view = array_view->buffer_views[2].data.as_uint8; + + struct ArrowBufferView view; + switch (array_view->storage_type) { + case NANOARROW_TYPE_STRING: + case NANOARROW_TYPE_BINARY: + view.size_bytes = + offsets_view->data.as_int32[i + 1] - offsets_view->data.as_int32[i]; + view.data.as_uint8 = data_view + offsets_view->data.as_int32[i]; + break; + case NANOARROW_TYPE_LARGE_STRING: + case NANOARROW_TYPE_LARGE_BINARY: + view.size_bytes = + offsets_view->data.as_int64[i + 1] - offsets_view->data.as_int64[i]; + view.data.as_uint8 = data_view + offsets_view->data.as_int64[i]; + break; + case NANOARROW_TYPE_FIXED_SIZE_BINARY: + view.size_bytes = array_view->layout.element_size_bits[1] / 8; + view.data.as_uint8 = + array_view->buffer_views[1].data.as_uint8 + (i * view.size_bytes); + break; + case NANOARROW_TYPE_STRING_VIEW: + case NANOARROW_TYPE_BINARY_VIEW: + view = ArrowArrayViewGetBytesFromViewArrayUnsafe(array_view, i); + break; + default: + view.data.data = NULL; + view.size_bytes = 0; + break; + } + + return view; +} + +static inline void ArrowArrayViewGetIntervalUnsafe( + const struct ArrowArrayView* array_view, int64_t i, struct ArrowInterval* out) { + const uint8_t* data_view = array_view->buffer_views[1].data.as_uint8; + switch (array_view->storage_type) { + case NANOARROW_TYPE_INTERVAL_MONTHS: { + const size_t size = sizeof(int32_t); + memcpy(&out->months, data_view + i * size, sizeof(int32_t)); + break; + } + case NANOARROW_TYPE_INTERVAL_DAY_TIME: { + const size_t size = sizeof(int32_t) + sizeof(int32_t); + memcpy(&out->days, data_view + i * size, sizeof(int32_t)); + memcpy(&out->ms, data_view + i * size + 4, sizeof(int32_t)); + break; + } + case NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO: { + const size_t size = sizeof(int32_t) + sizeof(int32_t) + sizeof(int64_t); + memcpy(&out->months, data_view + i * size, sizeof(int32_t)); + memcpy(&out->days, data_view + i * size + 4, sizeof(int32_t)); + memcpy(&out->ns, data_view + i * size + 8, sizeof(int64_t)); + break; + } + default: + break; + } +} + +static inline void ArrowArrayViewGetDecimalUnsafe(const struct ArrowArrayView* array_view, + int64_t i, struct ArrowDecimal* out) { + i += array_view->offset; + const uint8_t* data_view = array_view->buffer_views[1].data.as_uint8; + switch (array_view->storage_type) { + case NANOARROW_TYPE_DECIMAL128: + ArrowDecimalSetBytes(out, data_view + (i * 16)); + break; + case NANOARROW_TYPE_DECIMAL256: + ArrowDecimalSetBytes(out, data_view + (i * 32)); + break; + default: + memset(out->words, 0, sizeof(out->words)); + break; + } +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/3rd_party/nanoarrow/nanoarrow/nanoarrow.hpp b/3rd_party/nanoarrow/nanoarrow/nanoarrow.hpp new file mode 100644 index 0000000..b9470be --- /dev/null +++ b/3rd_party/nanoarrow/nanoarrow/nanoarrow.hpp @@ -0,0 +1,932 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include +#include +#include +#include + +#include "nanoarrow/nanoarrow.h" + +#ifndef NANOARROW_HPP_INCLUDED +#define NANOARROW_HPP_INCLUDED + +/// \defgroup nanoarrow_hpp Nanoarrow C++ Helpers +/// +/// The utilities provided in this file are intended to support C++ users +/// of the nanoarrow C library such that C++-style resource allocation +/// and error handling can be used with nanoarrow data structures. +/// These utilities are not intended to mirror the nanoarrow C API. + +namespace nanoarrow { + +/// \defgroup nanoarrow_hpp-errors Error handling helpers +/// +/// Most functions in the C API return an ArrowErrorCode to communicate +/// possible failure. Except where documented, it is usually not safe to +/// continue after a non-zero value has been returned. While the +/// nanoarrow C++ helpers do not throw any exceptions of their own, +/// these helpers are provided to facilitate using the nanoarrow C++ helpers +/// in frameworks where this is a useful error handling idiom. +/// +/// @{ + +class Exception : public std::exception { + public: + Exception(const std::string& msg) : msg_(msg) {} + const char* what() const noexcept { return msg_.c_str(); } + + private: + std::string msg_; +}; + +#if defined(NANOARROW_DEBUG) +#define _NANOARROW_THROW_NOT_OK_IMPL(NAME, EXPR, EXPR_STR) \ + do { \ + const int NAME = (EXPR); \ + if (NAME) { \ + throw nanoarrow::Exception( \ + std::string(EXPR_STR) + std::string(" failed with errno ") + \ + std::to_string(NAME) + std::string("\n * ") + std::string(__FILE__) + \ + std::string(":") + std::to_string(__LINE__) + std::string("\n")); \ + } \ + } while (0) +#else +#define _NANOARROW_THROW_NOT_OK_IMPL(NAME, EXPR, EXPR_STR) \ + do { \ + const int NAME = (EXPR); \ + if (NAME) { \ + throw nanoarrow::Exception(std::string(EXPR_STR) + \ + std::string(" failed with errno ") + \ + std::to_string(NAME)); \ + } \ + } while (0) +#endif + +#define NANOARROW_THROW_NOT_OK(EXPR) \ + _NANOARROW_THROW_NOT_OK_IMPL(_NANOARROW_MAKE_NAME(errno_status_, __COUNTER__), EXPR, \ + #EXPR) + +/// @} + +namespace literals { + +/// \defgroup nanoarrow_hpp-string_view_helpers ArrowStringView helpers +/// +/// Factories and equality comparison for ArrowStringView. +/// +/// @{ + +/// \brief User literal operator allowing ArrowStringView construction like "str"_asv +inline ArrowStringView operator"" _asv(const char* data, std::size_t size_bytes) { + return {data, static_cast(size_bytes)}; +} + +// @} + +} // namespace literals + +namespace internal { + +/// \defgroup nanoarrow_hpp-unique_base Base classes for Unique wrappers +/// +/// @{ + +template +static inline void init_pointer(T* data); + +template +static inline void move_pointer(T* src, T* dst); + +template +static inline void release_pointer(T* data); + +template <> +inline void init_pointer(struct ArrowSchema* data) { + data->release = nullptr; +} + +template <> +inline void move_pointer(struct ArrowSchema* src, struct ArrowSchema* dst) { + ArrowSchemaMove(src, dst); +} + +template <> +inline void release_pointer(struct ArrowSchema* data) { + if (data->release != nullptr) { + data->release(data); + } +} + +template <> +inline void init_pointer(struct ArrowArray* data) { + data->release = nullptr; +} + +template <> +inline void move_pointer(struct ArrowArray* src, struct ArrowArray* dst) { + ArrowArrayMove(src, dst); +} + +template <> +inline void release_pointer(struct ArrowArray* data) { + if (data->release != nullptr) { + data->release(data); + } +} + +template <> +inline void init_pointer(struct ArrowArrayStream* data) { + data->release = nullptr; +} + +template <> +inline void move_pointer(struct ArrowArrayStream* src, struct ArrowArrayStream* dst) { + ArrowArrayStreamMove(src, dst); +} + +template <> +inline void release_pointer(ArrowArrayStream* data) { + if (data->release != nullptr) { + data->release(data); + } +} + +template <> +inline void init_pointer(struct ArrowBuffer* data) { + ArrowBufferInit(data); +} + +template <> +inline void move_pointer(struct ArrowBuffer* src, struct ArrowBuffer* dst) { + ArrowBufferMove(src, dst); +} + +template <> +inline void release_pointer(struct ArrowBuffer* data) { + ArrowBufferReset(data); +} + +template <> +inline void init_pointer(struct ArrowBitmap* data) { + ArrowBitmapInit(data); +} + +template <> +inline void move_pointer(struct ArrowBitmap* src, struct ArrowBitmap* dst) { + ArrowBitmapMove(src, dst); +} + +template <> +inline void release_pointer(struct ArrowBitmap* data) { + ArrowBitmapReset(data); +} + +template <> +inline void init_pointer(struct ArrowArrayView* data) { + ArrowArrayViewInitFromType(data, NANOARROW_TYPE_UNINITIALIZED); +} + +template <> +inline void move_pointer(struct ArrowArrayView* src, struct ArrowArrayView* dst) { + ArrowArrayViewMove(src, dst); +} + +template <> +inline void release_pointer(struct ArrowArrayView* data) { + ArrowArrayViewReset(data); +} + +/// \brief A unique_ptr-like base class for stack-allocatable objects +/// \tparam T The object type +template +class Unique { + public: + /// \brief Construct an invalid instance of T holding no resources + Unique() { + std::memset(&data_, 0, sizeof(data_)); + init_pointer(&data_); + } + + /// \brief Move and take ownership of data + Unique(T* data) { + std::memset(&data_, 0, sizeof(data_)); + move_pointer(data, &data_); + } + + /// \brief Move and take ownership of data wrapped by rhs + Unique(Unique&& rhs) : Unique(rhs.get()) {} + Unique& operator=(Unique&& rhs) { + reset(rhs.get()); + return *this; + } + + // These objects are not copyable + Unique(const Unique& rhs) = delete; + + /// \brief Get a pointer to the data owned by this object + T* get() noexcept { return &data_; } + const T* get() const noexcept { return &data_; } + + /// \brief Use the pointer operator to access fields of this object + T* operator->() noexcept { return &data_; } + const T* operator->() const noexcept { return &data_; } + + /// \brief Call data's release callback if valid + void reset() { release_pointer(&data_); } + + /// \brief Call data's release callback if valid and move ownership of the data + /// pointed to by data + void reset(T* data) { + reset(); + move_pointer(data, &data_); + } + + /// \brief Move ownership of this object to the data pointed to by out + void move(T* out) { move_pointer(&data_, out); } + + ~Unique() { reset(); } + + protected: + T data_; +}; + +template +static inline void DeallocateWrappedBuffer(struct ArrowBufferAllocator* allocator, + uint8_t* ptr, int64_t size) { + NANOARROW_UNUSED(ptr); + NANOARROW_UNUSED(size); + auto obj = reinterpret_cast(allocator->private_data); + delete obj; +} + +/// @} + +} // namespace internal + +/// \defgroup nanoarrow_hpp-unique Unique object wrappers +/// +/// The Arrow C Data interface, the Arrow C Stream interface, and the +/// nanoarrow C library use stack-allocatable objects, some of which +/// require initialization or cleanup. +/// +/// @{ + +/// \brief Class wrapping a unique struct ArrowSchema +using UniqueSchema = internal::Unique; + +/// \brief Class wrapping a unique struct ArrowArray +using UniqueArray = internal::Unique; + +/// \brief Class wrapping a unique struct ArrowArrayStream +using UniqueArrayStream = internal::Unique; + +/// \brief Class wrapping a unique struct ArrowBuffer +using UniqueBuffer = internal::Unique; + +/// \brief Class wrapping a unique struct ArrowBitmap +using UniqueBitmap = internal::Unique; + +/// \brief Class wrapping a unique struct ArrowArrayView +using UniqueArrayView = internal::Unique; + +/// @} + +/// \defgroup nanoarrow_hpp-buffer Buffer helpers +/// +/// Helpers to wrap buffer-like C++ objects as ArrowBuffer objects that can +/// be used to build ArrowArray objects. +/// +/// @{ + +/// \brief Initialize a buffer wrapping an arbitrary C++ object +/// +/// Initializes a buffer with a release callback that deletes the moved obj +/// when ArrowBufferReset is called. This version is useful for wrapping +/// an object whose .data() member is missing or unrelated to the buffer +/// value that is destined for a the buffer of an ArrowArray. T must be movable. +template +static inline void BufferInitWrapped(struct ArrowBuffer* buffer, T obj, + const uint8_t* data, int64_t size_bytes) { + T* obj_moved = new T(std::move(obj)); + buffer->data = const_cast(data); + buffer->size_bytes = size_bytes; + buffer->capacity_bytes = 0; + buffer->allocator = + ArrowBufferDeallocator(&internal::DeallocateWrappedBuffer, obj_moved); +} + +/// \brief Initialize a buffer wrapping a C++ sequence +/// +/// Specifically, this uses obj.data() to set the buffer address and +/// obj.size() * sizeof(T::value_type) to set the buffer size. This works +/// for STL containers like std::vector, std::array, and std::string. +/// This function moves obj and ensures it is deleted when ArrowBufferReset +/// is called. +template +void BufferInitSequence(struct ArrowBuffer* buffer, T obj) { + // Move before calling .data() (matters sometimes). + T* obj_moved = new T(std::move(obj)); + buffer->data = + const_cast(reinterpret_cast(obj_moved->data())); + buffer->size_bytes = obj_moved->size() * sizeof(typename T::value_type); + buffer->capacity_bytes = 0; + buffer->allocator = + ArrowBufferDeallocator(&internal::DeallocateWrappedBuffer, obj_moved); +} + +/// @} + +/// \defgroup nanoarrow_hpp-array-stream ArrayStream helpers +/// +/// These classes provide simple ArrowArrayStream implementations that +/// can be extended to help simplify the process of creating a valid +/// ArrowArrayStream implementation or used as-is for testing. +/// +/// @{ + +/// @brief Export an ArrowArrayStream from a standard C++ class +/// @tparam T A class with methods `int GetSchema(ArrowSchema*)`, `int +/// GetNext(ArrowArray*)`, and `const char* GetLastError()` +/// +/// This class allows a standard C++ class to be exported to a generic ArrowArrayStream +/// consumer by mapping C callback invocations to method calls on an instance of the +/// object whose lifecycle is owned by the ArrowArrayStream. See VectorArrayStream for +/// minimal useful example of this pattern. +/// +/// The methods must be accessible to the ArrayStreamFactory, either as public methods or +/// by declaring ArrayStreamFactory a friend. Implementors are encouraged (but +/// not required) to implement a ToArrayStream(ArrowArrayStream*) that creates a new +/// instance owned by the ArrowArrayStream and moves the relevant data to that instance. +/// +/// An example implementation might be: +/// +/// \code +/// class StreamImpl { +/// public: +/// // Public methods (e.g., constructor) used from C++ to initialize relevant data +/// +/// // Idiomatic exporter to move data + lifecycle responsibility to an instance +/// // managed by the ArrowArrayStream callbacks +/// void ToArrayStream(struct ArrowArrayStream* out) { +/// ArrayStreamFactory::InitArrayStream(new StreamImpl(...), out); +/// } +/// +/// private: +/// // Make relevant methods available to the ArrayStreamFactory +/// friend class ArrayStreamFactory; +/// +/// // Method implementations (called from C, not normally interacted with from C++) +/// int GetSchema(struct ArrowSchema* schema) { return ENOTSUP; } +/// int GetNext(struct ArrowArray* array) { return ENOTSUP; } +/// const char* GetLastError() { nullptr; } +/// }; +/// \endcode +/// +/// An example usage might be: +/// +/// \code +/// // Call constructor and/or public methods to initialize relevant data +/// StreamImpl impl; +/// +/// // Export to ArrowArrayStream after data are finalized +/// UniqueArrayStream stream; +/// impl.ToArrayStream(stream.get()); +/// \endcode +template +class ArrayStreamFactory { + public: + /// \brief Take ownership of instance and populate callbacks of out + static void InitArrayStream(T* instance, struct ArrowArrayStream* out) { + out->get_schema = &get_schema_wrapper; + out->get_next = &get_next_wrapper; + out->get_last_error = &get_last_error_wrapper; + out->release = &release_wrapper; + out->private_data = instance; + } + + private: + static int get_schema_wrapper(struct ArrowArrayStream* stream, + struct ArrowSchema* schema) { + return reinterpret_cast(stream->private_data)->GetSchema(schema); + } + + static int get_next_wrapper(struct ArrowArrayStream* stream, struct ArrowArray* array) { + return reinterpret_cast(stream->private_data)->GetNext(array); + } + + static const char* get_last_error_wrapper(struct ArrowArrayStream* stream) { + return reinterpret_cast(stream->private_data)->GetLastError(); + } + + static void release_wrapper(struct ArrowArrayStream* stream) { + delete reinterpret_cast(stream->private_data); + stream->release = nullptr; + stream->private_data = nullptr; + } +}; + +/// \brief An empty array stream +/// +/// This class can be constructed from an struct ArrowSchema and implements a default +/// get_next() method that always marks the output ArrowArray as released. +/// +/// DEPRECATED (0.4.0): Early versions of nanoarrow allowed subclasses to override +/// get_schema(), get_next(), and get_last_error(). This functionality will be removed +/// in a future release: use the pattern documented in ArrayStreamFactory to create +/// custom ArrowArrayStream implementations. +class EmptyArrayStream { + public: + /// \brief Create an EmptyArrayStream from an ArrowSchema + /// + /// Takes ownership of schema. + EmptyArrayStream(struct ArrowSchema* schema) : schema_(schema) { + ArrowErrorInit(&error_); + } + + /// \brief Export to ArrowArrayStream + void ToArrayStream(struct ArrowArrayStream* out) { + EmptyArrayStream* impl = new EmptyArrayStream(schema_.get()); + ArrayStreamFactory::InitArrayStream(impl, out); + } + + /// \brief Create an empty UniqueArrayStream from a struct ArrowSchema + /// + /// DEPRECATED (0.4.0): Use the constructor + ToArrayStream() to export an + /// EmptyArrayStream to an ArrowArrayStream consumer. + static UniqueArrayStream MakeUnique(struct ArrowSchema* schema) { + UniqueArrayStream stream; + EmptyArrayStream(schema).ToArrayStream(stream.get()); + return stream; + } + + virtual ~EmptyArrayStream() {} + + protected: + UniqueSchema schema_; + struct ArrowError error_; + + void MakeStream(struct ArrowArrayStream* stream) { ToArrayStream(stream); } + + virtual int get_schema(struct ArrowSchema* schema) { + return ArrowSchemaDeepCopy(schema_.get(), schema); + } + + virtual int get_next(struct ArrowArray* array) { + array->release = nullptr; + return NANOARROW_OK; + } + + virtual const char* get_last_error() { return error_.message; } + + private: + friend class ArrayStreamFactory; + + int GetSchema(struct ArrowSchema* schema) { return get_schema(schema); } + + int GetNext(struct ArrowArray* array) { return get_next(array); } + + const char* GetLastError() { return get_last_error(); } +}; + +/// \brief Implementation of an ArrowArrayStream backed by a vector of UniqueArray objects +class VectorArrayStream { + public: + /// \brief Create a VectorArrayStream from an ArrowSchema + vector of UniqueArray + /// + /// Takes ownership of schema and moves arrays if possible. + VectorArrayStream(struct ArrowSchema* schema, std::vector arrays) + : offset_(0), schema_(schema), arrays_(std::move(arrays)) {} + + /// \brief Create a one-shot VectorArrayStream from an ArrowSchema + ArrowArray + /// + /// Takes ownership of schema and array. + VectorArrayStream(struct ArrowSchema* schema, struct ArrowArray* array) + : offset_(0), schema_(schema) { + arrays_.emplace_back(array); + } + + /// \brief Export to ArrowArrayStream + void ToArrayStream(struct ArrowArrayStream* out) { + VectorArrayStream* impl = new VectorArrayStream(schema_.get(), std::move(arrays_)); + ArrayStreamFactory::InitArrayStream(impl, out); + } + + /// \brief Create a UniqueArrowArrayStream from an existing array + /// + /// DEPRECATED (0.4.0): Use the constructors + ToArrayStream() to export a + /// VectorArrayStream to an ArrowArrayStream consumer. + static UniqueArrayStream MakeUnique(struct ArrowSchema* schema, + struct ArrowArray* array) { + UniqueArrayStream stream; + VectorArrayStream(schema, array).ToArrayStream(stream.get()); + return stream; + } + + /// \brief Create a UniqueArrowArrayStream from existing arrays + /// + /// DEPRECATED (0.4.0): Use the constructor + ToArrayStream() to export a + /// VectorArrayStream to an ArrowArrayStream consumer. + static UniqueArrayStream MakeUnique(struct ArrowSchema* schema, + std::vector arrays) { + UniqueArrayStream stream; + VectorArrayStream(schema, std::move(arrays)).ToArrayStream(stream.get()); + return stream; + } + + private: + int64_t offset_; + UniqueSchema schema_; + std::vector arrays_; + + friend class ArrayStreamFactory; + + int GetSchema(struct ArrowSchema* schema) { + return ArrowSchemaDeepCopy(schema_.get(), schema); + } + + int GetNext(struct ArrowArray* array) { + if (offset_ < static_cast(arrays_.size())) { + arrays_[offset_++].move(array); + } else { + array->release = nullptr; + } + + return NANOARROW_OK; + } + + const char* GetLastError() { return ""; } +}; + +/// @} + +namespace internal { +struct Nothing {}; + +template +class Maybe { + public: + Maybe() : nothing_(Nothing()), is_something_(false) {} + Maybe(Nothing) : Maybe() {} + + Maybe(T something) // NOLINT(google-explicit-constructor) + : something_(something), is_something_(true) {} + + explicit constexpr operator bool() const { return is_something_; } + + const T& operator*() const { return something_; } + + friend inline bool operator==(Maybe l, Maybe r) { + if (l.is_something_ != r.is_something_) return false; + return l.is_something_ ? l.something_ == r.something_ : true; + } + friend inline bool operator!=(Maybe l, Maybe r) { return !(l == r); } + + T value_or(T val) const { return is_something_ ? something_ : val; } + + private: + // When support for gcc 4.8 is dropped, we should also assert + // is_trivially_copyable::value + static_assert(std::is_trivially_destructible::value, ""); + + union { + Nothing nothing_; + T something_; + }; + bool is_something_; +}; + +template +struct RandomAccessRange { + Get get; + int64_t size; + + using value_type = decltype(std::declval()(0)); + + struct const_iterator { + int64_t i; + const RandomAccessRange* range; + bool operator==(const_iterator other) const { return i == other.i; } + bool operator!=(const_iterator other) const { return i != other.i; } + const_iterator& operator++() { return ++i, *this; } + value_type operator*() const { return range->get(i); } + }; + + const_iterator begin() const { return {0, this}; } + const_iterator end() const { return {size, this}; } +}; + +template +struct InputRange { + Next next; + using ValueOrFalsy = decltype(std::declval()()); + + static_assert(std::is_constructible::value, ""); + static_assert(std::is_default_constructible::value, ""); + using value_type = decltype(*std::declval()); + + struct iterator { + InputRange* range; + ValueOrFalsy stashed; + + bool operator==(iterator other) const { + return static_cast(stashed) == static_cast(other.stashed); + } + bool operator!=(iterator other) const { return !(*this == other); } + + iterator& operator++() { + stashed = range->next(); + return *this; + } + value_type operator*() const { return *stashed; } + }; + + iterator begin() { return {this, next()}; } + iterator end() { return {this, ValueOrFalsy()}; } +}; +} // namespace internal + +/// \defgroup nanoarrow_hpp-range_for Range-for helpers +/// +/// The Arrow C Data interface and the Arrow C Stream interface represent +/// data which can be iterated through using C++'s range-for statement. +/// +/// @{ + +/// \brief An object convertible to any empty optional +constexpr internal::Nothing NA{}; + +/// \brief A range-for compatible wrapper for ArrowArray of fixed size type +/// +/// Provides a sequence of optional copied from each non-null +/// slot of the wrapped array (null slots result in empty optionals). +template +class ViewArrayAs { + private: + struct Get { + const uint8_t* validity; + const void* values; + int64_t offset; + + internal::Maybe operator()(int64_t i) const { + i += offset; + if (validity == nullptr || ArrowBitGet(validity, i)) { + if (std::is_same::value) { + return ArrowBitGet(static_cast(values), i); + } else { + return static_cast(values)[i]; + } + } + return NA; + } + }; + + internal::RandomAccessRange range_; + + public: + ViewArrayAs(const ArrowArrayView* array_view) + : range_{ + Get{ + array_view->buffer_views[0].data.as_uint8, + array_view->buffer_views[1].data.data, + array_view->offset, + }, + array_view->length, + } {} + + ViewArrayAs(const ArrowArray* array) + : range_{ + Get{ + static_cast(array->buffers[0]), + array->buffers[1], + /*offset=*/0, + }, + array->length, + } {} + + using value_type = typename internal::RandomAccessRange::value_type; + using const_iterator = typename internal::RandomAccessRange::const_iterator; + const_iterator begin() const { return range_.begin(); } + const_iterator end() const { return range_.end(); } + value_type operator[](int64_t i) const { return range_.get(i); } +}; + +/// \brief A range-for compatible wrapper for ArrowArray of binary or utf8 +/// +/// Provides a sequence of optional referencing each non-null +/// slot of the wrapped array (null slots result in empty optionals). Large +/// binary and utf8 arrays can be wrapped by specifying 64 instead of 32 for +/// the template argument. +template +class ViewArrayAsBytes { + private: + static_assert(OffsetSize == 32 || OffsetSize == 64, ""); + using OffsetType = typename std::conditional::type; + + struct Get { + const uint8_t* validity; + const void* offsets; + const char* data; + int64_t offset; + + internal::Maybe operator()(int64_t i) const { + i += offset; + auto* offsets = static_cast(this->offsets); + if (validity == nullptr || ArrowBitGet(validity, i)) { + return ArrowStringView{data + offsets[i], offsets[i + 1] - offsets[i]}; + } + return NA; + } + }; + + internal::RandomAccessRange range_; + + public: + ViewArrayAsBytes(const ArrowArrayView* array_view) + : range_{ + Get{ + array_view->buffer_views[0].data.as_uint8, + array_view->buffer_views[1].data.data, + array_view->buffer_views[2].data.as_char, + array_view->offset, + }, + array_view->length, + } {} + + ViewArrayAsBytes(const ArrowArray* array) + : range_{ + Get{ + static_cast(array->buffers[0]), + array->buffers[1], + static_cast(array->buffers[2]), + /*offset=*/0, + }, + array->length, + } {} + + using value_type = typename internal::RandomAccessRange::value_type; + using const_iterator = typename internal::RandomAccessRange::const_iterator; + const_iterator begin() const { return range_.begin(); } + const_iterator end() const { return range_.end(); } + value_type operator[](int64_t i) const { return range_.get(i); } +}; + +/// \brief A range-for compatible wrapper for ArrowArray of fixed size binary +/// +/// Provides a sequence of optional referencing each non-null +/// slot of the wrapped array (null slots result in empty optionals). +class ViewArrayAsFixedSizeBytes { + private: + struct Get { + const uint8_t* validity; + const char* data; + int64_t offset; + int fixed_size; + + internal::Maybe operator()(int64_t i) const { + i += offset; + if (validity == nullptr || ArrowBitGet(validity, i)) { + return ArrowStringView{data + i * fixed_size, fixed_size}; + } + return NA; + } + }; + + internal::RandomAccessRange range_; + + public: + ViewArrayAsFixedSizeBytes(const ArrowArrayView* array_view, int fixed_size) + : range_{ + Get{ + array_view->buffer_views[0].data.as_uint8, + array_view->buffer_views[1].data.as_char, + array_view->offset, + fixed_size, + }, + array_view->length, + } {} + + ViewArrayAsFixedSizeBytes(const ArrowArray* array, int fixed_size) + : range_{ + Get{ + static_cast(array->buffers[0]), + static_cast(array->buffers[1]), + /*offset=*/0, + fixed_size, + }, + array->length, + } {} + + using value_type = typename internal::RandomAccessRange::value_type; + using const_iterator = typename internal::RandomAccessRange::const_iterator; + const_iterator begin() const { return range_.begin(); } + const_iterator end() const { return range_.end(); } + value_type operator[](int64_t i) const { return range_.get(i); } +}; + +/// \brief A range-for compatible wrapper for ArrowArrayStream +/// +/// Provides a sequence of ArrowArray& referencing the most recent array drawn +/// from the wrapped stream. (Each array may be moved from if necessary.) +/// When streams terminate due to an error, the error code and message are +/// available for inspection through the code() and error() member functions +/// respectively. Failure to inspect the error code will result in +/// an assertion failure. The number of arrays drawn from the stream is also +/// available through the count() member function. +class ViewArrayStream { + public: + ViewArrayStream(ArrowArrayStream* stream, ArrowErrorCode* code, ArrowError* error) + : code_{code}, error_{error} { + // Using a slightly more verbose constructor to silence a warning that occurs + // on some versions of MSVC. + range_.next.self = this; + range_.next.stream = stream; + } + + ViewArrayStream(ArrowArrayStream* stream, ArrowError* error) + : ViewArrayStream{stream, &internal_code_, error} {} + + ViewArrayStream(ArrowArrayStream* stream) + : ViewArrayStream{stream, &internal_code_, &internal_error_} {} + + // disable copy/move of this view, since its error references may point into itself + ViewArrayStream(ViewArrayStream&&) = delete; + ViewArrayStream& operator=(ViewArrayStream&&) = delete; + ViewArrayStream(const ViewArrayStream&) = delete; + ViewArrayStream& operator=(const ViewArrayStream&) = delete; + + // ensure the error code of this stream was accessed at least once + ~ViewArrayStream() { NANOARROW_DCHECK(code_was_accessed_); } + + private: + struct Next { + ViewArrayStream* self; + ArrowArrayStream* stream; + UniqueArray array; + + ArrowArray* operator()() { + array.reset(); + *self->code_ = ArrowArrayStreamGetNext(stream, array.get(), self->error_); + + if (array->release != nullptr) { + NANOARROW_DCHECK(*self->code_ == NANOARROW_OK); + ++self->count_; + return array.get(); + } + + return nullptr; + } + }; + + internal::InputRange range_; + ArrowErrorCode* code_; + ArrowError* error_; + ArrowError internal_error_ = {}; + ArrowErrorCode internal_code_; + bool code_was_accessed_ = false; + int count_ = 0; + + public: + using value_type = typename internal::InputRange::value_type; + using iterator = typename internal::InputRange::iterator; + iterator begin() { return range_.begin(); } + iterator end() { return range_.end(); } + + /// The error code which caused this stream to terminate, if any. + ArrowErrorCode code() { + code_was_accessed_ = true; + return *code_; + } + /// The error message which caused this stream to terminate, if any. + ArrowError* error() { return error_; } + + /// The number of arrays streamed so far. + int count() const { return count_; } +}; + +/// @} + +} // namespace nanoarrow + +/// \brief Equality comparison operator between ArrowStringView +/// \ingroup nanoarrow_hpp-string_view_helpers +inline bool operator==(ArrowStringView l, ArrowStringView r) { + if (l.size_bytes != r.size_bytes) return false; + return memcmp(l.data, r.data, l.size_bytes) == 0; +} + +#endif diff --git a/3rd_party/nanoarrow/nanoarrow/nanoarrow_ipc.h b/3rd_party/nanoarrow/nanoarrow/nanoarrow_ipc.h new file mode 100644 index 0000000..fcf5ef8 --- /dev/null +++ b/3rd_party/nanoarrow/nanoarrow/nanoarrow_ipc.h @@ -0,0 +1,698 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#ifndef NANOARROW_IPC_H_INCLUDED +#define NANOARROW_IPC_H_INCLUDED + +#include "nanoarrow/nanoarrow.h" + +#ifdef NANOARROW_NAMESPACE + +#define ArrowIpcCheckRuntime NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcCheckRuntime) +#define ArrowIpcSharedBufferIsThreadSafe \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcSharedBufferIsThreadSafe) +#define ArrowIpcSharedBufferInit \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcSharedBufferInit) +#define ArrowIpcSharedBufferReset \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcSharedBufferReset) +#define ArrowIpcDecoderInit NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcDecoderInit) +#define ArrowIpcDecoderReset NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcDecoderReset) +#define ArrowIpcDecoderPeekHeader \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcDecoderPeekHeader) +#define ArrowIpcDecoderVerifyHeader \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcDecoderVerifyHeader) +#define ArrowIpcDecoderDecodeHeader \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcDecoderDecodeHeader) +#define ArrowIpcDecoderDecodeSchema \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcDecoderDecodeSchema) +#define ArrowIpcDecoderDecodeArrayView \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcDecoderDecodeArrayView) +#define ArrowIpcDecoderDecodeArray \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcDecoderDecodeArray) +#define ArrowIpcDecoderDecodeArrayFromShared \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcDecoderDecodeArrayFromShared) +#define ArrowIpcDecoderSetSchema \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcDecoderSetSchema) +#define ArrowIpcDecoderSetEndianness \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcDecoderSetEndianness) +#define ArrowIpcDecoderPeekFooter \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcDecoderPeekFooter) +#define ArrowIpcDecoderVerifyFooter \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcDecoderVerifyFooter) +#define ArrowIpcDecoderDecodeFooter \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcDecoderDecodeFooter) +#define ArrowIpcInputStreamInitBuffer \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcInputStreamInitBuffer) +#define ArrowIpcInputStreamInitFile \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcInputStreamInitFile) +#define ArrowIpcInputStreamMove \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcInputStreamMove) +#define ArrowIpcArrayStreamReaderInit \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcArrayStreamReaderInit) +#define ArrowIpcEncoderInit NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcEncoderInit) +#define ArrowIpcEncoderReset NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcEncoderReset) +#define ArrowIpcEncoderFinalizeBuffer \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcEncoderFinalizeBuffer) +#define ArrowIpcEncoderEncodeSchema \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcEncoderEncodeSchema) +#define ArrowIpcEncoderEncodeSimpleRecordBatch \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcEncoderEncodeSimpleRecordBatch) +#define ArrowIpcOutputStreamInitBuffer \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcOutputStreamInitBuffer) +#define ArrowIpcOutputStreamInitFile \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcOutputStreamInitFile) +#define ArrowIpcOutputStreamWrite \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcOutputStreamWrite) +#define ArrowIpcOutputStreamMove \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcOutputStreamMove) +#define ArrowIpcWriterInit NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcWriterInit) +#define ArrowIpcWriterReset NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcWriterReset) +#define ArrowIpcWriterWriteSchema \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcWriterWriteSchema) +#define ArrowIpcWriterWriteArrayView \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcWriterWriteArrayView) +#define ArrowIpcWriterWriteArrayStream \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcWriterWriteArrayStream) +#define ArrowIpcWriterStartFile \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcWriterStartFile) +#define ArrowIpcWriterFinalizeFile \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcWriterFinalizeFile) +#define ArrowIpcFooterInit NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcFooterInit) +#define ArrowIpcFooterReset NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcFooterReset) +#define ArrowIpcEncoderEncodeFooter \ + NANOARROW_SYMBOL(NANOARROW_NAMESPACE, ArrowIpcEncoderEncodeFooter) + +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/// \defgroup nanoarrow_ipc Nanoarrow IPC extension +/// +/// Except where noted, objects are not thread-safe and clients should +/// take care to serialize accesses to methods. +/// +/// Because this library is intended to be vendored, it provides full type +/// definitions and encourages clients to stack or statically allocate +/// where convenient. +/// +/// @{ + +/// \brief Metadata version enumerator +enum ArrowIpcMetadataVersion { + NANOARROW_IPC_METADATA_VERSION_V1, + NANOARROW_IPC_METADATA_VERSION_V2, + NANOARROW_IPC_METADATA_VERSION_V3, + NANOARROW_IPC_METADATA_VERSION_V4, + NANOARROW_IPC_METADATA_VERSION_V5 +}; + +/// \brief Message type enumerator +enum ArrowIpcMessageType { + NANOARROW_IPC_MESSAGE_TYPE_UNINITIALIZED, + NANOARROW_IPC_MESSAGE_TYPE_SCHEMA, + NANOARROW_IPC_MESSAGE_TYPE_DICTIONARY_BATCH, + NANOARROW_IPC_MESSAGE_TYPE_RECORD_BATCH, + NANOARROW_IPC_MESSAGE_TYPE_TENSOR, + NANOARROW_IPC_MESSAGE_TYPE_SPARSE_TENSOR +}; + +/// \brief Endianness enumerator +enum ArrowIpcEndianness { + NANOARROW_IPC_ENDIANNESS_UNINITIALIZED, + NANOARROW_IPC_ENDIANNESS_LITTLE, + NANOARROW_IPC_ENDIANNESS_BIG +}; + +/// \brief Compression type enumerator +enum ArrowIpcCompressionType { + NANOARROW_IPC_COMPRESSION_TYPE_NONE, + NANOARROW_IPC_COMPRESSION_TYPE_LZ4_FRAME, + NANOARROW_IPC_COMPRESSION_TYPE_ZSTD +}; + +/// \brief Feature flag for a stream that uses dictionary replacement +#define NANOARROW_IPC_FEATURE_DICTIONARY_REPLACEMENT 1 + +/// \brief Feature flag for a stream that uses compression +#define NANOARROW_IPC_FEATURE_COMPRESSED_BODY 2 + +/// \brief Checks the nanoarrow runtime to make sure the run/build versions match +ArrowErrorCode ArrowIpcCheckRuntime(struct ArrowError* error); + +/// \brief Get the endianness of the current runtime +static inline enum ArrowIpcEndianness ArrowIpcSystemEndianness(void) { + uint32_t check = 1; + char first_byte; + memcpy(&first_byte, &check, sizeof(char)); + if (first_byte) { + return NANOARROW_IPC_ENDIANNESS_LITTLE; + } else { + return NANOARROW_IPC_ENDIANNESS_BIG; + } +} + +/// \brief A structure representing a reference-counted buffer that may be passed to +/// ArrowIpcDecoderDecodeArrayFromShared(). +struct ArrowIpcSharedBuffer { + struct ArrowBuffer private_src; +}; + +/// \brief Initialize the contents of a ArrowIpcSharedBuffer struct +/// +/// If NANOARROW_OK is returned, the ArrowIpcSharedBuffer takes ownership of +/// src. +ArrowErrorCode ArrowIpcSharedBufferInit(struct ArrowIpcSharedBuffer* shared, + struct ArrowBuffer* src); + +/// \brief Release the caller's copy of the shared buffer +/// +/// When finished, the caller must relinquish its own copy of the shared data +/// using this function. The original buffer will continue to exist until all +/// ArrowArray objects that refer to it have also been released. +void ArrowIpcSharedBufferReset(struct ArrowIpcSharedBuffer* shared); + +/// \brief Check for shared buffer thread safety +/// +/// Thread-safe shared buffers require C11 and the stdatomic.h header. +/// If either are unavailable, shared buffers are still possible but +/// the resulting arrays must not be passed to other threads to be released. +int ArrowIpcSharedBufferIsThreadSafe(void); + +/// \brief Decoder for Arrow IPC messages +/// +/// This structure is intended to be allocated by the caller, +/// initialized using ArrowIpcDecoderInit(), and released with +/// ArrowIpcDecoderReset(). These fields should not be modified +/// by the caller but can be read following a call to +/// ArrowIpcDecoderPeekHeader(), ArrowIpcDecoderVerifyHeader(), or +/// ArrowIpcDecoderDecodeHeader(). +struct ArrowIpcDecoder { + /// \brief The last verified or decoded message type + enum ArrowIpcMessageType message_type; + + /// \brief The metadata version as indicated by the current schema message + enum ArrowIpcMetadataVersion metadata_version; + + /// \brief Buffer endianness as indicated by the current schema message + enum ArrowIpcEndianness endianness; + + /// \brief Arrow IPC Features used as indicated by the current Schema message + int32_t feature_flags; + + /// \brief Compression used by the current RecordBatch message + enum ArrowIpcCompressionType codec; + + /// \brief The number of bytes in the current header message + /// + /// This value includes the 8 bytes before the start of the header message + /// content and any padding bytes required to make the header message size + /// be a multiple of 8 bytes. + int32_t header_size_bytes; + + /// \brief The number of bytes in the forthcoming body message. + int64_t body_size_bytes; + + /// \brief The last decoded Footer + /// + /// \warning This API is currently only public for use in integration testing; + /// use at your own risk. + struct ArrowIpcFooter* footer; + + /// \brief Private resources managed by this library + void* private_data; +}; + +/// \brief Initialize a decoder +ArrowErrorCode ArrowIpcDecoderInit(struct ArrowIpcDecoder* decoder); + +/// \brief Release all resources attached to a decoder +void ArrowIpcDecoderReset(struct ArrowIpcDecoder* decoder); + +/// \brief Peek at a message header +/// +/// The first 8 bytes of an Arrow IPC message are 0xFFFFFFFF followed by the size +/// of the header as a little-endian 32-bit integer. ArrowIpcDecoderPeekHeader() reads +/// these bytes and returns ESPIPE if there are not enough remaining bytes in data to read +/// the entire header message, EINVAL if the first 8 bytes are not valid, ENODATA if the +/// Arrow end-of-stream indicator has been reached, or NANOARROW_OK otherwise. +/// +/// Pre-1.0 messages were not prefixed with 0xFFFFFFFF. For these messages, a value +/// of 4 will be placed into prefix_size_bytes; otherwise a value of 8 will be placed +/// into prefix_size_bytes. +ArrowErrorCode ArrowIpcDecoderPeekHeader(struct ArrowIpcDecoder* decoder, + struct ArrowBufferView data, + int32_t* prefix_size_bytes, + struct ArrowError* error); + +/// \brief Verify a message header +/// +/// Runs ArrowIpcDecoderPeekHeader() to ensure data is sufficiently large but additionally +/// runs flatbuffer verification to ensure that decoding the data will not access +/// memory outside of the buffer specified by data. ArrowIpcDecoderVerifyHeader() will +/// also set decoder.header_size_bytes, decoder.body_size_bytes, decoder.metadata_version, +/// and decoder.message_type. +/// +/// Returns as ArrowIpcDecoderPeekHeader() and additionally will +/// return EINVAL if flatbuffer verification fails. +ArrowErrorCode ArrowIpcDecoderVerifyHeader(struct ArrowIpcDecoder* decoder, + struct ArrowBufferView data, + struct ArrowError* error); + +/// \brief Decode a message header +/// +/// Runs ArrowIpcDecoderPeekHeader() to ensure data is sufficiently large and decodes +/// the content of the message header. If data contains a schema message, +/// decoder.endianness and decoder.feature_flags is set and ArrowIpcDecoderDecodeSchema() +/// can be used to obtain the decoded schema. If data contains a record batch message, +/// decoder.codec is set and a successful call can be followed by a call to +/// ArrowIpcDecoderDecodeArray(). +/// +/// In almost all cases this should be preceded by a call to +/// ArrowIpcDecoderVerifyHeader() to ensure decoding does not access data outside of the +/// specified buffer. +/// +/// Returns EINVAL if the content of the message cannot be decoded or ENOTSUP if the +/// content of the message uses features not supported by this library. +ArrowErrorCode ArrowIpcDecoderDecodeHeader(struct ArrowIpcDecoder* decoder, + struct ArrowBufferView data, + struct ArrowError* error); + +/// \brief Decode an ArrowSchema +/// +/// After a successful call to ArrowIpcDecoderDecodeHeader(), retrieve an ArrowSchema. +/// The caller is responsible for releasing the schema if NANOARROW_OK is returned. +/// +/// Returns EINVAL if the decoder did not just decode a schema message or +/// NANOARROW_OK otherwise. +ArrowErrorCode ArrowIpcDecoderDecodeSchema(struct ArrowIpcDecoder* decoder, + struct ArrowSchema* out, + struct ArrowError* error); + +/// \brief Set the ArrowSchema used to decode future record batch messages +/// +/// Prepares the decoder for future record batch messages +/// of this type. The decoder takes ownership of schema if NANOARROW_OK is returned. +/// Note that you must call this explicitly after decoding a +/// Schema message (i.e., the decoder does not assume that the last-decoded +/// schema message applies to future record batch messages). +/// +/// Returns EINVAL if schema validation fails or NANOARROW_OK otherwise. +ArrowErrorCode ArrowIpcDecoderSetSchema(struct ArrowIpcDecoder* decoder, + struct ArrowSchema* schema, + struct ArrowError* error); + +/// \brief Set the endianness used to decode future record batch messages +/// +/// Prepares the decoder for future record batch messages with the specified +/// endianness. Note that you must call this explicitly after decoding a +/// Schema message (i.e., the decoder does not assume that the last-decoded +/// schema message applies to future record batch messages). +/// +/// Returns NANOARROW_OK on success. +ArrowErrorCode ArrowIpcDecoderSetEndianness(struct ArrowIpcDecoder* decoder, + enum ArrowIpcEndianness endianness); + +/// \brief Decode an ArrowArrayView +/// +/// After a successful call to ArrowIpcDecoderDecodeHeader(), deserialize the content +/// of body into an internally-managed ArrowArrayView and return it. Note that field index +/// does not equate to column index if any columns contain nested types. Use a value of -1 +/// to decode the entire array into a struct. The pointed-to ArrowArrayView is owned by +/// the ArrowIpcDecoder and must not be released. +/// +/// For streams that match system endianness and do not use compression, this operation +/// will not perform any heap allocations; however, the buffers referred to by the +/// returned ArrowArrayView are only valid as long as the buffer referred to by body stays +/// valid. +ArrowErrorCode ArrowIpcDecoderDecodeArrayView(struct ArrowIpcDecoder* decoder, + struct ArrowBufferView body, int64_t i, + struct ArrowArrayView** out, + struct ArrowError* error); + +/// \brief Decode an ArrowArray +/// +/// After a successful call to ArrowIpcDecoderDecodeHeader(), assemble an ArrowArray given +/// a message body and a field index. Note that field index does not equate to column +/// index if any columns contain nested types. Use a value of -1 to decode the entire +/// array into a struct. The caller is responsible for releasing the array if +/// NANOARROW_OK is returned. +/// +/// Returns EINVAL if the decoder did not just decode a record batch message, ENOTSUP +/// if the message uses features not supported by this library, or or NANOARROW_OK +/// otherwise. +ArrowErrorCode ArrowIpcDecoderDecodeArray(struct ArrowIpcDecoder* decoder, + struct ArrowBufferView body, int64_t i, + struct ArrowArray* out, + enum ArrowValidationLevel validation_level, + struct ArrowError* error); + +/// \brief Decode an ArrowArray from an owned buffer +/// +/// This implementation takes advantage of the fact that it can avoid copying individual +/// buffers. In all cases the caller must ArrowIpcSharedBufferReset() body after one or +/// more calls to ArrowIpcDecoderDecodeArrayFromShared(). If +/// ArrowIpcSharedBufferIsThreadSafe() returns 0, out must not be released by another +/// thread. +ArrowErrorCode ArrowIpcDecoderDecodeArrayFromShared( + struct ArrowIpcDecoder* decoder, struct ArrowIpcSharedBuffer* shared, int64_t i, + struct ArrowArray* out, enum ArrowValidationLevel validation_level, + struct ArrowError* error); + +/// \brief An user-extensible input data source +struct ArrowIpcInputStream { + /// \brief Read up to buf_size_bytes from stream into buf + /// + /// The actual number of bytes read is placed in the value pointed to by + /// size_read_out. Returns NANOARROW_OK on success. + ArrowErrorCode (*read)(struct ArrowIpcInputStream* stream, uint8_t* buf, + int64_t buf_size_bytes, int64_t* size_read_out, + struct ArrowError* error); + + /// \brief Release the stream and any resources it may be holding + /// + /// Release callback implementations must set the release member to NULL. + /// Callers must check that the release callback is not NULL before calling + /// read() or release(). + void (*release)(struct ArrowIpcInputStream* stream); + + /// \brief Private implementation-defined data + void* private_data; +}; + +/// \brief Transfer ownership of an ArrowIpcInputStream +void ArrowIpcInputStreamMove(struct ArrowIpcInputStream* src, + struct ArrowIpcInputStream* dst); + +/// \brief Create an input stream from an ArrowBuffer +/// +/// The stream takes ownership of the buffer and reads bytes from it. +ArrowErrorCode ArrowIpcInputStreamInitBuffer(struct ArrowIpcInputStream* stream, + struct ArrowBuffer* input); + +/// \brief Create an input stream from a C FILE* pointer +/// +/// Note that the ArrowIpcInputStream has no mechanism to communicate an error +/// if file_ptr fails to close. If this behaviour is needed, pass false to +/// close_on_release and handle closing the file independently from stream. +ArrowErrorCode ArrowIpcInputStreamInitFile(struct ArrowIpcInputStream* stream, + void* file_ptr, int close_on_release); + +/// \brief Options for ArrowIpcArrayStreamReaderInit() +struct ArrowIpcArrayStreamReaderOptions { + /// \brief The field index to extract. + /// + /// Defaults to -1 (i.e., read all fields). Note that this field index refers to + /// the flattened tree of children and not necessarily the column index. + int64_t field_index; + + /// \brief Set to a non-zero value to share the message body buffer among decoded arrays + /// + /// Sharing buffers is a good choice when (1) using memory-mapped IO + /// (since unreferenced portions of the file are often not loaded into memory) or + /// (2) if all data from all columns are about to be referenced anyway. When loading + /// a single field there is probably no advantage to using shared buffers. + /// Defaults to the value of ArrowIpcSharedBufferIsThreadSafe(). + int use_shared_buffers; +}; + +/// \brief Initialize an ArrowArrayStream from an input stream of bytes +/// +/// The stream of bytes must begin with a Schema message and be followed by +/// zero or more RecordBatch messages as described in the Arrow IPC stream +/// format specification. Returns NANOARROW_OK on success. If NANOARROW_OK +/// is returned, the ArrowArrayStream takes ownership of input_stream and +/// the caller is responsible for releasing out. +ArrowErrorCode ArrowIpcArrayStreamReaderInit( + struct ArrowArrayStream* out, struct ArrowIpcInputStream* input_stream, + struct ArrowIpcArrayStreamReaderOptions* options); + +/// \brief Encoder for Arrow IPC messages +/// +/// This structure is intended to be allocated by the caller, +/// initialized using ArrowIpcEncoderInit(), and released with +/// ArrowIpcEncoderReset(). +struct ArrowIpcEncoder { + /// \brief Private resources managed by this library + void* private_data; +}; + +/// \brief Initialize an encoder +/// +/// If NANOARROW_OK is returned, the caller must call ArrowIpcEncoderReset() +/// to release resources allocated by this function. +ArrowErrorCode ArrowIpcEncoderInit(struct ArrowIpcEncoder* encoder); + +/// \brief Release all resources attached to an encoder +void ArrowIpcEncoderReset(struct ArrowIpcEncoder* encoder); + +/// \brief Finalize the most recently encoded message into a buffer +/// +/// If specified, the message will be encapsulated (prefixed with the continuation +/// marker and the header size and 0-padded to a multiple of 8 bytes). +/// +/// The bytes of the encoded message will be appended to the provided buffer. +ArrowErrorCode ArrowIpcEncoderFinalizeBuffer(struct ArrowIpcEncoder* encoder, + char encapsulate, struct ArrowBuffer* out); + +/// \brief Encode an ArrowSchema +/// +/// Returns ENOMEM if allocation fails, NANOARROW_OK otherwise. +ArrowErrorCode ArrowIpcEncoderEncodeSchema(struct ArrowIpcEncoder* encoder, + const struct ArrowSchema* schema, + struct ArrowError* error); + +/// \brief Encode a struct typed ArrayView to a flatbuffer RecordBatch, embedded in a +/// Message. +/// +/// Body buffers are concatenated into a contiguous, padded body_buffer. +/// +/// Returns ENOMEM if allocation fails, NANOARROW_OK otherwise. +ArrowErrorCode ArrowIpcEncoderEncodeSimpleRecordBatch( + struct ArrowIpcEncoder* encoder, const struct ArrowArrayView* array_view, + struct ArrowBuffer* body_buffer, struct ArrowError* error); + +/// \brief An user-extensible output data sink +struct ArrowIpcOutputStream { + /// \brief Write up to buf_size_bytes from stream into buf + /// + /// The actual number of bytes written is placed in the value pointed to by + /// size_read_out. Returns NANOARROW_OK on success. + ArrowErrorCode (*write)(struct ArrowIpcOutputStream* stream, const void* buf, + int64_t buf_size_bytes, int64_t* size_written_out, + struct ArrowError* error); + + /// \brief Release the stream and any resources it may be holding + /// + /// Release callback implementations must set the release member to NULL. + /// Callers must check that the release callback is not NULL before calling + /// read() or release(). + void (*release)(struct ArrowIpcOutputStream* stream); + + /// \brief Private implementation-defined data + void* private_data; +}; + +/// \brief Transfer ownership of an ArrowIpcOutputStream +void ArrowIpcOutputStreamMove(struct ArrowIpcOutputStream* src, + struct ArrowIpcOutputStream* dst); + +/// \brief Create an output stream from an ArrowBuffer +/// +/// All bytes witten to the stream will be appended to the buffer. +/// The stream does not take ownership of the buffer. +ArrowErrorCode ArrowIpcOutputStreamInitBuffer(struct ArrowIpcOutputStream* stream, + struct ArrowBuffer* output); + +/// \brief Create an output stream from a C FILE* pointer +/// +/// Note that the ArrowIpcOutputStream has no mechanism to communicate an error +/// if file_ptr fails to close. If this behaviour is needed, pass false to +/// close_on_release and handle closing the file independently from stream. +ArrowErrorCode ArrowIpcOutputStreamInitFile(struct ArrowIpcOutputStream* stream, + void* file_ptr, int close_on_release); + +/// \brief Write to a stream, trying again until all are written or the stream errors. +ArrowErrorCode ArrowIpcOutputStreamWrite(struct ArrowIpcOutputStream* stream, + struct ArrowBufferView data, + struct ArrowError* error); + +/// \brief A stream writer which encodes Schemas and ArrowArrays into an IPC byte stream +/// +/// This structure is intended to be allocated by the caller, +/// initialized using ArrowIpcWriterInit(), and released with +/// ArrowIpcWriterReset(). +struct ArrowIpcWriter { + /// \brief Private resources managed by this library + void* private_data; +}; + +/// \brief Initialize an output stream of bytes from an ArrowArrayStream +/// +/// Returns NANOARROW_OK on success. If NANOARROW_OK is returned the writer +/// takes ownership of the output byte stream, and the caller is +/// responsible for releasing the writer by calling ArrowIpcWriterReset(). +ArrowErrorCode ArrowIpcWriterInit(struct ArrowIpcWriter* writer, + struct ArrowIpcOutputStream* output_stream); + +/// \brief Release all resources attached to a writer +void ArrowIpcWriterReset(struct ArrowIpcWriter* writer); + +/// \brief Write a schema to the output byte stream +/// +/// Errors are propagated from the underlying encoder and output byte stream. +ArrowErrorCode ArrowIpcWriterWriteSchema(struct ArrowIpcWriter* writer, + const struct ArrowSchema* in, + struct ArrowError* error); + +/// \brief Write an array view to the output byte stream +/// +/// The array view may be NULL, in which case an EOS will be written. +/// The writer does not check that a schema was already written. +/// +/// Errors are propagated from the underlying encoder and output byte stream, +ArrowErrorCode ArrowIpcWriterWriteArrayView(struct ArrowIpcWriter* writer, + const struct ArrowArrayView* in, + struct ArrowError* error); + +/// \brief Write an entire stream (including EOS) to the output byte stream +/// +/// Errors are propagated from the underlying encoder, array stream, and output byte +/// stream. +ArrowErrorCode ArrowIpcWriterWriteArrayStream(struct ArrowIpcWriter* writer, + struct ArrowArrayStream* in, + struct ArrowError* error); + +/// \brief Start writing an IPC file +/// +/// Writes the Arrow IPC magic and sets the writer up to track written blocks. +ArrowErrorCode ArrowIpcWriterStartFile(struct ArrowIpcWriter* writer, + struct ArrowError* error); + +/// \brief Finish writing an IPC file +/// +/// Writes the IPC file's footer, footer size, and ending magic. +ArrowErrorCode ArrowIpcWriterFinalizeFile(struct ArrowIpcWriter* writer, + struct ArrowError* error); +/// @} + +// Internal APIs: + +/// \brief Represents a byte range in an IPC file. +/// +/// \warning This API is currently only public for use in integration testing; +/// use at your own risk. +struct ArrowIpcFileBlock { + /// \brief offset relative to the first byte of the file. + int64_t offset; + /// \brief length of encapsulated metadata Message (including padding) + int32_t metadata_length; + /// \brief length of contiguous body buffers (including padding) + int64_t body_length; +}; + +/// \brief A footer for use in an IPC file +/// +/// \warning This API is currently only public for use in integration testing; +/// use at your own risk. +/// +/// This structure is intended to be allocated by the caller, initialized using +/// ArrowIpcFooterInit(), and released with ArrowIpcFooterReset(). +struct ArrowIpcFooter { + /// \brief the Footer's embedded Schema + struct ArrowSchema schema; + /// \brief all blocks containing RecordBatch Messages + struct ArrowBuffer record_batch_blocks; +}; + +/// \brief Initialize a footer +/// +/// \warning This API is currently only public for use in integration testing; +/// use at your own risk. +void ArrowIpcFooterInit(struct ArrowIpcFooter* footer); + +/// \brief Release all resources attached to an footer +/// +/// \warning This API is currently only public for use in integration testing; +/// use at your own risk. +void ArrowIpcFooterReset(struct ArrowIpcFooter* footer); + +/// \brief Encode a footer for use in an IPC file +/// +/// \warning This API is currently only public for use in integration testing; +/// use at your own risk. +/// +/// Returns ENOMEM if allocation fails, NANOARROW_OK otherwise. +ArrowErrorCode ArrowIpcEncoderEncodeFooter(struct ArrowIpcEncoder* encoder, + const struct ArrowIpcFooter* footer, + struct ArrowError* error); + +/// \brief Peek at a footer +/// +/// The last 10 bytes of an Arrow IPC file are the footer size as a little-endian +/// 32-bit integer followed by the ARROW1 magic. ArrowIpcDecoderPeekFooter() reads +/// these bytes and returns ESPIPE if there are not enough remaining bytes in data +/// to read the entire footer, EINVAL if the last 10 bytes are not valid, +/// or NANOARROW_OK otherwise. +/// +/// The footer size will be stored in decoder.header_size_bytes. +/// +/// \warning This API is currently only public for use in integration testing; +/// use at your own risk. +ArrowErrorCode ArrowIpcDecoderPeekFooter(struct ArrowIpcDecoder* decoder, + struct ArrowBufferView data, + struct ArrowError* error); + +/// \brief Verify a footer +/// +/// Runs ArrowIpcDecoderPeekFooter() to ensure data is sufficiently large but additionally +/// runs flatbuffer verification to ensure that decoding the data will not access +/// memory outside of the buffer specified by data. ArrowIpcDecoderVerifyFooter() will +/// also set decoder.header_size_bytes and decoder.metadata_version. +/// +/// Returns as ArrowIpcDecoderPeekFooter() and additionally will +/// return EINVAL if flatbuffer verification fails. +/// +/// \warning This API is currently only public for use in integration testing; +/// use at your own risk. +ArrowErrorCode ArrowIpcDecoderVerifyFooter(struct ArrowIpcDecoder* decoder, + struct ArrowBufferView data, + struct ArrowError* error); + +/// \brief Decode a footer +/// +/// Runs ArrowIpcDecoderPeekFooter() to ensure data is sufficiently large and decodes +/// the content of the footer. decoder.footer will be set for access to the file's +/// schema and record batches. In almost all cases this should be preceded by a call to +/// ArrowIpcDecoderVerifyFooter() to ensure decoding does not access data outside of the +/// specified buffer. +/// +/// Returns EINVAL if the content of the footer cannot be decoded or ENOTSUP if the +/// content of the footer uses features not supported by this library. +/// +/// \warning This API is currently only public for use in integration testing; +/// use at your own risk. +ArrowErrorCode ArrowIpcDecoderDecodeFooter(struct ArrowIpcDecoder* decoder, + struct ArrowBufferView data, + struct ArrowError* error); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/3rd_party/nanoarrow/nanoarrow/nanoarrow_ipc.hpp b/3rd_party/nanoarrow/nanoarrow/nanoarrow_ipc.hpp new file mode 100644 index 0000000..e1b90cf --- /dev/null +++ b/3rd_party/nanoarrow/nanoarrow/nanoarrow_ipc.hpp @@ -0,0 +1,168 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#ifndef NANOARROW_IPC_HPP_INCLUDED +#define NANOARROW_IPC_HPP_INCLUDED + +#include "nanoarrow/nanoarrow.hpp" +#include "nanoarrow/nanoarrow_ipc.h" + +namespace nanoarrow { + +namespace internal { + +template <> +inline void init_pointer(struct ArrowIpcDecoder* data) { + data->private_data = nullptr; +} + +template <> +inline void move_pointer(struct ArrowIpcDecoder* src, struct ArrowIpcDecoder* dst) { + memcpy(dst, src, sizeof(struct ArrowIpcDecoder)); + src->private_data = nullptr; +} + +template <> +inline void release_pointer(struct ArrowIpcDecoder* data) { + ArrowIpcDecoderReset(data); +} + +template <> +inline void init_pointer(struct ArrowIpcFooter* data) { + ArrowIpcFooterInit(data); +} + +template <> +inline void move_pointer(struct ArrowIpcFooter* src, struct ArrowIpcFooter* dst) { + ArrowSchemaMove(&src->schema, &dst->schema); + ArrowBufferMove(&src->record_batch_blocks, &dst->record_batch_blocks); +} + +template <> +inline void release_pointer(struct ArrowIpcFooter* data) { + ArrowIpcFooterReset(data); +} + +template <> +inline void init_pointer(struct ArrowIpcEncoder* data) { + data->private_data = nullptr; +} + +template <> +inline void move_pointer(struct ArrowIpcEncoder* src, struct ArrowIpcEncoder* dst) { + memcpy(dst, src, sizeof(struct ArrowIpcEncoder)); + src->private_data = nullptr; +} + +template <> +inline void release_pointer(struct ArrowIpcEncoder* data) { + ArrowIpcEncoderReset(data); +} + +template <> +inline void init_pointer(struct ArrowIpcInputStream* data) { + data->release = nullptr; +} + +template <> +inline void move_pointer(struct ArrowIpcInputStream* src, + struct ArrowIpcInputStream* dst) { + memcpy(dst, src, sizeof(struct ArrowIpcInputStream)); + src->release = nullptr; +} + +template <> +inline void release_pointer(struct ArrowIpcInputStream* data) { + if (data->release != nullptr) { + data->release(data); + } +} + +template <> +inline void init_pointer(struct ArrowIpcOutputStream* data) { + data->release = nullptr; +} + +template <> +inline void move_pointer(struct ArrowIpcOutputStream* src, + struct ArrowIpcOutputStream* dst) { + memcpy(dst, src, sizeof(struct ArrowIpcOutputStream)); + src->release = nullptr; +} + +template <> +inline void release_pointer(struct ArrowIpcOutputStream* data) { + if (data->release != nullptr) { + data->release(data); + } +} + +template <> +inline void init_pointer(struct ArrowIpcWriter* data) { + data->private_data = nullptr; +} + +template <> +inline void move_pointer(struct ArrowIpcWriter* src, struct ArrowIpcWriter* dst) { + memcpy(dst, src, sizeof(struct ArrowIpcWriter)); + src->private_data = nullptr; +} + +template <> +inline void release_pointer(struct ArrowIpcWriter* data) { + ArrowIpcWriterReset(data); +} + +} // namespace internal +} // namespace nanoarrow + +namespace nanoarrow { + +namespace ipc { + +/// \defgroup nanoarrow_ipc_hpp-unique Unique object wrappers +/// +/// Extends the unique object wrappers in nanoarrow.hpp to include C structs +/// defined in the nanoarrow_ipc.h header. +/// +/// @{ + +/// \brief Class wrapping a unique struct ArrowIpcDecoder +using UniqueDecoder = internal::Unique; + +/// \brief Class wrapping a unique struct ArrowIpcFooter +using UniqueFooter = internal::Unique; + +/// \brief Class wrapping a unique struct ArrowIpcEncoder +using UniqueEncoder = internal::Unique; + +/// \brief Class wrapping a unique struct ArrowIpcInputStream +using UniqueInputStream = internal::Unique; + +/// \brief Class wrapping a unique struct ArrowIpcOutputStream +using UniqueOutputStream = internal::Unique; + +/// \brief Class wrapping a unique struct ArrowIpcWriter +using UniqueWriter = internal::Unique; + +/// @} + +} // namespace ipc + +} // namespace nanoarrow + +#endif diff --git a/3rd_party/nanoarrow/nanoarrow_ipc.c b/3rd_party/nanoarrow/nanoarrow_ipc.c new file mode 100644 index 0000000..80bd407 --- /dev/null +++ b/3rd_party/nanoarrow/nanoarrow_ipc.c @@ -0,0 +1,29229 @@ +#ifndef FLATBUFFERS_COMMON_READER_H +#define FLATBUFFERS_COMMON_READER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +/* Common FlatBuffers read functionality for C. */ + +#include "flatcc/flatcc_prologue.h" +#include "flatcc/flatcc_flatbuffers.h" + + +#define __flatbuffers_read_scalar_at_byteoffset(N, p, o) N ## _read_from_pe((uint8_t *)(p) + (o)) +#define __flatbuffers_read_scalar(N, p) N ## _read_from_pe(p) +#define __flatbuffers_read_vt(ID, offset, t)\ +flatbuffers_voffset_t offset = 0;\ +{ flatbuffers_voffset_t id__tmp, *vt__tmp;\ + FLATCC_ASSERT(t != 0 && "null pointer table access");\ + id__tmp = ID;\ + vt__tmp = (flatbuffers_voffset_t *)((uint8_t *)(t) -\ + __flatbuffers_soffset_read_from_pe(t));\ + if (__flatbuffers_voffset_read_from_pe(vt__tmp) >= sizeof(vt__tmp[0]) * (id__tmp + 3u)) {\ + offset = __flatbuffers_voffset_read_from_pe(vt__tmp + id__tmp + 2);\ + }\ +} +#define __flatbuffers_field_present(ID, t) { __flatbuffers_read_vt(ID, offset__tmp, t) return offset__tmp != 0; } +#define __flatbuffers_scalar_field(T, ID, t)\ +{\ + __flatbuffers_read_vt(ID, offset__tmp, t)\ + if (offset__tmp) {\ + return (const T *)((uint8_t *)(t) + offset__tmp);\ + }\ + return 0;\ +} +#define __flatbuffers_define_scalar_field(ID, N, NK, TK, T, V)\ +static inline T N ## _ ## NK ## _get(N ## _table_t t__tmp)\ +{ __flatbuffers_read_vt(ID, offset__tmp, t__tmp)\ + return offset__tmp ? __flatbuffers_read_scalar_at_byteoffset(TK, t__tmp, offset__tmp) : V;\ +}\ +static inline T N ## _ ## NK(N ## _table_t t__tmp)\ +{ __flatbuffers_read_vt(ID, offset__tmp, t__tmp)\ + return offset__tmp ? __flatbuffers_read_scalar_at_byteoffset(TK, t__tmp, offset__tmp) : V;\ +}\ +static inline const T *N ## _ ## NK ## _get_ptr(N ## _table_t t__tmp)\ +__flatbuffers_scalar_field(T, ID, t__tmp)\ +static inline int N ## _ ## NK ## _is_present(N ## _table_t t__tmp)\ +__flatbuffers_field_present(ID, t__tmp)\ +__flatbuffers_define_scan_by_scalar_field(N, NK, T) +#define __flatbuffers_define_scalar_optional_field(ID, N, NK, TK, T, V)\ +__flatbuffers_define_scalar_field(ID, N, NK, TK, T, V)\ +static inline TK ## _option_t N ## _ ## NK ## _option(N ## _table_t t__tmp)\ +{ TK ## _option_t ret; __flatbuffers_read_vt(ID, offset__tmp, t__tmp)\ + ret.is_null = offset__tmp == 0; ret.value = offset__tmp ?\ + __flatbuffers_read_scalar_at_byteoffset(TK, t__tmp, offset__tmp) : V;\ + return ret; } +#define __flatbuffers_struct_field(T, ID, t, r)\ +{\ + __flatbuffers_read_vt(ID, offset__tmp, t)\ + if (offset__tmp) {\ + return (T)((uint8_t *)(t) + offset__tmp);\ + }\ + FLATCC_ASSERT(!(r) && "required field missing");\ + return 0;\ +} +#define __flatbuffers_offset_field(T, ID, t, r, adjust)\ +{\ + flatbuffers_uoffset_t *elem__tmp;\ + __flatbuffers_read_vt(ID, offset__tmp, t)\ + if (offset__tmp) {\ + elem__tmp = (flatbuffers_uoffset_t *)((uint8_t *)(t) + offset__tmp);\ + /* Add sizeof so C api can have raw access past header field. */\ + return (T)((uint8_t *)(elem__tmp) + adjust +\ + __flatbuffers_uoffset_read_from_pe(elem__tmp));\ + }\ + FLATCC_ASSERT(!(r) && "required field missing");\ + return 0;\ +} +#define __flatbuffers_vector_field(T, ID, t, r) __flatbuffers_offset_field(T, ID, t, r, sizeof(flatbuffers_uoffset_t)) +#define __flatbuffers_table_field(T, ID, t, r) __flatbuffers_offset_field(T, ID, t, r, 0) +#define __flatbuffers_define_struct_field(ID, N, NK, T, r)\ +static inline T N ## _ ## NK ## _get(N ## _table_t t__tmp)\ +__flatbuffers_struct_field(T, ID, t__tmp, r)\ +static inline T N ## _ ## NK(N ## _table_t t__tmp)\ +__flatbuffers_struct_field(T, ID, t__tmp, r)\ +static inline int N ## _ ## NK ## _is_present(N ## _table_t t__tmp)\ +__flatbuffers_field_present(ID, t__tmp) +#define __flatbuffers_define_vector_field(ID, N, NK, T, r)\ +static inline T N ## _ ## NK ## _get(N ## _table_t t__tmp)\ +__flatbuffers_vector_field(T, ID, t__tmp, r)\ +static inline T N ## _ ## NK(N ## _table_t t__tmp)\ +__flatbuffers_vector_field(T, ID, t__tmp, r)\ +static inline int N ## _ ## NK ## _is_present(N ## _table_t t__tmp)\ +__flatbuffers_field_present(ID, t__tmp) +#define __flatbuffers_define_table_field(ID, N, NK, T, r)\ +static inline T N ## _ ## NK ## _get(N ## _table_t t__tmp)\ +__flatbuffers_table_field(T, ID, t__tmp, r)\ +static inline T N ## _ ## NK(N ## _table_t t__tmp)\ +__flatbuffers_table_field(T, ID, t__tmp, r)\ +static inline int N ## _ ## NK ## _is_present(N ## _table_t t__tmp)\ +__flatbuffers_field_present(ID, t__tmp) +#define __flatbuffers_define_string_field(ID, N, NK, r)\ +static inline flatbuffers_string_t N ## _ ## NK ## _get(N ## _table_t t__tmp)\ +__flatbuffers_vector_field(flatbuffers_string_t, ID, t__tmp, r)\ +static inline flatbuffers_string_t N ## _ ## NK(N ## _table_t t__tmp)\ +__flatbuffers_vector_field(flatbuffers_string_t, ID, t__tmp, r)\ +static inline int N ## _ ## NK ## _is_present(N ## _table_t t__tmp)\ +__flatbuffers_field_present(ID, t__tmp)\ +__flatbuffers_define_scan_by_string_field(N, NK) +#define __flatbuffers_vec_len(vec)\ +{ return (vec) ? (size_t)__flatbuffers_uoffset_read_from_pe((flatbuffers_uoffset_t *)vec - 1) : 0; } +#define __flatbuffers_string_len(s) __flatbuffers_vec_len(s) +static inline size_t flatbuffers_vec_len(const void *vec) +__flatbuffers_vec_len(vec) +#define __flatbuffers_scalar_vec_at(N, vec, i)\ +{ FLATCC_ASSERT(flatbuffers_vec_len(vec) > (i) && "index out of range");\ + return __flatbuffers_read_scalar(N, &(vec)[i]); } +#define __flatbuffers_struct_vec_at(vec, i)\ +{ FLATCC_ASSERT(flatbuffers_vec_len(vec) > (i) && "index out of range"); return (vec) + (i); } +/* `adjust` skips past the header for string vectors. */ +#define __flatbuffers_offset_vec_at(T, vec, i, adjust)\ +{ const flatbuffers_uoffset_t *elem__tmp = (vec) + (i);\ + FLATCC_ASSERT(flatbuffers_vec_len(vec) > (i) && "index out of range");\ + return (T)((uint8_t *)(elem__tmp) + (size_t)__flatbuffers_uoffset_read_from_pe(elem__tmp) + (adjust)); } +#define __flatbuffers_define_scalar_vec_len(N)\ +static inline size_t N ## _vec_len(N ##_vec_t vec__tmp)\ +{ return flatbuffers_vec_len(vec__tmp); } +#define __flatbuffers_define_scalar_vec_at(N, T) \ +static inline T N ## _vec_at(N ## _vec_t vec__tmp, size_t i__tmp)\ +__flatbuffers_scalar_vec_at(N, vec__tmp, i__tmp) +typedef const char *flatbuffers_string_t; +static inline size_t flatbuffers_string_len(flatbuffers_string_t s) +__flatbuffers_string_len(s) +typedef const flatbuffers_uoffset_t *flatbuffers_string_vec_t; +typedef flatbuffers_uoffset_t *flatbuffers_string_mutable_vec_t; +static inline size_t flatbuffers_string_vec_len(flatbuffers_string_vec_t vec) +__flatbuffers_vec_len(vec) +static inline flatbuffers_string_t flatbuffers_string_vec_at(flatbuffers_string_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(flatbuffers_string_t, vec, i, sizeof(vec[0])) +typedef const void *flatbuffers_generic_t; +typedef void *flatbuffers_mutable_generic_t; +static inline flatbuffers_string_t flatbuffers_string_cast_from_generic(const flatbuffers_generic_t p) +{ return p ? ((const char *)p) + __flatbuffers_uoffset__size() : 0; } +typedef const flatbuffers_uoffset_t *flatbuffers_generic_vec_t; +typedef flatbuffers_uoffset_t *flatbuffers_generic_table_mutable_vec_t; +static inline size_t flatbuffers_generic_vec_len(flatbuffers_generic_vec_t vec) +__flatbuffers_vec_len(vec) +static inline flatbuffers_generic_t flatbuffers_generic_vec_at(flatbuffers_generic_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(flatbuffers_generic_t, vec, i, 0) +static inline flatbuffers_generic_t flatbuffers_generic_vec_at_as_string(flatbuffers_generic_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(flatbuffers_generic_t, vec, i, sizeof(vec[0])) +typedef struct flatbuffers_union { + flatbuffers_union_type_t type; + flatbuffers_generic_t value; +} flatbuffers_union_t; +typedef struct flatbuffers_union_vec { + const flatbuffers_union_type_t *type; + const flatbuffers_uoffset_t *value; +} flatbuffers_union_vec_t; +typedef struct flatbuffers_mutable_union { + flatbuffers_union_type_t type; + flatbuffers_mutable_generic_t value; +} flatbuffers_mutable_union_t; +typedef struct flatbuffers_mutable_union_vec { + flatbuffers_union_type_t *type; + flatbuffers_uoffset_t *value; +} flatbuffers_mutable_union_vec_t; +static inline flatbuffers_mutable_union_t flatbuffers_mutable_union_cast(flatbuffers_union_t u__tmp)\ +{ flatbuffers_mutable_union_t mu = { u__tmp.type, (flatbuffers_mutable_generic_t)u__tmp.value };\ + return mu; } +static inline flatbuffers_mutable_union_vec_t flatbuffers_mutable_union_vec_cast(flatbuffers_union_vec_t uv__tmp)\ +{ flatbuffers_mutable_union_vec_t muv =\ + { (flatbuffers_union_type_t *)uv__tmp.type, (flatbuffers_uoffset_t *)uv__tmp.value }; return muv; } +#define __flatbuffers_union_type_field(ID, t)\ +{\ + __flatbuffers_read_vt(ID, offset__tmp, t)\ + return offset__tmp ? __flatbuffers_read_scalar_at_byteoffset(__flatbuffers_utype, t, offset__tmp) : 0;\ +} +static inline flatbuffers_string_t flatbuffers_string_cast_from_union(const flatbuffers_union_t u__tmp)\ +{ return flatbuffers_string_cast_from_generic(u__tmp.value); } +#define __flatbuffers_define_union_field(NS, ID, N, NK, T, r)\ +static inline T ## _union_type_t N ## _ ## NK ## _type_get(N ## _table_t t__tmp)\ +__## NS ## union_type_field(((ID) - 1), t__tmp)\ +static inline NS ## generic_t N ## _ ## NK ## _get(N ## _table_t t__tmp)\ +__## NS ## table_field(NS ## generic_t, ID, t__tmp, r)\ +static inline T ## _union_type_t N ## _ ## NK ## _type(N ## _table_t t__tmp)\ +__## NS ## union_type_field(((ID) - 1), t__tmp)\ +static inline NS ## generic_t N ## _ ## NK(N ## _table_t t__tmp)\ +__## NS ## table_field(NS ## generic_t, ID, t__tmp, r)\ +static inline int N ## _ ## NK ## _is_present(N ## _table_t t__tmp)\ +__## NS ## field_present(ID, t__tmp)\ +static inline T ## _union_t N ## _ ## NK ## _union(N ## _table_t t__tmp)\ +{ T ## _union_t u__tmp = { 0, 0 }; u__tmp.type = N ## _ ## NK ## _type_get(t__tmp);\ + if (u__tmp.type == 0) return u__tmp; u__tmp.value = N ## _ ## NK ## _get(t__tmp); return u__tmp; }\ +static inline NS ## string_t N ## _ ## NK ## _as_string(N ## _table_t t__tmp)\ +{ return NS ## string_cast_from_generic(N ## _ ## NK ## _get(t__tmp)); }\ + +#define __flatbuffers_define_union_vector_ops(NS, T)\ +static inline size_t T ## _union_vec_len(T ## _union_vec_t uv__tmp)\ +{ return NS ## vec_len(uv__tmp.type); }\ +static inline T ## _union_t T ## _union_vec_at(T ## _union_vec_t uv__tmp, size_t i__tmp)\ +{ T ## _union_t u__tmp = { 0, 0 }; size_t n__tmp = NS ## vec_len(uv__tmp.type);\ + FLATCC_ASSERT(n__tmp > (i__tmp) && "index out of range"); u__tmp.type = uv__tmp.type[i__tmp];\ + /* Unknown type is treated as NONE for schema evolution. */\ + if (u__tmp.type == 0) return u__tmp;\ + u__tmp.value = NS ## generic_vec_at(uv__tmp.value, i__tmp); return u__tmp; }\ +static inline NS ## string_t T ## _union_vec_at_as_string(T ## _union_vec_t uv__tmp, size_t i__tmp)\ +{ return (NS ## string_t) NS ## generic_vec_at_as_string(uv__tmp.value, i__tmp); }\ + +#define __flatbuffers_define_union_vector(NS, T)\ +typedef NS ## union_vec_t T ## _union_vec_t;\ +typedef NS ## mutable_union_vec_t T ## _mutable_union_vec_t;\ +static inline T ## _mutable_union_vec_t T ## _mutable_union_vec_cast(T ## _union_vec_t u__tmp)\ +{ return NS ## mutable_union_vec_cast(u__tmp); }\ +__## NS ## define_union_vector_ops(NS, T) +#define __flatbuffers_define_union(NS, T)\ +typedef NS ## union_t T ## _union_t;\ +typedef NS ## mutable_union_t T ## _mutable_union_t;\ +static inline T ## _mutable_union_t T ## _mutable_union_cast(T ## _union_t u__tmp)\ +{ return NS ## mutable_union_cast(u__tmp); }\ +__## NS ## define_union_vector(NS, T) +#define __flatbuffers_define_union_vector_field(NS, ID, N, NK, T, r)\ +__## NS ## define_vector_field(ID - 1, N, NK ## _type, T ## _vec_t, r)\ +__## NS ## define_vector_field(ID, N, NK, flatbuffers_generic_vec_t, r)\ +static inline T ## _union_vec_t N ## _ ## NK ## _union(N ## _table_t t__tmp)\ +{ T ## _union_vec_t uv__tmp; uv__tmp.type = N ## _ ## NK ## _type_get(t__tmp);\ + uv__tmp.value = N ## _ ## NK(t__tmp);\ + FLATCC_ASSERT(NS ## vec_len(uv__tmp.type) == NS ## vec_len(uv__tmp.value)\ + && "union vector type length mismatch"); return uv__tmp; } +#include +static const size_t flatbuffers_not_found = (size_t)-1; +static const size_t flatbuffers_end = (size_t)-1; +#define __flatbuffers_identity(n) (n) +#define __flatbuffers_min(a, b) ((a) < (b) ? (a) : (b)) +/* Subtraction doesn't work for unsigned types. */ +#define __flatbuffers_scalar_cmp(x, y, n) ((x) < (y) ? -1 : (x) > (y)) +static inline int __flatbuffers_string_n_cmp(flatbuffers_string_t v, const char *s, size_t n) +{ size_t nv = flatbuffers_string_len(v); int x = strncmp(v, s, nv < n ? nv : n); + return x != 0 ? x : nv < n ? -1 : nv > n; } +/* `n` arg unused, but needed by string find macro expansion. */ +static inline int __flatbuffers_string_cmp(flatbuffers_string_t v, const char *s, size_t n) { (void)n; return strcmp(v, s); } +/* A = identity if searching scalar vectors rather than key fields. */ +/* Returns lowest matching index or not_found. */ +#define __flatbuffers_find_by_field(A, V, E, L, K, Kn, T, D)\ +{ T v__tmp; size_t a__tmp = 0, b__tmp, m__tmp; if (!(b__tmp = L(V))) { return flatbuffers_not_found; }\ + --b__tmp;\ + while (a__tmp < b__tmp) {\ + m__tmp = a__tmp + ((b__tmp - a__tmp) >> 1);\ + v__tmp = A(E(V, m__tmp));\ + if ((D(v__tmp, (K), (Kn))) < 0) {\ + a__tmp = m__tmp + 1;\ + } else {\ + b__tmp = m__tmp;\ + }\ + }\ + if (a__tmp == b__tmp) {\ + v__tmp = A(E(V, a__tmp));\ + if (D(v__tmp, (K), (Kn)) == 0) {\ + return a__tmp;\ + }\ + }\ + return flatbuffers_not_found;\ +} +#define __flatbuffers_find_by_scalar_field(A, V, E, L, K, T)\ +__flatbuffers_find_by_field(A, V, E, L, K, 0, T, __flatbuffers_scalar_cmp) +#define __flatbuffers_find_by_string_field(A, V, E, L, K)\ +__flatbuffers_find_by_field(A, V, E, L, K, 0, flatbuffers_string_t, __flatbuffers_string_cmp) +#define __flatbuffers_find_by_string_n_field(A, V, E, L, K, Kn)\ +__flatbuffers_find_by_field(A, V, E, L, K, Kn, flatbuffers_string_t, __flatbuffers_string_n_cmp) +#define __flatbuffers_define_find_by_scalar_field(N, NK, TK)\ +static inline size_t N ## _vec_find_by_ ## NK(N ## _vec_t vec__tmp, TK key__tmp)\ +__flatbuffers_find_by_scalar_field(N ## _ ## NK, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, TK) +#define __flatbuffers_define_scalar_find(N, T)\ +static inline size_t N ## _vec_find(N ## _vec_t vec__tmp, T key__tmp)\ +__flatbuffers_find_by_scalar_field(__flatbuffers_identity, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, T) +#define __flatbuffers_define_find_by_string_field(N, NK) \ +/* Note: find only works on vectors sorted by this field. */\ +static inline size_t N ## _vec_find_by_ ## NK(N ## _vec_t vec__tmp, const char *s__tmp)\ +__flatbuffers_find_by_string_field(N ## _ ## NK, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp)\ +static inline size_t N ## _vec_find_n_by_ ## NK(N ## _vec_t vec__tmp, const char *s__tmp, size_t n__tmp)\ +__flatbuffers_find_by_string_n_field(N ## _ ## NK, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp, n__tmp) +#define __flatbuffers_define_default_find_by_scalar_field(N, NK, TK)\ +static inline size_t N ## _vec_find(N ## _vec_t vec__tmp, TK key__tmp)\ +{ return N ## _vec_find_by_ ## NK(vec__tmp, key__tmp); } +#define __flatbuffers_define_default_find_by_string_field(N, NK) \ +static inline size_t N ## _vec_find(N ## _vec_t vec__tmp, const char *s__tmp)\ +{ return N ## _vec_find_by_ ## NK(vec__tmp, s__tmp); }\ +static inline size_t N ## _vec_find_n(N ## _vec_t vec__tmp, const char *s__tmp, size_t n__tmp)\ +{ return N ## _vec_find_n_by_ ## NK(vec__tmp, s__tmp, n__tmp); } +/* A = identity if searching scalar vectors rather than key fields. */ +/* Returns lowest matching index or not_found. */ +#define __flatbuffers_scan_by_field(b, e, A, V, E, L, K, Kn, T, D)\ +{ T v__tmp; size_t i__tmp;\ + for (i__tmp = b; i__tmp < e; ++i__tmp) {\ + v__tmp = A(E(V, i__tmp));\ + if (D(v__tmp, (K), (Kn)) == 0) {\ + return i__tmp;\ + }\ + }\ + return flatbuffers_not_found;\ +} +#define __flatbuffers_rscan_by_field(b, e, A, V, E, L, K, Kn, T, D)\ +{ T v__tmp; size_t i__tmp = e;\ + while (i__tmp-- > b) {\ + v__tmp = A(E(V, i__tmp));\ + if (D(v__tmp, (K), (Kn)) == 0) {\ + return i__tmp;\ + }\ + }\ + return flatbuffers_not_found;\ +} +#define __flatbuffers_scan_by_scalar_field(b, e, A, V, E, L, K, T)\ +__flatbuffers_scan_by_field(b, e, A, V, E, L, K, 0, T, __flatbuffers_scalar_cmp) +#define __flatbuffers_scan_by_string_field(b, e, A, V, E, L, K)\ +__flatbuffers_scan_by_field(b, e, A, V, E, L, K, 0, flatbuffers_string_t, __flatbuffers_string_cmp) +#define __flatbuffers_scan_by_string_n_field(b, e, A, V, E, L, K, Kn)\ +__flatbuffers_scan_by_field(b, e, A, V, E, L, K, Kn, flatbuffers_string_t, __flatbuffers_string_n_cmp) +#define __flatbuffers_rscan_by_scalar_field(b, e, A, V, E, L, K, T)\ +__flatbuffers_rscan_by_field(b, e, A, V, E, L, K, 0, T, __flatbuffers_scalar_cmp) +#define __flatbuffers_rscan_by_string_field(b, e, A, V, E, L, K)\ +__flatbuffers_rscan_by_field(b, e, A, V, E, L, K, 0, flatbuffers_string_t, __flatbuffers_string_cmp) +#define __flatbuffers_rscan_by_string_n_field(b, e, A, V, E, L, K, Kn)\ +__flatbuffers_rscan_by_field(b, e, A, V, E, L, K, Kn, flatbuffers_string_t, __flatbuffers_string_n_cmp) +#define __flatbuffers_define_scan_by_scalar_field(N, NK, T)\ +static inline size_t N ## _vec_scan_by_ ## NK(N ## _vec_t vec__tmp, T key__tmp)\ +__flatbuffers_scan_by_scalar_field(0, N ## _vec_len(vec__tmp), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, T)\ +static inline size_t N ## _vec_scan_ex_by_ ## NK(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, T key__tmp)\ +__flatbuffers_scan_by_scalar_field(begin__tmp, __flatbuffers_min(end__tmp, N ## _vec_len(vec__tmp)), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, T)\ +static inline size_t N ## _vec_rscan_by_ ## NK(N ## _vec_t vec__tmp, T key__tmp)\ +__flatbuffers_rscan_by_scalar_field(0, N ## _vec_len(vec__tmp), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, T)\ +static inline size_t N ## _vec_rscan_ex_by_ ## NK(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, T key__tmp)\ +__flatbuffers_rscan_by_scalar_field(begin__tmp, __flatbuffers_min(end__tmp, N ## _vec_len(vec__tmp)), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, T) +#define __flatbuffers_define_scalar_scan(N, T)\ +static inline size_t N ## _vec_scan(N ## _vec_t vec__tmp, T key__tmp)\ +__flatbuffers_scan_by_scalar_field(0, N ## _vec_len(vec__tmp), __flatbuffers_identity, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, T)\ +static inline size_t N ## _vec_scan_ex(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, T key__tmp)\ +__flatbuffers_scan_by_scalar_field(begin__tmp, __flatbuffers_min(end__tmp, N ## _vec_len(vec__tmp)), __flatbuffers_identity, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, T)\ +static inline size_t N ## _vec_rscan(N ## _vec_t vec__tmp, T key__tmp)\ +__flatbuffers_rscan_by_scalar_field(0, N ## _vec_len(vec__tmp), __flatbuffers_identity, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, T)\ +static inline size_t N ## _vec_rscan_ex(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, T key__tmp)\ +__flatbuffers_rscan_by_scalar_field(begin__tmp, __flatbuffers_min(end__tmp, N ## _vec_len(vec__tmp)), __flatbuffers_identity, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, T) +#define __flatbuffers_define_scan_by_string_field(N, NK) \ +static inline size_t N ## _vec_scan_by_ ## NK(N ## _vec_t vec__tmp, const char *s__tmp)\ +__flatbuffers_scan_by_string_field(0, N ## _vec_len(vec__tmp), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp)\ +static inline size_t N ## _vec_scan_n_by_ ## NK(N ## _vec_t vec__tmp, const char *s__tmp, size_t n__tmp)\ +__flatbuffers_scan_by_string_n_field(0, N ## _vec_len(vec__tmp), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp, n__tmp)\ +static inline size_t N ## _vec_scan_ex_by_ ## NK(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, const char *s__tmp)\ +__flatbuffers_scan_by_string_field(begin__tmp, __flatbuffers_min(end__tmp, N ## _vec_len(vec__tmp)), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp)\ +static inline size_t N ## _vec_scan_ex_n_by_ ## NK(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, const char *s__tmp, size_t n__tmp)\ +__flatbuffers_scan_by_string_n_field(begin__tmp, __flatbuffers_min( end__tmp, N ## _vec_len(vec__tmp)), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp, n__tmp)\ +static inline size_t N ## _vec_rscan_by_ ## NK(N ## _vec_t vec__tmp, const char *s__tmp)\ +__flatbuffers_rscan_by_string_field(0, N ## _vec_len(vec__tmp), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp)\ +static inline size_t N ## _vec_rscan_n_by_ ## NK(N ## _vec_t vec__tmp, const char *s__tmp, size_t n__tmp)\ +__flatbuffers_rscan_by_string_n_field(0, N ## _vec_len(vec__tmp), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp, n__tmp)\ +static inline size_t N ## _vec_rscan_ex_by_ ## NK(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, const char *s__tmp)\ +__flatbuffers_rscan_by_string_field(begin__tmp, __flatbuffers_min(end__tmp, N ## _vec_len(vec__tmp)), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp)\ +static inline size_t N ## _vec_rscan_ex_n_by_ ## NK(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, const char *s__tmp, size_t n__tmp)\ +__flatbuffers_rscan_by_string_n_field(begin__tmp, __flatbuffers_min( end__tmp, N ## _vec_len(vec__tmp)), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp, n__tmp) +#define __flatbuffers_define_default_scan_by_scalar_field(N, NK, TK)\ +static inline size_t N ## _vec_scan(N ## _vec_t vec__tmp, TK key__tmp)\ +{ return N ## _vec_scan_by_ ## NK(vec__tmp, key__tmp); }\ +static inline size_t N ## _vec_scan_ex(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, TK key__tmp)\ +{ return N ## _vec_scan_ex_by_ ## NK(vec__tmp, begin__tmp, end__tmp, key__tmp); }\ +static inline size_t N ## _vec_rscan(N ## _vec_t vec__tmp, TK key__tmp)\ +{ return N ## _vec_rscan_by_ ## NK(vec__tmp, key__tmp); }\ +static inline size_t N ## _vec_rscan_ex(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, TK key__tmp)\ +{ return N ## _vec_rscan_ex_by_ ## NK(vec__tmp, begin__tmp, end__tmp, key__tmp); } +#define __flatbuffers_define_default_scan_by_string_field(N, NK) \ +static inline size_t N ## _vec_scan(N ## _vec_t vec__tmp, const char *s__tmp)\ +{ return N ## _vec_scan_by_ ## NK(vec__tmp, s__tmp); }\ +static inline size_t N ## _vec_scan_n(N ## _vec_t vec__tmp, const char *s__tmp, size_t n__tmp)\ +{ return N ## _vec_scan_n_by_ ## NK(vec__tmp, s__tmp, n__tmp); }\ +static inline size_t N ## _vec_scan_ex(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, const char *s__tmp)\ +{ return N ## _vec_scan_ex_by_ ## NK(vec__tmp, begin__tmp, end__tmp, s__tmp); }\ +static inline size_t N ## _vec_scan_ex_n(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, const char *s__tmp, size_t n__tmp)\ +{ return N ## _vec_scan_ex_n_by_ ## NK(vec__tmp, begin__tmp, end__tmp, s__tmp, n__tmp); }\ +static inline size_t N ## _vec_rscan(N ## _vec_t vec__tmp, const char *s__tmp)\ +{ return N ## _vec_rscan_by_ ## NK(vec__tmp, s__tmp); }\ +static inline size_t N ## _vec_rscan_n(N ## _vec_t vec__tmp, const char *s__tmp, size_t n__tmp)\ +{ return N ## _vec_rscan_n_by_ ## NK(vec__tmp, s__tmp, n__tmp); }\ +static inline size_t N ## _vec_rscan_ex(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, const char *s__tmp)\ +{ return N ## _vec_rscan_ex_by_ ## NK(vec__tmp, begin__tmp, end__tmp, s__tmp); }\ +static inline size_t N ## _vec_rscan_ex_n(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, const char *s__tmp, size_t n__tmp)\ +{ return N ## _vec_rscan_ex_n_by_ ## NK(vec__tmp, begin__tmp, end__tmp, s__tmp, n__tmp); } +#define __flatbuffers_heap_sort(N, X, A, E, L, TK, TE, D, S)\ +static inline void __ ## N ## X ## __heap_sift_down(\ + N ## _mutable_vec_t vec__tmp, size_t start__tmp, size_t end__tmp)\ +{ size_t child__tmp, root__tmp; TK v1__tmp, v2__tmp, vroot__tmp;\ + root__tmp = start__tmp;\ + while ((root__tmp << 1) <= end__tmp) {\ + child__tmp = root__tmp << 1;\ + if (child__tmp < end__tmp) {\ + v1__tmp = A(E(vec__tmp, child__tmp));\ + v2__tmp = A(E(vec__tmp, child__tmp + 1));\ + if (D(v1__tmp, v2__tmp) < 0) {\ + child__tmp++;\ + }\ + }\ + vroot__tmp = A(E(vec__tmp, root__tmp));\ + v1__tmp = A(E(vec__tmp, child__tmp));\ + if (D(vroot__tmp, v1__tmp) < 0) {\ + S(vec__tmp, root__tmp, child__tmp, TE);\ + root__tmp = child__tmp;\ + } else {\ + return;\ + }\ + }\ +}\ +static inline void __ ## N ## X ## __heap_sort(N ## _mutable_vec_t vec__tmp)\ +{ size_t start__tmp, end__tmp, size__tmp;\ + size__tmp = L(vec__tmp); if (size__tmp == 0) return; end__tmp = size__tmp - 1; start__tmp = size__tmp >> 1;\ + do { __ ## N ## X ## __heap_sift_down(vec__tmp, start__tmp, end__tmp); } while (start__tmp--);\ + while (end__tmp > 0) { \ + S(vec__tmp, 0, end__tmp, TE);\ + __ ## N ## X ## __heap_sift_down(vec__tmp, 0, --end__tmp); } } +#define __flatbuffers_define_sort_by_field(N, NK, TK, TE, D, S)\ + __flatbuffers_heap_sort(N, _sort_by_ ## NK, N ## _ ## NK ## _get, N ## _vec_at, N ## _vec_len, TK, TE, D, S)\ +static inline void N ## _vec_sort_by_ ## NK(N ## _mutable_vec_t vec__tmp)\ +{ __ ## N ## _sort_by_ ## NK ## __heap_sort(vec__tmp); } +#define __flatbuffers_define_sort(N, TK, TE, D, S)\ +__flatbuffers_heap_sort(N, , __flatbuffers_identity, N ## _vec_at, N ## _vec_len, TK, TE, D, S)\ +static inline void N ## _vec_sort(N ## _mutable_vec_t vec__tmp) { __ ## N ## __heap_sort(vec__tmp); } +#define __flatbuffers_scalar_diff(x, y) ((x) < (y) ? -1 : (x) > (y)) +#define __flatbuffers_string_diff(x, y) __flatbuffers_string_n_cmp((x), (const char *)(y), flatbuffers_string_len(y)) +#define __flatbuffers_value_swap(vec, a, b, TE) { TE x__tmp = vec[b]; vec[b] = vec[a]; vec[a] = x__tmp; } +#define __flatbuffers_uoffset_swap(vec, a, b, TE)\ +{ TE ta__tmp, tb__tmp, d__tmp;\ + d__tmp = (TE)((a - b) * sizeof(vec[0]));\ + ta__tmp = __flatbuffers_uoffset_read_from_pe(vec + b) - d__tmp;\ + tb__tmp = __flatbuffers_uoffset_read_from_pe(vec + a) + d__tmp;\ + __flatbuffers_uoffset_write_to_pe(vec + a, ta__tmp);\ + __flatbuffers_uoffset_write_to_pe(vec + b, tb__tmp); } +#define __flatbuffers_scalar_swap(vec, a, b, TE) __flatbuffers_value_swap(vec, a, b, TE) +#define __flatbuffers_string_swap(vec, a, b, TE) __flatbuffers_uoffset_swap(vec, a, b, TE) +#define __flatbuffers_struct_swap(vec, a, b, TE) __flatbuffers_value_swap(vec, a, b, TE) +#define __flatbuffers_table_swap(vec, a, b, TE) __flatbuffers_uoffset_swap(vec, a, b, TE) +#define __flatbuffers_define_struct_sort_by_scalar_field(N, NK, TK, TE)\ + __flatbuffers_define_sort_by_field(N, NK, TK, TE, __flatbuffers_scalar_diff, __flatbuffers_struct_swap) +#define __flatbuffers_define_table_sort_by_scalar_field(N, NK, TK)\ + __flatbuffers_define_sort_by_field(N, NK, TK, flatbuffers_uoffset_t, __flatbuffers_scalar_diff, __flatbuffers_table_swap) +#define __flatbuffers_define_table_sort_by_string_field(N, NK)\ + __flatbuffers_define_sort_by_field(N, NK, flatbuffers_string_t, flatbuffers_uoffset_t, __flatbuffers_string_diff, __flatbuffers_table_swap) +#define __flatbuffers_define_scalar_sort(N, T) __flatbuffers_define_sort(N, T, T, __flatbuffers_scalar_diff, __flatbuffers_scalar_swap) +#define __flatbuffers_define_string_sort() __flatbuffers_define_sort(flatbuffers_string, flatbuffers_string_t, flatbuffers_uoffset_t, __flatbuffers_string_diff, __flatbuffers_string_swap) +#define __flatbuffers_sort_vector_field(N, NK, T, t)\ +{ T ## _mutable_vec_t v__tmp = (T ## _mutable_vec_t) N ## _ ## NK ## _get(t);\ + if (v__tmp) T ## _vec_sort(v__tmp); } +#define __flatbuffers_sort_table_field(N, NK, T, t)\ +{ T ## _sort((T ## _mutable_table_t)N ## _ ## NK ## _get(t)); } +#define __flatbuffers_sort_union_field(N, NK, T, t)\ +{ T ## _sort(T ## _mutable_union_cast(N ## _ ## NK ## _union(t))); } +#define __flatbuffers_sort_table_vector_field_elements(N, NK, T, t)\ +{ T ## _vec_t v__tmp = N ## _ ## NK ## _get(t); size_t i__tmp, n__tmp;\ + n__tmp = T ## _vec_len(v__tmp); for (i__tmp = 0; i__tmp < n__tmp; ++i__tmp) {\ + T ## _sort((T ## _mutable_table_t)T ## _vec_at(v__tmp, i__tmp)); }} +#define __flatbuffers_sort_union_vector_field_elements(N, NK, T, t)\ +{ T ## _union_vec_t v__tmp = N ## _ ## NK ## _union(t); size_t i__tmp, n__tmp;\ + n__tmp = T ## _union_vec_len(v__tmp); for (i__tmp = 0; i__tmp < n__tmp; ++i__tmp) {\ + T ## _sort(T ## _mutable_union_cast(T ## _union_vec_at(v__tmp, i__tmp))); }} +#define __flatbuffers_define_scalar_vector(N, T)\ +typedef const T *N ## _vec_t;\ +typedef T *N ## _mutable_vec_t;\ +__flatbuffers_define_scalar_vec_len(N)\ +__flatbuffers_define_scalar_vec_at(N, T)\ +__flatbuffers_define_scalar_find(N, T)\ +__flatbuffers_define_scalar_scan(N, T)\ +__flatbuffers_define_scalar_sort(N, T) + +#define __flatbuffers_define_integer_type(N, T, W)\ +__flatcc_define_integer_accessors(N, T, W, flatbuffers_endian)\ +__flatbuffers_define_scalar_vector(N, T) +__flatbuffers_define_scalar_vector(flatbuffers_bool, flatbuffers_bool_t) +__flatbuffers_define_scalar_vector(flatbuffers_char, char) +__flatbuffers_define_scalar_vector(flatbuffers_uint8, uint8_t) +__flatbuffers_define_scalar_vector(flatbuffers_int8, int8_t) +__flatbuffers_define_scalar_vector(flatbuffers_uint16, uint16_t) +__flatbuffers_define_scalar_vector(flatbuffers_int16, int16_t) +__flatbuffers_define_scalar_vector(flatbuffers_uint32, uint32_t) +__flatbuffers_define_scalar_vector(flatbuffers_int32, int32_t) +__flatbuffers_define_scalar_vector(flatbuffers_uint64, uint64_t) +__flatbuffers_define_scalar_vector(flatbuffers_int64, int64_t) +__flatbuffers_define_scalar_vector(flatbuffers_float, float) +__flatbuffers_define_scalar_vector(flatbuffers_double, double) +__flatbuffers_define_scalar_vector(flatbuffers_union_type, flatbuffers_union_type_t) +static inline size_t flatbuffers_string_vec_find(flatbuffers_string_vec_t vec, const char *s) +__flatbuffers_find_by_string_field(__flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s) +static inline size_t flatbuffers_string_vec_find_n(flatbuffers_string_vec_t vec, const char *s, size_t n) +__flatbuffers_find_by_string_n_field(__flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s, n) +static inline size_t flatbuffers_string_vec_scan(flatbuffers_string_vec_t vec, const char *s) +__flatbuffers_scan_by_string_field(0, flatbuffers_string_vec_len(vec), __flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s) +static inline size_t flatbuffers_string_vec_scan_n(flatbuffers_string_vec_t vec, const char *s, size_t n) +__flatbuffers_scan_by_string_n_field(0, flatbuffers_string_vec_len(vec), __flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s, n) +static inline size_t flatbuffers_string_vec_scan_ex(flatbuffers_string_vec_t vec, size_t begin, size_t end, const char *s) +__flatbuffers_scan_by_string_field(begin, __flatbuffers_min(end, flatbuffers_string_vec_len(vec)), __flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s) +static inline size_t flatbuffers_string_vec_scan_ex_n(flatbuffers_string_vec_t vec, size_t begin, size_t end, const char *s, size_t n) +__flatbuffers_scan_by_string_n_field(begin, __flatbuffers_min(end, flatbuffers_string_vec_len(vec)), __flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s, n) +static inline size_t flatbuffers_string_vec_rscan(flatbuffers_string_vec_t vec, const char *s) +__flatbuffers_rscan_by_string_field(0, flatbuffers_string_vec_len(vec), __flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s) +static inline size_t flatbuffers_string_vec_rscan_n(flatbuffers_string_vec_t vec, const char *s, size_t n) +__flatbuffers_rscan_by_string_n_field(0, flatbuffers_string_vec_len(vec), __flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s, n) +static inline size_t flatbuffers_string_vec_rscan_ex(flatbuffers_string_vec_t vec, size_t begin, size_t end, const char *s) +__flatbuffers_rscan_by_string_field(begin, __flatbuffers_min(end, flatbuffers_string_vec_len(vec)), __flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s) +static inline size_t flatbuffers_string_vec_rscan_ex_n(flatbuffers_string_vec_t vec, size_t begin, size_t end, const char *s, size_t n) +__flatbuffers_rscan_by_string_n_field(begin, __flatbuffers_min(end, flatbuffers_string_vec_len(vec)), __flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s, n) +__flatbuffers_define_string_sort() +#define __flatbuffers_define_struct_scalar_fixed_array_field(N, NK, TK, T, L)\ +static inline T N ## _ ## NK ## _get(N ## _struct_t t__tmp, size_t i__tmp)\ +{ if (!t__tmp || i__tmp >= L) return 0;\ + return __flatbuffers_read_scalar(TK, &(t__tmp->NK[i__tmp])); }\ +static inline const T *N ## _ ## NK ## _get_ptr(N ## _struct_t t__tmp)\ +{ return t__tmp ? t__tmp->NK : 0; }\ +static inline size_t N ## _ ## NK ## _get_len(void) { return L; }\ +static inline T N ## _ ## NK (N ## _struct_t t__tmp, size_t i__tmp)\ +{ return N ## _ ## NK ## _get(t__tmp, i__tmp); } +#define __flatbuffers_define_struct_struct_fixed_array_field(N, NK, T, L)\ +static inline T N ## _ ## NK ## _get(N ## _struct_t t__tmp, size_t i__tmp)\ +{ if (!t__tmp || i__tmp >= L) return 0; return t__tmp->NK + i__tmp; }static inline T N ## _ ## NK ## _get_ptr(N ## _struct_t t__tmp)\ +{ return t__tmp ? t__tmp->NK : 0; }\ +static inline size_t N ## _ ## NK ## _get_len(void) { return L; }\ +static inline T N ## _ ## NK(N ## _struct_t t__tmp, size_t i__tmp)\ +{ if (!t__tmp || i__tmp >= L) return 0; return t__tmp->NK + i__tmp; } +#define __flatbuffers_define_struct_scalar_field(N, NK, TK, T)\ +static inline T N ## _ ## NK ## _get(N ## _struct_t t__tmp)\ +{ return t__tmp ? __flatbuffers_read_scalar(TK, &(t__tmp->NK)) : 0; }\ +static inline const T *N ## _ ## NK ## _get_ptr(N ## _struct_t t__tmp)\ +{ return t__tmp ? &(t__tmp->NK) : 0; }\ +static inline T N ## _ ## NK (N ## _struct_t t__tmp)\ +{ return t__tmp ? __flatbuffers_read_scalar(TK, &(t__tmp->NK)) : 0; }\ +__flatbuffers_define_scan_by_scalar_field(N, NK, T) +#define __flatbuffers_define_struct_struct_field(N, NK, T)\ +static inline T N ## _ ## NK ## _get(N ## _struct_t t__tmp) { return t__tmp ? &(t__tmp->NK) : 0; }\ +static inline T N ## _ ## NK (N ## _struct_t t__tmp) { return t__tmp ? &(t__tmp->NK) : 0; } +/* If fid is null, the function returns true without testing as buffer is not expected to have any id. */ +static inline int flatbuffers_has_identifier(const void *buffer, const char *fid) +{ flatbuffers_thash_t id, id2 = 0; if (fid == 0) { return 1; }; + id2 = flatbuffers_type_hash_from_string(fid); + id = __flatbuffers_thash_read_from_pe(((flatbuffers_uoffset_t *)buffer) + 1); + return id2 == 0 || id == id2; } +static inline int flatbuffers_has_type_hash(const void *buffer, flatbuffers_thash_t thash) +{ return thash == 0 || (__flatbuffers_thash_read_from_pe((flatbuffers_uoffset_t *)buffer + 1) == thash); } + +static inline flatbuffers_thash_t flatbuffers_get_type_hash(const void *buffer) +{ return __flatbuffers_thash_read_from_pe((flatbuffers_uoffset_t *)buffer + 1); } + +#define flatbuffers_verify_endian() flatbuffers_has_identifier("\x00\x00\x00\x00" "1234", "1234") +static inline void *flatbuffers_read_size_prefix(void *b, size_t *size_out) +{ if (size_out) { *size_out = (size_t)__flatbuffers_uoffset_read_from_pe(b); } + return (uint8_t *)b + sizeof(flatbuffers_uoffset_t); } +/* Null file identifier accepts anything, otherwise fid should be 4 characters. */ +#define __flatbuffers_read_root(T, K, buffer, fid)\ + ((!buffer || !flatbuffers_has_identifier(buffer, fid)) ? 0 :\ + ((T ## _ ## K ## t)(((uint8_t *)buffer) +\ + __flatbuffers_uoffset_read_from_pe(buffer)))) +#define __flatbuffers_read_typed_root(T, K, buffer, thash)\ + ((!buffer || !flatbuffers_has_type_hash(buffer, thash)) ? 0 :\ + ((T ## _ ## K ## t)(((uint8_t *)buffer) +\ + __flatbuffers_uoffset_read_from_pe(buffer)))) +#define __flatbuffers_nested_buffer_as_root(C, N, T, K)\ +static inline T ## _ ## K ## t C ## _ ## N ## _as_root_with_identifier(C ## _ ## table_t t__tmp, const char *fid__tmp)\ +{ const uint8_t *buffer__tmp = C ## _ ## N(t__tmp); return __flatbuffers_read_root(T, K, buffer__tmp, fid__tmp); }\ +static inline T ## _ ## K ## t C ## _ ## N ## _as_typed_root(C ## _ ## table_t t__tmp)\ +{ const uint8_t *buffer__tmp = C ## _ ## N(t__tmp); return __flatbuffers_read_root(T, K, buffer__tmp, C ## _ ## type_identifier); }\ +static inline T ## _ ## K ## t C ## _ ## N ## _as_root(C ## _ ## table_t t__tmp)\ +{ const char *fid__tmp = T ## _file_identifier;\ + const uint8_t *buffer__tmp = C ## _ ## N(t__tmp); return __flatbuffers_read_root(T, K, buffer__tmp, fid__tmp); } +#define __flatbuffers_buffer_as_root(N, K)\ +static inline N ## _ ## K ## t N ## _as_root_with_identifier(const void *buffer__tmp, const char *fid__tmp)\ +{ return __flatbuffers_read_root(N, K, buffer__tmp, fid__tmp); }\ +static inline N ## _ ## K ## t N ## _as_root_with_type_hash(const void *buffer__tmp, flatbuffers_thash_t thash__tmp)\ +{ return __flatbuffers_read_typed_root(N, K, buffer__tmp, thash__tmp); }\ +static inline N ## _ ## K ## t N ## _as_root(const void *buffer__tmp)\ +{ const char *fid__tmp = N ## _file_identifier;\ + return __flatbuffers_read_root(N, K, buffer__tmp, fid__tmp); }\ +static inline N ## _ ## K ## t N ## _as_typed_root(const void *buffer__tmp)\ +{ return __flatbuffers_read_typed_root(N, K, buffer__tmp, N ## _type_hash); } +#define __flatbuffers_struct_as_root(N) __flatbuffers_buffer_as_root(N, struct_) +#define __flatbuffers_table_as_root(N) __flatbuffers_buffer_as_root(N, table_) + +#include "flatcc/flatcc_epilogue.h" +#endif /* FLATBUFFERS_COMMON_H */ +#ifndef FLATBUFFERS_COMMON_BUILDER_H +#define FLATBUFFERS_COMMON_BUILDER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +/* Common FlatBuffers build functionality for C. */ + +#include "flatcc/flatcc_prologue.h" +#ifndef FLATBUILDER_H +#include "flatcc/flatcc_builder.h" +#endif +typedef flatcc_builder_t flatbuffers_builder_t; +typedef flatcc_builder_ref_t flatbuffers_ref_t; +typedef flatcc_builder_ref_t flatbuffers_vec_ref_t; +typedef flatcc_builder_union_ref_t flatbuffers_union_ref_t; +typedef flatcc_builder_union_vec_ref_t flatbuffers_union_vec_ref_t; +/* integer return code (ref and ptr always fail on 0) */ +#define flatbuffers_failed(x) ((x) < 0) +typedef flatbuffers_ref_t flatbuffers_root_t; +#define flatbuffers_root(ref) ((flatbuffers_root_t)(ref)) + +#define __flatbuffers_memoize_begin(B, src)\ +do { flatcc_builder_ref_t _ref; if ((_ref = flatcc_builder_refmap_find((B), (src)))) return _ref; } while (0) +#define __flatbuffers_memoize_end(B, src, op) do { return flatcc_builder_refmap_insert((B), (src), (op)); } while (0) +#define __flatbuffers_memoize(B, src, op) do { __flatbuffers_memoize_begin(B, src); __flatbuffers_memoize_end(B, src, op); } while (0) + +#define __flatbuffers_build_buffer(NS)\ +typedef NS ## ref_t NS ## buffer_ref_t;\ +static inline int NS ## buffer_start(NS ## builder_t *B, const NS ##fid_t fid)\ +{ return flatcc_builder_start_buffer(B, fid, 0, 0); }\ +static inline int NS ## buffer_start_with_size(NS ## builder_t *B, const NS ##fid_t fid)\ +{ return flatcc_builder_start_buffer(B, fid, 0, flatcc_builder_with_size); }\ +static inline int NS ## buffer_start_aligned(NS ## builder_t *B, NS ##fid_t fid, uint16_t block_align)\ +{ return flatcc_builder_start_buffer(B, fid, block_align, 0); }\ +static inline int NS ## buffer_start_aligned_with_size(NS ## builder_t *B, NS ##fid_t fid, uint16_t block_align)\ +{ return flatcc_builder_start_buffer(B, fid, block_align, flatcc_builder_with_size); }\ +static inline NS ## buffer_ref_t NS ## buffer_end(NS ## builder_t *B, NS ## ref_t root)\ +{ return flatcc_builder_end_buffer(B, root); } + +#define __flatbuffers_build_table_root(NS, N, FID, TFID)\ +static inline int N ## _start_as_root(NS ## builder_t *B)\ +{ return NS ## buffer_start(B, FID) ? -1 : N ## _start(B); }\ +static inline int N ## _start_as_root_with_size(NS ## builder_t *B)\ +{ return NS ## buffer_start_with_size(B, FID) ? -1 : N ## _start(B); }\ +static inline int N ## _start_as_typed_root(NS ## builder_t *B)\ +{ return NS ## buffer_start(B, TFID) ? -1 : N ## _start(B); }\ +static inline int N ## _start_as_typed_root_with_size(NS ## builder_t *B)\ +{ return NS ## buffer_start_with_size(B, TFID) ? -1 : N ## _start(B); }\ +static inline NS ## buffer_ref_t N ## _end_as_root(NS ## builder_t *B)\ +{ return NS ## buffer_end(B, N ## _end(B)); }\ +static inline NS ## buffer_ref_t N ## _end_as_typed_root(NS ## builder_t *B)\ +{ return NS ## buffer_end(B, N ## _end(B)); }\ +static inline NS ## buffer_ref_t N ## _create_as_root(NS ## builder_t *B __ ## N ## _formal_args)\ +{ if (NS ## buffer_start(B, FID)) return 0; return NS ## buffer_end(B, N ## _create(B __ ## N ## _call_args)); }\ +static inline NS ## buffer_ref_t N ## _create_as_root_with_size(NS ## builder_t *B __ ## N ## _formal_args)\ +{ if (NS ## buffer_start_with_size(B, FID)) return 0; return NS ## buffer_end(B, N ## _create(B __ ## N ## _call_args)); }\ +static inline NS ## buffer_ref_t N ## _create_as_typed_root(NS ## builder_t *B __ ## N ## _formal_args)\ +{ if (NS ## buffer_start(B, TFID)) return 0; return NS ## buffer_end(B, N ## _create(B __ ## N ## _call_args)); }\ +static inline NS ## buffer_ref_t N ## _create_as_typed_root_with_size(NS ## builder_t *B __ ## N ## _formal_args)\ +{ if (NS ## buffer_start_with_size(B, TFID)) return 0; return NS ## buffer_end(B, N ## _create(B __ ## N ## _call_args)); }\ +static inline NS ## buffer_ref_t N ## _clone_as_root(NS ## builder_t *B, N ## _table_t t)\ +{ if (NS ## buffer_start(B, FID)) return 0; return NS ## buffer_end(B, N ## _clone(B, t)); }\ +static inline NS ## buffer_ref_t N ## _clone_as_root_with_size(NS ## builder_t *B, N ## _table_t t)\ +{ if (NS ## buffer_start_with_size(B, FID)) return 0; return NS ## buffer_end(B, N ## _clone(B, t)); }\ +static inline NS ## buffer_ref_t N ## _clone_as_typed_root(NS ## builder_t *B, N ## _table_t t)\ +{ if (NS ## buffer_start(B, TFID)) return 0;return NS ## buffer_end(B, N ## _clone(B, t)); }\ +static inline NS ## buffer_ref_t N ## _clone_as_typed_root_with_size(NS ## builder_t *B, N ## _table_t t)\ +{ if (NS ## buffer_start_with_size(B, TFID)) return 0; return NS ## buffer_end(B, N ## _clone(B, t)); } + +#define __flatbuffers_build_table_prolog(NS, N, FID, TFID)\ +__flatbuffers_build_table_vector_ops(NS, N ## _vec, N)\ +__flatbuffers_build_table_root(NS, N, FID, TFID) + +#define __flatbuffers_build_struct_root(NS, N, A, FID, TFID)\ +static inline N ## _t *N ## _start_as_root(NS ## builder_t *B)\ +{ return NS ## buffer_start(B, FID) ? 0 : N ## _start(B); }\ +static inline N ## _t *N ## _start_as_root_with_size(NS ## builder_t *B)\ +{ return NS ## buffer_start_with_size(B, FID) ? 0 : N ## _start(B); }\ +static inline N ## _t *N ## _start_as_typed_root(NS ## builder_t *B)\ +{ return NS ## buffer_start(B, TFID) ? 0 : N ## _start(B); }\ +static inline N ## _t *N ## _start_as_typed_root_with_size(NS ## builder_t *B)\ +{ return NS ## buffer_start_with_size(B, TFID) ? 0 : N ## _start(B); }\ +static inline NS ## buffer_ref_t N ## _end_as_root(NS ## builder_t *B)\ +{ return NS ## buffer_end(B, N ## _end(B)); }\ +static inline NS ## buffer_ref_t N ## _end_as_typed_root(NS ## builder_t *B)\ +{ return NS ## buffer_end(B, N ## _end(B)); }\ +static inline NS ## buffer_ref_t N ## _end_pe_as_root(NS ## builder_t *B)\ +{ return NS ## buffer_end(B, N ## _end_pe(B)); }\ +static inline NS ## buffer_ref_t N ## _end_pe_as_typed_root(NS ## builder_t *B)\ +{ return NS ## buffer_end(B, N ## _end_pe(B)); }\ +static inline NS ## buffer_ref_t N ## _create_as_root(NS ## builder_t *B __ ## N ## _formal_args)\ +{ return flatcc_builder_create_buffer(B, FID, 0,\ + N ## _create(B __ ## N ## _call_args), A, 0); }\ +static inline NS ## buffer_ref_t N ## _create_as_root_with_size(NS ## builder_t *B __ ## N ## _formal_args)\ +{ return flatcc_builder_create_buffer(B, FID, 0,\ + N ## _create(B __ ## N ## _call_args), A, flatcc_builder_with_size); }\ +static inline NS ## buffer_ref_t N ## _create_as_typed_root(NS ## builder_t *B __ ## N ## _formal_args)\ +{ return flatcc_builder_create_buffer(B, TFID, 0,\ + N ## _create(B __ ## N ## _call_args), A, 0); }\ +static inline NS ## buffer_ref_t N ## _create_as_typed_root_with_size(NS ## builder_t *B __ ## N ## _formal_args)\ +{ return flatcc_builder_create_buffer(B, TFID, 0,\ + N ## _create(B __ ## N ## _call_args), A, flatcc_builder_with_size); }\ +static inline NS ## buffer_ref_t N ## _clone_as_root(NS ## builder_t *B, N ## _struct_t p)\ +{ return flatcc_builder_create_buffer(B, FID, 0, N ## _clone(B, p), A, 0); }\ +static inline NS ## buffer_ref_t N ## _clone_as_root_with_size(NS ## builder_t *B, N ## _struct_t p)\ +{ return flatcc_builder_create_buffer(B, FID, 0, N ## _clone(B, p), A, flatcc_builder_with_size); }\ +static inline NS ## buffer_ref_t N ## _clone_as_typed_root(NS ## builder_t *B, N ## _struct_t p)\ +{ return flatcc_builder_create_buffer(B, TFID, 0, N ## _clone(B, p), A, 0); }\ +static inline NS ## buffer_ref_t N ## _clone_as_typed_root_with_size(NS ## builder_t *B, N ## _struct_t p)\ +{ return flatcc_builder_create_buffer(B, TFID, 0, N ## _clone(B, p), A, flatcc_builder_with_size); } + +#define __flatbuffers_build_nested_table_root(NS, N, TN, FID, TFID)\ +static inline int N ## _start_as_root(NS ## builder_t *B)\ +{ return NS ## buffer_start(B, FID) ? -1 : TN ## _start(B); }\ +static inline int N ## _start_as_typed_root(NS ## builder_t *B)\ +{ return NS ## buffer_start(B, TFID) ? -1 : TN ## _start(B); }\ +static inline int N ## _end_as_root(NS ## builder_t *B)\ +{ return N ## _add(B, NS ## buffer_end(B, TN ## _end(B))); }\ +static inline int N ## _end_as_typed_root(NS ## builder_t *B)\ +{ return N ## _add(B, NS ## buffer_end(B, TN ## _end(B))); }\ +static inline int N ## _nest(NS ## builder_t *B, void *data, size_t size, uint16_t align)\ +{ return N ## _add(B, flatcc_builder_create_vector(B, data, size, 1,\ + align ? align : 8, FLATBUFFERS_COUNT_MAX(1))); }\ +static inline int N ## _typed_nest(NS ## builder_t *B, void *data, size_t size, uint16_t align)\ +{ return N ## _add(B, flatcc_builder_create_vector(B, data, size, 1,\ + align ? align : 8, FLATBUFFERS_COUNT_MAX(1))); }\ +static inline int N ## _clone_as_root(NS ## builder_t *B, TN ## _table_t t)\ +{ return N ## _add(B, TN ## _clone_as_root(B, t)); }\ +static inline int N ## _clone_as_typed_root(NS ## builder_t *B, TN ## _table_t t)\ +{ return N ## _add(B, TN ## _clone_as_typed_root(B, t)); } + +#define __flatbuffers_build_nested_struct_root(NS, N, TN, A, FID, TFID)\ +static inline TN ## _t *N ## _start_as_root(NS ## builder_t *B)\ +{ return NS ## buffer_start(B, FID) ? 0 : TN ## _start(B); }\ +static inline TN ## _t *N ## _start_as_typed_root(NS ## builder_t *B)\ +{ return NS ## buffer_start(B, FID) ? 0 : TN ## _start(B); }\ +static inline int N ## _end_as_root(NS ## builder_t *B)\ +{ return N ## _add(B, NS ## buffer_end(B, TN ## _end(B))); }\ +static inline int N ## _end_as_typed_root(NS ## builder_t *B)\ +{ return N ## _add(B, NS ## buffer_end(B, TN ## _end(B))); }\ +static inline int N ## _end_pe_as_root(NS ## builder_t *B)\ +{ return N ## _add(B, NS ## buffer_end(B, TN ## _end_pe(B))); }\ +static inline int N ## _create_as_root(NS ## builder_t *B __ ## TN ## _formal_args)\ +{ return N ## _add(B, flatcc_builder_create_buffer(B, FID, 0,\ + TN ## _create(B __ ## TN ## _call_args), A, flatcc_builder_is_nested)); }\ +static inline int N ## _create_as_typed_root(NS ## builder_t *B __ ## TN ## _formal_args)\ +{ return N ## _add(B, flatcc_builder_create_buffer(B, TFID, 0,\ + TN ## _create(B __ ## TN ## _call_args), A, flatcc_builder_is_nested)); }\ +static inline int N ## _nest(NS ## builder_t *B, void *data, size_t size, uint16_t align)\ +{ return N ## _add(B, flatcc_builder_create_vector(B, data, size, 1,\ + align < A ? A : align, FLATBUFFERS_COUNT_MAX(1))); }\ +static inline int N ## _typed_nest(NS ## builder_t *B, void *data, size_t size, uint16_t align)\ +{ return N ## _add(B, flatcc_builder_create_vector(B, data, size, 1,\ + align < A ? A : align, FLATBUFFERS_COUNT_MAX(1))); }\ +static inline int N ## _clone_as_root(NS ## builder_t *B, TN ## _struct_t p)\ +{ return N ## _add(B, TN ## _clone_as_root(B, p)); }\ +static inline int N ## _clone_as_typed_root(NS ## builder_t *B, TN ## _struct_t p)\ +{ return N ## _add(B, TN ## _clone_as_typed_root(B, p)); } + +#define __flatbuffers_build_vector_ops(NS, V, N, TN, T)\ +static inline T *V ## _extend(NS ## builder_t *B, size_t len)\ +{ return (T *)flatcc_builder_extend_vector(B, len); }\ +static inline T *V ## _append(NS ## builder_t *B, const T *data, size_t len)\ +{ return (T *)flatcc_builder_append_vector(B, data, len); }\ +static inline int V ## _truncate(NS ## builder_t *B, size_t len)\ +{ return flatcc_builder_truncate_vector(B, len); }\ +static inline T *V ## _edit(NS ## builder_t *B)\ +{ return (T *)flatcc_builder_vector_edit(B); }\ +static inline size_t V ## _reserved_len(NS ## builder_t *B)\ +{ return flatcc_builder_vector_count(B); }\ +static inline T *V ## _push(NS ## builder_t *B, const T *p)\ +{ T *_p; return (_p = (T *)flatcc_builder_extend_vector(B, 1)) ? (memcpy(_p, p, TN ## __size()), _p) : 0; }\ +static inline T *V ## _push_copy(NS ## builder_t *B, const T *p)\ +{ T *_p; return (_p = (T *)flatcc_builder_extend_vector(B, 1)) ? TN ## _copy(_p, p) : 0; }\ +static inline T *V ## _push_clone(NS ## builder_t *B, const T *p)\ +{ T *_p; return (_p = (T *)flatcc_builder_extend_vector(B, 1)) ? TN ## _copy(_p, p) : 0; }\ +static inline T *V ## _push_create(NS ## builder_t *B __ ## TN ## _formal_args)\ +{ T *_p; return (_p = (T *)flatcc_builder_extend_vector(B, 1)) ? TN ## _assign(_p __ ## TN ## _call_args) : 0; } + +#define __flatbuffers_build_vector(NS, N, T, S, A)\ +typedef NS ## ref_t N ## _vec_ref_t;\ +static inline int N ## _vec_start(NS ## builder_t *B)\ +{ return flatcc_builder_start_vector(B, S, A, FLATBUFFERS_COUNT_MAX(S)); }\ +static inline N ## _vec_ref_t N ## _vec_end_pe(NS ## builder_t *B)\ +{ return flatcc_builder_end_vector(B); }\ +static inline N ## _vec_ref_t N ## _vec_end(NS ## builder_t *B)\ +{ if (!NS ## is_native_pe()) { size_t i, n; T *p = (T *)flatcc_builder_vector_edit(B);\ + for (i = 0, n = flatcc_builder_vector_count(B); i < n; ++i)\ + { N ## _to_pe(N ## __ptr_add(p, i)); }} return flatcc_builder_end_vector(B); }\ +static inline N ## _vec_ref_t N ## _vec_create_pe(NS ## builder_t *B, const T *data, size_t len)\ +{ return flatcc_builder_create_vector(B, data, len, S, A, FLATBUFFERS_COUNT_MAX(S)); }\ +static inline N ## _vec_ref_t N ## _vec_create(NS ## builder_t *B, const T *data, size_t len)\ +{ if (!NS ## is_native_pe()) { size_t i; T *p; int ret = flatcc_builder_start_vector(B, S, A, FLATBUFFERS_COUNT_MAX(S)); if (ret) { return ret; }\ + p = (T *)flatcc_builder_extend_vector(B, len); if (!p) return 0;\ + for (i = 0; i < len; ++i) { N ## _copy_to_pe(N ## __ptr_add(p, i), N ## __const_ptr_add(data, i)); }\ + return flatcc_builder_end_vector(B); } else return flatcc_builder_create_vector(B, data, len, S, A, FLATBUFFERS_COUNT_MAX(S)); }\ +static inline N ## _vec_ref_t N ## _vec_clone(NS ## builder_t *B, N ##_vec_t vec)\ +{ __flatbuffers_memoize(B, vec, flatcc_builder_create_vector(B, vec, N ## _vec_len(vec), S, A, FLATBUFFERS_COUNT_MAX(S))); }\ +static inline N ## _vec_ref_t N ## _vec_slice(NS ## builder_t *B, N ##_vec_t vec, size_t index, size_t len)\ +{ size_t n = N ## _vec_len(vec); if (index >= n) index = n; n -= index; if (len > n) len = n;\ + return flatcc_builder_create_vector(B, N ## __const_ptr_add(vec, index), len, S, A, FLATBUFFERS_COUNT_MAX(S)); }\ +__flatbuffers_build_vector_ops(NS, N ## _vec, N, N, T) + +#define __flatbuffers_build_union_vector_ops(NS, V, N, TN)\ +static inline TN ## _union_ref_t *V ## _extend(NS ## builder_t *B, size_t len)\ +{ return flatcc_builder_extend_union_vector(B, len); }\ +static inline TN ## _union_ref_t *V ## _append(NS ## builder_t *B, const TN ## _union_ref_t *data, size_t len)\ +{ return flatcc_builder_append_union_vector(B, data, len); }\ +static inline int V ## _truncate(NS ## builder_t *B, size_t len)\ +{ return flatcc_builder_truncate_union_vector(B, len); }\ +static inline TN ## _union_ref_t *V ## _edit(NS ## builder_t *B)\ +{ return (TN ## _union_ref_t *) flatcc_builder_union_vector_edit(B); }\ +static inline size_t V ## _reserved_len(NS ## builder_t *B)\ +{ return flatcc_builder_union_vector_count(B); }\ +static inline TN ## _union_ref_t *V ## _push(NS ## builder_t *B, const TN ## _union_ref_t ref)\ +{ return flatcc_builder_union_vector_push(B, ref); }\ +static inline TN ## _union_ref_t *V ## _push_clone(NS ## builder_t *B, TN ## _union_t u)\ +{ return TN ## _vec_push(B, TN ## _clone(B, u)); } + +#define __flatbuffers_build_union_vector(NS, N)\ +static inline int N ## _vec_start(NS ## builder_t *B)\ +{ return flatcc_builder_start_union_vector(B); }\ +static inline N ## _union_vec_ref_t N ## _vec_end(NS ## builder_t *B)\ +{ return flatcc_builder_end_union_vector(B); }\ +static inline N ## _union_vec_ref_t N ## _vec_create(NS ## builder_t *B, const N ## _union_ref_t *data, size_t len)\ +{ return flatcc_builder_create_union_vector(B, data, len); }\ +__flatbuffers_build_union_vector_ops(NS, N ## _vec, N, N)\ +/* Preserves DAG structure separately for type and value vector, so a type vector could be shared for many value vectors. */\ +static inline N ## _union_vec_ref_t N ## _vec_clone(NS ## builder_t *B, N ##_union_vec_t vec)\ +{ N ## _union_vec_ref_t _uvref, _ret = { 0, 0 }; NS ## union_ref_t _uref; size_t _i, _len;\ + if (vec.type == 0) return _ret;\ + _uvref.type = flatcc_builder_refmap_find(B, vec.type); _uvref.value = flatcc_builder_refmap_find(B, vec.value);\ + _len = N ## _union_vec_len(vec); if (_uvref.type == 0) {\ + _uvref.type = flatcc_builder_refmap_insert(B, vec.type, (flatcc_builder_create_type_vector(B, vec.type, _len))); }\ + if (_uvref.type == 0) return _ret; if (_uvref.value == 0) {\ + if (flatcc_builder_start_offset_vector(B)) return _ret;\ + for (_i = 0; _i < _len; ++_i) { _uref = N ## _clone(B, N ## _union_vec_at(vec, _i));\ + if (!_uref.value || !(flatcc_builder_offset_vector_push(B, _uref.value))) return _ret; }\ + _uvref.value = flatcc_builder_refmap_insert(B, vec.value, flatcc_builder_end_offset_vector(B));\ + if (_uvref.value == 0) return _ret; } return _uvref; } + +#define __flatbuffers_build_string_vector_ops(NS, N)\ +static inline int N ## _push_start(NS ## builder_t *B)\ +{ return NS ## string_start(B); }\ +static inline NS ## string_ref_t *N ## _push_end(NS ## builder_t *B)\ +{ return NS ## string_vec_push(B, NS ## string_end(B)); }\ +static inline NS ## string_ref_t *N ## _push_create(NS ## builder_t *B, const char *s, size_t len)\ +{ return NS ## string_vec_push(B, NS ## string_create(B, s, len)); }\ +static inline NS ## string_ref_t *N ## _push_create_str(NS ## builder_t *B, const char *s)\ +{ return NS ## string_vec_push(B, NS ## string_create_str(B, s)); }\ +static inline NS ## string_ref_t *N ## _push_create_strn(NS ## builder_t *B, const char *s, size_t max_len)\ +{ return NS ## string_vec_push(B, NS ## string_create_strn(B, s, max_len)); }\ +static inline NS ## string_ref_t *N ## _push_clone(NS ## builder_t *B, NS ## string_t string)\ +{ return NS ## string_vec_push(B, NS ## string_clone(B, string)); }\ +static inline NS ## string_ref_t *N ## _push_slice(NS ## builder_t *B, NS ## string_t string, size_t index, size_t len)\ +{ return NS ## string_vec_push(B, NS ## string_slice(B, string, index, len)); } + +#define __flatbuffers_build_table_vector_ops(NS, N, TN)\ +static inline int N ## _push_start(NS ## builder_t *B)\ +{ return TN ## _start(B); }\ +static inline TN ## _ref_t *N ## _push_end(NS ## builder_t *B)\ +{ return N ## _push(B, TN ## _end(B)); }\ +static inline TN ## _ref_t *N ## _push_create(NS ## builder_t *B __ ## TN ##_formal_args)\ +{ return N ## _push(B, TN ## _create(B __ ## TN ## _call_args)); } + +#define __flatbuffers_build_offset_vector_ops(NS, V, N, TN)\ +static inline TN ## _ref_t *V ## _extend(NS ## builder_t *B, size_t len)\ +{ return flatcc_builder_extend_offset_vector(B, len); }\ +static inline TN ## _ref_t *V ## _append(NS ## builder_t *B, const TN ## _ref_t *data, size_t len)\ +{ return flatcc_builder_append_offset_vector(B, data, len); }\ +static inline int V ## _truncate(NS ## builder_t *B, size_t len)\ +{ return flatcc_builder_truncate_offset_vector(B, len); }\ +static inline TN ## _ref_t *V ## _edit(NS ## builder_t *B)\ +{ return (TN ## _ref_t *)flatcc_builder_offset_vector_edit(B); }\ +static inline size_t V ## _reserved_len(NS ## builder_t *B)\ +{ return flatcc_builder_offset_vector_count(B); }\ +static inline TN ## _ref_t *V ## _push(NS ## builder_t *B, const TN ## _ref_t ref)\ +{ return ref ? flatcc_builder_offset_vector_push(B, ref) : 0; } + +#define __flatbuffers_build_offset_vector(NS, N)\ +typedef NS ## ref_t N ## _vec_ref_t;\ +static inline int N ## _vec_start(NS ## builder_t *B)\ +{ return flatcc_builder_start_offset_vector(B); }\ +static inline N ## _vec_ref_t N ## _vec_end(NS ## builder_t *B)\ +{ return flatcc_builder_end_offset_vector(B); }\ +static inline N ## _vec_ref_t N ## _vec_create(NS ## builder_t *B, const N ## _ref_t *data, size_t len)\ +{ return flatcc_builder_create_offset_vector(B, data, len); }\ +__flatbuffers_build_offset_vector_ops(NS, N ## _vec, N, N)\ +static inline N ## _vec_ref_t N ## _vec_clone(NS ## builder_t *B, N ##_vec_t vec)\ +{ int _ret; N ## _ref_t _e; size_t _i, _len; __flatbuffers_memoize_begin(B, vec);\ + _len = N ## _vec_len(vec); if (flatcc_builder_start_offset_vector(B)) return 0;\ + for (_i = 0; _i < _len; ++_i) { if (!(_e = N ## _clone(B, N ## _vec_at(vec, _i)))) return 0;\ + if (!flatcc_builder_offset_vector_push(B, _e)) return 0; }\ + __flatbuffers_memoize_end(B, vec, flatcc_builder_end_offset_vector(B)); }\ + +#define __flatbuffers_build_string_ops(NS, N)\ +static inline char *N ## _append(NS ## builder_t *B, const char *s, size_t len)\ +{ return flatcc_builder_append_string(B, s, len); }\ +static inline char *N ## _append_str(NS ## builder_t *B, const char *s)\ +{ return flatcc_builder_append_string_str(B, s); }\ +static inline char *N ## _append_strn(NS ## builder_t *B, const char *s, size_t len)\ +{ return flatcc_builder_append_string_strn(B, s, len); }\ +static inline size_t N ## _reserved_len(NS ## builder_t *B)\ +{ return flatcc_builder_string_len(B); }\ +static inline char *N ## _extend(NS ## builder_t *B, size_t len)\ +{ return flatcc_builder_extend_string(B, len); }\ +static inline char *N ## _edit(NS ## builder_t *B)\ +{ return flatcc_builder_string_edit(B); }\ +static inline int N ## _truncate(NS ## builder_t *B, size_t len)\ +{ return flatcc_builder_truncate_string(B, len); } + +#define __flatbuffers_build_string(NS)\ +typedef NS ## ref_t NS ## string_ref_t;\ +static inline int NS ## string_start(NS ## builder_t *B)\ +{ return flatcc_builder_start_string(B); }\ +static inline NS ## string_ref_t NS ## string_end(NS ## builder_t *B)\ +{ return flatcc_builder_end_string(B); }\ +static inline NS ## ref_t NS ## string_create(NS ## builder_t *B, const char *s, size_t len)\ +{ return flatcc_builder_create_string(B, s, len); }\ +static inline NS ## ref_t NS ## string_create_str(NS ## builder_t *B, const char *s)\ +{ return flatcc_builder_create_string_str(B, s); }\ +static inline NS ## ref_t NS ## string_create_strn(NS ## builder_t *B, const char *s, size_t len)\ +{ return flatcc_builder_create_string_strn(B, s, len); }\ +static inline NS ## string_ref_t NS ## string_clone(NS ## builder_t *B, NS ## string_t string)\ +{ __flatbuffers_memoize(B, string, flatcc_builder_create_string(B, string, NS ## string_len(string))); }\ +static inline NS ## string_ref_t NS ## string_slice(NS ## builder_t *B, NS ## string_t string, size_t index, size_t len)\ +{ size_t n = NS ## string_len(string); if (index >= n) index = n; n -= index; if (len > n) len = n;\ + return flatcc_builder_create_string(B, string + index, len); }\ +__flatbuffers_build_string_ops(NS, NS ## string)\ +__flatbuffers_build_offset_vector(NS, NS ## string) + +#define __flatbuffers_copy_from_pe(P, P2, N) (*(P) = N ## _read_from_pe(P2), (P)) +#define __flatbuffers_from_pe(P, N) (*(P) = N ## _read_from_pe(P), (P)) +#define __flatbuffers_copy_to_pe(P, P2, N) (N ## _write_to_pe((P), *(P2)), (P)) +#define __flatbuffers_to_pe(P, N) (N ## _write_to_pe((P), *(P)), (P)) +#define __flatbuffers_define_fixed_array_primitives(NS, N, T)\ +static inline T *N ## _array_copy(T *p, const T *p2, size_t n)\ +{ memcpy(p, p2, n * sizeof(T)); return p; }\ +static inline T *N ## _array_copy_from_pe(T *p, const T *p2, size_t n)\ +{ size_t i; if (NS ## is_native_pe()) memcpy(p, p2, n * sizeof(T)); else\ + for (i = 0; i < n; ++i) N ## _copy_from_pe(&p[i], &p2[i]); return p; }\ +static inline T *N ## _array_copy_to_pe(T *p, const T *p2, size_t n)\ +{ size_t i; if (NS ## is_native_pe()) memcpy(p, p2, n * sizeof(T)); else\ + for (i = 0; i < n; ++i) N ## _copy_to_pe(&p[i], &p2[i]); return p; } +#define __flatbuffers_define_scalar_primitives(NS, N, T)\ +static inline T *N ## _from_pe(T *p) { return __ ## NS ## from_pe(p, N); }\ +static inline T *N ## _to_pe(T *p) { return __ ## NS ## to_pe(p, N); }\ +static inline T *N ## _copy(T *p, const T *p2) { *p = *p2; return p; }\ +static inline T *N ## _copy_from_pe(T *p, const T *p2)\ +{ return __ ## NS ## copy_from_pe(p, p2, N); }\ +static inline T *N ## _copy_to_pe(T *p, const T *p2) \ +{ return __ ## NS ## copy_to_pe(p, p2, N); }\ +static inline T *N ## _assign(T *p, const T v0) { *p = v0; return p; }\ +static inline T *N ## _assign_from_pe(T *p, T v0)\ +{ *p = N ## _read_from_pe(&v0); return p; }\ +static inline T *N ## _assign_to_pe(T *p, T v0)\ +{ N ## _write_to_pe(p, v0); return p; } +#define __flatbuffers_build_scalar(NS, N, T)\ +__ ## NS ## define_scalar_primitives(NS, N, T)\ +__ ## NS ## define_fixed_array_primitives(NS, N, T)\ +__ ## NS ## build_vector(NS, N, T, sizeof(T), sizeof(T)) +/* Depends on generated copy_to/from_pe functions, and the type. */ +#define __flatbuffers_define_struct_primitives(NS, N)\ +static inline N ## _t *N ##_to_pe(N ## _t *p)\ +{ if (!NS ## is_native_pe()) { N ## _copy_to_pe(p, p); }; return p; }\ +static inline N ## _t *N ##_from_pe(N ## _t *p)\ +{ if (!NS ## is_native_pe()) { N ## _copy_from_pe(p, p); }; return p; }\ +static inline N ## _t *N ## _clear(N ## _t *p) { return (N ## _t *)memset(p, 0, N ## __size()); } + +/* Depends on generated copy/assign_to/from_pe functions, and the type. */ +#define __flatbuffers_build_struct(NS, N, S, A, FID, TFID)\ +__ ## NS ## define_struct_primitives(NS, N)\ +typedef NS ## ref_t N ## _ref_t;\ +static inline N ## _t *N ## _start(NS ## builder_t *B)\ +{ return (N ## _t *)flatcc_builder_start_struct(B, S, A); }\ +static inline N ## _ref_t N ## _end(NS ## builder_t *B)\ +{ if (!NS ## is_native_pe()) { N ## _to_pe((N ## _t *)flatcc_builder_struct_edit(B)); }\ + return flatcc_builder_end_struct(B); }\ +static inline N ## _ref_t N ## _end_pe(NS ## builder_t *B)\ +{ return flatcc_builder_end_struct(B); }\ +static inline N ## _ref_t N ## _create(NS ## builder_t *B __ ## N ## _formal_args)\ +{ N ## _t *_p = N ## _start(B); if (!_p) return 0; N ##_assign_to_pe(_p __ ## N ## _call_args);\ + return N ## _end_pe(B); }\ +static inline N ## _ref_t N ## _clone(NS ## builder_t *B, N ## _struct_t p)\ +{ N ## _t *_p; __flatbuffers_memoize_begin(B, p); _p = N ## _start(B); if (!_p) return 0;\ + N ## _copy(_p, p); __flatbuffers_memoize_end(B, p, N ##_end_pe(B)); }\ +__flatbuffers_build_vector(NS, N, N ## _t, S, A)\ +__flatbuffers_build_struct_root(NS, N, A, FID, TFID)\ + +#define __flatbuffers_struct_clear_field(p) memset((p), 0, sizeof(*(p))) +#define __flatbuffers_build_table(NS, N, K)\ +static inline int N ## _start(NS ## builder_t *B)\ +{ return flatcc_builder_start_table(B, K); }\ +static inline N ## _ref_t N ## _end(NS ## builder_t *B)\ +{ FLATCC_ASSERT(flatcc_builder_check_required(B, __ ## N ## _required,\ + sizeof(__ ## N ## _required) / sizeof(__ ## N ## _required[0]) - 1));\ + return flatcc_builder_end_table(B); }\ +__flatbuffers_build_offset_vector(NS, N) + +#define __flatbuffers_build_table_field(ID, NS, N, TN, TT)\ +static inline int N ## _add(NS ## builder_t *B, TN ## _ref_t ref)\ +{ TN ## _ref_t *_p; return (ref && (_p = flatcc_builder_table_add_offset(B, ID))) ?\ + ((*_p = ref), 0) : -1; }\ +static inline int N ## _start(NS ## builder_t *B)\ +{ return TN ## _start(B); }\ +static inline int N ## _end(NS ## builder_t *B)\ +{ return N ## _add(B, TN ## _end(B)); }\ +static inline TN ## _ref_t N ## _create(NS ## builder_t *B __ ## TN ##_formal_args)\ +{ return N ## _add(B, TN ## _create(B __ ## TN ## _call_args)); }\ +static inline int N ## _clone(NS ## builder_t *B, TN ## _table_t p)\ +{ return N ## _add(B, TN ## _clone(B, p)); }\ +static inline int N ## _pick(NS ## builder_t *B, TT ## _table_t t)\ +{ TN ## _table_t _p = N ## _get(t); return _p ? N ## _clone(B, _p) : 0; } + +#define __flatbuffers_build_union_field(ID, NS, N, TN, TT)\ +static inline int N ## _add(NS ## builder_t *B, TN ## _union_ref_t uref)\ +{ NS ## ref_t *_p; TN ## _union_type_t *_pt; if (uref.type == TN ## _NONE) return 0; if (uref.value == 0) return -1;\ + if (!(_pt = (TN ## _union_type_t *)flatcc_builder_table_add(B, ID - 1, sizeof(*_pt), sizeof(*_pt)))) return -1;\ + *_pt = uref.type; if (!(_p = flatcc_builder_table_add_offset(B, ID))) return -1; *_p = uref.value; return 0; }\ +static inline int N ## _add_type(NS ## builder_t *B, TN ## _union_type_t type)\ +{ TN ## _union_type_t *_pt; if (type == TN ## _NONE) return 0; return (_pt = (TN ## _union_type_t *)flatcc_builder_table_add(B, ID - 1,\ + sizeof(*_pt), sizeof(*_pt))) ? ((*_pt = type), 0) : -1; }\ +static inline int N ## _add_value(NS ## builder_t *B, TN ## _union_ref_t uref)\ +{ NS ## ref_t *p; if (uref.type == TN ## _NONE) return 0; return (p = flatcc_builder_table_add_offset(B, ID)) ?\ + ((*p = uref.value), 0) : -1; }\ +static inline int N ## _clone(NS ## builder_t *B, TN ## _union_t p)\ +{ return N ## _add(B, TN ## _clone(B, p)); }\ +static inline int N ## _pick(NS ## builder_t *B, TT ## _table_t t)\ +{ TN ## _union_t _p = N ## _union(t); return _p.type ? N ## _clone(B, _p) : 0; } + +/* M is the union value name and T is its type, i.e. the qualified name. */ +#define __flatbuffers_build_union_table_value_field(NS, N, NU, M, T)\ +static inline int N ## _ ## M ## _add(NS ## builder_t *B, T ## _ref_t ref)\ +{ return N ## _add(B, NU ## _as_ ## M (ref)); }\ +static inline int N ## _ ## M ## _start(NS ## builder_t *B)\ +{ return T ## _start(B); }\ +static inline int N ## _ ## M ## _end(NS ## builder_t *B)\ +{ T ## _ref_t ref = T ## _end(B);\ + return ref ? N ## _ ## M ## _add(B, ref) : -1; }\ +static inline int N ## _ ## M ## _create(NS ## builder_t *B __ ## T ##_formal_args)\ +{ T ## _ref_t ref = T ## _create(B __ ## T ## _call_args);\ + return ref ? N ## _add(B, NU ## _as_ ## M(ref)) : -1; }\ +static inline int N ## _ ## M ## _clone(NS ## builder_t *B, T ## _table_t t)\ +{ T ## _ref_t ref = T ## _clone(B, t);\ + return ref ? N ## _add(B, NU ## _as_ ## M(ref)) : -1; } + +/* M is the union value name and T is its type, i.e. the qualified name. */ +#define __flatbuffers_build_union_struct_value_field(NS, N, NU, M, T)\ +static inline int N ## _ ## M ## _add(NS ## builder_t *B, T ## _ref_t ref)\ +{ return N ## _add(B, NU ## _as_ ## M (ref)); }\ +static inline T ## _t *N ## _ ## M ## _start(NS ## builder_t *B)\ +{ return T ## _start(B); }\ +static inline int N ## _ ## M ## _end(NS ## builder_t *B)\ +{ T ## _ref_t ref = T ## _end(B);\ + return ref ? N ## _ ## M ## _add(B, ref) : -1; }\ +static inline int N ## _ ## M ## _create(NS ## builder_t *B __ ## T ##_formal_args)\ +{ T ## _ref_t ref = T ## _create(B __ ## T ## _call_args);\ + return ref ? N ## _add(B, NU ## _as_ ## M(ref)) : -1; }\ +static inline int N ## _ ## M ## _end_pe(NS ## builder_t *B)\ +{ T ## _ref_t ref = T ## _end_pe(B);\ + return ref ? N ## _add(B, NU ## _as_ ## M(ref)) : -1; }\ +static inline int N ## _ ## M ## _clone(NS ## builder_t *B, T ## _struct_t p)\ +{ T ## _ref_t ref = T ## _clone(B, p);\ + return ref ? N ## _add(B, NU ## _as_ ## M(ref)) : -1; } +#define __flatbuffers_build_union_string_value_field(NS, N, NU, M)\ +static inline int N ## _ ## M ## _add(NS ## builder_t *B, NS ## string_ref_t ref)\ +{ return N ## _add(B, NU ## _as_ ## M (ref)); }\ +__flatbuffers_build_string_field_ops(NS, N ## _ ## M) + +/* NS: common namespace, ID: table field id (not offset), TN: name of type T, TT: name of table type + * S: sizeof of scalar type, A: alignment of type T, default value V of type T. */ +#define __flatbuffers_build_scalar_field(ID, NS, N, TN, T, S, A, V, TT)\ +static inline int N ## _add(NS ## builder_t *B, const T v)\ +{ T *_p; if (v == V) return 0; if (!(_p = (T *)flatcc_builder_table_add(B, ID, S, A))) return -1;\ + TN ## _assign_to_pe(_p, v); return 0; }\ +static inline int N ## _force_add(NS ## builder_t *B, const T v)\ +{ T *_p; if (!(_p = (T *)flatcc_builder_table_add(B, ID, S, A))) return -1;\ + TN ## _assign_to_pe(_p, v); return 0; }\ +/* Clone does not skip default values and expects pe endian content. */\ +static inline int N ## _clone(NS ## builder_t *B, const T *p)\ +{ return 0 == flatcc_builder_table_add_copy(B, ID, p, S, A) ? -1 : 0; }\ +/* Transferring a missing field is a nop success with 0 as result. */\ +static inline int N ## _pick(NS ## builder_t *B, TT ## _table_t t)\ +{ const T *_p = N ## _get_ptr(t); return _p ? N ## _clone(B, _p) : 0; } + +/* NS: common namespace, ID: table field id (not offset), TN: name of type T, TT: name of table type + * S: sizeof of scalar type, A: alignment of type T. */ +#define __flatbuffers_build_scalar_optional_field(ID, NS, N, TN, T, S, A, TT)\ +static inline int N ## _add(NS ## builder_t *B, const T v)\ +{ T *_p; if (!(_p = (T *)flatcc_builder_table_add(B, ID, S, A))) return -1;\ + TN ## _assign_to_pe(_p, v); return 0; }\ +/* Clone does not skip default values and expects pe endian content. */\ +static inline int N ## _clone(NS ## builder_t *B, const T *p)\ +{ return 0 == flatcc_builder_table_add_copy(B, ID, p, S, A) ? -1 : 0; }\ +/* Transferring a missing field is a nop success with 0 as result. */\ +static inline int N ## _pick(NS ## builder_t *B, TT ## _table_t t)\ +{ const T *_p = N ## _get_ptr(t); return _p ? N ## _clone(B, _p) : 0; } + +#define __flatbuffers_build_struct_field(ID, NS, N, TN, S, A, TT)\ +static inline TN ## _t *N ## _start(NS ## builder_t *B)\ +{ return (TN ## _t *)flatcc_builder_table_add(B, ID, S, A); }\ +static inline int N ## _end(NS ## builder_t *B)\ +{ if (!NS ## is_native_pe()) { TN ## _to_pe((TN ## _t *)flatcc_builder_table_edit(B, S)); } return 0; }\ +static inline int N ## _end_pe(NS ## builder_t *B) { return 0; }\ +static inline int N ## _create(NS ## builder_t *B __ ## TN ## _formal_args)\ +{ TN ## _t *_p = N ## _start(B); if (!_p) return -1; TN ##_assign_to_pe(_p __ ## TN ## _call_args);\ + return 0; }\ +static inline int N ## _add(NS ## builder_t *B, const TN ## _t *p)\ +{ TN ## _t *_p = N ## _start(B); if (!_p) return -1; TN ##_copy_to_pe(_p, p); return 0; }\ +static inline int N ## _clone(NS ## builder_t *B, TN ## _struct_t p)\ +{ return 0 == flatcc_builder_table_add_copy(B, ID, p, S, A) ? -1 : 0; }\ +static inline int N ## _pick(NS ## builder_t *B, TT ## _table_t t)\ +{ TN ## _struct_t _p = N ## _get(t); return _p ? N ## _clone(B, _p) : 0; } + +#define __flatbuffers_build_vector_field(ID, NS, N, TN, T, TT)\ +static inline int N ## _add(NS ## builder_t *B, TN ## _vec_ref_t ref)\ +{ TN ## _vec_ref_t *_p; return (ref && (_p = flatcc_builder_table_add_offset(B, ID))) ? ((*_p = ref), 0) : -1; }\ +static inline int N ## _start(NS ## builder_t *B)\ +{ return TN ## _vec_start(B); }\ +static inline int N ## _end_pe(NS ## builder_t *B)\ +{ return N ## _add(B, TN ## _vec_end_pe(B)); }\ +static inline int N ## _end(NS ## builder_t *B)\ +{ return N ## _add(B, TN ## _vec_end(B)); }\ +static inline int N ## _create_pe(NS ## builder_t *B, const T *data, size_t len)\ +{ return N ## _add(B, TN ## _vec_create_pe(B, data, len)); }\ +static inline int N ## _create(NS ## builder_t *B, const T *data, size_t len)\ +{ return N ## _add(B, TN ## _vec_create(B, data, len)); }\ +static inline int N ## _slice(NS ## builder_t *B, TN ## _vec_t vec, size_t index, size_t len)\ +{ return N ## _add(B, TN ## _vec_slice(B, vec, index, len)); }\ +static inline int N ## _clone(NS ## builder_t *B, TN ## _vec_t vec)\ +{ return N ## _add(B, TN ## _vec_clone(B, vec)); }\ +static inline int N ## _pick(NS ## builder_t *B, TT ## _table_t t)\ +{ TN ## _vec_t _p = N ## _get(t); return _p ? N ## _clone(B, _p) : 0; }\ +__flatbuffers_build_vector_ops(NS, N, N, TN, T)\ + +#define __flatbuffers_build_offset_vector_field(ID, NS, N, TN, TT)\ +static inline int N ## _add(NS ## builder_t *B, TN ## _vec_ref_t ref)\ +{ TN ## _vec_ref_t *_p; return (ref && (_p = flatcc_builder_table_add_offset(B, ID))) ? ((*_p = ref), 0) : -1; }\ +static inline int N ## _start(NS ## builder_t *B)\ +{ return flatcc_builder_start_offset_vector(B); }\ +static inline int N ## _end(NS ## builder_t *B)\ +{ return N ## _add(B, flatcc_builder_end_offset_vector(B)); }\ +static inline int N ## _create(NS ## builder_t *B, const TN ## _ref_t *data, size_t len)\ +{ return N ## _add(B, flatcc_builder_create_offset_vector(B, data, len)); }\ +__flatbuffers_build_offset_vector_ops(NS, N, N, TN)\ +static inline int N ## _clone(NS ## builder_t *B, TN ## _vec_t vec)\ +{ return N ## _add(B, TN ## _vec_clone(B, vec)); }\ +static inline int N ## _pick(NS ## builder_t *B, TT ## _table_t t)\ +{ TN ## _vec_t _p = N ## _get(t); return _p ? N ## _clone(B, _p) : 0; } + +/* depends on N ## _add which differs for union member fields and ordinary fields */\ +#define __flatbuffers_build_string_field_ops(NS, N)\ +static inline int N ## _start(NS ## builder_t *B)\ +{ return flatcc_builder_start_string(B); }\ +static inline int N ## _end(NS ## builder_t *B)\ +{ return N ## _add(B, flatcc_builder_end_string(B)); }\ +static inline int N ## _create(NS ## builder_t *B, const char *s, size_t len)\ +{ return N ## _add(B, flatcc_builder_create_string(B, s, len)); }\ +static inline int N ## _create_str(NS ## builder_t *B, const char *s)\ +{ return N ## _add(B, flatcc_builder_create_string_str(B, s)); }\ +static inline int N ## _create_strn(NS ## builder_t *B, const char *s, size_t max_len)\ +{ return N ## _add(B, flatcc_builder_create_string_strn(B, s, max_len)); }\ +static inline int N ## _clone(NS ## builder_t *B, NS ## string_t string)\ +{ return N ## _add(B, NS ## string_clone(B, string)); }\ +static inline int N ## _slice(NS ## builder_t *B, NS ## string_t string, size_t index, size_t len)\ +{ return N ## _add(B, NS ## string_slice(B, string, index, len)); }\ +__flatbuffers_build_string_ops(NS, N) + +#define __flatbuffers_build_string_field(ID, NS, N, TT)\ +static inline int N ## _add(NS ## builder_t *B, NS ## string_ref_t ref)\ +{ NS ## string_ref_t *_p; return (ref && (_p = flatcc_builder_table_add_offset(B, ID))) ? ((*_p = ref), 0) : -1; }\ +__flatbuffers_build_string_field_ops(NS, N)\ +static inline int N ## _pick(NS ## builder_t *B, TT ## _table_t t)\ +{ NS ## string_t _p = N ## _get(t); return _p ? N ## _clone(B, _p) : 0; } + +#define __flatbuffers_build_table_vector_field(ID, NS, N, TN, TT)\ +__flatbuffers_build_offset_vector_field(ID, NS, N, TN, TT)\ +__flatbuffers_build_table_vector_ops(NS, N, TN) + +#define __flatbuffers_build_union_vector_field(ID, NS, N, TN, TT)\ +static inline int N ## _add(NS ## builder_t *B, TN ## _union_vec_ref_t uvref)\ +{ NS ## vec_ref_t *_p; if (!uvref.type || !uvref.value) return uvref.type == uvref.value ? 0 : -1;\ + if (!(_p = flatcc_builder_table_add_offset(B, ID - 1))) return -1; *_p = uvref.type;\ + if (!(_p = flatcc_builder_table_add_offset(B, ID))) return -1; *_p = uvref.value; return 0; }\ +static inline int N ## _start(NS ## builder_t *B)\ +{ return flatcc_builder_start_union_vector(B); }\ +static inline int N ## _end(NS ## builder_t *B)\ +{ return N ## _add(B, flatcc_builder_end_union_vector(B)); }\ +static inline int N ## _create(NS ## builder_t *B, const TN ## _union_ref_t *data, size_t len)\ +{ return N ## _add(B, flatcc_builder_create_union_vector(B, data, len)); }\ +__flatbuffers_build_union_vector_ops(NS, N, N, TN)\ +static inline int N ## _clone(NS ## builder_t *B, TN ## _union_vec_t vec)\ +{ return N ## _add(B, TN ## _vec_clone(B, vec)); }\ +static inline int N ## _pick(NS ## builder_t *B, TT ## _table_t t)\ +{ TN ## _union_vec_t _p = N ## _union(t); return _p.type ? N ## _clone(B, _p) : 0; } + +#define __flatbuffers_build_union_table_vector_value_field(NS, N, NU, M, T)\ +static inline int N ## _ ## M ## _push_start(NS ## builder_t *B)\ +{ return T ## _start(B); }\ +static inline NU ## _union_ref_t *N ## _ ## M ## _push_end(NS ## builder_t *B)\ +{ return NU ## _vec_push(B, NU ## _as_ ## M (T ## _end(B))); }\ +static inline NU ## _union_ref_t *N ## _ ## M ## _push(NS ## builder_t *B, T ## _ref_t ref)\ +{ return NU ## _vec_push(B, NU ## _as_ ## M (ref)); }\ +static inline NU ## _union_ref_t *N ## _ ## M ## _push_create(NS ## builder_t *B __ ## T ##_formal_args)\ +{ return NU ## _vec_push(B, NU ## _as_ ## M(T ## _create(B __ ## T ## _call_args))); }\ +static inline NU ## _union_ref_t *N ## _ ## M ## _push_clone(NS ## builder_t *B, T ## _table_t t)\ +{ return NU ## _vec_push(B, NU ## _as_ ## M(T ## _clone(B, t))); } + +#define __flatbuffers_build_union_struct_vector_value_field(NS, N, NU, M, T)\ +static inline T ## _t *N ## _ ## M ## _push_start(NS ## builder_t *B)\ +{ return T ## _start(B); }\ +static inline NU ## _union_ref_t *N ## _ ## M ## _push_end(NS ## builder_t *B)\ +{ return NU ## _vec_push(B, NU ## _as_ ## M (T ## _end(B))); }\ +static inline NU ## _union_ref_t *N ## _ ## M ## _push(NS ## builder_t *B, T ## _ref_t ref)\ +{ return NU ## _vec_push(B, NU ## _as_ ## M (ref)); }\ +static inline NU ## _union_ref_t *N ## _ ## M ## _push_create(NS ## builder_t *B __ ## T ##_formal_args)\ +{ return NU ## _vec_push(B, NU ## _as_ ## M(T ## _create(B __ ## T ## _call_args))); }\ +static inline NU ## _union_ref_t *N ## _ ## M ## _push_clone(NS ## builder_t *B, T ## _struct_t p)\ +{ return NU ## _vec_push(B, NU ## _as_ ## M(T ## _clone(B, p))); } + +#define __flatbuffers_build_union_string_vector_value_field(NS, N, NU, M)\ +static inline NU ## _union_ref_t *N ## _ ## M ## _push(NS ## builder_t *B, NS ## string_ref_t ref)\ +{ return NU ## _vec_push(B, NU ## _as_ ## M (ref)); }\ +static inline int N ## _ ## M ## _push_start(NS ## builder_t *B)\ +{ return NS ## string_start(B); }\ +static inline NU ## _union_ref_t *N ## _ ## M ## _push_end(NS ## builder_t *B)\ +{ return NU ## _vec_push(B, NU ## _as_ ## M(NS ## string_end(B))); }\ +static inline NU ## _union_ref_t *N ## _ ## M ## _push_create(NS ## builder_t *B, const char *s, size_t len)\ +{ return NU ## _vec_push(B, NU ## _as_ ## M(NS ## string_create(B, s, len))); }\ +static inline NU ## _union_ref_t *N ## _ ## M ## _push_create_str(NS ## builder_t *B, const char *s)\ +{ return NU ## _vec_push(B, NU ## _as_ ## M(NS ## string_create_str(B, s))); }\ +static inline NU ## _union_ref_t *N ## _ ## M ## _push_create_strn(NS ## builder_t *B, const char *s, size_t max_len)\ +{ return NU ## _vec_push(B, NU ## _as_ ## M(NS ## string_create_strn(B, s, max_len))); }\ +static inline NU ## _union_ref_t *N ## _ ## M ## _push_clone(NS ## builder_t *B, NS ## string_t string)\ +{ return NU ## _vec_push(B, NU ## _as_ ## M(NS ## string_clone(B, string))); }\ +static inline NU ## _union_ref_t *N ## _ ## M ## _push_slice(NS ## builder_t *B, NS ## string_t string, size_t index, size_t len)\ +{ return NU ## _vec_push(B, NU ## _as_ ## M(NS ## string_slice(B, string, index, len))); } + +#define __flatbuffers_build_string_vector_field(ID, NS, N, TT)\ +__flatbuffers_build_offset_vector_field(ID, NS, N, NS ## string, TT)\ +__flatbuffers_build_string_vector_ops(NS, N) + +#define __flatbuffers_char_formal_args , char v0 +#define __flatbuffers_char_call_args , v0 +#define __flatbuffers_uint8_formal_args , uint8_t v0 +#define __flatbuffers_uint8_call_args , v0 +#define __flatbuffers_int8_formal_args , int8_t v0 +#define __flatbuffers_int8_call_args , v0 +#define __flatbuffers_bool_formal_args , flatbuffers_bool_t v0 +#define __flatbuffers_bool_call_args , v0 +#define __flatbuffers_uint16_formal_args , uint16_t v0 +#define __flatbuffers_uint16_call_args , v0 +#define __flatbuffers_uint32_formal_args , uint32_t v0 +#define __flatbuffers_uint32_call_args , v0 +#define __flatbuffers_uint64_formal_args , uint64_t v0 +#define __flatbuffers_uint64_call_args , v0 +#define __flatbuffers_int16_formal_args , int16_t v0 +#define __flatbuffers_int16_call_args , v0 +#define __flatbuffers_int32_formal_args , int32_t v0 +#define __flatbuffers_int32_call_args , v0 +#define __flatbuffers_int64_formal_args , int64_t v0 +#define __flatbuffers_int64_call_args , v0 +#define __flatbuffers_float_formal_args , float v0 +#define __flatbuffers_float_call_args , v0 +#define __flatbuffers_double_formal_args , double v0 +#define __flatbuffers_double_call_args , v0 + +__flatbuffers_build_scalar(flatbuffers_, flatbuffers_char, char) +__flatbuffers_build_scalar(flatbuffers_, flatbuffers_uint8, uint8_t) +__flatbuffers_build_scalar(flatbuffers_, flatbuffers_int8, int8_t) +__flatbuffers_build_scalar(flatbuffers_, flatbuffers_bool, flatbuffers_bool_t) +__flatbuffers_build_scalar(flatbuffers_, flatbuffers_uint16, uint16_t) +__flatbuffers_build_scalar(flatbuffers_, flatbuffers_uint32, uint32_t) +__flatbuffers_build_scalar(flatbuffers_, flatbuffers_uint64, uint64_t) +__flatbuffers_build_scalar(flatbuffers_, flatbuffers_int16, int16_t) +__flatbuffers_build_scalar(flatbuffers_, flatbuffers_int32, int32_t) +__flatbuffers_build_scalar(flatbuffers_, flatbuffers_int64, int64_t) +__flatbuffers_build_scalar(flatbuffers_, flatbuffers_float, float) +__flatbuffers_build_scalar(flatbuffers_, flatbuffers_double, double) + +__flatbuffers_build_string(flatbuffers_) + +__flatbuffers_build_buffer(flatbuffers_) +#include "flatcc/flatcc_epilogue.h" +#endif /* FLATBUFFERS_COMMON_BUILDER_H */ +#ifndef SCHEMA_READER_H +#define SCHEMA_READER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef FLATBUFFERS_COMMON_READER_H +#include "flatbuffers_common_reader.h" +#endif +#include "flatcc/flatcc_flatbuffers.h" +#ifndef __alignas_is_defined +#include +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + +typedef struct org_apache_arrow_flatbuf_Buffer org_apache_arrow_flatbuf_Buffer_t; +typedef const org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_struct_t; +typedef org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_mutable_struct_t; +typedef const org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_vec_t; +typedef org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_mutable_vec_t; + +typedef const struct org_apache_arrow_flatbuf_Null_table *org_apache_arrow_flatbuf_Null_table_t; +typedef struct org_apache_arrow_flatbuf_Null_table *org_apache_arrow_flatbuf_Null_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Null_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Null_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Struct__table *org_apache_arrow_flatbuf_Struct__table_t; +typedef struct org_apache_arrow_flatbuf_Struct__table *org_apache_arrow_flatbuf_Struct__mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Struct__vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Struct__mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_List_table *org_apache_arrow_flatbuf_List_table_t; +typedef struct org_apache_arrow_flatbuf_List_table *org_apache_arrow_flatbuf_List_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_List_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_List_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeList_table *org_apache_arrow_flatbuf_LargeList_table_t; +typedef struct org_apache_arrow_flatbuf_LargeList_table *org_apache_arrow_flatbuf_LargeList_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeList_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeList_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_ListView_table *org_apache_arrow_flatbuf_ListView_table_t; +typedef struct org_apache_arrow_flatbuf_ListView_table *org_apache_arrow_flatbuf_ListView_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_ListView_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_ListView_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeListView_table *org_apache_arrow_flatbuf_LargeListView_table_t; +typedef struct org_apache_arrow_flatbuf_LargeListView_table *org_apache_arrow_flatbuf_LargeListView_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeListView_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeListView_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_FixedSizeList_table *org_apache_arrow_flatbuf_FixedSizeList_table_t; +typedef struct org_apache_arrow_flatbuf_FixedSizeList_table *org_apache_arrow_flatbuf_FixedSizeList_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeList_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeList_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Map_table *org_apache_arrow_flatbuf_Map_table_t; +typedef struct org_apache_arrow_flatbuf_Map_table *org_apache_arrow_flatbuf_Map_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Map_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Map_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Union_table *org_apache_arrow_flatbuf_Union_table_t; +typedef struct org_apache_arrow_flatbuf_Union_table *org_apache_arrow_flatbuf_Union_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Union_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Union_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Int_table *org_apache_arrow_flatbuf_Int_table_t; +typedef struct org_apache_arrow_flatbuf_Int_table *org_apache_arrow_flatbuf_Int_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Int_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Int_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_FloatingPoint_table *org_apache_arrow_flatbuf_FloatingPoint_table_t; +typedef struct org_apache_arrow_flatbuf_FloatingPoint_table *org_apache_arrow_flatbuf_FloatingPoint_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FloatingPoint_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FloatingPoint_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Utf8_table *org_apache_arrow_flatbuf_Utf8_table_t; +typedef struct org_apache_arrow_flatbuf_Utf8_table *org_apache_arrow_flatbuf_Utf8_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Binary_table *org_apache_arrow_flatbuf_Binary_table_t; +typedef struct org_apache_arrow_flatbuf_Binary_table *org_apache_arrow_flatbuf_Binary_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Binary_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Binary_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeUtf8_table *org_apache_arrow_flatbuf_LargeUtf8_table_t; +typedef struct org_apache_arrow_flatbuf_LargeUtf8_table *org_apache_arrow_flatbuf_LargeUtf8_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeUtf8_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeUtf8_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeBinary_table *org_apache_arrow_flatbuf_LargeBinary_table_t; +typedef struct org_apache_arrow_flatbuf_LargeBinary_table *org_apache_arrow_flatbuf_LargeBinary_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeBinary_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeBinary_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Utf8View_table *org_apache_arrow_flatbuf_Utf8View_table_t; +typedef struct org_apache_arrow_flatbuf_Utf8View_table *org_apache_arrow_flatbuf_Utf8View_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8View_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8View_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_BinaryView_table *org_apache_arrow_flatbuf_BinaryView_table_t; +typedef struct org_apache_arrow_flatbuf_BinaryView_table *org_apache_arrow_flatbuf_BinaryView_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_BinaryView_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_BinaryView_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_FixedSizeBinary_table *org_apache_arrow_flatbuf_FixedSizeBinary_table_t; +typedef struct org_apache_arrow_flatbuf_FixedSizeBinary_table *org_apache_arrow_flatbuf_FixedSizeBinary_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeBinary_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeBinary_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Bool_table *org_apache_arrow_flatbuf_Bool_table_t; +typedef struct org_apache_arrow_flatbuf_Bool_table *org_apache_arrow_flatbuf_Bool_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Bool_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Bool_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_RunEndEncoded_table *org_apache_arrow_flatbuf_RunEndEncoded_table_t; +typedef struct org_apache_arrow_flatbuf_RunEndEncoded_table *org_apache_arrow_flatbuf_RunEndEncoded_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_RunEndEncoded_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_RunEndEncoded_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Decimal_table *org_apache_arrow_flatbuf_Decimal_table_t; +typedef struct org_apache_arrow_flatbuf_Decimal_table *org_apache_arrow_flatbuf_Decimal_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Decimal_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Decimal_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Date_table *org_apache_arrow_flatbuf_Date_table_t; +typedef struct org_apache_arrow_flatbuf_Date_table *org_apache_arrow_flatbuf_Date_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Date_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Date_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Time_table *org_apache_arrow_flatbuf_Time_table_t; +typedef struct org_apache_arrow_flatbuf_Time_table *org_apache_arrow_flatbuf_Time_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Time_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Time_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Timestamp_table *org_apache_arrow_flatbuf_Timestamp_table_t; +typedef struct org_apache_arrow_flatbuf_Timestamp_table *org_apache_arrow_flatbuf_Timestamp_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Timestamp_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Timestamp_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Interval_table *org_apache_arrow_flatbuf_Interval_table_t; +typedef struct org_apache_arrow_flatbuf_Interval_table *org_apache_arrow_flatbuf_Interval_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Interval_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Interval_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Duration_table *org_apache_arrow_flatbuf_Duration_table_t; +typedef struct org_apache_arrow_flatbuf_Duration_table *org_apache_arrow_flatbuf_Duration_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Duration_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Duration_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_KeyValue_table *org_apache_arrow_flatbuf_KeyValue_table_t; +typedef struct org_apache_arrow_flatbuf_KeyValue_table *org_apache_arrow_flatbuf_KeyValue_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_KeyValue_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_KeyValue_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_DictionaryEncoding_table *org_apache_arrow_flatbuf_DictionaryEncoding_table_t; +typedef struct org_apache_arrow_flatbuf_DictionaryEncoding_table *org_apache_arrow_flatbuf_DictionaryEncoding_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_DictionaryEncoding_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_DictionaryEncoding_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Field_table *org_apache_arrow_flatbuf_Field_table_t; +typedef struct org_apache_arrow_flatbuf_Field_table *org_apache_arrow_flatbuf_Field_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Field_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Field_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Schema_table *org_apache_arrow_flatbuf_Schema_table_t; +typedef struct org_apache_arrow_flatbuf_Schema_table *org_apache_arrow_flatbuf_Schema_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Schema_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Schema_mutable_vec_t; +#ifndef org_apache_arrow_flatbuf_Null_file_identifier +#define org_apache_arrow_flatbuf_Null_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Null_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Null_identifier +#define org_apache_arrow_flatbuf_Null_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Null_type_hash ((flatbuffers_thash_t)0x7b36a4dd) +#define org_apache_arrow_flatbuf_Null_type_identifier "\xdd\xa4\x36\x7b" +#ifndef org_apache_arrow_flatbuf_Null_file_extension +#define org_apache_arrow_flatbuf_Null_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Struct__file_identifier +#define org_apache_arrow_flatbuf_Struct__file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Struct__file_identifier */ +#ifndef org_apache_arrow_flatbuf_Struct__identifier +#define org_apache_arrow_flatbuf_Struct__identifier 0 +#endif +#define org_apache_arrow_flatbuf_Struct__type_hash ((flatbuffers_thash_t)0x6310f362) +#define org_apache_arrow_flatbuf_Struct__type_identifier "\x62\xf3\x10\x63" +#ifndef org_apache_arrow_flatbuf_Struct__file_extension +#define org_apache_arrow_flatbuf_Struct__file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_List_file_identifier +#define org_apache_arrow_flatbuf_List_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_List_file_identifier */ +#ifndef org_apache_arrow_flatbuf_List_identifier +#define org_apache_arrow_flatbuf_List_identifier 0 +#endif +#define org_apache_arrow_flatbuf_List_type_hash ((flatbuffers_thash_t)0xd4ce5878) +#define org_apache_arrow_flatbuf_List_type_identifier "\x78\x58\xce\xd4" +#ifndef org_apache_arrow_flatbuf_List_file_extension +#define org_apache_arrow_flatbuf_List_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeList_file_identifier +#define org_apache_arrow_flatbuf_LargeList_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeList_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeList_identifier +#define org_apache_arrow_flatbuf_LargeList_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeList_type_hash ((flatbuffers_thash_t)0x38aa7e27) +#define org_apache_arrow_flatbuf_LargeList_type_identifier "\x27\x7e\xaa\x38" +#ifndef org_apache_arrow_flatbuf_LargeList_file_extension +#define org_apache_arrow_flatbuf_LargeList_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_ListView_file_identifier +#define org_apache_arrow_flatbuf_ListView_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_ListView_file_identifier */ +#ifndef org_apache_arrow_flatbuf_ListView_identifier +#define org_apache_arrow_flatbuf_ListView_identifier 0 +#endif +#define org_apache_arrow_flatbuf_ListView_type_hash ((flatbuffers_thash_t)0x23d37919) +#define org_apache_arrow_flatbuf_ListView_type_identifier "\x19\x79\xd3\x23" +#ifndef org_apache_arrow_flatbuf_ListView_file_extension +#define org_apache_arrow_flatbuf_ListView_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeListView_file_identifier +#define org_apache_arrow_flatbuf_LargeListView_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeListView_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeListView_identifier +#define org_apache_arrow_flatbuf_LargeListView_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeListView_type_hash ((flatbuffers_thash_t)0x28efac02) +#define org_apache_arrow_flatbuf_LargeListView_type_identifier "\x02\xac\xef\x28" +#ifndef org_apache_arrow_flatbuf_LargeListView_file_extension +#define org_apache_arrow_flatbuf_LargeListView_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_FixedSizeList_file_identifier +#define org_apache_arrow_flatbuf_FixedSizeList_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_FixedSizeList_file_identifier */ +#ifndef org_apache_arrow_flatbuf_FixedSizeList_identifier +#define org_apache_arrow_flatbuf_FixedSizeList_identifier 0 +#endif +#define org_apache_arrow_flatbuf_FixedSizeList_type_hash ((flatbuffers_thash_t)0xcef245bb) +#define org_apache_arrow_flatbuf_FixedSizeList_type_identifier "\xbb\x45\xf2\xce" +#ifndef org_apache_arrow_flatbuf_FixedSizeList_file_extension +#define org_apache_arrow_flatbuf_FixedSizeList_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Map_file_identifier +#define org_apache_arrow_flatbuf_Map_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Map_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Map_identifier +#define org_apache_arrow_flatbuf_Map_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Map_type_hash ((flatbuffers_thash_t)0xcebef8e6) +#define org_apache_arrow_flatbuf_Map_type_identifier "\xe6\xf8\xbe\xce" +#ifndef org_apache_arrow_flatbuf_Map_file_extension +#define org_apache_arrow_flatbuf_Map_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Union_file_identifier +#define org_apache_arrow_flatbuf_Union_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Union_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Union_identifier +#define org_apache_arrow_flatbuf_Union_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Union_type_hash ((flatbuffers_thash_t)0x896bda57) +#define org_apache_arrow_flatbuf_Union_type_identifier "\x57\xda\x6b\x89" +#ifndef org_apache_arrow_flatbuf_Union_file_extension +#define org_apache_arrow_flatbuf_Union_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Int_file_identifier +#define org_apache_arrow_flatbuf_Int_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Int_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Int_identifier +#define org_apache_arrow_flatbuf_Int_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Int_type_hash ((flatbuffers_thash_t)0x30789001) +#define org_apache_arrow_flatbuf_Int_type_identifier "\x01\x90\x78\x30" +#ifndef org_apache_arrow_flatbuf_Int_file_extension +#define org_apache_arrow_flatbuf_Int_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_FloatingPoint_file_identifier +#define org_apache_arrow_flatbuf_FloatingPoint_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_FloatingPoint_file_identifier */ +#ifndef org_apache_arrow_flatbuf_FloatingPoint_identifier +#define org_apache_arrow_flatbuf_FloatingPoint_identifier 0 +#endif +#define org_apache_arrow_flatbuf_FloatingPoint_type_hash ((flatbuffers_thash_t)0xf7d06268) +#define org_apache_arrow_flatbuf_FloatingPoint_type_identifier "\x68\x62\xd0\xf7" +#ifndef org_apache_arrow_flatbuf_FloatingPoint_file_extension +#define org_apache_arrow_flatbuf_FloatingPoint_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Utf8_file_identifier +#define org_apache_arrow_flatbuf_Utf8_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Utf8_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Utf8_identifier +#define org_apache_arrow_flatbuf_Utf8_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Utf8_type_hash ((flatbuffers_thash_t)0x8fe60d37) +#define org_apache_arrow_flatbuf_Utf8_type_identifier "\x37\x0d\xe6\x8f" +#ifndef org_apache_arrow_flatbuf_Utf8_file_extension +#define org_apache_arrow_flatbuf_Utf8_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Binary_file_identifier +#define org_apache_arrow_flatbuf_Binary_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Binary_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Binary_identifier +#define org_apache_arrow_flatbuf_Binary_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Binary_type_hash ((flatbuffers_thash_t)0x8e21a795) +#define org_apache_arrow_flatbuf_Binary_type_identifier "\x95\xa7\x21\x8e" +#ifndef org_apache_arrow_flatbuf_Binary_file_extension +#define org_apache_arrow_flatbuf_Binary_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeUtf8_file_identifier +#define org_apache_arrow_flatbuf_LargeUtf8_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeUtf8_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeUtf8_identifier +#define org_apache_arrow_flatbuf_LargeUtf8_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeUtf8_type_hash ((flatbuffers_thash_t)0x24ed2fb0) +#define org_apache_arrow_flatbuf_LargeUtf8_type_identifier "\xb0\x2f\xed\x24" +#ifndef org_apache_arrow_flatbuf_LargeUtf8_file_extension +#define org_apache_arrow_flatbuf_LargeUtf8_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeBinary_file_identifier +#define org_apache_arrow_flatbuf_LargeBinary_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeBinary_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeBinary_identifier +#define org_apache_arrow_flatbuf_LargeBinary_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeBinary_type_hash ((flatbuffers_thash_t)0xbd437872) +#define org_apache_arrow_flatbuf_LargeBinary_type_identifier "\x72\x78\x43\xbd" +#ifndef org_apache_arrow_flatbuf_LargeBinary_file_extension +#define org_apache_arrow_flatbuf_LargeBinary_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Utf8View_file_identifier +#define org_apache_arrow_flatbuf_Utf8View_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Utf8View_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Utf8View_identifier +#define org_apache_arrow_flatbuf_Utf8View_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Utf8View_type_hash ((flatbuffers_thash_t)0xab7692) +#define org_apache_arrow_flatbuf_Utf8View_type_identifier "\x92\x76\xab\x00" +#ifndef org_apache_arrow_flatbuf_Utf8View_file_extension +#define org_apache_arrow_flatbuf_Utf8View_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_BinaryView_file_identifier +#define org_apache_arrow_flatbuf_BinaryView_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_BinaryView_file_identifier */ +#ifndef org_apache_arrow_flatbuf_BinaryView_identifier +#define org_apache_arrow_flatbuf_BinaryView_identifier 0 +#endif +#define org_apache_arrow_flatbuf_BinaryView_type_hash ((flatbuffers_thash_t)0x18c52428) +#define org_apache_arrow_flatbuf_BinaryView_type_identifier "\x28\x24\xc5\x18" +#ifndef org_apache_arrow_flatbuf_BinaryView_file_extension +#define org_apache_arrow_flatbuf_BinaryView_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier +#define org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier */ +#ifndef org_apache_arrow_flatbuf_FixedSizeBinary_identifier +#define org_apache_arrow_flatbuf_FixedSizeBinary_identifier 0 +#endif +#define org_apache_arrow_flatbuf_FixedSizeBinary_type_hash ((flatbuffers_thash_t)0x80d0f4ce) +#define org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier "\xce\xf4\xd0\x80" +#ifndef org_apache_arrow_flatbuf_FixedSizeBinary_file_extension +#define org_apache_arrow_flatbuf_FixedSizeBinary_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Bool_file_identifier +#define org_apache_arrow_flatbuf_Bool_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Bool_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Bool_identifier +#define org_apache_arrow_flatbuf_Bool_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Bool_type_hash ((flatbuffers_thash_t)0x96bf83f0) +#define org_apache_arrow_flatbuf_Bool_type_identifier "\xf0\x83\xbf\x96" +#ifndef org_apache_arrow_flatbuf_Bool_file_extension +#define org_apache_arrow_flatbuf_Bool_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_RunEndEncoded_file_identifier +#define org_apache_arrow_flatbuf_RunEndEncoded_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_RunEndEncoded_file_identifier */ +#ifndef org_apache_arrow_flatbuf_RunEndEncoded_identifier +#define org_apache_arrow_flatbuf_RunEndEncoded_identifier 0 +#endif +#define org_apache_arrow_flatbuf_RunEndEncoded_type_hash ((flatbuffers_thash_t)0x5a98bcc) +#define org_apache_arrow_flatbuf_RunEndEncoded_type_identifier "\xcc\x8b\xa9\x05" +#ifndef org_apache_arrow_flatbuf_RunEndEncoded_file_extension +#define org_apache_arrow_flatbuf_RunEndEncoded_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Decimal_file_identifier +#define org_apache_arrow_flatbuf_Decimal_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Decimal_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Decimal_identifier +#define org_apache_arrow_flatbuf_Decimal_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Decimal_type_hash ((flatbuffers_thash_t)0x91d1beb7) +#define org_apache_arrow_flatbuf_Decimal_type_identifier "\xb7\xbe\xd1\x91" +#ifndef org_apache_arrow_flatbuf_Decimal_file_extension +#define org_apache_arrow_flatbuf_Decimal_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Date_file_identifier +#define org_apache_arrow_flatbuf_Date_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Date_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Date_identifier +#define org_apache_arrow_flatbuf_Date_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Date_type_hash ((flatbuffers_thash_t)0xe0ccf624) +#define org_apache_arrow_flatbuf_Date_type_identifier "\x24\xf6\xcc\xe0" +#ifndef org_apache_arrow_flatbuf_Date_file_extension +#define org_apache_arrow_flatbuf_Date_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Time_file_identifier +#define org_apache_arrow_flatbuf_Time_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Time_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Time_identifier +#define org_apache_arrow_flatbuf_Time_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Time_type_hash ((flatbuffers_thash_t)0x2442a489) +#define org_apache_arrow_flatbuf_Time_type_identifier "\x89\xa4\x42\x24" +#ifndef org_apache_arrow_flatbuf_Time_file_extension +#define org_apache_arrow_flatbuf_Time_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Timestamp_file_identifier +#define org_apache_arrow_flatbuf_Timestamp_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Timestamp_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Timestamp_identifier +#define org_apache_arrow_flatbuf_Timestamp_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Timestamp_type_hash ((flatbuffers_thash_t)0x1fddf080) +#define org_apache_arrow_flatbuf_Timestamp_type_identifier "\x80\xf0\xdd\x1f" +#ifndef org_apache_arrow_flatbuf_Timestamp_file_extension +#define org_apache_arrow_flatbuf_Timestamp_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Interval_file_identifier +#define org_apache_arrow_flatbuf_Interval_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Interval_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Interval_identifier +#define org_apache_arrow_flatbuf_Interval_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Interval_type_hash ((flatbuffers_thash_t)0x1e2d6809) +#define org_apache_arrow_flatbuf_Interval_type_identifier "\x09\x68\x2d\x1e" +#ifndef org_apache_arrow_flatbuf_Interval_file_extension +#define org_apache_arrow_flatbuf_Interval_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Duration_file_identifier +#define org_apache_arrow_flatbuf_Duration_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Duration_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Duration_identifier +#define org_apache_arrow_flatbuf_Duration_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Duration_type_hash ((flatbuffers_thash_t)0x1ecea6b0) +#define org_apache_arrow_flatbuf_Duration_type_identifier "\xb0\xa6\xce\x1e" +#ifndef org_apache_arrow_flatbuf_Duration_file_extension +#define org_apache_arrow_flatbuf_Duration_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_KeyValue_file_identifier +#define org_apache_arrow_flatbuf_KeyValue_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_KeyValue_file_identifier */ +#ifndef org_apache_arrow_flatbuf_KeyValue_identifier +#define org_apache_arrow_flatbuf_KeyValue_identifier 0 +#endif +#define org_apache_arrow_flatbuf_KeyValue_type_hash ((flatbuffers_thash_t)0x3b264744) +#define org_apache_arrow_flatbuf_KeyValue_type_identifier "\x44\x47\x26\x3b" +#ifndef org_apache_arrow_flatbuf_KeyValue_file_extension +#define org_apache_arrow_flatbuf_KeyValue_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier +#define org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier */ +#ifndef org_apache_arrow_flatbuf_DictionaryEncoding_identifier +#define org_apache_arrow_flatbuf_DictionaryEncoding_identifier 0 +#endif +#define org_apache_arrow_flatbuf_DictionaryEncoding_type_hash ((flatbuffers_thash_t)0x8c703261) +#define org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier "\x61\x32\x70\x8c" +#ifndef org_apache_arrow_flatbuf_DictionaryEncoding_file_extension +#define org_apache_arrow_flatbuf_DictionaryEncoding_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Field_file_identifier +#define org_apache_arrow_flatbuf_Field_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Field_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Field_identifier +#define org_apache_arrow_flatbuf_Field_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Field_type_hash ((flatbuffers_thash_t)0xd981525c) +#define org_apache_arrow_flatbuf_Field_type_identifier "\x5c\x52\x81\xd9" +#ifndef org_apache_arrow_flatbuf_Field_file_extension +#define org_apache_arrow_flatbuf_Field_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Buffer_file_identifier +#define org_apache_arrow_flatbuf_Buffer_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Buffer_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Buffer_identifier +#define org_apache_arrow_flatbuf_Buffer_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Buffer_type_hash ((flatbuffers_thash_t)0x519d7fea) +#define org_apache_arrow_flatbuf_Buffer_type_identifier "\xea\x7f\x9d\x51" +#ifndef org_apache_arrow_flatbuf_Buffer_file_extension +#define org_apache_arrow_flatbuf_Buffer_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Schema_file_identifier +#define org_apache_arrow_flatbuf_Schema_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Schema_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Schema_identifier +#define org_apache_arrow_flatbuf_Schema_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Schema_type_hash ((flatbuffers_thash_t)0x406570b) +#define org_apache_arrow_flatbuf_Schema_type_identifier "\x0b\x57\x06\x04" +#ifndef org_apache_arrow_flatbuf_Schema_file_extension +#define org_apache_arrow_flatbuf_Schema_file_extension "bin" +#endif + +typedef int16_t org_apache_arrow_flatbuf_MetadataVersion_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_MetadataVersion, org_apache_arrow_flatbuf_MetadataVersion_enum_t, 16) +/** 0.1.0 (October 2016). */ +#define org_apache_arrow_flatbuf_MetadataVersion_V1 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_MetadataVersion_V2 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_MetadataVersion_V3 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(2)) +#define org_apache_arrow_flatbuf_MetadataVersion_V4 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(3)) +#define org_apache_arrow_flatbuf_MetadataVersion_V5 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(4)) + +static inline const char *org_apache_arrow_flatbuf_MetadataVersion_name(org_apache_arrow_flatbuf_MetadataVersion_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_MetadataVersion_V1: return "V1"; + case org_apache_arrow_flatbuf_MetadataVersion_V2: return "V2"; + case org_apache_arrow_flatbuf_MetadataVersion_V3: return "V3"; + case org_apache_arrow_flatbuf_MetadataVersion_V4: return "V4"; + case org_apache_arrow_flatbuf_MetadataVersion_V5: return "V5"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_MetadataVersion_is_known_value(org_apache_arrow_flatbuf_MetadataVersion_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_MetadataVersion_V1: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V2: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V3: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V4: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V5: return 1; + default: return 0; + } +} + +/** Represents Arrow Features that might not have full support + * within implementations. This is intended to be used in + * two scenarios: + * 1. A mechanism for readers of Arrow Streams + * and files to understand that the stream or file makes + * use of a feature that isn't supported or unknown to + * the implementation (and therefore can meet the Arrow + * forward compatibility guarantees). + * 2. A means of negotiating between a client and server + * what features a stream is allowed to use. The enums + * values here are intented to represent higher level + * features, additional details maybe negotiated + * with key-value pairs specific to the protocol. + * + * Enums added to this list should be assigned power-of-two values + * to facilitate exchanging and comparing bitmaps for supported + * features. */ +typedef int64_t org_apache_arrow_flatbuf_Feature_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Feature, org_apache_arrow_flatbuf_Feature_enum_t, 64) +/** Needed to make flatbuffers happy. */ +#define org_apache_arrow_flatbuf_Feature_UNUSED ((org_apache_arrow_flatbuf_Feature_enum_t)INT64_C(0)) +#define org_apache_arrow_flatbuf_Feature_DICTIONARY_REPLACEMENT ((org_apache_arrow_flatbuf_Feature_enum_t)INT64_C(1)) +#define org_apache_arrow_flatbuf_Feature_COMPRESSED_BODY ((org_apache_arrow_flatbuf_Feature_enum_t)INT64_C(2)) + +static inline const char *org_apache_arrow_flatbuf_Feature_name(org_apache_arrow_flatbuf_Feature_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Feature_UNUSED: return "UNUSED"; + case org_apache_arrow_flatbuf_Feature_DICTIONARY_REPLACEMENT: return "DICTIONARY_REPLACEMENT"; + case org_apache_arrow_flatbuf_Feature_COMPRESSED_BODY: return "COMPRESSED_BODY"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Feature_is_known_value(org_apache_arrow_flatbuf_Feature_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Feature_UNUSED: return 1; + case org_apache_arrow_flatbuf_Feature_DICTIONARY_REPLACEMENT: return 1; + case org_apache_arrow_flatbuf_Feature_COMPRESSED_BODY: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_UnionMode_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t, 16) +#define org_apache_arrow_flatbuf_UnionMode_Sparse ((org_apache_arrow_flatbuf_UnionMode_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_UnionMode_Dense ((org_apache_arrow_flatbuf_UnionMode_enum_t)INT16_C(1)) + +static inline const char *org_apache_arrow_flatbuf_UnionMode_name(org_apache_arrow_flatbuf_UnionMode_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_UnionMode_Sparse: return "Sparse"; + case org_apache_arrow_flatbuf_UnionMode_Dense: return "Dense"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_UnionMode_is_known_value(org_apache_arrow_flatbuf_UnionMode_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_UnionMode_Sparse: return 1; + case org_apache_arrow_flatbuf_UnionMode_Dense: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_Precision_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t, 16) +#define org_apache_arrow_flatbuf_Precision_HALF ((org_apache_arrow_flatbuf_Precision_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_Precision_SINGLE ((org_apache_arrow_flatbuf_Precision_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_Precision_DOUBLE ((org_apache_arrow_flatbuf_Precision_enum_t)INT16_C(2)) + +static inline const char *org_apache_arrow_flatbuf_Precision_name(org_apache_arrow_flatbuf_Precision_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Precision_HALF: return "HALF"; + case org_apache_arrow_flatbuf_Precision_SINGLE: return "SINGLE"; + case org_apache_arrow_flatbuf_Precision_DOUBLE: return "DOUBLE"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Precision_is_known_value(org_apache_arrow_flatbuf_Precision_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Precision_HALF: return 1; + case org_apache_arrow_flatbuf_Precision_SINGLE: return 1; + case org_apache_arrow_flatbuf_Precision_DOUBLE: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_DateUnit_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t, 16) +#define org_apache_arrow_flatbuf_DateUnit_DAY ((org_apache_arrow_flatbuf_DateUnit_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_DateUnit_MILLISECOND ((org_apache_arrow_flatbuf_DateUnit_enum_t)INT16_C(1)) + +static inline const char *org_apache_arrow_flatbuf_DateUnit_name(org_apache_arrow_flatbuf_DateUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DateUnit_DAY: return "DAY"; + case org_apache_arrow_flatbuf_DateUnit_MILLISECOND: return "MILLISECOND"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_DateUnit_is_known_value(org_apache_arrow_flatbuf_DateUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DateUnit_DAY: return 1; + case org_apache_arrow_flatbuf_DateUnit_MILLISECOND: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_TimeUnit_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 16) +#define org_apache_arrow_flatbuf_TimeUnit_SECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_TimeUnit_MILLISECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_TimeUnit_MICROSECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(2)) +#define org_apache_arrow_flatbuf_TimeUnit_NANOSECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(3)) + +static inline const char *org_apache_arrow_flatbuf_TimeUnit_name(org_apache_arrow_flatbuf_TimeUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_TimeUnit_SECOND: return "SECOND"; + case org_apache_arrow_flatbuf_TimeUnit_MILLISECOND: return "MILLISECOND"; + case org_apache_arrow_flatbuf_TimeUnit_MICROSECOND: return "MICROSECOND"; + case org_apache_arrow_flatbuf_TimeUnit_NANOSECOND: return "NANOSECOND"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_TimeUnit_is_known_value(org_apache_arrow_flatbuf_TimeUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_TimeUnit_SECOND: return 1; + case org_apache_arrow_flatbuf_TimeUnit_MILLISECOND: return 1; + case org_apache_arrow_flatbuf_TimeUnit_MICROSECOND: return 1; + case org_apache_arrow_flatbuf_TimeUnit_NANOSECOND: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_IntervalUnit_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t, 16) +#define org_apache_arrow_flatbuf_IntervalUnit_YEAR_MONTH ((org_apache_arrow_flatbuf_IntervalUnit_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_IntervalUnit_DAY_TIME ((org_apache_arrow_flatbuf_IntervalUnit_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_IntervalUnit_MONTH_DAY_NANO ((org_apache_arrow_flatbuf_IntervalUnit_enum_t)INT16_C(2)) + +static inline const char *org_apache_arrow_flatbuf_IntervalUnit_name(org_apache_arrow_flatbuf_IntervalUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_IntervalUnit_YEAR_MONTH: return "YEAR_MONTH"; + case org_apache_arrow_flatbuf_IntervalUnit_DAY_TIME: return "DAY_TIME"; + case org_apache_arrow_flatbuf_IntervalUnit_MONTH_DAY_NANO: return "MONTH_DAY_NANO"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_IntervalUnit_is_known_value(org_apache_arrow_flatbuf_IntervalUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_IntervalUnit_YEAR_MONTH: return 1; + case org_apache_arrow_flatbuf_IntervalUnit_DAY_TIME: return 1; + case org_apache_arrow_flatbuf_IntervalUnit_MONTH_DAY_NANO: return 1; + default: return 0; + } +} + +/** ---------------------------------------------------------------------- + * Dictionary encoding metadata + * Maintained for forwards compatibility, in the future + * Dictionaries might be explicit maps between integers and values + * allowing for non-contiguous index values */ +typedef int16_t org_apache_arrow_flatbuf_DictionaryKind_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t, 16) +#define org_apache_arrow_flatbuf_DictionaryKind_DenseArray ((org_apache_arrow_flatbuf_DictionaryKind_enum_t)INT16_C(0)) + +static inline const char *org_apache_arrow_flatbuf_DictionaryKind_name(org_apache_arrow_flatbuf_DictionaryKind_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DictionaryKind_DenseArray: return "DenseArray"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_DictionaryKind_is_known_value(org_apache_arrow_flatbuf_DictionaryKind_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DictionaryKind_DenseArray: return 1; + default: return 0; + } +} + +/** ---------------------------------------------------------------------- + * Endianness of the platform producing the data */ +typedef int16_t org_apache_arrow_flatbuf_Endianness_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t, 16) +#define org_apache_arrow_flatbuf_Endianness_Little ((org_apache_arrow_flatbuf_Endianness_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_Endianness_Big ((org_apache_arrow_flatbuf_Endianness_enum_t)INT16_C(1)) + +static inline const char *org_apache_arrow_flatbuf_Endianness_name(org_apache_arrow_flatbuf_Endianness_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Endianness_Little: return "Little"; + case org_apache_arrow_flatbuf_Endianness_Big: return "Big"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Endianness_is_known_value(org_apache_arrow_flatbuf_Endianness_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Endianness_Little: return 1; + case org_apache_arrow_flatbuf_Endianness_Big: return 1; + default: return 0; + } +} + + +/** ---------------------------------------------------------------------- + * A Buffer represents a single contiguous memory segment */ +struct org_apache_arrow_flatbuf_Buffer { + /** The relative offset into the shared memory page where the bytes for this + * buffer starts */ + alignas(8) int64_t offset; + /** The absolute length (in bytes) of the memory buffer. The memory is found + * from offset (inclusive) to offset + length (non-inclusive). When building + * messages using the encapsulated IPC message, padding bytes may be written + * after a buffer, but such padding bytes do not need to be accounted for in + * the size here. */ + alignas(8) int64_t length; +}; +static_assert(sizeof(org_apache_arrow_flatbuf_Buffer_t) == 16, "struct size mismatch"); + +static inline const org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer__const_ptr_add(const org_apache_arrow_flatbuf_Buffer_t *p, size_t i) { return p + i; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer__ptr_add(org_apache_arrow_flatbuf_Buffer_t *p, size_t i) { return p + i; } +static inline org_apache_arrow_flatbuf_Buffer_struct_t org_apache_arrow_flatbuf_Buffer_vec_at(org_apache_arrow_flatbuf_Buffer_vec_t vec, size_t i) +__flatbuffers_struct_vec_at(vec, i) +static inline size_t org_apache_arrow_flatbuf_Buffer__size(void) { return 16; } +static inline size_t org_apache_arrow_flatbuf_Buffer_vec_len(org_apache_arrow_flatbuf_Buffer_vec_t vec) +__flatbuffers_vec_len(vec) +__flatbuffers_struct_as_root(org_apache_arrow_flatbuf_Buffer) + +__flatbuffers_define_struct_scalar_field(org_apache_arrow_flatbuf_Buffer, offset, flatbuffers_int64, int64_t) +__flatbuffers_define_struct_scalar_field(org_apache_arrow_flatbuf_Buffer, length, flatbuffers_int64, int64_t) + + +/** These are stored in the flatbuffer in the Type union below */ +struct org_apache_arrow_flatbuf_Null_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Null_vec_len(org_apache_arrow_flatbuf_Null_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Null_table_t org_apache_arrow_flatbuf_Null_vec_at(org_apache_arrow_flatbuf_Null_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Null_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Null) + + +/** A Struct_ in the flatbuffer metadata is the same as an Arrow Struct + * (according to the physical memory layout). We used Struct_ here as + * Struct is a reserved word in Flatbuffers */ +struct org_apache_arrow_flatbuf_Struct__table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Struct__vec_len(org_apache_arrow_flatbuf_Struct__vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Struct__table_t org_apache_arrow_flatbuf_Struct__vec_at(org_apache_arrow_flatbuf_Struct__vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Struct__table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Struct_) + + +struct org_apache_arrow_flatbuf_List_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_List_vec_len(org_apache_arrow_flatbuf_List_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_List_table_t org_apache_arrow_flatbuf_List_vec_at(org_apache_arrow_flatbuf_List_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_List_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_List) + + +/** Same as List, but with 64-bit offsets, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeList_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeList_vec_len(org_apache_arrow_flatbuf_LargeList_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeList_table_t org_apache_arrow_flatbuf_LargeList_vec_at(org_apache_arrow_flatbuf_LargeList_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeList_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeList) + + +/** Represents the same logical types that List can, but contains offsets and + * sizes allowing for writes in any order and sharing of child values among + * list values. */ +struct org_apache_arrow_flatbuf_ListView_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_ListView_vec_len(org_apache_arrow_flatbuf_ListView_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_ListView_table_t org_apache_arrow_flatbuf_ListView_vec_at(org_apache_arrow_flatbuf_ListView_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_ListView_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_ListView) + + +/** Same as ListView, but with 64-bit offsets and sizes, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeListView_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeListView_vec_len(org_apache_arrow_flatbuf_LargeListView_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeListView_table_t org_apache_arrow_flatbuf_LargeListView_vec_at(org_apache_arrow_flatbuf_LargeListView_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeListView_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeListView) + + +struct org_apache_arrow_flatbuf_FixedSizeList_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_FixedSizeList_vec_len(org_apache_arrow_flatbuf_FixedSizeList_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_FixedSizeList_table_t org_apache_arrow_flatbuf_FixedSizeList_vec_at(org_apache_arrow_flatbuf_FixedSizeList_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_FixedSizeList_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_FixedSizeList) + +/** Number of list items per value */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_FixedSizeList, listSize, flatbuffers_int32, int32_t, INT32_C(0)) + +/** A Map is a logical nested type that is represented as + * + * List> + * + * In this layout, the keys and values are each respectively contiguous. We do + * not constrain the key and value types, so the application is responsible + * for ensuring that the keys are hashable and unique. Whether the keys are sorted + * may be set in the metadata for this field. + * + * In a field with Map type, the field has a child Struct field, which then + * has two children: key type and the second the value type. The names of the + * child fields may be respectively "entries", "key", and "value", but this is + * not enforced. + * + * Map + * ```text + * - child[0] entries: Struct + * - child[0] key: K + * - child[1] value: V + * ``` + * Neither the "entries" field nor the "key" field may be nullable. + * + * The metadata is structured so that Arrow systems without special handling + * for Map can make Map an alias for List. The "layout" attribute for the Map + * field must have the same contents as a List. */ +struct org_apache_arrow_flatbuf_Map_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Map_vec_len(org_apache_arrow_flatbuf_Map_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Map_table_t org_apache_arrow_flatbuf_Map_vec_at(org_apache_arrow_flatbuf_Map_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Map_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Map) + +/** Set to true if the keys within each value are sorted */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Map, keysSorted, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) + +/** A union is a complex type with children in Field + * By default ids in the type vector refer to the offsets in the children + * optionally typeIds provides an indirection between the child offset and the type id + * for each child `typeIds[offset]` is the id used in the type vector */ +struct org_apache_arrow_flatbuf_Union_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Union_vec_len(org_apache_arrow_flatbuf_Union_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Union_table_t org_apache_arrow_flatbuf_Union_vec_at(org_apache_arrow_flatbuf_Union_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Union_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Union) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Union, mode, org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t, INT16_C(0)) +__flatbuffers_define_vector_field(1, org_apache_arrow_flatbuf_Union, typeIds, flatbuffers_int32_vec_t, 0) + +struct org_apache_arrow_flatbuf_Int_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Int_vec_len(org_apache_arrow_flatbuf_Int_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Int_table_t org_apache_arrow_flatbuf_Int_vec_at(org_apache_arrow_flatbuf_Int_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Int_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Int) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Int, bitWidth, flatbuffers_int32, int32_t, INT32_C(0)) +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Int, is_signed, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) + +struct org_apache_arrow_flatbuf_FloatingPoint_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_FloatingPoint_vec_len(org_apache_arrow_flatbuf_FloatingPoint_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_FloatingPoint_table_t org_apache_arrow_flatbuf_FloatingPoint_vec_at(org_apache_arrow_flatbuf_FloatingPoint_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_FloatingPoint_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_FloatingPoint) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_FloatingPoint, precision, org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t, INT16_C(0)) + +/** Unicode with UTF-8 encoding */ +struct org_apache_arrow_flatbuf_Utf8_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Utf8_vec_len(org_apache_arrow_flatbuf_Utf8_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Utf8_table_t org_apache_arrow_flatbuf_Utf8_vec_at(org_apache_arrow_flatbuf_Utf8_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Utf8_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Utf8) + + +/** Opaque binary data */ +struct org_apache_arrow_flatbuf_Binary_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Binary_vec_len(org_apache_arrow_flatbuf_Binary_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Binary_table_t org_apache_arrow_flatbuf_Binary_vec_at(org_apache_arrow_flatbuf_Binary_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Binary_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Binary) + + +/** Same as Utf8, but with 64-bit offsets, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeUtf8_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeUtf8_vec_len(org_apache_arrow_flatbuf_LargeUtf8_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeUtf8_table_t org_apache_arrow_flatbuf_LargeUtf8_vec_at(org_apache_arrow_flatbuf_LargeUtf8_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeUtf8_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeUtf8) + + +/** Same as Binary, but with 64-bit offsets, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeBinary_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeBinary_vec_len(org_apache_arrow_flatbuf_LargeBinary_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeBinary_table_t org_apache_arrow_flatbuf_LargeBinary_vec_at(org_apache_arrow_flatbuf_LargeBinary_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeBinary_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeBinary) + + +/** Logically the same as Utf8, but the internal representation uses a view + * struct that contains the string length and either the string's entire data + * inline (for small strings) or an inlined prefix, an index of another buffer, + * and an offset pointing to a slice in that buffer (for non-small strings). + * + * Since it uses a variable number of data buffers, each Field with this type + * must have a corresponding entry in `variadicBufferCounts`. */ +struct org_apache_arrow_flatbuf_Utf8View_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Utf8View_vec_len(org_apache_arrow_flatbuf_Utf8View_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Utf8View_table_t org_apache_arrow_flatbuf_Utf8View_vec_at(org_apache_arrow_flatbuf_Utf8View_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Utf8View_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Utf8View) + + +/** Logically the same as Binary, but the internal representation uses a view + * struct that contains the string length and either the string's entire data + * inline (for small strings) or an inlined prefix, an index of another buffer, + * and an offset pointing to a slice in that buffer (for non-small strings). + * + * Since it uses a variable number of data buffers, each Field with this type + * must have a corresponding entry in `variadicBufferCounts`. */ +struct org_apache_arrow_flatbuf_BinaryView_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_BinaryView_vec_len(org_apache_arrow_flatbuf_BinaryView_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_BinaryView_table_t org_apache_arrow_flatbuf_BinaryView_vec_at(org_apache_arrow_flatbuf_BinaryView_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_BinaryView_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_BinaryView) + + +struct org_apache_arrow_flatbuf_FixedSizeBinary_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_FixedSizeBinary_vec_len(org_apache_arrow_flatbuf_FixedSizeBinary_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_FixedSizeBinary_table_t org_apache_arrow_flatbuf_FixedSizeBinary_vec_at(org_apache_arrow_flatbuf_FixedSizeBinary_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_FixedSizeBinary_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_FixedSizeBinary) + +/** Number of bytes per value */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_FixedSizeBinary, byteWidth, flatbuffers_int32, int32_t, INT32_C(0)) + +struct org_apache_arrow_flatbuf_Bool_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Bool_vec_len(org_apache_arrow_flatbuf_Bool_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Bool_table_t org_apache_arrow_flatbuf_Bool_vec_at(org_apache_arrow_flatbuf_Bool_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Bool_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Bool) + + +/** Contains two child arrays, run_ends and values. + * The run_ends child array must be a 16/32/64-bit integer array + * which encodes the indices at which the run with the value in + * each corresponding index in the values child array ends. + * Like list/struct types, the value array can be of any type. */ +struct org_apache_arrow_flatbuf_RunEndEncoded_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_RunEndEncoded_vec_len(org_apache_arrow_flatbuf_RunEndEncoded_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_RunEndEncoded_table_t org_apache_arrow_flatbuf_RunEndEncoded_vec_at(org_apache_arrow_flatbuf_RunEndEncoded_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_RunEndEncoded_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_RunEndEncoded) + + +/** Exact decimal value represented as an integer value in two's + * complement. Currently only 128-bit (16-byte) and 256-bit (32-byte) integers + * are used. The representation uses the endianness indicated + * in the Schema. */ +struct org_apache_arrow_flatbuf_Decimal_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Decimal_vec_len(org_apache_arrow_flatbuf_Decimal_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Decimal_table_t org_apache_arrow_flatbuf_Decimal_vec_at(org_apache_arrow_flatbuf_Decimal_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Decimal_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Decimal) + +/** Total number of decimal digits */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Decimal, precision, flatbuffers_int32, int32_t, INT32_C(0)) +/** Number of digits after the decimal point "." */ +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Decimal, scale, flatbuffers_int32, int32_t, INT32_C(0)) +/** Number of bits per value. The only accepted widths are 128 and 256. + * We use bitWidth for consistency with Int::bitWidth. */ +__flatbuffers_define_scalar_field(2, org_apache_arrow_flatbuf_Decimal, bitWidth, flatbuffers_int32, int32_t, INT32_C(128)) + +/** Date is either a 32-bit or 64-bit signed integer type representing an + * elapsed time since UNIX epoch (1970-01-01), stored in either of two units: + * + * * Milliseconds (64 bits) indicating UNIX time elapsed since the epoch (no + * leap seconds), where the values are evenly divisible by 86400000 + * * Days (32 bits) since the UNIX epoch */ +struct org_apache_arrow_flatbuf_Date_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Date_vec_len(org_apache_arrow_flatbuf_Date_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Date_table_t org_apache_arrow_flatbuf_Date_vec_at(org_apache_arrow_flatbuf_Date_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Date_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Date) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Date, unit, org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t, INT16_C(1)) + +/** Time is either a 32-bit or 64-bit signed integer type representing an + * elapsed time since midnight, stored in either of four units: seconds, + * milliseconds, microseconds or nanoseconds. + * + * The integer `bitWidth` depends on the `unit` and must be one of the following: + * * SECOND and MILLISECOND: 32 bits + * * MICROSECOND and NANOSECOND: 64 bits + * + * The allowed values are between 0 (inclusive) and 86400 (=24*60*60) seconds + * (exclusive), adjusted for the time unit (for example, up to 86400000 + * exclusive for the MILLISECOND unit). + * This definition doesn't allow for leap seconds. Time values from + * measurements with leap seconds will need to be corrected when ingesting + * into Arrow (for example by replacing the value 86400 with 86399). */ +struct org_apache_arrow_flatbuf_Time_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Time_vec_len(org_apache_arrow_flatbuf_Time_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Time_table_t org_apache_arrow_flatbuf_Time_vec_at(org_apache_arrow_flatbuf_Time_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Time_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Time) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Time, unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, INT16_C(1)) +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Time, bitWidth, flatbuffers_int32, int32_t, INT32_C(32)) + +/** Timestamp is a 64-bit signed integer representing an elapsed time since a + * fixed epoch, stored in either of four units: seconds, milliseconds, + * microseconds or nanoseconds, and is optionally annotated with a timezone. + * + * Timestamp values do not include any leap seconds (in other words, all + * days are considered 86400 seconds long). + * + * Timestamps with a non-empty timezone + * ------------------------------------ + * + * If a Timestamp column has a non-empty timezone value, its epoch is + * 1970-01-01 00:00:00 (January 1st 1970, midnight) in the *UTC* timezone + * (the Unix epoch), regardless of the Timestamp's own timezone. + * + * Therefore, timestamp values with a non-empty timezone correspond to + * physical points in time together with some additional information about + * how the data was obtained and/or how to display it (the timezone). + * + * For example, the timestamp value 0 with the timezone string "Europe/Paris" + * corresponds to "January 1st 1970, 00h00" in the UTC timezone, but the + * application may prefer to display it as "January 1st 1970, 01h00" in + * the Europe/Paris timezone (which is the same physical point in time). + * + * One consequence is that timestamp values with a non-empty timezone + * can be compared and ordered directly, since they all share the same + * well-known point of reference (the Unix epoch). + * + * Timestamps with an unset / empty timezone + * ----------------------------------------- + * + * If a Timestamp column has no timezone value, its epoch is + * 1970-01-01 00:00:00 (January 1st 1970, midnight) in an *unknown* timezone. + * + * Therefore, timestamp values without a timezone cannot be meaningfully + * interpreted as physical points in time, but only as calendar / clock + * indications ("wall clock time") in an unspecified timezone. + * + * For example, the timestamp value 0 with an empty timezone string + * corresponds to "January 1st 1970, 00h00" in an unknown timezone: there + * is not enough information to interpret it as a well-defined physical + * point in time. + * + * One consequence is that timestamp values without a timezone cannot + * be reliably compared or ordered, since they may have different points of + * reference. In particular, it is *not* possible to interpret an unset + * or empty timezone as the same as "UTC". + * + * Conversion between timezones + * ---------------------------- + * + * If a Timestamp column has a non-empty timezone, changing the timezone + * to a different non-empty value is a metadata-only operation: + * the timestamp values need not change as their point of reference remains + * the same (the Unix epoch). + * + * However, if a Timestamp column has no timezone value, changing it to a + * non-empty value requires to think about the desired semantics. + * One possibility is to assume that the original timestamp values are + * relative to the epoch of the timezone being set; timestamp values should + * then adjusted to the Unix epoch (for example, changing the timezone from + * empty to "Europe/Paris" would require converting the timestamp values + * from "Europe/Paris" to "UTC", which seems counter-intuitive but is + * nevertheless correct). + * + * Guidelines for encoding data from external libraries + * ---------------------------------------------------- + * + * Date & time libraries often have multiple different data types for temporal + * data. In order to ease interoperability between different implementations the + * Arrow project has some recommendations for encoding these types into a Timestamp + * column. + * + * An "instant" represents a physical point in time that has no relevant timezone + * (for example, astronomical data). To encode an instant, use a Timestamp with + * the timezone string set to "UTC", and make sure the Timestamp values + * are relative to the UTC epoch (January 1st 1970, midnight). + * + * A "zoned date-time" represents a physical point in time annotated with an + * informative timezone (for example, the timezone in which the data was + * recorded). To encode a zoned date-time, use a Timestamp with the timezone + * string set to the name of the timezone, and make sure the Timestamp values + * are relative to the UTC epoch (January 1st 1970, midnight). + * + * (There is some ambiguity between an instant and a zoned date-time with the + * UTC timezone. Both of these are stored the same in Arrow. Typically, + * this distinction does not matter. If it does, then an application should + * use custom metadata or an extension type to distinguish between the two cases.) + * + * An "offset date-time" represents a physical point in time combined with an + * explicit offset from UTC. To encode an offset date-time, use a Timestamp + * with the timezone string set to the numeric timezone offset string + * (e.g. "+03:00"), and make sure the Timestamp values are relative to + * the UTC epoch (January 1st 1970, midnight). + * + * A "naive date-time" (also called "local date-time" in some libraries) + * represents a wall clock time combined with a calendar date, but with + * no indication of how to map this information to a physical point in time. + * Naive date-times must be handled with care because of this missing + * information, and also because daylight saving time (DST) may make + * some values ambiguous or nonexistent. A naive date-time may be + * stored as a struct with Date and Time fields. However, it may also be + * encoded into a Timestamp column with an empty timezone. The timestamp + * values should be computed "as if" the timezone of the date-time values + * was UTC; for example, the naive date-time "January 1st 1970, 00h00" would + * be encoded as timestamp value 0. */ +struct org_apache_arrow_flatbuf_Timestamp_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Timestamp_vec_len(org_apache_arrow_flatbuf_Timestamp_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Timestamp_table_t org_apache_arrow_flatbuf_Timestamp_vec_at(org_apache_arrow_flatbuf_Timestamp_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Timestamp_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Timestamp) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Timestamp, unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, INT16_C(0)) +/** The timezone is an optional string indicating the name of a timezone, + * one of: + * + * * As used in the Olson timezone database (the "tz database" or + * "tzdata"), such as "America/New_York". + * * An absolute timezone offset of the form "+XX:XX" or "-XX:XX", + * such as "+07:30". + * + * Whether a timezone string is present indicates different semantics about + * the data (see above). */ +__flatbuffers_define_string_field(1, org_apache_arrow_flatbuf_Timestamp, timezone, 0) + +struct org_apache_arrow_flatbuf_Interval_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Interval_vec_len(org_apache_arrow_flatbuf_Interval_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Interval_table_t org_apache_arrow_flatbuf_Interval_vec_at(org_apache_arrow_flatbuf_Interval_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Interval_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Interval) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Interval, unit, org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t, INT16_C(0)) + +struct org_apache_arrow_flatbuf_Duration_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Duration_vec_len(org_apache_arrow_flatbuf_Duration_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Duration_table_t org_apache_arrow_flatbuf_Duration_vec_at(org_apache_arrow_flatbuf_Duration_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Duration_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Duration) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Duration, unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, INT16_C(1)) +/** ---------------------------------------------------------------------- + * Top-level Type value, enabling extensible type-specific metadata. We can + * add new logical types to Type without breaking backwards compatibility */ +typedef uint8_t org_apache_arrow_flatbuf_Type_union_type_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Type, org_apache_arrow_flatbuf_Type_union_type_t, 8) +__flatbuffers_define_union(flatbuffers_, org_apache_arrow_flatbuf_Type) +/** ---------------------------------------------------------------------- + * user defined key value pairs to add custom metadata to arrow + * key namespacing is the responsibility of the user */ +#define org_apache_arrow_flatbuf_Type_NONE ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(0)) +#define org_apache_arrow_flatbuf_Type_Null ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(1)) +#define org_apache_arrow_flatbuf_Type_Int ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(2)) +#define org_apache_arrow_flatbuf_Type_FloatingPoint ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(3)) +#define org_apache_arrow_flatbuf_Type_Binary ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(4)) +#define org_apache_arrow_flatbuf_Type_Utf8 ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(5)) +#define org_apache_arrow_flatbuf_Type_Bool ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(6)) +#define org_apache_arrow_flatbuf_Type_Decimal ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(7)) +#define org_apache_arrow_flatbuf_Type_Date ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(8)) +#define org_apache_arrow_flatbuf_Type_Time ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(9)) +#define org_apache_arrow_flatbuf_Type_Timestamp ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(10)) +#define org_apache_arrow_flatbuf_Type_Interval ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(11)) +#define org_apache_arrow_flatbuf_Type_List ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(12)) +#define org_apache_arrow_flatbuf_Type_Struct_ ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(13)) +#define org_apache_arrow_flatbuf_Type_Union ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(14)) +#define org_apache_arrow_flatbuf_Type_FixedSizeBinary ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(15)) +#define org_apache_arrow_flatbuf_Type_FixedSizeList ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(16)) +#define org_apache_arrow_flatbuf_Type_Map ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(17)) +#define org_apache_arrow_flatbuf_Type_Duration ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(18)) +#define org_apache_arrow_flatbuf_Type_LargeBinary ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(19)) +#define org_apache_arrow_flatbuf_Type_LargeUtf8 ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(20)) +#define org_apache_arrow_flatbuf_Type_LargeList ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(21)) +#define org_apache_arrow_flatbuf_Type_RunEndEncoded ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(22)) +#define org_apache_arrow_flatbuf_Type_BinaryView ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(23)) +#define org_apache_arrow_flatbuf_Type_Utf8View ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(24)) +#define org_apache_arrow_flatbuf_Type_ListView ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(25)) +#define org_apache_arrow_flatbuf_Type_LargeListView ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(26)) + +static inline const char *org_apache_arrow_flatbuf_Type_type_name(org_apache_arrow_flatbuf_Type_union_type_t type) +{ + switch (type) { + case org_apache_arrow_flatbuf_Type_NONE: return "NONE"; + case org_apache_arrow_flatbuf_Type_Null: return "Null"; + case org_apache_arrow_flatbuf_Type_Int: return "Int"; + case org_apache_arrow_flatbuf_Type_FloatingPoint: return "FloatingPoint"; + case org_apache_arrow_flatbuf_Type_Binary: return "Binary"; + case org_apache_arrow_flatbuf_Type_Utf8: return "Utf8"; + case org_apache_arrow_flatbuf_Type_Bool: return "Bool"; + case org_apache_arrow_flatbuf_Type_Decimal: return "Decimal"; + case org_apache_arrow_flatbuf_Type_Date: return "Date"; + case org_apache_arrow_flatbuf_Type_Time: return "Time"; + case org_apache_arrow_flatbuf_Type_Timestamp: return "Timestamp"; + case org_apache_arrow_flatbuf_Type_Interval: return "Interval"; + case org_apache_arrow_flatbuf_Type_List: return "List"; + case org_apache_arrow_flatbuf_Type_Struct_: return "Struct_"; + case org_apache_arrow_flatbuf_Type_Union: return "Union"; + case org_apache_arrow_flatbuf_Type_FixedSizeBinary: return "FixedSizeBinary"; + case org_apache_arrow_flatbuf_Type_FixedSizeList: return "FixedSizeList"; + case org_apache_arrow_flatbuf_Type_Map: return "Map"; + case org_apache_arrow_flatbuf_Type_Duration: return "Duration"; + case org_apache_arrow_flatbuf_Type_LargeBinary: return "LargeBinary"; + case org_apache_arrow_flatbuf_Type_LargeUtf8: return "LargeUtf8"; + case org_apache_arrow_flatbuf_Type_LargeList: return "LargeList"; + case org_apache_arrow_flatbuf_Type_RunEndEncoded: return "RunEndEncoded"; + case org_apache_arrow_flatbuf_Type_BinaryView: return "BinaryView"; + case org_apache_arrow_flatbuf_Type_Utf8View: return "Utf8View"; + case org_apache_arrow_flatbuf_Type_ListView: return "ListView"; + case org_apache_arrow_flatbuf_Type_LargeListView: return "LargeListView"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Type_is_known_type(org_apache_arrow_flatbuf_Type_union_type_t type) +{ + switch (type) { + case org_apache_arrow_flatbuf_Type_NONE: return 1; + case org_apache_arrow_flatbuf_Type_Null: return 1; + case org_apache_arrow_flatbuf_Type_Int: return 1; + case org_apache_arrow_flatbuf_Type_FloatingPoint: return 1; + case org_apache_arrow_flatbuf_Type_Binary: return 1; + case org_apache_arrow_flatbuf_Type_Utf8: return 1; + case org_apache_arrow_flatbuf_Type_Bool: return 1; + case org_apache_arrow_flatbuf_Type_Decimal: return 1; + case org_apache_arrow_flatbuf_Type_Date: return 1; + case org_apache_arrow_flatbuf_Type_Time: return 1; + case org_apache_arrow_flatbuf_Type_Timestamp: return 1; + case org_apache_arrow_flatbuf_Type_Interval: return 1; + case org_apache_arrow_flatbuf_Type_List: return 1; + case org_apache_arrow_flatbuf_Type_Struct_: return 1; + case org_apache_arrow_flatbuf_Type_Union: return 1; + case org_apache_arrow_flatbuf_Type_FixedSizeBinary: return 1; + case org_apache_arrow_flatbuf_Type_FixedSizeList: return 1; + case org_apache_arrow_flatbuf_Type_Map: return 1; + case org_apache_arrow_flatbuf_Type_Duration: return 1; + case org_apache_arrow_flatbuf_Type_LargeBinary: return 1; + case org_apache_arrow_flatbuf_Type_LargeUtf8: return 1; + case org_apache_arrow_flatbuf_Type_LargeList: return 1; + case org_apache_arrow_flatbuf_Type_RunEndEncoded: return 1; + case org_apache_arrow_flatbuf_Type_BinaryView: return 1; + case org_apache_arrow_flatbuf_Type_Utf8View: return 1; + case org_apache_arrow_flatbuf_Type_ListView: return 1; + case org_apache_arrow_flatbuf_Type_LargeListView: return 1; + default: return 0; + } +} + + +struct org_apache_arrow_flatbuf_KeyValue_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_KeyValue_vec_len(org_apache_arrow_flatbuf_KeyValue_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_KeyValue_table_t org_apache_arrow_flatbuf_KeyValue_vec_at(org_apache_arrow_flatbuf_KeyValue_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_KeyValue_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_KeyValue) + +__flatbuffers_define_string_field(0, org_apache_arrow_flatbuf_KeyValue, key, 0) +__flatbuffers_define_string_field(1, org_apache_arrow_flatbuf_KeyValue, value, 0) + +struct org_apache_arrow_flatbuf_DictionaryEncoding_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_DictionaryEncoding_vec_len(org_apache_arrow_flatbuf_DictionaryEncoding_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_DictionaryEncoding_table_t org_apache_arrow_flatbuf_DictionaryEncoding_vec_at(org_apache_arrow_flatbuf_DictionaryEncoding_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_DictionaryEncoding_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_DictionaryEncoding) + +/** The known dictionary id in the application where this data is used. In + * the file or streaming formats, the dictionary ids are found in the + * DictionaryBatch messages */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_DictionaryEncoding, id, flatbuffers_int64, int64_t, INT64_C(0)) +/** The dictionary indices are constrained to be non-negative integers. If + * this field is null, the indices must be signed int32. To maximize + * cross-language compatibility and performance, implementations are + * recommended to prefer signed integer types over unsigned integer types + * and to avoid uint64 indices unless they are required by an application. */ +__flatbuffers_define_table_field(1, org_apache_arrow_flatbuf_DictionaryEncoding, indexType, org_apache_arrow_flatbuf_Int_table_t, 0) +/** By default, dictionaries are not ordered, or the order does not have + * semantic meaning. In some statistical, applications, dictionary-encoding + * is used to represent ordered categorical data, and we provide a way to + * preserve that metadata here */ +__flatbuffers_define_scalar_field(2, org_apache_arrow_flatbuf_DictionaryEncoding, isOrdered, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) +__flatbuffers_define_scalar_field(3, org_apache_arrow_flatbuf_DictionaryEncoding, dictionaryKind, org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t, INT16_C(0)) + +/** ---------------------------------------------------------------------- + * A field represents a named column in a record / row batch or child of a + * nested type. */ +struct org_apache_arrow_flatbuf_Field_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Field_vec_len(org_apache_arrow_flatbuf_Field_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Field_table_t org_apache_arrow_flatbuf_Field_vec_at(org_apache_arrow_flatbuf_Field_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Field_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Field) + +/** Name is not required, in i.e. a List */ +__flatbuffers_define_string_field(0, org_apache_arrow_flatbuf_Field, name, 0) +/** Whether or not this field can contain nulls. Should be true in general. */ +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Field, nullable, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) +/** This is the type of the decoded value if the field is dictionary encoded. */ +__flatbuffers_define_union_field(flatbuffers_, 3, org_apache_arrow_flatbuf_Field, type, org_apache_arrow_flatbuf_Type, 0) +/** Present only if the field is dictionary encoded. */ +__flatbuffers_define_table_field(4, org_apache_arrow_flatbuf_Field, dictionary, org_apache_arrow_flatbuf_DictionaryEncoding_table_t, 0) +/** children apply only to nested data types like Struct, List and Union. For + * primitive types children will have length 0. */ +__flatbuffers_define_vector_field(5, org_apache_arrow_flatbuf_Field, children, org_apache_arrow_flatbuf_Field_vec_t, 0) +/** User-defined metadata */ +__flatbuffers_define_vector_field(6, org_apache_arrow_flatbuf_Field, custom_metadata, org_apache_arrow_flatbuf_KeyValue_vec_t, 0) + +/** ---------------------------------------------------------------------- + * A Schema describes the columns in a row batch */ +struct org_apache_arrow_flatbuf_Schema_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Schema_vec_len(org_apache_arrow_flatbuf_Schema_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Schema_table_t org_apache_arrow_flatbuf_Schema_vec_at(org_apache_arrow_flatbuf_Schema_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Schema_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Schema) + +/** endianness of the buffer + * it is Little Endian by default + * if endianness doesn't match the underlying system then the vectors need to be converted */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Schema, endianness, org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t, INT16_C(0)) +__flatbuffers_define_vector_field(1, org_apache_arrow_flatbuf_Schema, fields, org_apache_arrow_flatbuf_Field_vec_t, 0) +__flatbuffers_define_vector_field(2, org_apache_arrow_flatbuf_Schema, custom_metadata, org_apache_arrow_flatbuf_KeyValue_vec_t, 0) +/** Features used in the stream/file. */ +__flatbuffers_define_vector_field(3, org_apache_arrow_flatbuf_Schema, features, org_apache_arrow_flatbuf_Feature_vec_t, 0) + + +#include "flatcc/flatcc_epilogue.h" +#endif /* SCHEMA_READER_H */ +#ifndef SCHEMA_BUILDER_H +#define SCHEMA_BUILDER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef SCHEMA_READER_H +#include "Schema_reader.h" +#endif +#ifndef FLATBUFFERS_COMMON_BUILDER_H +#include "flatbuffers_common_builder.h" +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + +#define __org_apache_arrow_flatbuf_MetadataVersion_formal_args , org_apache_arrow_flatbuf_MetadataVersion_enum_t v0 +#define __org_apache_arrow_flatbuf_MetadataVersion_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_MetadataVersion, org_apache_arrow_flatbuf_MetadataVersion_enum_t) +#define __org_apache_arrow_flatbuf_Feature_formal_args , org_apache_arrow_flatbuf_Feature_enum_t v0 +#define __org_apache_arrow_flatbuf_Feature_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_Feature, org_apache_arrow_flatbuf_Feature_enum_t) +#define __org_apache_arrow_flatbuf_UnionMode_formal_args , org_apache_arrow_flatbuf_UnionMode_enum_t v0 +#define __org_apache_arrow_flatbuf_UnionMode_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t) +#define __org_apache_arrow_flatbuf_Precision_formal_args , org_apache_arrow_flatbuf_Precision_enum_t v0 +#define __org_apache_arrow_flatbuf_Precision_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t) +#define __org_apache_arrow_flatbuf_DateUnit_formal_args , org_apache_arrow_flatbuf_DateUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_DateUnit_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t) +#define __org_apache_arrow_flatbuf_TimeUnit_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_TimeUnit_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t) +#define __org_apache_arrow_flatbuf_IntervalUnit_formal_args , org_apache_arrow_flatbuf_IntervalUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_IntervalUnit_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t) +#define __org_apache_arrow_flatbuf_DictionaryKind_formal_args , org_apache_arrow_flatbuf_DictionaryKind_enum_t v0 +#define __org_apache_arrow_flatbuf_DictionaryKind_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t) +#define __org_apache_arrow_flatbuf_Endianness_formal_args , org_apache_arrow_flatbuf_Endianness_enum_t v0 +#define __org_apache_arrow_flatbuf_Endianness_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t) + +#define __org_apache_arrow_flatbuf_Buffer_formal_args , int64_t v0, int64_t v1 +#define __org_apache_arrow_flatbuf_Buffer_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_assign(org_apache_arrow_flatbuf_Buffer_t *p, int64_t v0, int64_t v1) +{ p->offset = v0; p->length = v1; + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_copy(org_apache_arrow_flatbuf_Buffer_t *p, const org_apache_arrow_flatbuf_Buffer_t *p2) +{ p->offset = p2->offset; p->length = p2->length; + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_assign_to_pe(org_apache_arrow_flatbuf_Buffer_t *p, int64_t v0, int64_t v1) +{ flatbuffers_int64_assign_to_pe(&p->offset, v0); flatbuffers_int64_assign_to_pe(&p->length, v1); + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_copy_to_pe(org_apache_arrow_flatbuf_Buffer_t *p, const org_apache_arrow_flatbuf_Buffer_t *p2) +{ flatbuffers_int64_copy_to_pe(&p->offset, &p2->offset); flatbuffers_int64_copy_to_pe(&p->length, &p2->length); + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_assign_from_pe(org_apache_arrow_flatbuf_Buffer_t *p, int64_t v0, int64_t v1) +{ flatbuffers_int64_assign_from_pe(&p->offset, v0); flatbuffers_int64_assign_from_pe(&p->length, v1); + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_copy_from_pe(org_apache_arrow_flatbuf_Buffer_t *p, const org_apache_arrow_flatbuf_Buffer_t *p2) +{ flatbuffers_int64_copy_from_pe(&p->offset, &p2->offset); flatbuffers_int64_copy_from_pe(&p->length, &p2->length); + return p; } +__flatbuffers_build_struct(flatbuffers_, org_apache_arrow_flatbuf_Buffer, 16, 8, org_apache_arrow_flatbuf_Buffer_file_identifier, org_apache_arrow_flatbuf_Buffer_type_identifier) +__flatbuffers_define_fixed_array_primitives(flatbuffers_, org_apache_arrow_flatbuf_Buffer, org_apache_arrow_flatbuf_Buffer_t) + +typedef flatbuffers_union_ref_t org_apache_arrow_flatbuf_Type_union_ref_t; +typedef flatbuffers_union_vec_ref_t org_apache_arrow_flatbuf_Type_union_vec_ref_t; +static org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Type_union_t t); + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Null_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Null_ref_t; +static org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Null_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Null, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Struct__required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Struct__ref_t; +static org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Struct__table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Struct_, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_List_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_List_ref_t; +static org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_List_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_List, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeList_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeList_ref_t; +static org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeList_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeList, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_ListView_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_ListView_ref_t; +static org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_ListView_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_ListView, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeListView_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeListView_ref_t; +static org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeListView_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeListView, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_FixedSizeList_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_FixedSizeList_ref_t; +static org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeList_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeList, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Map_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Map_ref_t; +static org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Map_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Map, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Union_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Union_ref_t; +static org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Union_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Union, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Int_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Int_ref_t; +static org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Int_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Int, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_FloatingPoint_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_FloatingPoint_ref_t; +static org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FloatingPoint_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_FloatingPoint, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Utf8_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Utf8_ref_t; +static org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Utf8, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Binary_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Binary_ref_t; +static org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Binary_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Binary, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeUtf8_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeUtf8_ref_t; +static org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeUtf8_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeUtf8, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeBinary_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeBinary_ref_t; +static org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeBinary_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeBinary, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Utf8View_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Utf8View_ref_t; +static org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8View_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Utf8View, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_BinaryView_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_BinaryView_ref_t; +static org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_BinaryView_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_BinaryView, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_FixedSizeBinary_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_ref_t; +static org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeBinary_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeBinary, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Bool_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Bool_ref_t; +static org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Bool_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Bool, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_RunEndEncoded_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_RunEndEncoded_ref_t; +static org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_RunEndEncoded_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_RunEndEncoded, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Decimal_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Decimal_ref_t; +static org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Decimal_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Decimal, 3) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Date_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Date_ref_t; +static org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Date_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Date, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Time_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Time_ref_t; +static org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Time_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Time, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Timestamp_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Timestamp_ref_t; +static org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Timestamp_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Timestamp, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Interval_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Interval_ref_t; +static org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Interval_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Interval, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Duration_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Duration_ref_t; +static org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Duration_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Duration, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_KeyValue_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_KeyValue_ref_t; +static org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_KeyValue_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_KeyValue, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_DictionaryEncoding_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_ref_t; +static org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_DictionaryEncoding_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding, 4) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Field_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Field_ref_t; +static org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Field_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Field, 7) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Schema_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Schema_ref_t; +static org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Schema_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Schema, 4) + +#define __org_apache_arrow_flatbuf_Null_formal_args +#define __org_apache_arrow_flatbuf_Null_call_args +static inline org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Null_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Null, org_apache_arrow_flatbuf_Null_file_identifier, org_apache_arrow_flatbuf_Null_type_identifier) + +#define __org_apache_arrow_flatbuf_Struct__formal_args +#define __org_apache_arrow_flatbuf_Struct__call_args +static inline org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Struct__formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Struct_, org_apache_arrow_flatbuf_Struct__file_identifier, org_apache_arrow_flatbuf_Struct__type_identifier) + +#define __org_apache_arrow_flatbuf_List_formal_args +#define __org_apache_arrow_flatbuf_List_call_args +static inline org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_List_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_List, org_apache_arrow_flatbuf_List_file_identifier, org_apache_arrow_flatbuf_List_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeList_formal_args +#define __org_apache_arrow_flatbuf_LargeList_call_args +static inline org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeList_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeList, org_apache_arrow_flatbuf_LargeList_file_identifier, org_apache_arrow_flatbuf_LargeList_type_identifier) + +#define __org_apache_arrow_flatbuf_ListView_formal_args +#define __org_apache_arrow_flatbuf_ListView_call_args +static inline org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_ListView_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_ListView, org_apache_arrow_flatbuf_ListView_file_identifier, org_apache_arrow_flatbuf_ListView_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeListView_formal_args +#define __org_apache_arrow_flatbuf_LargeListView_call_args +static inline org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeListView_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeListView, org_apache_arrow_flatbuf_LargeListView_file_identifier, org_apache_arrow_flatbuf_LargeListView_type_identifier) + +#define __org_apache_arrow_flatbuf_FixedSizeList_formal_args , int32_t v0 +#define __org_apache_arrow_flatbuf_FixedSizeList_call_args , v0 +static inline org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeList_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeList, org_apache_arrow_flatbuf_FixedSizeList_file_identifier, org_apache_arrow_flatbuf_FixedSizeList_type_identifier) + +#define __org_apache_arrow_flatbuf_Map_formal_args , flatbuffers_bool_t v0 +#define __org_apache_arrow_flatbuf_Map_call_args , v0 +static inline org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Map_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Map, org_apache_arrow_flatbuf_Map_file_identifier, org_apache_arrow_flatbuf_Map_type_identifier) + +#define __org_apache_arrow_flatbuf_Union_formal_args , org_apache_arrow_flatbuf_UnionMode_enum_t v0, flatbuffers_int32_vec_ref_t v1 +#define __org_apache_arrow_flatbuf_Union_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Union_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Union, org_apache_arrow_flatbuf_Union_file_identifier, org_apache_arrow_flatbuf_Union_type_identifier) + +#define __org_apache_arrow_flatbuf_Int_formal_args , int32_t v0, flatbuffers_bool_t v1 +#define __org_apache_arrow_flatbuf_Int_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Int_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_Int_file_identifier, org_apache_arrow_flatbuf_Int_type_identifier) + +#define __org_apache_arrow_flatbuf_FloatingPoint_formal_args , org_apache_arrow_flatbuf_Precision_enum_t v0 +#define __org_apache_arrow_flatbuf_FloatingPoint_call_args , v0 +static inline org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FloatingPoint_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_FloatingPoint, org_apache_arrow_flatbuf_FloatingPoint_file_identifier, org_apache_arrow_flatbuf_FloatingPoint_type_identifier) + +#define __org_apache_arrow_flatbuf_Utf8_formal_args +#define __org_apache_arrow_flatbuf_Utf8_call_args +static inline org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Utf8, org_apache_arrow_flatbuf_Utf8_file_identifier, org_apache_arrow_flatbuf_Utf8_type_identifier) + +#define __org_apache_arrow_flatbuf_Binary_formal_args +#define __org_apache_arrow_flatbuf_Binary_call_args +static inline org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Binary_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Binary, org_apache_arrow_flatbuf_Binary_file_identifier, org_apache_arrow_flatbuf_Binary_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeUtf8_formal_args +#define __org_apache_arrow_flatbuf_LargeUtf8_call_args +static inline org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeUtf8_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeUtf8, org_apache_arrow_flatbuf_LargeUtf8_file_identifier, org_apache_arrow_flatbuf_LargeUtf8_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeBinary_formal_args +#define __org_apache_arrow_flatbuf_LargeBinary_call_args +static inline org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeBinary_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeBinary, org_apache_arrow_flatbuf_LargeBinary_file_identifier, org_apache_arrow_flatbuf_LargeBinary_type_identifier) + +#define __org_apache_arrow_flatbuf_Utf8View_formal_args +#define __org_apache_arrow_flatbuf_Utf8View_call_args +static inline org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8View_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Utf8View, org_apache_arrow_flatbuf_Utf8View_file_identifier, org_apache_arrow_flatbuf_Utf8View_type_identifier) + +#define __org_apache_arrow_flatbuf_BinaryView_formal_args +#define __org_apache_arrow_flatbuf_BinaryView_call_args +static inline org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_BinaryView_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_BinaryView, org_apache_arrow_flatbuf_BinaryView_file_identifier, org_apache_arrow_flatbuf_BinaryView_type_identifier) + +#define __org_apache_arrow_flatbuf_FixedSizeBinary_formal_args , int32_t v0 +#define __org_apache_arrow_flatbuf_FixedSizeBinary_call_args , v0 +static inline org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeBinary_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeBinary, org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier, org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier) + +#define __org_apache_arrow_flatbuf_Bool_formal_args +#define __org_apache_arrow_flatbuf_Bool_call_args +static inline org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Bool_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Bool, org_apache_arrow_flatbuf_Bool_file_identifier, org_apache_arrow_flatbuf_Bool_type_identifier) + +#define __org_apache_arrow_flatbuf_RunEndEncoded_formal_args +#define __org_apache_arrow_flatbuf_RunEndEncoded_call_args +static inline org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_RunEndEncoded_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_RunEndEncoded, org_apache_arrow_flatbuf_RunEndEncoded_file_identifier, org_apache_arrow_flatbuf_RunEndEncoded_type_identifier) + +#define __org_apache_arrow_flatbuf_Decimal_formal_args , int32_t v0, int32_t v1, int32_t v2 +#define __org_apache_arrow_flatbuf_Decimal_call_args , v0, v1, v2 +static inline org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Decimal_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Decimal, org_apache_arrow_flatbuf_Decimal_file_identifier, org_apache_arrow_flatbuf_Decimal_type_identifier) + +#define __org_apache_arrow_flatbuf_Date_formal_args , org_apache_arrow_flatbuf_DateUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_Date_call_args , v0 +static inline org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Date_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Date, org_apache_arrow_flatbuf_Date_file_identifier, org_apache_arrow_flatbuf_Date_type_identifier) + +#define __org_apache_arrow_flatbuf_Time_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0, int32_t v1 +#define __org_apache_arrow_flatbuf_Time_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Time_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Time, org_apache_arrow_flatbuf_Time_file_identifier, org_apache_arrow_flatbuf_Time_type_identifier) + +#define __org_apache_arrow_flatbuf_Timestamp_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0, flatbuffers_string_ref_t v1 +#define __org_apache_arrow_flatbuf_Timestamp_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Timestamp_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Timestamp, org_apache_arrow_flatbuf_Timestamp_file_identifier, org_apache_arrow_flatbuf_Timestamp_type_identifier) + +#define __org_apache_arrow_flatbuf_Interval_formal_args , org_apache_arrow_flatbuf_IntervalUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_Interval_call_args , v0 +static inline org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Interval_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Interval, org_apache_arrow_flatbuf_Interval_file_identifier, org_apache_arrow_flatbuf_Interval_type_identifier) + +#define __org_apache_arrow_flatbuf_Duration_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_Duration_call_args , v0 +static inline org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Duration_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Duration, org_apache_arrow_flatbuf_Duration_file_identifier, org_apache_arrow_flatbuf_Duration_type_identifier) + +#define __org_apache_arrow_flatbuf_KeyValue_formal_args , flatbuffers_string_ref_t v0, flatbuffers_string_ref_t v1 +#define __org_apache_arrow_flatbuf_KeyValue_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_KeyValue_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_KeyValue, org_apache_arrow_flatbuf_KeyValue_file_identifier, org_apache_arrow_flatbuf_KeyValue_type_identifier) + +#define __org_apache_arrow_flatbuf_DictionaryEncoding_formal_args , int64_t v0, org_apache_arrow_flatbuf_Int_ref_t v1, flatbuffers_bool_t v2, org_apache_arrow_flatbuf_DictionaryKind_enum_t v3 +#define __org_apache_arrow_flatbuf_DictionaryEncoding_call_args , v0, v1, v2, v3 +static inline org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_DictionaryEncoding_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding, org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier, org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier) + +#define __org_apache_arrow_flatbuf_Field_formal_args ,\ + flatbuffers_string_ref_t v0, flatbuffers_bool_t v1, org_apache_arrow_flatbuf_Type_union_ref_t v3, org_apache_arrow_flatbuf_DictionaryEncoding_ref_t v4, org_apache_arrow_flatbuf_Field_vec_ref_t v5, org_apache_arrow_flatbuf_KeyValue_vec_ref_t v6 +#define __org_apache_arrow_flatbuf_Field_call_args ,\ + v0, v1, v3, v4, v5, v6 +static inline org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Field_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Field, org_apache_arrow_flatbuf_Field_file_identifier, org_apache_arrow_flatbuf_Field_type_identifier) + +#define __org_apache_arrow_flatbuf_Schema_formal_args , org_apache_arrow_flatbuf_Endianness_enum_t v0, org_apache_arrow_flatbuf_Field_vec_ref_t v1, org_apache_arrow_flatbuf_KeyValue_vec_ref_t v2, org_apache_arrow_flatbuf_Feature_vec_ref_t v3 +#define __org_apache_arrow_flatbuf_Schema_call_args , v0, v1, v2, v3 +static inline org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Schema_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Schema, org_apache_arrow_flatbuf_Schema_file_identifier, org_apache_arrow_flatbuf_Schema_type_identifier) + +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_NONE(void) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_NONE; uref.value = 0; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Null(org_apache_arrow_flatbuf_Null_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Null; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Int(org_apache_arrow_flatbuf_Int_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Int; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_FloatingPoint(org_apache_arrow_flatbuf_FloatingPoint_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_FloatingPoint; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Binary(org_apache_arrow_flatbuf_Binary_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Binary; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Utf8(org_apache_arrow_flatbuf_Utf8_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Utf8; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Bool(org_apache_arrow_flatbuf_Bool_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Bool; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Decimal(org_apache_arrow_flatbuf_Decimal_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Decimal; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Date(org_apache_arrow_flatbuf_Date_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Date; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Time(org_apache_arrow_flatbuf_Time_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Time; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Timestamp(org_apache_arrow_flatbuf_Timestamp_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Timestamp; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Interval(org_apache_arrow_flatbuf_Interval_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Interval; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_List(org_apache_arrow_flatbuf_List_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_List; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Struct_(org_apache_arrow_flatbuf_Struct__ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Struct_; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Union(org_apache_arrow_flatbuf_Union_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Union; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_FixedSizeBinary(org_apache_arrow_flatbuf_FixedSizeBinary_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_FixedSizeBinary; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_FixedSizeList(org_apache_arrow_flatbuf_FixedSizeList_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_FixedSizeList; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Map(org_apache_arrow_flatbuf_Map_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Map; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Duration(org_apache_arrow_flatbuf_Duration_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Duration; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeBinary(org_apache_arrow_flatbuf_LargeBinary_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeBinary; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeUtf8(org_apache_arrow_flatbuf_LargeUtf8_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeUtf8; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeList(org_apache_arrow_flatbuf_LargeList_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeList; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_RunEndEncoded(org_apache_arrow_flatbuf_RunEndEncoded_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_RunEndEncoded; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_BinaryView(org_apache_arrow_flatbuf_BinaryView_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_BinaryView; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Utf8View(org_apache_arrow_flatbuf_Utf8View_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Utf8View; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_ListView(org_apache_arrow_flatbuf_ListView_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_ListView; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeListView(org_apache_arrow_flatbuf_LargeListView_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeListView; uref.value = ref; return uref; } +__flatbuffers_build_union_vector(flatbuffers_, org_apache_arrow_flatbuf_Type) + +static org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Type_union_t u) +{ + switch (u.type) { + case 1: return org_apache_arrow_flatbuf_Type_as_Null(org_apache_arrow_flatbuf_Null_clone(B, (org_apache_arrow_flatbuf_Null_table_t)u.value)); + case 2: return org_apache_arrow_flatbuf_Type_as_Int(org_apache_arrow_flatbuf_Int_clone(B, (org_apache_arrow_flatbuf_Int_table_t)u.value)); + case 3: return org_apache_arrow_flatbuf_Type_as_FloatingPoint(org_apache_arrow_flatbuf_FloatingPoint_clone(B, (org_apache_arrow_flatbuf_FloatingPoint_table_t)u.value)); + case 4: return org_apache_arrow_flatbuf_Type_as_Binary(org_apache_arrow_flatbuf_Binary_clone(B, (org_apache_arrow_flatbuf_Binary_table_t)u.value)); + case 5: return org_apache_arrow_flatbuf_Type_as_Utf8(org_apache_arrow_flatbuf_Utf8_clone(B, (org_apache_arrow_flatbuf_Utf8_table_t)u.value)); + case 6: return org_apache_arrow_flatbuf_Type_as_Bool(org_apache_arrow_flatbuf_Bool_clone(B, (org_apache_arrow_flatbuf_Bool_table_t)u.value)); + case 7: return org_apache_arrow_flatbuf_Type_as_Decimal(org_apache_arrow_flatbuf_Decimal_clone(B, (org_apache_arrow_flatbuf_Decimal_table_t)u.value)); + case 8: return org_apache_arrow_flatbuf_Type_as_Date(org_apache_arrow_flatbuf_Date_clone(B, (org_apache_arrow_flatbuf_Date_table_t)u.value)); + case 9: return org_apache_arrow_flatbuf_Type_as_Time(org_apache_arrow_flatbuf_Time_clone(B, (org_apache_arrow_flatbuf_Time_table_t)u.value)); + case 10: return org_apache_arrow_flatbuf_Type_as_Timestamp(org_apache_arrow_flatbuf_Timestamp_clone(B, (org_apache_arrow_flatbuf_Timestamp_table_t)u.value)); + case 11: return org_apache_arrow_flatbuf_Type_as_Interval(org_apache_arrow_flatbuf_Interval_clone(B, (org_apache_arrow_flatbuf_Interval_table_t)u.value)); + case 12: return org_apache_arrow_flatbuf_Type_as_List(org_apache_arrow_flatbuf_List_clone(B, (org_apache_arrow_flatbuf_List_table_t)u.value)); + case 13: return org_apache_arrow_flatbuf_Type_as_Struct_(org_apache_arrow_flatbuf_Struct__clone(B, (org_apache_arrow_flatbuf_Struct__table_t)u.value)); + case 14: return org_apache_arrow_flatbuf_Type_as_Union(org_apache_arrow_flatbuf_Union_clone(B, (org_apache_arrow_flatbuf_Union_table_t)u.value)); + case 15: return org_apache_arrow_flatbuf_Type_as_FixedSizeBinary(org_apache_arrow_flatbuf_FixedSizeBinary_clone(B, (org_apache_arrow_flatbuf_FixedSizeBinary_table_t)u.value)); + case 16: return org_apache_arrow_flatbuf_Type_as_FixedSizeList(org_apache_arrow_flatbuf_FixedSizeList_clone(B, (org_apache_arrow_flatbuf_FixedSizeList_table_t)u.value)); + case 17: return org_apache_arrow_flatbuf_Type_as_Map(org_apache_arrow_flatbuf_Map_clone(B, (org_apache_arrow_flatbuf_Map_table_t)u.value)); + case 18: return org_apache_arrow_flatbuf_Type_as_Duration(org_apache_arrow_flatbuf_Duration_clone(B, (org_apache_arrow_flatbuf_Duration_table_t)u.value)); + case 19: return org_apache_arrow_flatbuf_Type_as_LargeBinary(org_apache_arrow_flatbuf_LargeBinary_clone(B, (org_apache_arrow_flatbuf_LargeBinary_table_t)u.value)); + case 20: return org_apache_arrow_flatbuf_Type_as_LargeUtf8(org_apache_arrow_flatbuf_LargeUtf8_clone(B, (org_apache_arrow_flatbuf_LargeUtf8_table_t)u.value)); + case 21: return org_apache_arrow_flatbuf_Type_as_LargeList(org_apache_arrow_flatbuf_LargeList_clone(B, (org_apache_arrow_flatbuf_LargeList_table_t)u.value)); + case 22: return org_apache_arrow_flatbuf_Type_as_RunEndEncoded(org_apache_arrow_flatbuf_RunEndEncoded_clone(B, (org_apache_arrow_flatbuf_RunEndEncoded_table_t)u.value)); + case 23: return org_apache_arrow_flatbuf_Type_as_BinaryView(org_apache_arrow_flatbuf_BinaryView_clone(B, (org_apache_arrow_flatbuf_BinaryView_table_t)u.value)); + case 24: return org_apache_arrow_flatbuf_Type_as_Utf8View(org_apache_arrow_flatbuf_Utf8View_clone(B, (org_apache_arrow_flatbuf_Utf8View_table_t)u.value)); + case 25: return org_apache_arrow_flatbuf_Type_as_ListView(org_apache_arrow_flatbuf_ListView_clone(B, (org_apache_arrow_flatbuf_ListView_table_t)u.value)); + case 26: return org_apache_arrow_flatbuf_Type_as_LargeListView(org_apache_arrow_flatbuf_LargeListView_clone(B, (org_apache_arrow_flatbuf_LargeListView_table_t)u.value)); + default: return org_apache_arrow_flatbuf_Type_as_NONE(); + } +} + + +static inline org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Null_formal_args) +{ + if (org_apache_arrow_flatbuf_Null_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Null_end(B); +} + +static org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Null_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Null_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Null_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Struct__formal_args) +{ + if (org_apache_arrow_flatbuf_Struct__start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Struct__end(B); +} + +static org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Struct__table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Struct__start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Struct__end(B)); +} + + +static inline org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_List_formal_args) +{ + if (org_apache_arrow_flatbuf_List_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_List_end(B); +} + +static org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_List_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_List_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_List_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeList_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeList_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeList_end(B); +} + +static org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeList_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeList_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeList_end(B)); +} + + +static inline org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_ListView_formal_args) +{ + if (org_apache_arrow_flatbuf_ListView_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_ListView_end(B); +} + +static org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_ListView_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_ListView_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_ListView_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeListView_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeListView_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeListView_end(B); +} + +static org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeListView_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeListView_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeListView_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_FixedSizeList_listSize, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_FixedSizeList) + +static inline org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeList_formal_args) +{ + if (org_apache_arrow_flatbuf_FixedSizeList_start(B) + || org_apache_arrow_flatbuf_FixedSizeList_listSize_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_FixedSizeList_end(B); +} + +static org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeList_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_FixedSizeList_start(B) + || org_apache_arrow_flatbuf_FixedSizeList_listSize_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_FixedSizeList_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Map_keysSorted, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_Map) + +static inline org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Map_formal_args) +{ + if (org_apache_arrow_flatbuf_Map_start(B) + || org_apache_arrow_flatbuf_Map_keysSorted_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Map_end(B); +} + +static org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Map_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Map_start(B) + || org_apache_arrow_flatbuf_Map_keysSorted_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Map_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Union_mode, org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Union) +__flatbuffers_build_vector_field(1, flatbuffers_, org_apache_arrow_flatbuf_Union_typeIds, flatbuffers_int32, int32_t, org_apache_arrow_flatbuf_Union) + +static inline org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Union_formal_args) +{ + if (org_apache_arrow_flatbuf_Union_start(B) + || org_apache_arrow_flatbuf_Union_typeIds_add(B, v1) + || org_apache_arrow_flatbuf_Union_mode_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Union_end(B); +} + +static org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Union_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Union_start(B) + || org_apache_arrow_flatbuf_Union_typeIds_pick(B, t) + || org_apache_arrow_flatbuf_Union_mode_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Union_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Int_bitWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_Int) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Int_is_signed, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_Int) + +static inline org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Int_formal_args) +{ + if (org_apache_arrow_flatbuf_Int_start(B) + || org_apache_arrow_flatbuf_Int_bitWidth_add(B, v0) + || org_apache_arrow_flatbuf_Int_is_signed_add(B, v1)) { + return 0; + } + return org_apache_arrow_flatbuf_Int_end(B); +} + +static org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Int_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Int_start(B) + || org_apache_arrow_flatbuf_Int_bitWidth_pick(B, t) + || org_apache_arrow_flatbuf_Int_is_signed_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Int_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_FloatingPoint_precision, org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_FloatingPoint) + +static inline org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FloatingPoint_formal_args) +{ + if (org_apache_arrow_flatbuf_FloatingPoint_start(B) + || org_apache_arrow_flatbuf_FloatingPoint_precision_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_FloatingPoint_end(B); +} + +static org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FloatingPoint_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_FloatingPoint_start(B) + || org_apache_arrow_flatbuf_FloatingPoint_precision_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_FloatingPoint_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8_formal_args) +{ + if (org_apache_arrow_flatbuf_Utf8_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Utf8_end(B); +} + +static org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Utf8_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Utf8_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Binary_formal_args) +{ + if (org_apache_arrow_flatbuf_Binary_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Binary_end(B); +} + +static org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Binary_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Binary_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Binary_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeUtf8_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeUtf8_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeUtf8_end(B); +} + +static org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeUtf8_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeUtf8_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeUtf8_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeBinary_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeBinary_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeBinary_end(B); +} + +static org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeBinary_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeBinary_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeBinary_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8View_formal_args) +{ + if (org_apache_arrow_flatbuf_Utf8View_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Utf8View_end(B); +} + +static org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8View_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Utf8View_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Utf8View_end(B)); +} + + +static inline org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_BinaryView_formal_args) +{ + if (org_apache_arrow_flatbuf_BinaryView_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_BinaryView_end(B); +} + +static org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_BinaryView_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_BinaryView_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_BinaryView_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_FixedSizeBinary_byteWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_FixedSizeBinary) + +static inline org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeBinary_formal_args) +{ + if (org_apache_arrow_flatbuf_FixedSizeBinary_start(B) + || org_apache_arrow_flatbuf_FixedSizeBinary_byteWidth_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_FixedSizeBinary_end(B); +} + +static org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeBinary_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_FixedSizeBinary_start(B) + || org_apache_arrow_flatbuf_FixedSizeBinary_byteWidth_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_FixedSizeBinary_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Bool_formal_args) +{ + if (org_apache_arrow_flatbuf_Bool_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Bool_end(B); +} + +static org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Bool_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Bool_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Bool_end(B)); +} + + +static inline org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_RunEndEncoded_formal_args) +{ + if (org_apache_arrow_flatbuf_RunEndEncoded_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_RunEndEncoded_end(B); +} + +static org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_RunEndEncoded_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_RunEndEncoded_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_RunEndEncoded_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Decimal_precision, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Decimal_scale, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_scalar_field(2, flatbuffers_, org_apache_arrow_flatbuf_Decimal_bitWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(128), org_apache_arrow_flatbuf_Decimal) + +static inline org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Decimal_formal_args) +{ + if (org_apache_arrow_flatbuf_Decimal_start(B) + || org_apache_arrow_flatbuf_Decimal_precision_add(B, v0) + || org_apache_arrow_flatbuf_Decimal_scale_add(B, v1) + || org_apache_arrow_flatbuf_Decimal_bitWidth_add(B, v2)) { + return 0; + } + return org_apache_arrow_flatbuf_Decimal_end(B); +} + +static org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Decimal_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Decimal_start(B) + || org_apache_arrow_flatbuf_Decimal_precision_pick(B, t) + || org_apache_arrow_flatbuf_Decimal_scale_pick(B, t) + || org_apache_arrow_flatbuf_Decimal_bitWidth_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Decimal_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Date_unit, org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t, 2, 2, INT16_C(1), org_apache_arrow_flatbuf_Date) + +static inline org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Date_formal_args) +{ + if (org_apache_arrow_flatbuf_Date_start(B) + || org_apache_arrow_flatbuf_Date_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Date_end(B); +} + +static org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Date_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Date_start(B) + || org_apache_arrow_flatbuf_Date_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Date_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Time_unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 2, 2, INT16_C(1), org_apache_arrow_flatbuf_Time) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Time_bitWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(32), org_apache_arrow_flatbuf_Time) + +static inline org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Time_formal_args) +{ + if (org_apache_arrow_flatbuf_Time_start(B) + || org_apache_arrow_flatbuf_Time_bitWidth_add(B, v1) + || org_apache_arrow_flatbuf_Time_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Time_end(B); +} + +static org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Time_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Time_start(B) + || org_apache_arrow_flatbuf_Time_bitWidth_pick(B, t) + || org_apache_arrow_flatbuf_Time_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Time_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Timestamp_unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Timestamp) +__flatbuffers_build_string_field(1, flatbuffers_, org_apache_arrow_flatbuf_Timestamp_timezone, org_apache_arrow_flatbuf_Timestamp) + +static inline org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Timestamp_formal_args) +{ + if (org_apache_arrow_flatbuf_Timestamp_start(B) + || org_apache_arrow_flatbuf_Timestamp_timezone_add(B, v1) + || org_apache_arrow_flatbuf_Timestamp_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Timestamp_end(B); +} + +static org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Timestamp_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Timestamp_start(B) + || org_apache_arrow_flatbuf_Timestamp_timezone_pick(B, t) + || org_apache_arrow_flatbuf_Timestamp_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Timestamp_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Interval_unit, org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Interval) + +static inline org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Interval_formal_args) +{ + if (org_apache_arrow_flatbuf_Interval_start(B) + || org_apache_arrow_flatbuf_Interval_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Interval_end(B); +} + +static org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Interval_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Interval_start(B) + || org_apache_arrow_flatbuf_Interval_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Interval_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Duration_unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 2, 2, INT16_C(1), org_apache_arrow_flatbuf_Duration) + +static inline org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Duration_formal_args) +{ + if (org_apache_arrow_flatbuf_Duration_start(B) + || org_apache_arrow_flatbuf_Duration_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Duration_end(B); +} + +static org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Duration_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Duration_start(B) + || org_apache_arrow_flatbuf_Duration_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Duration_end(B)); +} + +__flatbuffers_build_string_field(0, flatbuffers_, org_apache_arrow_flatbuf_KeyValue_key, org_apache_arrow_flatbuf_KeyValue) +__flatbuffers_build_string_field(1, flatbuffers_, org_apache_arrow_flatbuf_KeyValue_value, org_apache_arrow_flatbuf_KeyValue) + +static inline org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_KeyValue_formal_args) +{ + if (org_apache_arrow_flatbuf_KeyValue_start(B) + || org_apache_arrow_flatbuf_KeyValue_key_add(B, v0) + || org_apache_arrow_flatbuf_KeyValue_value_add(B, v1)) { + return 0; + } + return org_apache_arrow_flatbuf_KeyValue_end(B); +} + +static org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_KeyValue_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_KeyValue_start(B) + || org_apache_arrow_flatbuf_KeyValue_key_pick(B, t) + || org_apache_arrow_flatbuf_KeyValue_value_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_KeyValue_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_id, flatbuffers_int64, int64_t, 8, 8, INT64_C(0), org_apache_arrow_flatbuf_DictionaryEncoding) +__flatbuffers_build_table_field(1, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_indexType, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_DictionaryEncoding) +__flatbuffers_build_scalar_field(2, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_isOrdered, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_DictionaryEncoding) +__flatbuffers_build_scalar_field(3, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_dictionaryKind, org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_DictionaryEncoding) + +static inline org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_DictionaryEncoding_formal_args) +{ + if (org_apache_arrow_flatbuf_DictionaryEncoding_start(B) + || org_apache_arrow_flatbuf_DictionaryEncoding_id_add(B, v0) + || org_apache_arrow_flatbuf_DictionaryEncoding_indexType_add(B, v1) + || org_apache_arrow_flatbuf_DictionaryEncoding_dictionaryKind_add(B, v3) + || org_apache_arrow_flatbuf_DictionaryEncoding_isOrdered_add(B, v2)) { + return 0; + } + return org_apache_arrow_flatbuf_DictionaryEncoding_end(B); +} + +static org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_DictionaryEncoding_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_DictionaryEncoding_start(B) + || org_apache_arrow_flatbuf_DictionaryEncoding_id_pick(B, t) + || org_apache_arrow_flatbuf_DictionaryEncoding_indexType_pick(B, t) + || org_apache_arrow_flatbuf_DictionaryEncoding_dictionaryKind_pick(B, t) + || org_apache_arrow_flatbuf_DictionaryEncoding_isOrdered_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_DictionaryEncoding_end(B)); +} + +__flatbuffers_build_string_field(0, flatbuffers_, org_apache_arrow_flatbuf_Field_name, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Field_nullable, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_Field) +__flatbuffers_build_union_field(3, flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Null, org_apache_arrow_flatbuf_Null) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Int, org_apache_arrow_flatbuf_Int) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, FloatingPoint, org_apache_arrow_flatbuf_FloatingPoint) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Binary, org_apache_arrow_flatbuf_Binary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Utf8, org_apache_arrow_flatbuf_Utf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Bool, org_apache_arrow_flatbuf_Bool) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Decimal, org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Date, org_apache_arrow_flatbuf_Date) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Time, org_apache_arrow_flatbuf_Time) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Timestamp, org_apache_arrow_flatbuf_Timestamp) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Interval, org_apache_arrow_flatbuf_Interval) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, List, org_apache_arrow_flatbuf_List) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Struct_, org_apache_arrow_flatbuf_Struct_) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Union, org_apache_arrow_flatbuf_Union) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, FixedSizeBinary, org_apache_arrow_flatbuf_FixedSizeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, FixedSizeList, org_apache_arrow_flatbuf_FixedSizeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Map, org_apache_arrow_flatbuf_Map) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Duration, org_apache_arrow_flatbuf_Duration) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeBinary, org_apache_arrow_flatbuf_LargeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeUtf8, org_apache_arrow_flatbuf_LargeUtf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeList, org_apache_arrow_flatbuf_LargeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, RunEndEncoded, org_apache_arrow_flatbuf_RunEndEncoded) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, BinaryView, org_apache_arrow_flatbuf_BinaryView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Utf8View, org_apache_arrow_flatbuf_Utf8View) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, ListView, org_apache_arrow_flatbuf_ListView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeListView, org_apache_arrow_flatbuf_LargeListView) +__flatbuffers_build_table_field(4, flatbuffers_, org_apache_arrow_flatbuf_Field_dictionary, org_apache_arrow_flatbuf_DictionaryEncoding, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_table_vector_field(5, flatbuffers_, org_apache_arrow_flatbuf_Field_children, org_apache_arrow_flatbuf_Field, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_table_vector_field(6, flatbuffers_, org_apache_arrow_flatbuf_Field_custom_metadata, org_apache_arrow_flatbuf_KeyValue, org_apache_arrow_flatbuf_Field) + +static inline org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Field_formal_args) +{ + if (org_apache_arrow_flatbuf_Field_start(B) + || org_apache_arrow_flatbuf_Field_name_add(B, v0) + || org_apache_arrow_flatbuf_Field_type_add_value(B, v3) + || org_apache_arrow_flatbuf_Field_dictionary_add(B, v4) + || org_apache_arrow_flatbuf_Field_children_add(B, v5) + || org_apache_arrow_flatbuf_Field_custom_metadata_add(B, v6) + || org_apache_arrow_flatbuf_Field_nullable_add(B, v1) + || org_apache_arrow_flatbuf_Field_type_add_type(B, v3.type)) { + return 0; + } + return org_apache_arrow_flatbuf_Field_end(B); +} + +static org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Field_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Field_start(B) + || org_apache_arrow_flatbuf_Field_name_pick(B, t) + || org_apache_arrow_flatbuf_Field_type_pick(B, t) + || org_apache_arrow_flatbuf_Field_dictionary_pick(B, t) + || org_apache_arrow_flatbuf_Field_children_pick(B, t) + || org_apache_arrow_flatbuf_Field_custom_metadata_pick(B, t) + || org_apache_arrow_flatbuf_Field_nullable_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Field_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Schema_endianness, org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Schema) +__flatbuffers_build_table_vector_field(1, flatbuffers_, org_apache_arrow_flatbuf_Schema_fields, org_apache_arrow_flatbuf_Field, org_apache_arrow_flatbuf_Schema) +__flatbuffers_build_table_vector_field(2, flatbuffers_, org_apache_arrow_flatbuf_Schema_custom_metadata, org_apache_arrow_flatbuf_KeyValue, org_apache_arrow_flatbuf_Schema) +__flatbuffers_build_vector_field(3, flatbuffers_, org_apache_arrow_flatbuf_Schema_features, org_apache_arrow_flatbuf_Feature, org_apache_arrow_flatbuf_Feature_enum_t, org_apache_arrow_flatbuf_Schema) + +static inline org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Schema_formal_args) +{ + if (org_apache_arrow_flatbuf_Schema_start(B) + || org_apache_arrow_flatbuf_Schema_fields_add(B, v1) + || org_apache_arrow_flatbuf_Schema_custom_metadata_add(B, v2) + || org_apache_arrow_flatbuf_Schema_features_add(B, v3) + || org_apache_arrow_flatbuf_Schema_endianness_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Schema_end(B); +} + +static org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Schema_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Schema_start(B) + || org_apache_arrow_flatbuf_Schema_fields_pick(B, t) + || org_apache_arrow_flatbuf_Schema_custom_metadata_pick(B, t) + || org_apache_arrow_flatbuf_Schema_features_pick(B, t) + || org_apache_arrow_flatbuf_Schema_endianness_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Schema_end(B)); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* SCHEMA_BUILDER_H */ +#ifndef SCHEMA_VERIFIER_H +#define SCHEMA_VERIFIER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef SCHEMA_READER_H +#include "Schema_reader.h" +#endif +#include "flatcc/flatcc_verifier.h" +#include "flatcc/flatcc_prologue.h" + +static int org_apache_arrow_flatbuf_Null_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Struct__verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_List_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeList_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_ListView_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeListView_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_FixedSizeList_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Map_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Union_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Int_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_FloatingPoint_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Utf8_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Binary_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeUtf8_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeBinary_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Utf8View_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_BinaryView_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_FixedSizeBinary_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Bool_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_RunEndEncoded_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Decimal_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Date_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Time_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Timestamp_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Interval_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Duration_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_KeyValue_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_DictionaryEncoding_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Field_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Schema_verify_table(flatcc_table_verifier_descriptor_t *td); + +static int org_apache_arrow_flatbuf_Type_union_verifier(flatcc_union_verifier_descriptor_t *ud) +{ + switch (ud->type) { + case 1: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Null_verify_table); /* Null */ + case 2: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Int_verify_table); /* Int */ + case 3: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_FloatingPoint_verify_table); /* FloatingPoint */ + case 4: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Binary_verify_table); /* Binary */ + case 5: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Utf8_verify_table); /* Utf8 */ + case 6: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Bool_verify_table); /* Bool */ + case 7: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Decimal_verify_table); /* Decimal */ + case 8: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Date_verify_table); /* Date */ + case 9: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Time_verify_table); /* Time */ + case 10: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Timestamp_verify_table); /* Timestamp */ + case 11: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Interval_verify_table); /* Interval */ + case 12: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_List_verify_table); /* List */ + case 13: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Struct__verify_table); /* Struct_ */ + case 14: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Union_verify_table); /* Union */ + case 15: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); /* FixedSizeBinary */ + case 16: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_FixedSizeList_verify_table); /* FixedSizeList */ + case 17: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Map_verify_table); /* Map */ + case 18: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Duration_verify_table); /* Duration */ + case 19: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeBinary_verify_table); /* LargeBinary */ + case 20: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeUtf8_verify_table); /* LargeUtf8 */ + case 21: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeList_verify_table); /* LargeList */ + case 22: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_RunEndEncoded_verify_table); /* RunEndEncoded */ + case 23: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_BinaryView_verify_table); /* BinaryView */ + case 24: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Utf8View_verify_table); /* Utf8View */ + case 25: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_ListView_verify_table); /* ListView */ + case 26: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeListView_verify_table); /* LargeListView */ + default: return flatcc_verify_ok; + } +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_identifier, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_identifier, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_typed_root(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_type_hash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_typed_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_type_hash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_struct_as_typed_root(buf, bufsiz, thash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_struct_as_typed_root_with_size(buf, bufsiz, thash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_struct_as_root(buf, bufsiz, fid, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_struct_as_root_with_size(buf, bufsiz, fid, 16, 8); +} + +static int org_apache_arrow_flatbuf_Null_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Null_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Null_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Null_type_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Null_type_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static int org_apache_arrow_flatbuf_Struct__verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Struct__identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Struct__identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Struct__type_identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Struct__type_identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static int org_apache_arrow_flatbuf_List_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_List_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_List_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_List_type_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_List_type_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_List_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeList_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_type_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_type_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static int org_apache_arrow_flatbuf_ListView_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_ListView_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_ListView_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_ListView_type_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_ListView_type_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeListView_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_type_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_type_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static int org_apache_arrow_flatbuf_FixedSizeList_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* listSize */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_type_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_type_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static int org_apache_arrow_flatbuf_Map_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 1, 1) /* keysSorted */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Map_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Map_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Map_type_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Map_type_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static int org_apache_arrow_flatbuf_Union_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* mode */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 1, 0, 4, 4, INT64_C(1073741823)) /* typeIds */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Union_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Union_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Union_type_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Union_type_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static int org_apache_arrow_flatbuf_Int_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* bitWidth */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 1, 1) /* is_signed */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Int_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Int_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Int_type_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Int_type_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static int org_apache_arrow_flatbuf_FloatingPoint_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* precision */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_type_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_type_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static int org_apache_arrow_flatbuf_Utf8_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_type_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_type_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static int org_apache_arrow_flatbuf_Binary_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Binary_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Binary_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Binary_type_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Binary_type_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeUtf8_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_type_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_type_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeBinary_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_type_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_type_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static int org_apache_arrow_flatbuf_Utf8View_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_type_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_type_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static int org_apache_arrow_flatbuf_BinaryView_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_type_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_type_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static int org_apache_arrow_flatbuf_FixedSizeBinary_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* byteWidth */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static int org_apache_arrow_flatbuf_Bool_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Bool_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Bool_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Bool_type_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Bool_type_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static int org_apache_arrow_flatbuf_RunEndEncoded_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_type_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_type_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static int org_apache_arrow_flatbuf_Decimal_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* precision */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 4, 4) /* scale */)) return ret; + if ((ret = flatcc_verify_field(td, 2, 4, 4) /* bitWidth */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_type_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_type_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static int org_apache_arrow_flatbuf_Date_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Date_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Date_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Date_type_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Date_type_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static int org_apache_arrow_flatbuf_Time_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 4, 4) /* bitWidth */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Time_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Time_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Time_type_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Time_type_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static int org_apache_arrow_flatbuf_Timestamp_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + if ((ret = flatcc_verify_string_field(td, 1, 0) /* timezone */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_type_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_type_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static int org_apache_arrow_flatbuf_Interval_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Interval_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Interval_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Interval_type_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Interval_type_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static int org_apache_arrow_flatbuf_Duration_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Duration_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Duration_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Duration_type_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Duration_type_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static int org_apache_arrow_flatbuf_KeyValue_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_string_field(td, 0, 0) /* key */)) return ret; + if ((ret = flatcc_verify_string_field(td, 1, 0) /* value */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_type_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_type_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static int org_apache_arrow_flatbuf_DictionaryEncoding_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 8, 8) /* id */)) return ret; + if ((ret = flatcc_verify_table_field(td, 1, 0, &org_apache_arrow_flatbuf_Int_verify_table) /* indexType */)) return ret; + if ((ret = flatcc_verify_field(td, 2, 1, 1) /* isOrdered */)) return ret; + if ((ret = flatcc_verify_field(td, 3, 2, 2) /* dictionaryKind */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static int org_apache_arrow_flatbuf_Field_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_string_field(td, 0, 0) /* name */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 1, 1) /* nullable */)) return ret; + if ((ret = flatcc_verify_union_field(td, 3, 0, &org_apache_arrow_flatbuf_Type_union_verifier) /* type */)) return ret; + if ((ret = flatcc_verify_table_field(td, 4, 0, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table) /* dictionary */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 5, 0, &org_apache_arrow_flatbuf_Field_verify_table) /* children */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 6, 0, &org_apache_arrow_flatbuf_KeyValue_verify_table) /* custom_metadata */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Field_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Field_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Field_type_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Field_type_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static int org_apache_arrow_flatbuf_Schema_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* endianness */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 1, 0, &org_apache_arrow_flatbuf_Field_verify_table) /* fields */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 2, 0, &org_apache_arrow_flatbuf_KeyValue_verify_table) /* custom_metadata */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 3, 0, 8, 8, INT64_C(536870911)) /* features */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Schema_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Schema_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Schema_type_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Schema_type_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* SCHEMA_VERIFIER_H */ +#ifndef FILE_READER_H +#define FILE_READER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef FLATBUFFERS_COMMON_READER_H +#include "flatbuffers_common_reader.h" +#endif +#ifndef SCHEMA_READER_H +#include "Schema_reader.h" +#endif +#include "flatcc/flatcc_flatbuffers.h" +#ifndef __alignas_is_defined +#include +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + +typedef struct org_apache_arrow_flatbuf_Block org_apache_arrow_flatbuf_Block_t; +typedef const org_apache_arrow_flatbuf_Block_t *org_apache_arrow_flatbuf_Block_struct_t; +typedef org_apache_arrow_flatbuf_Block_t *org_apache_arrow_flatbuf_Block_mutable_struct_t; +typedef const org_apache_arrow_flatbuf_Block_t *org_apache_arrow_flatbuf_Block_vec_t; +typedef org_apache_arrow_flatbuf_Block_t *org_apache_arrow_flatbuf_Block_mutable_vec_t; + +typedef const struct org_apache_arrow_flatbuf_Footer_table *org_apache_arrow_flatbuf_Footer_table_t; +typedef struct org_apache_arrow_flatbuf_Footer_table *org_apache_arrow_flatbuf_Footer_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Footer_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Footer_mutable_vec_t; +#ifndef org_apache_arrow_flatbuf_Footer_file_identifier +#define org_apache_arrow_flatbuf_Footer_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Footer_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Footer_identifier +#define org_apache_arrow_flatbuf_Footer_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Footer_type_hash ((flatbuffers_thash_t)0x65df4be3) +#define org_apache_arrow_flatbuf_Footer_type_identifier "\xe3\x4b\xdf\x65" +#ifndef org_apache_arrow_flatbuf_Footer_file_extension +#define org_apache_arrow_flatbuf_Footer_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Block_file_identifier +#define org_apache_arrow_flatbuf_Block_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Block_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Block_identifier +#define org_apache_arrow_flatbuf_Block_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Block_type_hash ((flatbuffers_thash_t)0xdc6d4841) +#define org_apache_arrow_flatbuf_Block_type_identifier "\x41\x48\x6d\xdc" +#ifndef org_apache_arrow_flatbuf_Block_file_extension +#define org_apache_arrow_flatbuf_Block_file_extension "bin" +#endif + + +struct org_apache_arrow_flatbuf_Block { + /** Index to the start of the RecordBlock (note this is past the Message header) */ + alignas(8) int64_t offset; + /** Length of the metadata */ + alignas(4) int32_t metaDataLength; + /** Length of the data (this is aligned so there can be a gap between this and + * the metadata). */ + alignas(8) int64_t bodyLength; +}; +static_assert(sizeof(org_apache_arrow_flatbuf_Block_t) == 24, "struct size mismatch"); + +static inline const org_apache_arrow_flatbuf_Block_t *org_apache_arrow_flatbuf_Block__const_ptr_add(const org_apache_arrow_flatbuf_Block_t *p, size_t i) { return p + i; } +static inline org_apache_arrow_flatbuf_Block_t *org_apache_arrow_flatbuf_Block__ptr_add(org_apache_arrow_flatbuf_Block_t *p, size_t i) { return p + i; } +static inline org_apache_arrow_flatbuf_Block_struct_t org_apache_arrow_flatbuf_Block_vec_at(org_apache_arrow_flatbuf_Block_vec_t vec, size_t i) +__flatbuffers_struct_vec_at(vec, i) +static inline size_t org_apache_arrow_flatbuf_Block__size(void) { return 24; } +static inline size_t org_apache_arrow_flatbuf_Block_vec_len(org_apache_arrow_flatbuf_Block_vec_t vec) +__flatbuffers_vec_len(vec) +__flatbuffers_struct_as_root(org_apache_arrow_flatbuf_Block) + +__flatbuffers_define_struct_scalar_field(org_apache_arrow_flatbuf_Block, offset, flatbuffers_int64, int64_t) +__flatbuffers_define_struct_scalar_field(org_apache_arrow_flatbuf_Block, metaDataLength, flatbuffers_int32, int32_t) +__flatbuffers_define_struct_scalar_field(org_apache_arrow_flatbuf_Block, bodyLength, flatbuffers_int64, int64_t) + + +/** ---------------------------------------------------------------------- + * Arrow File metadata + * */ +struct org_apache_arrow_flatbuf_Footer_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Footer_vec_len(org_apache_arrow_flatbuf_Footer_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Footer_table_t org_apache_arrow_flatbuf_Footer_vec_at(org_apache_arrow_flatbuf_Footer_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Footer_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Footer) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Footer, version, org_apache_arrow_flatbuf_MetadataVersion, org_apache_arrow_flatbuf_MetadataVersion_enum_t, INT16_C(0)) +__flatbuffers_define_table_field(1, org_apache_arrow_flatbuf_Footer, schema, org_apache_arrow_flatbuf_Schema_table_t, 0) +__flatbuffers_define_vector_field(2, org_apache_arrow_flatbuf_Footer, dictionaries, org_apache_arrow_flatbuf_Block_vec_t, 0) +__flatbuffers_define_vector_field(3, org_apache_arrow_flatbuf_Footer, recordBatches, org_apache_arrow_flatbuf_Block_vec_t, 0) +/** User-defined metadata */ +__flatbuffers_define_vector_field(4, org_apache_arrow_flatbuf_Footer, custom_metadata, org_apache_arrow_flatbuf_KeyValue_vec_t, 0) + + +#include "flatcc/flatcc_epilogue.h" +#endif /* FILE_READER_H */ +#ifndef FILE_BUILDER_H +#define FILE_BUILDER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef FILE_READER_H +#include "File_reader.h" +#endif +#ifndef FLATBUFFERS_COMMON_BUILDER_H +#include "flatbuffers_common_builder.h" +#endif +#ifndef SCHEMA_BUILDER_H +#include "Schema_builder.h" +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + +#define __org_apache_arrow_flatbuf_Block_formal_args , int64_t v0, int32_t v1, int64_t v2 +#define __org_apache_arrow_flatbuf_Block_call_args , v0, v1, v2 +static inline org_apache_arrow_flatbuf_Block_t *org_apache_arrow_flatbuf_Block_assign(org_apache_arrow_flatbuf_Block_t *p, int64_t v0, int32_t v1, int64_t v2) +{ p->offset = v0; p->metaDataLength = v1; p->bodyLength = v2; + return p; } +static inline org_apache_arrow_flatbuf_Block_t *org_apache_arrow_flatbuf_Block_copy(org_apache_arrow_flatbuf_Block_t *p, const org_apache_arrow_flatbuf_Block_t *p2) +{ p->offset = p2->offset; p->metaDataLength = p2->metaDataLength; p->bodyLength = p2->bodyLength; + return p; } +static inline org_apache_arrow_flatbuf_Block_t *org_apache_arrow_flatbuf_Block_assign_to_pe(org_apache_arrow_flatbuf_Block_t *p, int64_t v0, int32_t v1, int64_t v2) +{ flatbuffers_int64_assign_to_pe(&p->offset, v0); flatbuffers_int32_assign_to_pe(&p->metaDataLength, v1); flatbuffers_int64_assign_to_pe(&p->bodyLength, v2); + return p; } +static inline org_apache_arrow_flatbuf_Block_t *org_apache_arrow_flatbuf_Block_copy_to_pe(org_apache_arrow_flatbuf_Block_t *p, const org_apache_arrow_flatbuf_Block_t *p2) +{ flatbuffers_int64_copy_to_pe(&p->offset, &p2->offset); flatbuffers_int32_copy_to_pe(&p->metaDataLength, &p2->metaDataLength); flatbuffers_int64_copy_to_pe(&p->bodyLength, &p2->bodyLength); + return p; } +static inline org_apache_arrow_flatbuf_Block_t *org_apache_arrow_flatbuf_Block_assign_from_pe(org_apache_arrow_flatbuf_Block_t *p, int64_t v0, int32_t v1, int64_t v2) +{ flatbuffers_int64_assign_from_pe(&p->offset, v0); flatbuffers_int32_assign_from_pe(&p->metaDataLength, v1); flatbuffers_int64_assign_from_pe(&p->bodyLength, v2); + return p; } +static inline org_apache_arrow_flatbuf_Block_t *org_apache_arrow_flatbuf_Block_copy_from_pe(org_apache_arrow_flatbuf_Block_t *p, const org_apache_arrow_flatbuf_Block_t *p2) +{ flatbuffers_int64_copy_from_pe(&p->offset, &p2->offset); flatbuffers_int32_copy_from_pe(&p->metaDataLength, &p2->metaDataLength); flatbuffers_int64_copy_from_pe(&p->bodyLength, &p2->bodyLength); + return p; } +__flatbuffers_build_struct(flatbuffers_, org_apache_arrow_flatbuf_Block, 24, 8, org_apache_arrow_flatbuf_Block_file_identifier, org_apache_arrow_flatbuf_Block_type_identifier) +__flatbuffers_define_fixed_array_primitives(flatbuffers_, org_apache_arrow_flatbuf_Block, org_apache_arrow_flatbuf_Block_t) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Footer_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Footer_ref_t; +static org_apache_arrow_flatbuf_Footer_ref_t org_apache_arrow_flatbuf_Footer_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Footer_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Footer, 5) + +#define __org_apache_arrow_flatbuf_Footer_formal_args ,\ + org_apache_arrow_flatbuf_MetadataVersion_enum_t v0, org_apache_arrow_flatbuf_Schema_ref_t v1, org_apache_arrow_flatbuf_Block_vec_ref_t v2, org_apache_arrow_flatbuf_Block_vec_ref_t v3, org_apache_arrow_flatbuf_KeyValue_vec_ref_t v4 +#define __org_apache_arrow_flatbuf_Footer_call_args ,\ + v0, v1, v2, v3, v4 +static inline org_apache_arrow_flatbuf_Footer_ref_t org_apache_arrow_flatbuf_Footer_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Footer_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Footer, org_apache_arrow_flatbuf_Footer_file_identifier, org_apache_arrow_flatbuf_Footer_type_identifier) + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Footer_version, org_apache_arrow_flatbuf_MetadataVersion, org_apache_arrow_flatbuf_MetadataVersion_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Footer) +__flatbuffers_build_table_field(1, flatbuffers_, org_apache_arrow_flatbuf_Footer_schema, org_apache_arrow_flatbuf_Schema, org_apache_arrow_flatbuf_Footer) +__flatbuffers_build_vector_field(2, flatbuffers_, org_apache_arrow_flatbuf_Footer_dictionaries, org_apache_arrow_flatbuf_Block, org_apache_arrow_flatbuf_Block_t, org_apache_arrow_flatbuf_Footer) +__flatbuffers_build_vector_field(3, flatbuffers_, org_apache_arrow_flatbuf_Footer_recordBatches, org_apache_arrow_flatbuf_Block, org_apache_arrow_flatbuf_Block_t, org_apache_arrow_flatbuf_Footer) +__flatbuffers_build_table_vector_field(4, flatbuffers_, org_apache_arrow_flatbuf_Footer_custom_metadata, org_apache_arrow_flatbuf_KeyValue, org_apache_arrow_flatbuf_Footer) + +static inline org_apache_arrow_flatbuf_Footer_ref_t org_apache_arrow_flatbuf_Footer_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Footer_formal_args) +{ + if (org_apache_arrow_flatbuf_Footer_start(B) + || org_apache_arrow_flatbuf_Footer_schema_add(B, v1) + || org_apache_arrow_flatbuf_Footer_dictionaries_add(B, v2) + || org_apache_arrow_flatbuf_Footer_recordBatches_add(B, v3) + || org_apache_arrow_flatbuf_Footer_custom_metadata_add(B, v4) + || org_apache_arrow_flatbuf_Footer_version_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Footer_end(B); +} + +static org_apache_arrow_flatbuf_Footer_ref_t org_apache_arrow_flatbuf_Footer_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Footer_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Footer_start(B) + || org_apache_arrow_flatbuf_Footer_schema_pick(B, t) + || org_apache_arrow_flatbuf_Footer_dictionaries_pick(B, t) + || org_apache_arrow_flatbuf_Footer_recordBatches_pick(B, t) + || org_apache_arrow_flatbuf_Footer_custom_metadata_pick(B, t) + || org_apache_arrow_flatbuf_Footer_version_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Footer_end(B)); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* FILE_BUILDER_H */ +#ifndef FILE_VERIFIER_H +#define FILE_VERIFIER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef FILE_READER_H +#include "File_reader.h" +#endif +#include "flatcc/flatcc_verifier.h" +#ifndef SCHEMA_VERIFIER_H +#include "Schema_verifier.h" +#endif +#include "flatcc/flatcc_prologue.h" + +static int org_apache_arrow_flatbuf_Footer_verify_table(flatcc_table_verifier_descriptor_t *td); + +static inline int org_apache_arrow_flatbuf_Block_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Block_identifier, 24, 8); +} + +static inline int org_apache_arrow_flatbuf_Block_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Block_identifier, 24, 8); +} + +static inline int org_apache_arrow_flatbuf_Block_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_typed_root(buf, bufsiz, org_apache_arrow_flatbuf_Block_type_hash, 24, 8); +} + +static inline int org_apache_arrow_flatbuf_Block_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_typed_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Block_type_hash, 24, 8); +} + +static inline int org_apache_arrow_flatbuf_Block_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_struct_as_typed_root(buf, bufsiz, thash, 24, 8); +} + +static inline int org_apache_arrow_flatbuf_Block_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_struct_as_typed_root_with_size(buf, bufsiz, thash, 24, 8); +} + +static inline int org_apache_arrow_flatbuf_Block_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_struct_as_root(buf, bufsiz, fid, 24, 8); +} + +static inline int org_apache_arrow_flatbuf_Block_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_struct_as_root_with_size(buf, bufsiz, fid, 24, 8); +} + +static int org_apache_arrow_flatbuf_Footer_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* version */)) return ret; + if ((ret = flatcc_verify_table_field(td, 1, 0, &org_apache_arrow_flatbuf_Schema_verify_table) /* schema */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 2, 0, 24, 8, INT64_C(178956970)) /* dictionaries */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 3, 0, 24, 8, INT64_C(178956970)) /* recordBatches */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 4, 0, &org_apache_arrow_flatbuf_KeyValue_verify_table) /* custom_metadata */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Footer_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Footer_identifier, &org_apache_arrow_flatbuf_Footer_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Footer_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Footer_identifier, &org_apache_arrow_flatbuf_Footer_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Footer_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Footer_type_identifier, &org_apache_arrow_flatbuf_Footer_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Footer_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Footer_type_identifier, &org_apache_arrow_flatbuf_Footer_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Footer_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Footer_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Footer_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Footer_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Footer_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Footer_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Footer_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Footer_verify_table); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* FILE_VERIFIER_H */ +#ifndef SCHEMA_READER_H +#define SCHEMA_READER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef FLATBUFFERS_COMMON_READER_H +#include "flatbuffers_common_reader.h" +#endif +#include "flatcc/flatcc_flatbuffers.h" +#ifndef __alignas_is_defined +#include +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + +typedef struct org_apache_arrow_flatbuf_Buffer org_apache_arrow_flatbuf_Buffer_t; +typedef const org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_struct_t; +typedef org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_mutable_struct_t; +typedef const org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_vec_t; +typedef org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_mutable_vec_t; + +typedef const struct org_apache_arrow_flatbuf_Null_table *org_apache_arrow_flatbuf_Null_table_t; +typedef struct org_apache_arrow_flatbuf_Null_table *org_apache_arrow_flatbuf_Null_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Null_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Null_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Struct__table *org_apache_arrow_flatbuf_Struct__table_t; +typedef struct org_apache_arrow_flatbuf_Struct__table *org_apache_arrow_flatbuf_Struct__mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Struct__vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Struct__mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_List_table *org_apache_arrow_flatbuf_List_table_t; +typedef struct org_apache_arrow_flatbuf_List_table *org_apache_arrow_flatbuf_List_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_List_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_List_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeList_table *org_apache_arrow_flatbuf_LargeList_table_t; +typedef struct org_apache_arrow_flatbuf_LargeList_table *org_apache_arrow_flatbuf_LargeList_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeList_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeList_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_ListView_table *org_apache_arrow_flatbuf_ListView_table_t; +typedef struct org_apache_arrow_flatbuf_ListView_table *org_apache_arrow_flatbuf_ListView_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_ListView_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_ListView_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeListView_table *org_apache_arrow_flatbuf_LargeListView_table_t; +typedef struct org_apache_arrow_flatbuf_LargeListView_table *org_apache_arrow_flatbuf_LargeListView_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeListView_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeListView_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_FixedSizeList_table *org_apache_arrow_flatbuf_FixedSizeList_table_t; +typedef struct org_apache_arrow_flatbuf_FixedSizeList_table *org_apache_arrow_flatbuf_FixedSizeList_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeList_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeList_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Map_table *org_apache_arrow_flatbuf_Map_table_t; +typedef struct org_apache_arrow_flatbuf_Map_table *org_apache_arrow_flatbuf_Map_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Map_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Map_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Union_table *org_apache_arrow_flatbuf_Union_table_t; +typedef struct org_apache_arrow_flatbuf_Union_table *org_apache_arrow_flatbuf_Union_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Union_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Union_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Int_table *org_apache_arrow_flatbuf_Int_table_t; +typedef struct org_apache_arrow_flatbuf_Int_table *org_apache_arrow_flatbuf_Int_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Int_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Int_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_FloatingPoint_table *org_apache_arrow_flatbuf_FloatingPoint_table_t; +typedef struct org_apache_arrow_flatbuf_FloatingPoint_table *org_apache_arrow_flatbuf_FloatingPoint_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FloatingPoint_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FloatingPoint_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Utf8_table *org_apache_arrow_flatbuf_Utf8_table_t; +typedef struct org_apache_arrow_flatbuf_Utf8_table *org_apache_arrow_flatbuf_Utf8_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Binary_table *org_apache_arrow_flatbuf_Binary_table_t; +typedef struct org_apache_arrow_flatbuf_Binary_table *org_apache_arrow_flatbuf_Binary_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Binary_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Binary_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeUtf8_table *org_apache_arrow_flatbuf_LargeUtf8_table_t; +typedef struct org_apache_arrow_flatbuf_LargeUtf8_table *org_apache_arrow_flatbuf_LargeUtf8_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeUtf8_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeUtf8_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeBinary_table *org_apache_arrow_flatbuf_LargeBinary_table_t; +typedef struct org_apache_arrow_flatbuf_LargeBinary_table *org_apache_arrow_flatbuf_LargeBinary_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeBinary_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeBinary_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Utf8View_table *org_apache_arrow_flatbuf_Utf8View_table_t; +typedef struct org_apache_arrow_flatbuf_Utf8View_table *org_apache_arrow_flatbuf_Utf8View_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8View_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8View_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_BinaryView_table *org_apache_arrow_flatbuf_BinaryView_table_t; +typedef struct org_apache_arrow_flatbuf_BinaryView_table *org_apache_arrow_flatbuf_BinaryView_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_BinaryView_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_BinaryView_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_FixedSizeBinary_table *org_apache_arrow_flatbuf_FixedSizeBinary_table_t; +typedef struct org_apache_arrow_flatbuf_FixedSizeBinary_table *org_apache_arrow_flatbuf_FixedSizeBinary_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeBinary_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeBinary_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Bool_table *org_apache_arrow_flatbuf_Bool_table_t; +typedef struct org_apache_arrow_flatbuf_Bool_table *org_apache_arrow_flatbuf_Bool_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Bool_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Bool_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_RunEndEncoded_table *org_apache_arrow_flatbuf_RunEndEncoded_table_t; +typedef struct org_apache_arrow_flatbuf_RunEndEncoded_table *org_apache_arrow_flatbuf_RunEndEncoded_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_RunEndEncoded_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_RunEndEncoded_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Decimal_table *org_apache_arrow_flatbuf_Decimal_table_t; +typedef struct org_apache_arrow_flatbuf_Decimal_table *org_apache_arrow_flatbuf_Decimal_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Decimal_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Decimal_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Date_table *org_apache_arrow_flatbuf_Date_table_t; +typedef struct org_apache_arrow_flatbuf_Date_table *org_apache_arrow_flatbuf_Date_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Date_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Date_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Time_table *org_apache_arrow_flatbuf_Time_table_t; +typedef struct org_apache_arrow_flatbuf_Time_table *org_apache_arrow_flatbuf_Time_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Time_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Time_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Timestamp_table *org_apache_arrow_flatbuf_Timestamp_table_t; +typedef struct org_apache_arrow_flatbuf_Timestamp_table *org_apache_arrow_flatbuf_Timestamp_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Timestamp_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Timestamp_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Interval_table *org_apache_arrow_flatbuf_Interval_table_t; +typedef struct org_apache_arrow_flatbuf_Interval_table *org_apache_arrow_flatbuf_Interval_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Interval_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Interval_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Duration_table *org_apache_arrow_flatbuf_Duration_table_t; +typedef struct org_apache_arrow_flatbuf_Duration_table *org_apache_arrow_flatbuf_Duration_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Duration_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Duration_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_KeyValue_table *org_apache_arrow_flatbuf_KeyValue_table_t; +typedef struct org_apache_arrow_flatbuf_KeyValue_table *org_apache_arrow_flatbuf_KeyValue_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_KeyValue_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_KeyValue_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_DictionaryEncoding_table *org_apache_arrow_flatbuf_DictionaryEncoding_table_t; +typedef struct org_apache_arrow_flatbuf_DictionaryEncoding_table *org_apache_arrow_flatbuf_DictionaryEncoding_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_DictionaryEncoding_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_DictionaryEncoding_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Field_table *org_apache_arrow_flatbuf_Field_table_t; +typedef struct org_apache_arrow_flatbuf_Field_table *org_apache_arrow_flatbuf_Field_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Field_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Field_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Schema_table *org_apache_arrow_flatbuf_Schema_table_t; +typedef struct org_apache_arrow_flatbuf_Schema_table *org_apache_arrow_flatbuf_Schema_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Schema_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Schema_mutable_vec_t; +#ifndef org_apache_arrow_flatbuf_Null_file_identifier +#define org_apache_arrow_flatbuf_Null_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Null_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Null_identifier +#define org_apache_arrow_flatbuf_Null_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Null_type_hash ((flatbuffers_thash_t)0x7b36a4dd) +#define org_apache_arrow_flatbuf_Null_type_identifier "\xdd\xa4\x36\x7b" +#ifndef org_apache_arrow_flatbuf_Null_file_extension +#define org_apache_arrow_flatbuf_Null_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Struct__file_identifier +#define org_apache_arrow_flatbuf_Struct__file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Struct__file_identifier */ +#ifndef org_apache_arrow_flatbuf_Struct__identifier +#define org_apache_arrow_flatbuf_Struct__identifier 0 +#endif +#define org_apache_arrow_flatbuf_Struct__type_hash ((flatbuffers_thash_t)0x6310f362) +#define org_apache_arrow_flatbuf_Struct__type_identifier "\x62\xf3\x10\x63" +#ifndef org_apache_arrow_flatbuf_Struct__file_extension +#define org_apache_arrow_flatbuf_Struct__file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_List_file_identifier +#define org_apache_arrow_flatbuf_List_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_List_file_identifier */ +#ifndef org_apache_arrow_flatbuf_List_identifier +#define org_apache_arrow_flatbuf_List_identifier 0 +#endif +#define org_apache_arrow_flatbuf_List_type_hash ((flatbuffers_thash_t)0xd4ce5878) +#define org_apache_arrow_flatbuf_List_type_identifier "\x78\x58\xce\xd4" +#ifndef org_apache_arrow_flatbuf_List_file_extension +#define org_apache_arrow_flatbuf_List_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeList_file_identifier +#define org_apache_arrow_flatbuf_LargeList_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeList_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeList_identifier +#define org_apache_arrow_flatbuf_LargeList_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeList_type_hash ((flatbuffers_thash_t)0x38aa7e27) +#define org_apache_arrow_flatbuf_LargeList_type_identifier "\x27\x7e\xaa\x38" +#ifndef org_apache_arrow_flatbuf_LargeList_file_extension +#define org_apache_arrow_flatbuf_LargeList_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_ListView_file_identifier +#define org_apache_arrow_flatbuf_ListView_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_ListView_file_identifier */ +#ifndef org_apache_arrow_flatbuf_ListView_identifier +#define org_apache_arrow_flatbuf_ListView_identifier 0 +#endif +#define org_apache_arrow_flatbuf_ListView_type_hash ((flatbuffers_thash_t)0x23d37919) +#define org_apache_arrow_flatbuf_ListView_type_identifier "\x19\x79\xd3\x23" +#ifndef org_apache_arrow_flatbuf_ListView_file_extension +#define org_apache_arrow_flatbuf_ListView_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeListView_file_identifier +#define org_apache_arrow_flatbuf_LargeListView_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeListView_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeListView_identifier +#define org_apache_arrow_flatbuf_LargeListView_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeListView_type_hash ((flatbuffers_thash_t)0x28efac02) +#define org_apache_arrow_flatbuf_LargeListView_type_identifier "\x02\xac\xef\x28" +#ifndef org_apache_arrow_flatbuf_LargeListView_file_extension +#define org_apache_arrow_flatbuf_LargeListView_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_FixedSizeList_file_identifier +#define org_apache_arrow_flatbuf_FixedSizeList_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_FixedSizeList_file_identifier */ +#ifndef org_apache_arrow_flatbuf_FixedSizeList_identifier +#define org_apache_arrow_flatbuf_FixedSizeList_identifier 0 +#endif +#define org_apache_arrow_flatbuf_FixedSizeList_type_hash ((flatbuffers_thash_t)0xcef245bb) +#define org_apache_arrow_flatbuf_FixedSizeList_type_identifier "\xbb\x45\xf2\xce" +#ifndef org_apache_arrow_flatbuf_FixedSizeList_file_extension +#define org_apache_arrow_flatbuf_FixedSizeList_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Map_file_identifier +#define org_apache_arrow_flatbuf_Map_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Map_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Map_identifier +#define org_apache_arrow_flatbuf_Map_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Map_type_hash ((flatbuffers_thash_t)0xcebef8e6) +#define org_apache_arrow_flatbuf_Map_type_identifier "\xe6\xf8\xbe\xce" +#ifndef org_apache_arrow_flatbuf_Map_file_extension +#define org_apache_arrow_flatbuf_Map_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Union_file_identifier +#define org_apache_arrow_flatbuf_Union_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Union_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Union_identifier +#define org_apache_arrow_flatbuf_Union_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Union_type_hash ((flatbuffers_thash_t)0x896bda57) +#define org_apache_arrow_flatbuf_Union_type_identifier "\x57\xda\x6b\x89" +#ifndef org_apache_arrow_flatbuf_Union_file_extension +#define org_apache_arrow_flatbuf_Union_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Int_file_identifier +#define org_apache_arrow_flatbuf_Int_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Int_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Int_identifier +#define org_apache_arrow_flatbuf_Int_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Int_type_hash ((flatbuffers_thash_t)0x30789001) +#define org_apache_arrow_flatbuf_Int_type_identifier "\x01\x90\x78\x30" +#ifndef org_apache_arrow_flatbuf_Int_file_extension +#define org_apache_arrow_flatbuf_Int_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_FloatingPoint_file_identifier +#define org_apache_arrow_flatbuf_FloatingPoint_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_FloatingPoint_file_identifier */ +#ifndef org_apache_arrow_flatbuf_FloatingPoint_identifier +#define org_apache_arrow_flatbuf_FloatingPoint_identifier 0 +#endif +#define org_apache_arrow_flatbuf_FloatingPoint_type_hash ((flatbuffers_thash_t)0xf7d06268) +#define org_apache_arrow_flatbuf_FloatingPoint_type_identifier "\x68\x62\xd0\xf7" +#ifndef org_apache_arrow_flatbuf_FloatingPoint_file_extension +#define org_apache_arrow_flatbuf_FloatingPoint_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Utf8_file_identifier +#define org_apache_arrow_flatbuf_Utf8_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Utf8_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Utf8_identifier +#define org_apache_arrow_flatbuf_Utf8_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Utf8_type_hash ((flatbuffers_thash_t)0x8fe60d37) +#define org_apache_arrow_flatbuf_Utf8_type_identifier "\x37\x0d\xe6\x8f" +#ifndef org_apache_arrow_flatbuf_Utf8_file_extension +#define org_apache_arrow_flatbuf_Utf8_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Binary_file_identifier +#define org_apache_arrow_flatbuf_Binary_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Binary_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Binary_identifier +#define org_apache_arrow_flatbuf_Binary_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Binary_type_hash ((flatbuffers_thash_t)0x8e21a795) +#define org_apache_arrow_flatbuf_Binary_type_identifier "\x95\xa7\x21\x8e" +#ifndef org_apache_arrow_flatbuf_Binary_file_extension +#define org_apache_arrow_flatbuf_Binary_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeUtf8_file_identifier +#define org_apache_arrow_flatbuf_LargeUtf8_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeUtf8_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeUtf8_identifier +#define org_apache_arrow_flatbuf_LargeUtf8_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeUtf8_type_hash ((flatbuffers_thash_t)0x24ed2fb0) +#define org_apache_arrow_flatbuf_LargeUtf8_type_identifier "\xb0\x2f\xed\x24" +#ifndef org_apache_arrow_flatbuf_LargeUtf8_file_extension +#define org_apache_arrow_flatbuf_LargeUtf8_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeBinary_file_identifier +#define org_apache_arrow_flatbuf_LargeBinary_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeBinary_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeBinary_identifier +#define org_apache_arrow_flatbuf_LargeBinary_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeBinary_type_hash ((flatbuffers_thash_t)0xbd437872) +#define org_apache_arrow_flatbuf_LargeBinary_type_identifier "\x72\x78\x43\xbd" +#ifndef org_apache_arrow_flatbuf_LargeBinary_file_extension +#define org_apache_arrow_flatbuf_LargeBinary_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Utf8View_file_identifier +#define org_apache_arrow_flatbuf_Utf8View_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Utf8View_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Utf8View_identifier +#define org_apache_arrow_flatbuf_Utf8View_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Utf8View_type_hash ((flatbuffers_thash_t)0xab7692) +#define org_apache_arrow_flatbuf_Utf8View_type_identifier "\x92\x76\xab\x00" +#ifndef org_apache_arrow_flatbuf_Utf8View_file_extension +#define org_apache_arrow_flatbuf_Utf8View_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_BinaryView_file_identifier +#define org_apache_arrow_flatbuf_BinaryView_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_BinaryView_file_identifier */ +#ifndef org_apache_arrow_flatbuf_BinaryView_identifier +#define org_apache_arrow_flatbuf_BinaryView_identifier 0 +#endif +#define org_apache_arrow_flatbuf_BinaryView_type_hash ((flatbuffers_thash_t)0x18c52428) +#define org_apache_arrow_flatbuf_BinaryView_type_identifier "\x28\x24\xc5\x18" +#ifndef org_apache_arrow_flatbuf_BinaryView_file_extension +#define org_apache_arrow_flatbuf_BinaryView_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier +#define org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier */ +#ifndef org_apache_arrow_flatbuf_FixedSizeBinary_identifier +#define org_apache_arrow_flatbuf_FixedSizeBinary_identifier 0 +#endif +#define org_apache_arrow_flatbuf_FixedSizeBinary_type_hash ((flatbuffers_thash_t)0x80d0f4ce) +#define org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier "\xce\xf4\xd0\x80" +#ifndef org_apache_arrow_flatbuf_FixedSizeBinary_file_extension +#define org_apache_arrow_flatbuf_FixedSizeBinary_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Bool_file_identifier +#define org_apache_arrow_flatbuf_Bool_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Bool_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Bool_identifier +#define org_apache_arrow_flatbuf_Bool_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Bool_type_hash ((flatbuffers_thash_t)0x96bf83f0) +#define org_apache_arrow_flatbuf_Bool_type_identifier "\xf0\x83\xbf\x96" +#ifndef org_apache_arrow_flatbuf_Bool_file_extension +#define org_apache_arrow_flatbuf_Bool_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_RunEndEncoded_file_identifier +#define org_apache_arrow_flatbuf_RunEndEncoded_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_RunEndEncoded_file_identifier */ +#ifndef org_apache_arrow_flatbuf_RunEndEncoded_identifier +#define org_apache_arrow_flatbuf_RunEndEncoded_identifier 0 +#endif +#define org_apache_arrow_flatbuf_RunEndEncoded_type_hash ((flatbuffers_thash_t)0x5a98bcc) +#define org_apache_arrow_flatbuf_RunEndEncoded_type_identifier "\xcc\x8b\xa9\x05" +#ifndef org_apache_arrow_flatbuf_RunEndEncoded_file_extension +#define org_apache_arrow_flatbuf_RunEndEncoded_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Decimal_file_identifier +#define org_apache_arrow_flatbuf_Decimal_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Decimal_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Decimal_identifier +#define org_apache_arrow_flatbuf_Decimal_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Decimal_type_hash ((flatbuffers_thash_t)0x91d1beb7) +#define org_apache_arrow_flatbuf_Decimal_type_identifier "\xb7\xbe\xd1\x91" +#ifndef org_apache_arrow_flatbuf_Decimal_file_extension +#define org_apache_arrow_flatbuf_Decimal_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Date_file_identifier +#define org_apache_arrow_flatbuf_Date_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Date_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Date_identifier +#define org_apache_arrow_flatbuf_Date_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Date_type_hash ((flatbuffers_thash_t)0xe0ccf624) +#define org_apache_arrow_flatbuf_Date_type_identifier "\x24\xf6\xcc\xe0" +#ifndef org_apache_arrow_flatbuf_Date_file_extension +#define org_apache_arrow_flatbuf_Date_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Time_file_identifier +#define org_apache_arrow_flatbuf_Time_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Time_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Time_identifier +#define org_apache_arrow_flatbuf_Time_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Time_type_hash ((flatbuffers_thash_t)0x2442a489) +#define org_apache_arrow_flatbuf_Time_type_identifier "\x89\xa4\x42\x24" +#ifndef org_apache_arrow_flatbuf_Time_file_extension +#define org_apache_arrow_flatbuf_Time_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Timestamp_file_identifier +#define org_apache_arrow_flatbuf_Timestamp_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Timestamp_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Timestamp_identifier +#define org_apache_arrow_flatbuf_Timestamp_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Timestamp_type_hash ((flatbuffers_thash_t)0x1fddf080) +#define org_apache_arrow_flatbuf_Timestamp_type_identifier "\x80\xf0\xdd\x1f" +#ifndef org_apache_arrow_flatbuf_Timestamp_file_extension +#define org_apache_arrow_flatbuf_Timestamp_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Interval_file_identifier +#define org_apache_arrow_flatbuf_Interval_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Interval_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Interval_identifier +#define org_apache_arrow_flatbuf_Interval_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Interval_type_hash ((flatbuffers_thash_t)0x1e2d6809) +#define org_apache_arrow_flatbuf_Interval_type_identifier "\x09\x68\x2d\x1e" +#ifndef org_apache_arrow_flatbuf_Interval_file_extension +#define org_apache_arrow_flatbuf_Interval_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Duration_file_identifier +#define org_apache_arrow_flatbuf_Duration_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Duration_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Duration_identifier +#define org_apache_arrow_flatbuf_Duration_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Duration_type_hash ((flatbuffers_thash_t)0x1ecea6b0) +#define org_apache_arrow_flatbuf_Duration_type_identifier "\xb0\xa6\xce\x1e" +#ifndef org_apache_arrow_flatbuf_Duration_file_extension +#define org_apache_arrow_flatbuf_Duration_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_KeyValue_file_identifier +#define org_apache_arrow_flatbuf_KeyValue_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_KeyValue_file_identifier */ +#ifndef org_apache_arrow_flatbuf_KeyValue_identifier +#define org_apache_arrow_flatbuf_KeyValue_identifier 0 +#endif +#define org_apache_arrow_flatbuf_KeyValue_type_hash ((flatbuffers_thash_t)0x3b264744) +#define org_apache_arrow_flatbuf_KeyValue_type_identifier "\x44\x47\x26\x3b" +#ifndef org_apache_arrow_flatbuf_KeyValue_file_extension +#define org_apache_arrow_flatbuf_KeyValue_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier +#define org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier */ +#ifndef org_apache_arrow_flatbuf_DictionaryEncoding_identifier +#define org_apache_arrow_flatbuf_DictionaryEncoding_identifier 0 +#endif +#define org_apache_arrow_flatbuf_DictionaryEncoding_type_hash ((flatbuffers_thash_t)0x8c703261) +#define org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier "\x61\x32\x70\x8c" +#ifndef org_apache_arrow_flatbuf_DictionaryEncoding_file_extension +#define org_apache_arrow_flatbuf_DictionaryEncoding_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Field_file_identifier +#define org_apache_arrow_flatbuf_Field_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Field_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Field_identifier +#define org_apache_arrow_flatbuf_Field_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Field_type_hash ((flatbuffers_thash_t)0xd981525c) +#define org_apache_arrow_flatbuf_Field_type_identifier "\x5c\x52\x81\xd9" +#ifndef org_apache_arrow_flatbuf_Field_file_extension +#define org_apache_arrow_flatbuf_Field_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Buffer_file_identifier +#define org_apache_arrow_flatbuf_Buffer_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Buffer_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Buffer_identifier +#define org_apache_arrow_flatbuf_Buffer_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Buffer_type_hash ((flatbuffers_thash_t)0x519d7fea) +#define org_apache_arrow_flatbuf_Buffer_type_identifier "\xea\x7f\x9d\x51" +#ifndef org_apache_arrow_flatbuf_Buffer_file_extension +#define org_apache_arrow_flatbuf_Buffer_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Schema_file_identifier +#define org_apache_arrow_flatbuf_Schema_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Schema_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Schema_identifier +#define org_apache_arrow_flatbuf_Schema_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Schema_type_hash ((flatbuffers_thash_t)0x406570b) +#define org_apache_arrow_flatbuf_Schema_type_identifier "\x0b\x57\x06\x04" +#ifndef org_apache_arrow_flatbuf_Schema_file_extension +#define org_apache_arrow_flatbuf_Schema_file_extension "bin" +#endif + +typedef int16_t org_apache_arrow_flatbuf_MetadataVersion_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_MetadataVersion, org_apache_arrow_flatbuf_MetadataVersion_enum_t, 16) +/** 0.1.0 (October 2016). */ +#define org_apache_arrow_flatbuf_MetadataVersion_V1 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_MetadataVersion_V2 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_MetadataVersion_V3 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(2)) +#define org_apache_arrow_flatbuf_MetadataVersion_V4 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(3)) +#define org_apache_arrow_flatbuf_MetadataVersion_V5 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(4)) + +static inline const char *org_apache_arrow_flatbuf_MetadataVersion_name(org_apache_arrow_flatbuf_MetadataVersion_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_MetadataVersion_V1: return "V1"; + case org_apache_arrow_flatbuf_MetadataVersion_V2: return "V2"; + case org_apache_arrow_flatbuf_MetadataVersion_V3: return "V3"; + case org_apache_arrow_flatbuf_MetadataVersion_V4: return "V4"; + case org_apache_arrow_flatbuf_MetadataVersion_V5: return "V5"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_MetadataVersion_is_known_value(org_apache_arrow_flatbuf_MetadataVersion_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_MetadataVersion_V1: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V2: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V3: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V4: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V5: return 1; + default: return 0; + } +} + +/** Represents Arrow Features that might not have full support + * within implementations. This is intended to be used in + * two scenarios: + * 1. A mechanism for readers of Arrow Streams + * and files to understand that the stream or file makes + * use of a feature that isn't supported or unknown to + * the implementation (and therefore can meet the Arrow + * forward compatibility guarantees). + * 2. A means of negotiating between a client and server + * what features a stream is allowed to use. The enums + * values here are intented to represent higher level + * features, additional details maybe negotiated + * with key-value pairs specific to the protocol. + * + * Enums added to this list should be assigned power-of-two values + * to facilitate exchanging and comparing bitmaps for supported + * features. */ +typedef int64_t org_apache_arrow_flatbuf_Feature_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Feature, org_apache_arrow_flatbuf_Feature_enum_t, 64) +/** Needed to make flatbuffers happy. */ +#define org_apache_arrow_flatbuf_Feature_UNUSED ((org_apache_arrow_flatbuf_Feature_enum_t)INT64_C(0)) +#define org_apache_arrow_flatbuf_Feature_DICTIONARY_REPLACEMENT ((org_apache_arrow_flatbuf_Feature_enum_t)INT64_C(1)) +#define org_apache_arrow_flatbuf_Feature_COMPRESSED_BODY ((org_apache_arrow_flatbuf_Feature_enum_t)INT64_C(2)) + +static inline const char *org_apache_arrow_flatbuf_Feature_name(org_apache_arrow_flatbuf_Feature_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Feature_UNUSED: return "UNUSED"; + case org_apache_arrow_flatbuf_Feature_DICTIONARY_REPLACEMENT: return "DICTIONARY_REPLACEMENT"; + case org_apache_arrow_flatbuf_Feature_COMPRESSED_BODY: return "COMPRESSED_BODY"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Feature_is_known_value(org_apache_arrow_flatbuf_Feature_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Feature_UNUSED: return 1; + case org_apache_arrow_flatbuf_Feature_DICTIONARY_REPLACEMENT: return 1; + case org_apache_arrow_flatbuf_Feature_COMPRESSED_BODY: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_UnionMode_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t, 16) +#define org_apache_arrow_flatbuf_UnionMode_Sparse ((org_apache_arrow_flatbuf_UnionMode_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_UnionMode_Dense ((org_apache_arrow_flatbuf_UnionMode_enum_t)INT16_C(1)) + +static inline const char *org_apache_arrow_flatbuf_UnionMode_name(org_apache_arrow_flatbuf_UnionMode_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_UnionMode_Sparse: return "Sparse"; + case org_apache_arrow_flatbuf_UnionMode_Dense: return "Dense"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_UnionMode_is_known_value(org_apache_arrow_flatbuf_UnionMode_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_UnionMode_Sparse: return 1; + case org_apache_arrow_flatbuf_UnionMode_Dense: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_Precision_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t, 16) +#define org_apache_arrow_flatbuf_Precision_HALF ((org_apache_arrow_flatbuf_Precision_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_Precision_SINGLE ((org_apache_arrow_flatbuf_Precision_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_Precision_DOUBLE ((org_apache_arrow_flatbuf_Precision_enum_t)INT16_C(2)) + +static inline const char *org_apache_arrow_flatbuf_Precision_name(org_apache_arrow_flatbuf_Precision_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Precision_HALF: return "HALF"; + case org_apache_arrow_flatbuf_Precision_SINGLE: return "SINGLE"; + case org_apache_arrow_flatbuf_Precision_DOUBLE: return "DOUBLE"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Precision_is_known_value(org_apache_arrow_flatbuf_Precision_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Precision_HALF: return 1; + case org_apache_arrow_flatbuf_Precision_SINGLE: return 1; + case org_apache_arrow_flatbuf_Precision_DOUBLE: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_DateUnit_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t, 16) +#define org_apache_arrow_flatbuf_DateUnit_DAY ((org_apache_arrow_flatbuf_DateUnit_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_DateUnit_MILLISECOND ((org_apache_arrow_flatbuf_DateUnit_enum_t)INT16_C(1)) + +static inline const char *org_apache_arrow_flatbuf_DateUnit_name(org_apache_arrow_flatbuf_DateUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DateUnit_DAY: return "DAY"; + case org_apache_arrow_flatbuf_DateUnit_MILLISECOND: return "MILLISECOND"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_DateUnit_is_known_value(org_apache_arrow_flatbuf_DateUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DateUnit_DAY: return 1; + case org_apache_arrow_flatbuf_DateUnit_MILLISECOND: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_TimeUnit_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 16) +#define org_apache_arrow_flatbuf_TimeUnit_SECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_TimeUnit_MILLISECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_TimeUnit_MICROSECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(2)) +#define org_apache_arrow_flatbuf_TimeUnit_NANOSECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(3)) + +static inline const char *org_apache_arrow_flatbuf_TimeUnit_name(org_apache_arrow_flatbuf_TimeUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_TimeUnit_SECOND: return "SECOND"; + case org_apache_arrow_flatbuf_TimeUnit_MILLISECOND: return "MILLISECOND"; + case org_apache_arrow_flatbuf_TimeUnit_MICROSECOND: return "MICROSECOND"; + case org_apache_arrow_flatbuf_TimeUnit_NANOSECOND: return "NANOSECOND"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_TimeUnit_is_known_value(org_apache_arrow_flatbuf_TimeUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_TimeUnit_SECOND: return 1; + case org_apache_arrow_flatbuf_TimeUnit_MILLISECOND: return 1; + case org_apache_arrow_flatbuf_TimeUnit_MICROSECOND: return 1; + case org_apache_arrow_flatbuf_TimeUnit_NANOSECOND: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_IntervalUnit_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t, 16) +#define org_apache_arrow_flatbuf_IntervalUnit_YEAR_MONTH ((org_apache_arrow_flatbuf_IntervalUnit_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_IntervalUnit_DAY_TIME ((org_apache_arrow_flatbuf_IntervalUnit_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_IntervalUnit_MONTH_DAY_NANO ((org_apache_arrow_flatbuf_IntervalUnit_enum_t)INT16_C(2)) + +static inline const char *org_apache_arrow_flatbuf_IntervalUnit_name(org_apache_arrow_flatbuf_IntervalUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_IntervalUnit_YEAR_MONTH: return "YEAR_MONTH"; + case org_apache_arrow_flatbuf_IntervalUnit_DAY_TIME: return "DAY_TIME"; + case org_apache_arrow_flatbuf_IntervalUnit_MONTH_DAY_NANO: return "MONTH_DAY_NANO"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_IntervalUnit_is_known_value(org_apache_arrow_flatbuf_IntervalUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_IntervalUnit_YEAR_MONTH: return 1; + case org_apache_arrow_flatbuf_IntervalUnit_DAY_TIME: return 1; + case org_apache_arrow_flatbuf_IntervalUnit_MONTH_DAY_NANO: return 1; + default: return 0; + } +} + +/** ---------------------------------------------------------------------- + * Dictionary encoding metadata + * Maintained for forwards compatibility, in the future + * Dictionaries might be explicit maps between integers and values + * allowing for non-contiguous index values */ +typedef int16_t org_apache_arrow_flatbuf_DictionaryKind_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t, 16) +#define org_apache_arrow_flatbuf_DictionaryKind_DenseArray ((org_apache_arrow_flatbuf_DictionaryKind_enum_t)INT16_C(0)) + +static inline const char *org_apache_arrow_flatbuf_DictionaryKind_name(org_apache_arrow_flatbuf_DictionaryKind_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DictionaryKind_DenseArray: return "DenseArray"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_DictionaryKind_is_known_value(org_apache_arrow_flatbuf_DictionaryKind_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DictionaryKind_DenseArray: return 1; + default: return 0; + } +} + +/** ---------------------------------------------------------------------- + * Endianness of the platform producing the data */ +typedef int16_t org_apache_arrow_flatbuf_Endianness_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t, 16) +#define org_apache_arrow_flatbuf_Endianness_Little ((org_apache_arrow_flatbuf_Endianness_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_Endianness_Big ((org_apache_arrow_flatbuf_Endianness_enum_t)INT16_C(1)) + +static inline const char *org_apache_arrow_flatbuf_Endianness_name(org_apache_arrow_flatbuf_Endianness_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Endianness_Little: return "Little"; + case org_apache_arrow_flatbuf_Endianness_Big: return "Big"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Endianness_is_known_value(org_apache_arrow_flatbuf_Endianness_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Endianness_Little: return 1; + case org_apache_arrow_flatbuf_Endianness_Big: return 1; + default: return 0; + } +} + + +/** ---------------------------------------------------------------------- + * A Buffer represents a single contiguous memory segment */ +struct org_apache_arrow_flatbuf_Buffer { + /** The relative offset into the shared memory page where the bytes for this + * buffer starts */ + alignas(8) int64_t offset; + /** The absolute length (in bytes) of the memory buffer. The memory is found + * from offset (inclusive) to offset + length (non-inclusive). When building + * messages using the encapsulated IPC message, padding bytes may be written + * after a buffer, but such padding bytes do not need to be accounted for in + * the size here. */ + alignas(8) int64_t length; +}; +static_assert(sizeof(org_apache_arrow_flatbuf_Buffer_t) == 16, "struct size mismatch"); + +static inline const org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer__const_ptr_add(const org_apache_arrow_flatbuf_Buffer_t *p, size_t i) { return p + i; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer__ptr_add(org_apache_arrow_flatbuf_Buffer_t *p, size_t i) { return p + i; } +static inline org_apache_arrow_flatbuf_Buffer_struct_t org_apache_arrow_flatbuf_Buffer_vec_at(org_apache_arrow_flatbuf_Buffer_vec_t vec, size_t i) +__flatbuffers_struct_vec_at(vec, i) +static inline size_t org_apache_arrow_flatbuf_Buffer__size(void) { return 16; } +static inline size_t org_apache_arrow_flatbuf_Buffer_vec_len(org_apache_arrow_flatbuf_Buffer_vec_t vec) +__flatbuffers_vec_len(vec) +__flatbuffers_struct_as_root(org_apache_arrow_flatbuf_Buffer) + +__flatbuffers_define_struct_scalar_field(org_apache_arrow_flatbuf_Buffer, offset, flatbuffers_int64, int64_t) +__flatbuffers_define_struct_scalar_field(org_apache_arrow_flatbuf_Buffer, length, flatbuffers_int64, int64_t) + + +/** These are stored in the flatbuffer in the Type union below */ +struct org_apache_arrow_flatbuf_Null_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Null_vec_len(org_apache_arrow_flatbuf_Null_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Null_table_t org_apache_arrow_flatbuf_Null_vec_at(org_apache_arrow_flatbuf_Null_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Null_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Null) + + +/** A Struct_ in the flatbuffer metadata is the same as an Arrow Struct + * (according to the physical memory layout). We used Struct_ here as + * Struct is a reserved word in Flatbuffers */ +struct org_apache_arrow_flatbuf_Struct__table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Struct__vec_len(org_apache_arrow_flatbuf_Struct__vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Struct__table_t org_apache_arrow_flatbuf_Struct__vec_at(org_apache_arrow_flatbuf_Struct__vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Struct__table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Struct_) + + +struct org_apache_arrow_flatbuf_List_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_List_vec_len(org_apache_arrow_flatbuf_List_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_List_table_t org_apache_arrow_flatbuf_List_vec_at(org_apache_arrow_flatbuf_List_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_List_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_List) + + +/** Same as List, but with 64-bit offsets, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeList_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeList_vec_len(org_apache_arrow_flatbuf_LargeList_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeList_table_t org_apache_arrow_flatbuf_LargeList_vec_at(org_apache_arrow_flatbuf_LargeList_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeList_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeList) + + +/** Represents the same logical types that List can, but contains offsets and + * sizes allowing for writes in any order and sharing of child values among + * list values. */ +struct org_apache_arrow_flatbuf_ListView_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_ListView_vec_len(org_apache_arrow_flatbuf_ListView_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_ListView_table_t org_apache_arrow_flatbuf_ListView_vec_at(org_apache_arrow_flatbuf_ListView_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_ListView_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_ListView) + + +/** Same as ListView, but with 64-bit offsets and sizes, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeListView_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeListView_vec_len(org_apache_arrow_flatbuf_LargeListView_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeListView_table_t org_apache_arrow_flatbuf_LargeListView_vec_at(org_apache_arrow_flatbuf_LargeListView_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeListView_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeListView) + + +struct org_apache_arrow_flatbuf_FixedSizeList_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_FixedSizeList_vec_len(org_apache_arrow_flatbuf_FixedSizeList_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_FixedSizeList_table_t org_apache_arrow_flatbuf_FixedSizeList_vec_at(org_apache_arrow_flatbuf_FixedSizeList_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_FixedSizeList_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_FixedSizeList) + +/** Number of list items per value */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_FixedSizeList, listSize, flatbuffers_int32, int32_t, INT32_C(0)) + +/** A Map is a logical nested type that is represented as + * + * List> + * + * In this layout, the keys and values are each respectively contiguous. We do + * not constrain the key and value types, so the application is responsible + * for ensuring that the keys are hashable and unique. Whether the keys are sorted + * may be set in the metadata for this field. + * + * In a field with Map type, the field has a child Struct field, which then + * has two children: key type and the second the value type. The names of the + * child fields may be respectively "entries", "key", and "value", but this is + * not enforced. + * + * Map + * ```text + * - child[0] entries: Struct + * - child[0] key: K + * - child[1] value: V + * ``` + * Neither the "entries" field nor the "key" field may be nullable. + * + * The metadata is structured so that Arrow systems without special handling + * for Map can make Map an alias for List. The "layout" attribute for the Map + * field must have the same contents as a List. */ +struct org_apache_arrow_flatbuf_Map_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Map_vec_len(org_apache_arrow_flatbuf_Map_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Map_table_t org_apache_arrow_flatbuf_Map_vec_at(org_apache_arrow_flatbuf_Map_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Map_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Map) + +/** Set to true if the keys within each value are sorted */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Map, keysSorted, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) + +/** A union is a complex type with children in Field + * By default ids in the type vector refer to the offsets in the children + * optionally typeIds provides an indirection between the child offset and the type id + * for each child `typeIds[offset]` is the id used in the type vector */ +struct org_apache_arrow_flatbuf_Union_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Union_vec_len(org_apache_arrow_flatbuf_Union_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Union_table_t org_apache_arrow_flatbuf_Union_vec_at(org_apache_arrow_flatbuf_Union_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Union_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Union) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Union, mode, org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t, INT16_C(0)) +__flatbuffers_define_vector_field(1, org_apache_arrow_flatbuf_Union, typeIds, flatbuffers_int32_vec_t, 0) + +struct org_apache_arrow_flatbuf_Int_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Int_vec_len(org_apache_arrow_flatbuf_Int_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Int_table_t org_apache_arrow_flatbuf_Int_vec_at(org_apache_arrow_flatbuf_Int_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Int_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Int) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Int, bitWidth, flatbuffers_int32, int32_t, INT32_C(0)) +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Int, is_signed, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) + +struct org_apache_arrow_flatbuf_FloatingPoint_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_FloatingPoint_vec_len(org_apache_arrow_flatbuf_FloatingPoint_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_FloatingPoint_table_t org_apache_arrow_flatbuf_FloatingPoint_vec_at(org_apache_arrow_flatbuf_FloatingPoint_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_FloatingPoint_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_FloatingPoint) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_FloatingPoint, precision, org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t, INT16_C(0)) + +/** Unicode with UTF-8 encoding */ +struct org_apache_arrow_flatbuf_Utf8_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Utf8_vec_len(org_apache_arrow_flatbuf_Utf8_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Utf8_table_t org_apache_arrow_flatbuf_Utf8_vec_at(org_apache_arrow_flatbuf_Utf8_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Utf8_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Utf8) + + +/** Opaque binary data */ +struct org_apache_arrow_flatbuf_Binary_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Binary_vec_len(org_apache_arrow_flatbuf_Binary_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Binary_table_t org_apache_arrow_flatbuf_Binary_vec_at(org_apache_arrow_flatbuf_Binary_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Binary_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Binary) + + +/** Same as Utf8, but with 64-bit offsets, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeUtf8_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeUtf8_vec_len(org_apache_arrow_flatbuf_LargeUtf8_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeUtf8_table_t org_apache_arrow_flatbuf_LargeUtf8_vec_at(org_apache_arrow_flatbuf_LargeUtf8_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeUtf8_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeUtf8) + + +/** Same as Binary, but with 64-bit offsets, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeBinary_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeBinary_vec_len(org_apache_arrow_flatbuf_LargeBinary_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeBinary_table_t org_apache_arrow_flatbuf_LargeBinary_vec_at(org_apache_arrow_flatbuf_LargeBinary_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeBinary_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeBinary) + + +/** Logically the same as Utf8, but the internal representation uses a view + * struct that contains the string length and either the string's entire data + * inline (for small strings) or an inlined prefix, an index of another buffer, + * and an offset pointing to a slice in that buffer (for non-small strings). + * + * Since it uses a variable number of data buffers, each Field with this type + * must have a corresponding entry in `variadicBufferCounts`. */ +struct org_apache_arrow_flatbuf_Utf8View_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Utf8View_vec_len(org_apache_arrow_flatbuf_Utf8View_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Utf8View_table_t org_apache_arrow_flatbuf_Utf8View_vec_at(org_apache_arrow_flatbuf_Utf8View_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Utf8View_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Utf8View) + + +/** Logically the same as Binary, but the internal representation uses a view + * struct that contains the string length and either the string's entire data + * inline (for small strings) or an inlined prefix, an index of another buffer, + * and an offset pointing to a slice in that buffer (for non-small strings). + * + * Since it uses a variable number of data buffers, each Field with this type + * must have a corresponding entry in `variadicBufferCounts`. */ +struct org_apache_arrow_flatbuf_BinaryView_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_BinaryView_vec_len(org_apache_arrow_flatbuf_BinaryView_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_BinaryView_table_t org_apache_arrow_flatbuf_BinaryView_vec_at(org_apache_arrow_flatbuf_BinaryView_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_BinaryView_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_BinaryView) + + +struct org_apache_arrow_flatbuf_FixedSizeBinary_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_FixedSizeBinary_vec_len(org_apache_arrow_flatbuf_FixedSizeBinary_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_FixedSizeBinary_table_t org_apache_arrow_flatbuf_FixedSizeBinary_vec_at(org_apache_arrow_flatbuf_FixedSizeBinary_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_FixedSizeBinary_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_FixedSizeBinary) + +/** Number of bytes per value */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_FixedSizeBinary, byteWidth, flatbuffers_int32, int32_t, INT32_C(0)) + +struct org_apache_arrow_flatbuf_Bool_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Bool_vec_len(org_apache_arrow_flatbuf_Bool_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Bool_table_t org_apache_arrow_flatbuf_Bool_vec_at(org_apache_arrow_flatbuf_Bool_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Bool_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Bool) + + +/** Contains two child arrays, run_ends and values. + * The run_ends child array must be a 16/32/64-bit integer array + * which encodes the indices at which the run with the value in + * each corresponding index in the values child array ends. + * Like list/struct types, the value array can be of any type. */ +struct org_apache_arrow_flatbuf_RunEndEncoded_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_RunEndEncoded_vec_len(org_apache_arrow_flatbuf_RunEndEncoded_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_RunEndEncoded_table_t org_apache_arrow_flatbuf_RunEndEncoded_vec_at(org_apache_arrow_flatbuf_RunEndEncoded_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_RunEndEncoded_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_RunEndEncoded) + + +/** Exact decimal value represented as an integer value in two's + * complement. Currently only 128-bit (16-byte) and 256-bit (32-byte) integers + * are used. The representation uses the endianness indicated + * in the Schema. */ +struct org_apache_arrow_flatbuf_Decimal_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Decimal_vec_len(org_apache_arrow_flatbuf_Decimal_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Decimal_table_t org_apache_arrow_flatbuf_Decimal_vec_at(org_apache_arrow_flatbuf_Decimal_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Decimal_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Decimal) + +/** Total number of decimal digits */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Decimal, precision, flatbuffers_int32, int32_t, INT32_C(0)) +/** Number of digits after the decimal point "." */ +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Decimal, scale, flatbuffers_int32, int32_t, INT32_C(0)) +/** Number of bits per value. The only accepted widths are 128 and 256. + * We use bitWidth for consistency with Int::bitWidth. */ +__flatbuffers_define_scalar_field(2, org_apache_arrow_flatbuf_Decimal, bitWidth, flatbuffers_int32, int32_t, INT32_C(128)) + +/** Date is either a 32-bit or 64-bit signed integer type representing an + * elapsed time since UNIX epoch (1970-01-01), stored in either of two units: + * + * * Milliseconds (64 bits) indicating UNIX time elapsed since the epoch (no + * leap seconds), where the values are evenly divisible by 86400000 + * * Days (32 bits) since the UNIX epoch */ +struct org_apache_arrow_flatbuf_Date_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Date_vec_len(org_apache_arrow_flatbuf_Date_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Date_table_t org_apache_arrow_flatbuf_Date_vec_at(org_apache_arrow_flatbuf_Date_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Date_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Date) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Date, unit, org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t, INT16_C(1)) + +/** Time is either a 32-bit or 64-bit signed integer type representing an + * elapsed time since midnight, stored in either of four units: seconds, + * milliseconds, microseconds or nanoseconds. + * + * The integer `bitWidth` depends on the `unit` and must be one of the following: + * * SECOND and MILLISECOND: 32 bits + * * MICROSECOND and NANOSECOND: 64 bits + * + * The allowed values are between 0 (inclusive) and 86400 (=24*60*60) seconds + * (exclusive), adjusted for the time unit (for example, up to 86400000 + * exclusive for the MILLISECOND unit). + * This definition doesn't allow for leap seconds. Time values from + * measurements with leap seconds will need to be corrected when ingesting + * into Arrow (for example by replacing the value 86400 with 86399). */ +struct org_apache_arrow_flatbuf_Time_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Time_vec_len(org_apache_arrow_flatbuf_Time_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Time_table_t org_apache_arrow_flatbuf_Time_vec_at(org_apache_arrow_flatbuf_Time_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Time_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Time) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Time, unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, INT16_C(1)) +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Time, bitWidth, flatbuffers_int32, int32_t, INT32_C(32)) + +/** Timestamp is a 64-bit signed integer representing an elapsed time since a + * fixed epoch, stored in either of four units: seconds, milliseconds, + * microseconds or nanoseconds, and is optionally annotated with a timezone. + * + * Timestamp values do not include any leap seconds (in other words, all + * days are considered 86400 seconds long). + * + * Timestamps with a non-empty timezone + * ------------------------------------ + * + * If a Timestamp column has a non-empty timezone value, its epoch is + * 1970-01-01 00:00:00 (January 1st 1970, midnight) in the *UTC* timezone + * (the Unix epoch), regardless of the Timestamp's own timezone. + * + * Therefore, timestamp values with a non-empty timezone correspond to + * physical points in time together with some additional information about + * how the data was obtained and/or how to display it (the timezone). + * + * For example, the timestamp value 0 with the timezone string "Europe/Paris" + * corresponds to "January 1st 1970, 00h00" in the UTC timezone, but the + * application may prefer to display it as "January 1st 1970, 01h00" in + * the Europe/Paris timezone (which is the same physical point in time). + * + * One consequence is that timestamp values with a non-empty timezone + * can be compared and ordered directly, since they all share the same + * well-known point of reference (the Unix epoch). + * + * Timestamps with an unset / empty timezone + * ----------------------------------------- + * + * If a Timestamp column has no timezone value, its epoch is + * 1970-01-01 00:00:00 (January 1st 1970, midnight) in an *unknown* timezone. + * + * Therefore, timestamp values without a timezone cannot be meaningfully + * interpreted as physical points in time, but only as calendar / clock + * indications ("wall clock time") in an unspecified timezone. + * + * For example, the timestamp value 0 with an empty timezone string + * corresponds to "January 1st 1970, 00h00" in an unknown timezone: there + * is not enough information to interpret it as a well-defined physical + * point in time. + * + * One consequence is that timestamp values without a timezone cannot + * be reliably compared or ordered, since they may have different points of + * reference. In particular, it is *not* possible to interpret an unset + * or empty timezone as the same as "UTC". + * + * Conversion between timezones + * ---------------------------- + * + * If a Timestamp column has a non-empty timezone, changing the timezone + * to a different non-empty value is a metadata-only operation: + * the timestamp values need not change as their point of reference remains + * the same (the Unix epoch). + * + * However, if a Timestamp column has no timezone value, changing it to a + * non-empty value requires to think about the desired semantics. + * One possibility is to assume that the original timestamp values are + * relative to the epoch of the timezone being set; timestamp values should + * then adjusted to the Unix epoch (for example, changing the timezone from + * empty to "Europe/Paris" would require converting the timestamp values + * from "Europe/Paris" to "UTC", which seems counter-intuitive but is + * nevertheless correct). + * + * Guidelines for encoding data from external libraries + * ---------------------------------------------------- + * + * Date & time libraries often have multiple different data types for temporal + * data. In order to ease interoperability between different implementations the + * Arrow project has some recommendations for encoding these types into a Timestamp + * column. + * + * An "instant" represents a physical point in time that has no relevant timezone + * (for example, astronomical data). To encode an instant, use a Timestamp with + * the timezone string set to "UTC", and make sure the Timestamp values + * are relative to the UTC epoch (January 1st 1970, midnight). + * + * A "zoned date-time" represents a physical point in time annotated with an + * informative timezone (for example, the timezone in which the data was + * recorded). To encode a zoned date-time, use a Timestamp with the timezone + * string set to the name of the timezone, and make sure the Timestamp values + * are relative to the UTC epoch (January 1st 1970, midnight). + * + * (There is some ambiguity between an instant and a zoned date-time with the + * UTC timezone. Both of these are stored the same in Arrow. Typically, + * this distinction does not matter. If it does, then an application should + * use custom metadata or an extension type to distinguish between the two cases.) + * + * An "offset date-time" represents a physical point in time combined with an + * explicit offset from UTC. To encode an offset date-time, use a Timestamp + * with the timezone string set to the numeric timezone offset string + * (e.g. "+03:00"), and make sure the Timestamp values are relative to + * the UTC epoch (January 1st 1970, midnight). + * + * A "naive date-time" (also called "local date-time" in some libraries) + * represents a wall clock time combined with a calendar date, but with + * no indication of how to map this information to a physical point in time. + * Naive date-times must be handled with care because of this missing + * information, and also because daylight saving time (DST) may make + * some values ambiguous or nonexistent. A naive date-time may be + * stored as a struct with Date and Time fields. However, it may also be + * encoded into a Timestamp column with an empty timezone. The timestamp + * values should be computed "as if" the timezone of the date-time values + * was UTC; for example, the naive date-time "January 1st 1970, 00h00" would + * be encoded as timestamp value 0. */ +struct org_apache_arrow_flatbuf_Timestamp_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Timestamp_vec_len(org_apache_arrow_flatbuf_Timestamp_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Timestamp_table_t org_apache_arrow_flatbuf_Timestamp_vec_at(org_apache_arrow_flatbuf_Timestamp_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Timestamp_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Timestamp) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Timestamp, unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, INT16_C(0)) +/** The timezone is an optional string indicating the name of a timezone, + * one of: + * + * * As used in the Olson timezone database (the "tz database" or + * "tzdata"), such as "America/New_York". + * * An absolute timezone offset of the form "+XX:XX" or "-XX:XX", + * such as "+07:30". + * + * Whether a timezone string is present indicates different semantics about + * the data (see above). */ +__flatbuffers_define_string_field(1, org_apache_arrow_flatbuf_Timestamp, timezone, 0) + +struct org_apache_arrow_flatbuf_Interval_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Interval_vec_len(org_apache_arrow_flatbuf_Interval_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Interval_table_t org_apache_arrow_flatbuf_Interval_vec_at(org_apache_arrow_flatbuf_Interval_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Interval_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Interval) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Interval, unit, org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t, INT16_C(0)) + +struct org_apache_arrow_flatbuf_Duration_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Duration_vec_len(org_apache_arrow_flatbuf_Duration_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Duration_table_t org_apache_arrow_flatbuf_Duration_vec_at(org_apache_arrow_flatbuf_Duration_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Duration_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Duration) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Duration, unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, INT16_C(1)) +/** ---------------------------------------------------------------------- + * Top-level Type value, enabling extensible type-specific metadata. We can + * add new logical types to Type without breaking backwards compatibility */ +typedef uint8_t org_apache_arrow_flatbuf_Type_union_type_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Type, org_apache_arrow_flatbuf_Type_union_type_t, 8) +__flatbuffers_define_union(flatbuffers_, org_apache_arrow_flatbuf_Type) +/** ---------------------------------------------------------------------- + * user defined key value pairs to add custom metadata to arrow + * key namespacing is the responsibility of the user */ +#define org_apache_arrow_flatbuf_Type_NONE ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(0)) +#define org_apache_arrow_flatbuf_Type_Null ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(1)) +#define org_apache_arrow_flatbuf_Type_Int ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(2)) +#define org_apache_arrow_flatbuf_Type_FloatingPoint ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(3)) +#define org_apache_arrow_flatbuf_Type_Binary ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(4)) +#define org_apache_arrow_flatbuf_Type_Utf8 ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(5)) +#define org_apache_arrow_flatbuf_Type_Bool ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(6)) +#define org_apache_arrow_flatbuf_Type_Decimal ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(7)) +#define org_apache_arrow_flatbuf_Type_Date ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(8)) +#define org_apache_arrow_flatbuf_Type_Time ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(9)) +#define org_apache_arrow_flatbuf_Type_Timestamp ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(10)) +#define org_apache_arrow_flatbuf_Type_Interval ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(11)) +#define org_apache_arrow_flatbuf_Type_List ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(12)) +#define org_apache_arrow_flatbuf_Type_Struct_ ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(13)) +#define org_apache_arrow_flatbuf_Type_Union ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(14)) +#define org_apache_arrow_flatbuf_Type_FixedSizeBinary ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(15)) +#define org_apache_arrow_flatbuf_Type_FixedSizeList ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(16)) +#define org_apache_arrow_flatbuf_Type_Map ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(17)) +#define org_apache_arrow_flatbuf_Type_Duration ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(18)) +#define org_apache_arrow_flatbuf_Type_LargeBinary ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(19)) +#define org_apache_arrow_flatbuf_Type_LargeUtf8 ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(20)) +#define org_apache_arrow_flatbuf_Type_LargeList ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(21)) +#define org_apache_arrow_flatbuf_Type_RunEndEncoded ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(22)) +#define org_apache_arrow_flatbuf_Type_BinaryView ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(23)) +#define org_apache_arrow_flatbuf_Type_Utf8View ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(24)) +#define org_apache_arrow_flatbuf_Type_ListView ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(25)) +#define org_apache_arrow_flatbuf_Type_LargeListView ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(26)) + +static inline const char *org_apache_arrow_flatbuf_Type_type_name(org_apache_arrow_flatbuf_Type_union_type_t type) +{ + switch (type) { + case org_apache_arrow_flatbuf_Type_NONE: return "NONE"; + case org_apache_arrow_flatbuf_Type_Null: return "Null"; + case org_apache_arrow_flatbuf_Type_Int: return "Int"; + case org_apache_arrow_flatbuf_Type_FloatingPoint: return "FloatingPoint"; + case org_apache_arrow_flatbuf_Type_Binary: return "Binary"; + case org_apache_arrow_flatbuf_Type_Utf8: return "Utf8"; + case org_apache_arrow_flatbuf_Type_Bool: return "Bool"; + case org_apache_arrow_flatbuf_Type_Decimal: return "Decimal"; + case org_apache_arrow_flatbuf_Type_Date: return "Date"; + case org_apache_arrow_flatbuf_Type_Time: return "Time"; + case org_apache_arrow_flatbuf_Type_Timestamp: return "Timestamp"; + case org_apache_arrow_flatbuf_Type_Interval: return "Interval"; + case org_apache_arrow_flatbuf_Type_List: return "List"; + case org_apache_arrow_flatbuf_Type_Struct_: return "Struct_"; + case org_apache_arrow_flatbuf_Type_Union: return "Union"; + case org_apache_arrow_flatbuf_Type_FixedSizeBinary: return "FixedSizeBinary"; + case org_apache_arrow_flatbuf_Type_FixedSizeList: return "FixedSizeList"; + case org_apache_arrow_flatbuf_Type_Map: return "Map"; + case org_apache_arrow_flatbuf_Type_Duration: return "Duration"; + case org_apache_arrow_flatbuf_Type_LargeBinary: return "LargeBinary"; + case org_apache_arrow_flatbuf_Type_LargeUtf8: return "LargeUtf8"; + case org_apache_arrow_flatbuf_Type_LargeList: return "LargeList"; + case org_apache_arrow_flatbuf_Type_RunEndEncoded: return "RunEndEncoded"; + case org_apache_arrow_flatbuf_Type_BinaryView: return "BinaryView"; + case org_apache_arrow_flatbuf_Type_Utf8View: return "Utf8View"; + case org_apache_arrow_flatbuf_Type_ListView: return "ListView"; + case org_apache_arrow_flatbuf_Type_LargeListView: return "LargeListView"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Type_is_known_type(org_apache_arrow_flatbuf_Type_union_type_t type) +{ + switch (type) { + case org_apache_arrow_flatbuf_Type_NONE: return 1; + case org_apache_arrow_flatbuf_Type_Null: return 1; + case org_apache_arrow_flatbuf_Type_Int: return 1; + case org_apache_arrow_flatbuf_Type_FloatingPoint: return 1; + case org_apache_arrow_flatbuf_Type_Binary: return 1; + case org_apache_arrow_flatbuf_Type_Utf8: return 1; + case org_apache_arrow_flatbuf_Type_Bool: return 1; + case org_apache_arrow_flatbuf_Type_Decimal: return 1; + case org_apache_arrow_flatbuf_Type_Date: return 1; + case org_apache_arrow_flatbuf_Type_Time: return 1; + case org_apache_arrow_flatbuf_Type_Timestamp: return 1; + case org_apache_arrow_flatbuf_Type_Interval: return 1; + case org_apache_arrow_flatbuf_Type_List: return 1; + case org_apache_arrow_flatbuf_Type_Struct_: return 1; + case org_apache_arrow_flatbuf_Type_Union: return 1; + case org_apache_arrow_flatbuf_Type_FixedSizeBinary: return 1; + case org_apache_arrow_flatbuf_Type_FixedSizeList: return 1; + case org_apache_arrow_flatbuf_Type_Map: return 1; + case org_apache_arrow_flatbuf_Type_Duration: return 1; + case org_apache_arrow_flatbuf_Type_LargeBinary: return 1; + case org_apache_arrow_flatbuf_Type_LargeUtf8: return 1; + case org_apache_arrow_flatbuf_Type_LargeList: return 1; + case org_apache_arrow_flatbuf_Type_RunEndEncoded: return 1; + case org_apache_arrow_flatbuf_Type_BinaryView: return 1; + case org_apache_arrow_flatbuf_Type_Utf8View: return 1; + case org_apache_arrow_flatbuf_Type_ListView: return 1; + case org_apache_arrow_flatbuf_Type_LargeListView: return 1; + default: return 0; + } +} + + +struct org_apache_arrow_flatbuf_KeyValue_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_KeyValue_vec_len(org_apache_arrow_flatbuf_KeyValue_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_KeyValue_table_t org_apache_arrow_flatbuf_KeyValue_vec_at(org_apache_arrow_flatbuf_KeyValue_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_KeyValue_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_KeyValue) + +__flatbuffers_define_string_field(0, org_apache_arrow_flatbuf_KeyValue, key, 0) +__flatbuffers_define_string_field(1, org_apache_arrow_flatbuf_KeyValue, value, 0) + +struct org_apache_arrow_flatbuf_DictionaryEncoding_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_DictionaryEncoding_vec_len(org_apache_arrow_flatbuf_DictionaryEncoding_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_DictionaryEncoding_table_t org_apache_arrow_flatbuf_DictionaryEncoding_vec_at(org_apache_arrow_flatbuf_DictionaryEncoding_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_DictionaryEncoding_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_DictionaryEncoding) + +/** The known dictionary id in the application where this data is used. In + * the file or streaming formats, the dictionary ids are found in the + * DictionaryBatch messages */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_DictionaryEncoding, id, flatbuffers_int64, int64_t, INT64_C(0)) +/** The dictionary indices are constrained to be non-negative integers. If + * this field is null, the indices must be signed int32. To maximize + * cross-language compatibility and performance, implementations are + * recommended to prefer signed integer types over unsigned integer types + * and to avoid uint64 indices unless they are required by an application. */ +__flatbuffers_define_table_field(1, org_apache_arrow_flatbuf_DictionaryEncoding, indexType, org_apache_arrow_flatbuf_Int_table_t, 0) +/** By default, dictionaries are not ordered, or the order does not have + * semantic meaning. In some statistical, applications, dictionary-encoding + * is used to represent ordered categorical data, and we provide a way to + * preserve that metadata here */ +__flatbuffers_define_scalar_field(2, org_apache_arrow_flatbuf_DictionaryEncoding, isOrdered, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) +__flatbuffers_define_scalar_field(3, org_apache_arrow_flatbuf_DictionaryEncoding, dictionaryKind, org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t, INT16_C(0)) + +/** ---------------------------------------------------------------------- + * A field represents a named column in a record / row batch or child of a + * nested type. */ +struct org_apache_arrow_flatbuf_Field_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Field_vec_len(org_apache_arrow_flatbuf_Field_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Field_table_t org_apache_arrow_flatbuf_Field_vec_at(org_apache_arrow_flatbuf_Field_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Field_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Field) + +/** Name is not required, in i.e. a List */ +__flatbuffers_define_string_field(0, org_apache_arrow_flatbuf_Field, name, 0) +/** Whether or not this field can contain nulls. Should be true in general. */ +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Field, nullable, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) +/** This is the type of the decoded value if the field is dictionary encoded. */ +__flatbuffers_define_union_field(flatbuffers_, 3, org_apache_arrow_flatbuf_Field, type, org_apache_arrow_flatbuf_Type, 0) +/** Present only if the field is dictionary encoded. */ +__flatbuffers_define_table_field(4, org_apache_arrow_flatbuf_Field, dictionary, org_apache_arrow_flatbuf_DictionaryEncoding_table_t, 0) +/** children apply only to nested data types like Struct, List and Union. For + * primitive types children will have length 0. */ +__flatbuffers_define_vector_field(5, org_apache_arrow_flatbuf_Field, children, org_apache_arrow_flatbuf_Field_vec_t, 0) +/** User-defined metadata */ +__flatbuffers_define_vector_field(6, org_apache_arrow_flatbuf_Field, custom_metadata, org_apache_arrow_flatbuf_KeyValue_vec_t, 0) + +/** ---------------------------------------------------------------------- + * A Schema describes the columns in a row batch */ +struct org_apache_arrow_flatbuf_Schema_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Schema_vec_len(org_apache_arrow_flatbuf_Schema_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Schema_table_t org_apache_arrow_flatbuf_Schema_vec_at(org_apache_arrow_flatbuf_Schema_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Schema_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Schema) + +/** endianness of the buffer + * it is Little Endian by default + * if endianness doesn't match the underlying system then the vectors need to be converted */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Schema, endianness, org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t, INT16_C(0)) +__flatbuffers_define_vector_field(1, org_apache_arrow_flatbuf_Schema, fields, org_apache_arrow_flatbuf_Field_vec_t, 0) +__flatbuffers_define_vector_field(2, org_apache_arrow_flatbuf_Schema, custom_metadata, org_apache_arrow_flatbuf_KeyValue_vec_t, 0) +/** Features used in the stream/file. */ +__flatbuffers_define_vector_field(3, org_apache_arrow_flatbuf_Schema, features, org_apache_arrow_flatbuf_Feature_vec_t, 0) + + +#include "flatcc/flatcc_epilogue.h" +#endif /* SCHEMA_READER_H */ +#ifndef SCHEMA_BUILDER_H +#define SCHEMA_BUILDER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef SCHEMA_READER_H +#include "Schema_reader.h" +#endif +#ifndef FLATBUFFERS_COMMON_BUILDER_H +#include "flatbuffers_common_builder.h" +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + +#define __org_apache_arrow_flatbuf_MetadataVersion_formal_args , org_apache_arrow_flatbuf_MetadataVersion_enum_t v0 +#define __org_apache_arrow_flatbuf_MetadataVersion_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_MetadataVersion, org_apache_arrow_flatbuf_MetadataVersion_enum_t) +#define __org_apache_arrow_flatbuf_Feature_formal_args , org_apache_arrow_flatbuf_Feature_enum_t v0 +#define __org_apache_arrow_flatbuf_Feature_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_Feature, org_apache_arrow_flatbuf_Feature_enum_t) +#define __org_apache_arrow_flatbuf_UnionMode_formal_args , org_apache_arrow_flatbuf_UnionMode_enum_t v0 +#define __org_apache_arrow_flatbuf_UnionMode_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t) +#define __org_apache_arrow_flatbuf_Precision_formal_args , org_apache_arrow_flatbuf_Precision_enum_t v0 +#define __org_apache_arrow_flatbuf_Precision_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t) +#define __org_apache_arrow_flatbuf_DateUnit_formal_args , org_apache_arrow_flatbuf_DateUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_DateUnit_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t) +#define __org_apache_arrow_flatbuf_TimeUnit_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_TimeUnit_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t) +#define __org_apache_arrow_flatbuf_IntervalUnit_formal_args , org_apache_arrow_flatbuf_IntervalUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_IntervalUnit_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t) +#define __org_apache_arrow_flatbuf_DictionaryKind_formal_args , org_apache_arrow_flatbuf_DictionaryKind_enum_t v0 +#define __org_apache_arrow_flatbuf_DictionaryKind_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t) +#define __org_apache_arrow_flatbuf_Endianness_formal_args , org_apache_arrow_flatbuf_Endianness_enum_t v0 +#define __org_apache_arrow_flatbuf_Endianness_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t) + +#define __org_apache_arrow_flatbuf_Buffer_formal_args , int64_t v0, int64_t v1 +#define __org_apache_arrow_flatbuf_Buffer_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_assign(org_apache_arrow_flatbuf_Buffer_t *p, int64_t v0, int64_t v1) +{ p->offset = v0; p->length = v1; + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_copy(org_apache_arrow_flatbuf_Buffer_t *p, const org_apache_arrow_flatbuf_Buffer_t *p2) +{ p->offset = p2->offset; p->length = p2->length; + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_assign_to_pe(org_apache_arrow_flatbuf_Buffer_t *p, int64_t v0, int64_t v1) +{ flatbuffers_int64_assign_to_pe(&p->offset, v0); flatbuffers_int64_assign_to_pe(&p->length, v1); + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_copy_to_pe(org_apache_arrow_flatbuf_Buffer_t *p, const org_apache_arrow_flatbuf_Buffer_t *p2) +{ flatbuffers_int64_copy_to_pe(&p->offset, &p2->offset); flatbuffers_int64_copy_to_pe(&p->length, &p2->length); + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_assign_from_pe(org_apache_arrow_flatbuf_Buffer_t *p, int64_t v0, int64_t v1) +{ flatbuffers_int64_assign_from_pe(&p->offset, v0); flatbuffers_int64_assign_from_pe(&p->length, v1); + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_copy_from_pe(org_apache_arrow_flatbuf_Buffer_t *p, const org_apache_arrow_flatbuf_Buffer_t *p2) +{ flatbuffers_int64_copy_from_pe(&p->offset, &p2->offset); flatbuffers_int64_copy_from_pe(&p->length, &p2->length); + return p; } +__flatbuffers_build_struct(flatbuffers_, org_apache_arrow_flatbuf_Buffer, 16, 8, org_apache_arrow_flatbuf_Buffer_file_identifier, org_apache_arrow_flatbuf_Buffer_type_identifier) +__flatbuffers_define_fixed_array_primitives(flatbuffers_, org_apache_arrow_flatbuf_Buffer, org_apache_arrow_flatbuf_Buffer_t) + +typedef flatbuffers_union_ref_t org_apache_arrow_flatbuf_Type_union_ref_t; +typedef flatbuffers_union_vec_ref_t org_apache_arrow_flatbuf_Type_union_vec_ref_t; +static org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Type_union_t t); + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Null_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Null_ref_t; +static org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Null_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Null, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Struct__required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Struct__ref_t; +static org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Struct__table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Struct_, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_List_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_List_ref_t; +static org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_List_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_List, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeList_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeList_ref_t; +static org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeList_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeList, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_ListView_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_ListView_ref_t; +static org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_ListView_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_ListView, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeListView_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeListView_ref_t; +static org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeListView_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeListView, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_FixedSizeList_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_FixedSizeList_ref_t; +static org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeList_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeList, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Map_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Map_ref_t; +static org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Map_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Map, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Union_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Union_ref_t; +static org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Union_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Union, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Int_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Int_ref_t; +static org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Int_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Int, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_FloatingPoint_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_FloatingPoint_ref_t; +static org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FloatingPoint_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_FloatingPoint, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Utf8_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Utf8_ref_t; +static org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Utf8, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Binary_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Binary_ref_t; +static org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Binary_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Binary, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeUtf8_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeUtf8_ref_t; +static org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeUtf8_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeUtf8, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeBinary_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeBinary_ref_t; +static org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeBinary_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeBinary, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Utf8View_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Utf8View_ref_t; +static org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8View_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Utf8View, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_BinaryView_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_BinaryView_ref_t; +static org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_BinaryView_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_BinaryView, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_FixedSizeBinary_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_ref_t; +static org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeBinary_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeBinary, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Bool_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Bool_ref_t; +static org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Bool_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Bool, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_RunEndEncoded_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_RunEndEncoded_ref_t; +static org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_RunEndEncoded_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_RunEndEncoded, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Decimal_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Decimal_ref_t; +static org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Decimal_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Decimal, 3) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Date_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Date_ref_t; +static org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Date_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Date, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Time_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Time_ref_t; +static org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Time_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Time, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Timestamp_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Timestamp_ref_t; +static org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Timestamp_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Timestamp, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Interval_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Interval_ref_t; +static org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Interval_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Interval, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Duration_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Duration_ref_t; +static org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Duration_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Duration, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_KeyValue_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_KeyValue_ref_t; +static org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_KeyValue_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_KeyValue, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_DictionaryEncoding_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_ref_t; +static org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_DictionaryEncoding_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding, 4) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Field_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Field_ref_t; +static org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Field_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Field, 7) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Schema_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Schema_ref_t; +static org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Schema_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Schema, 4) + +#define __org_apache_arrow_flatbuf_Null_formal_args +#define __org_apache_arrow_flatbuf_Null_call_args +static inline org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Null_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Null, org_apache_arrow_flatbuf_Null_file_identifier, org_apache_arrow_flatbuf_Null_type_identifier) + +#define __org_apache_arrow_flatbuf_Struct__formal_args +#define __org_apache_arrow_flatbuf_Struct__call_args +static inline org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Struct__formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Struct_, org_apache_arrow_flatbuf_Struct__file_identifier, org_apache_arrow_flatbuf_Struct__type_identifier) + +#define __org_apache_arrow_flatbuf_List_formal_args +#define __org_apache_arrow_flatbuf_List_call_args +static inline org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_List_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_List, org_apache_arrow_flatbuf_List_file_identifier, org_apache_arrow_flatbuf_List_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeList_formal_args +#define __org_apache_arrow_flatbuf_LargeList_call_args +static inline org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeList_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeList, org_apache_arrow_flatbuf_LargeList_file_identifier, org_apache_arrow_flatbuf_LargeList_type_identifier) + +#define __org_apache_arrow_flatbuf_ListView_formal_args +#define __org_apache_arrow_flatbuf_ListView_call_args +static inline org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_ListView_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_ListView, org_apache_arrow_flatbuf_ListView_file_identifier, org_apache_arrow_flatbuf_ListView_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeListView_formal_args +#define __org_apache_arrow_flatbuf_LargeListView_call_args +static inline org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeListView_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeListView, org_apache_arrow_flatbuf_LargeListView_file_identifier, org_apache_arrow_flatbuf_LargeListView_type_identifier) + +#define __org_apache_arrow_flatbuf_FixedSizeList_formal_args , int32_t v0 +#define __org_apache_arrow_flatbuf_FixedSizeList_call_args , v0 +static inline org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeList_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeList, org_apache_arrow_flatbuf_FixedSizeList_file_identifier, org_apache_arrow_flatbuf_FixedSizeList_type_identifier) + +#define __org_apache_arrow_flatbuf_Map_formal_args , flatbuffers_bool_t v0 +#define __org_apache_arrow_flatbuf_Map_call_args , v0 +static inline org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Map_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Map, org_apache_arrow_flatbuf_Map_file_identifier, org_apache_arrow_flatbuf_Map_type_identifier) + +#define __org_apache_arrow_flatbuf_Union_formal_args , org_apache_arrow_flatbuf_UnionMode_enum_t v0, flatbuffers_int32_vec_ref_t v1 +#define __org_apache_arrow_flatbuf_Union_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Union_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Union, org_apache_arrow_flatbuf_Union_file_identifier, org_apache_arrow_flatbuf_Union_type_identifier) + +#define __org_apache_arrow_flatbuf_Int_formal_args , int32_t v0, flatbuffers_bool_t v1 +#define __org_apache_arrow_flatbuf_Int_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Int_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_Int_file_identifier, org_apache_arrow_flatbuf_Int_type_identifier) + +#define __org_apache_arrow_flatbuf_FloatingPoint_formal_args , org_apache_arrow_flatbuf_Precision_enum_t v0 +#define __org_apache_arrow_flatbuf_FloatingPoint_call_args , v0 +static inline org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FloatingPoint_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_FloatingPoint, org_apache_arrow_flatbuf_FloatingPoint_file_identifier, org_apache_arrow_flatbuf_FloatingPoint_type_identifier) + +#define __org_apache_arrow_flatbuf_Utf8_formal_args +#define __org_apache_arrow_flatbuf_Utf8_call_args +static inline org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Utf8, org_apache_arrow_flatbuf_Utf8_file_identifier, org_apache_arrow_flatbuf_Utf8_type_identifier) + +#define __org_apache_arrow_flatbuf_Binary_formal_args +#define __org_apache_arrow_flatbuf_Binary_call_args +static inline org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Binary_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Binary, org_apache_arrow_flatbuf_Binary_file_identifier, org_apache_arrow_flatbuf_Binary_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeUtf8_formal_args +#define __org_apache_arrow_flatbuf_LargeUtf8_call_args +static inline org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeUtf8_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeUtf8, org_apache_arrow_flatbuf_LargeUtf8_file_identifier, org_apache_arrow_flatbuf_LargeUtf8_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeBinary_formal_args +#define __org_apache_arrow_flatbuf_LargeBinary_call_args +static inline org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeBinary_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeBinary, org_apache_arrow_flatbuf_LargeBinary_file_identifier, org_apache_arrow_flatbuf_LargeBinary_type_identifier) + +#define __org_apache_arrow_flatbuf_Utf8View_formal_args +#define __org_apache_arrow_flatbuf_Utf8View_call_args +static inline org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8View_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Utf8View, org_apache_arrow_flatbuf_Utf8View_file_identifier, org_apache_arrow_flatbuf_Utf8View_type_identifier) + +#define __org_apache_arrow_flatbuf_BinaryView_formal_args +#define __org_apache_arrow_flatbuf_BinaryView_call_args +static inline org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_BinaryView_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_BinaryView, org_apache_arrow_flatbuf_BinaryView_file_identifier, org_apache_arrow_flatbuf_BinaryView_type_identifier) + +#define __org_apache_arrow_flatbuf_FixedSizeBinary_formal_args , int32_t v0 +#define __org_apache_arrow_flatbuf_FixedSizeBinary_call_args , v0 +static inline org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeBinary_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeBinary, org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier, org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier) + +#define __org_apache_arrow_flatbuf_Bool_formal_args +#define __org_apache_arrow_flatbuf_Bool_call_args +static inline org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Bool_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Bool, org_apache_arrow_flatbuf_Bool_file_identifier, org_apache_arrow_flatbuf_Bool_type_identifier) + +#define __org_apache_arrow_flatbuf_RunEndEncoded_formal_args +#define __org_apache_arrow_flatbuf_RunEndEncoded_call_args +static inline org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_RunEndEncoded_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_RunEndEncoded, org_apache_arrow_flatbuf_RunEndEncoded_file_identifier, org_apache_arrow_flatbuf_RunEndEncoded_type_identifier) + +#define __org_apache_arrow_flatbuf_Decimal_formal_args , int32_t v0, int32_t v1, int32_t v2 +#define __org_apache_arrow_flatbuf_Decimal_call_args , v0, v1, v2 +static inline org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Decimal_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Decimal, org_apache_arrow_flatbuf_Decimal_file_identifier, org_apache_arrow_flatbuf_Decimal_type_identifier) + +#define __org_apache_arrow_flatbuf_Date_formal_args , org_apache_arrow_flatbuf_DateUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_Date_call_args , v0 +static inline org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Date_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Date, org_apache_arrow_flatbuf_Date_file_identifier, org_apache_arrow_flatbuf_Date_type_identifier) + +#define __org_apache_arrow_flatbuf_Time_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0, int32_t v1 +#define __org_apache_arrow_flatbuf_Time_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Time_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Time, org_apache_arrow_flatbuf_Time_file_identifier, org_apache_arrow_flatbuf_Time_type_identifier) + +#define __org_apache_arrow_flatbuf_Timestamp_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0, flatbuffers_string_ref_t v1 +#define __org_apache_arrow_flatbuf_Timestamp_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Timestamp_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Timestamp, org_apache_arrow_flatbuf_Timestamp_file_identifier, org_apache_arrow_flatbuf_Timestamp_type_identifier) + +#define __org_apache_arrow_flatbuf_Interval_formal_args , org_apache_arrow_flatbuf_IntervalUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_Interval_call_args , v0 +static inline org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Interval_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Interval, org_apache_arrow_flatbuf_Interval_file_identifier, org_apache_arrow_flatbuf_Interval_type_identifier) + +#define __org_apache_arrow_flatbuf_Duration_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_Duration_call_args , v0 +static inline org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Duration_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Duration, org_apache_arrow_flatbuf_Duration_file_identifier, org_apache_arrow_flatbuf_Duration_type_identifier) + +#define __org_apache_arrow_flatbuf_KeyValue_formal_args , flatbuffers_string_ref_t v0, flatbuffers_string_ref_t v1 +#define __org_apache_arrow_flatbuf_KeyValue_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_KeyValue_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_KeyValue, org_apache_arrow_flatbuf_KeyValue_file_identifier, org_apache_arrow_flatbuf_KeyValue_type_identifier) + +#define __org_apache_arrow_flatbuf_DictionaryEncoding_formal_args , int64_t v0, org_apache_arrow_flatbuf_Int_ref_t v1, flatbuffers_bool_t v2, org_apache_arrow_flatbuf_DictionaryKind_enum_t v3 +#define __org_apache_arrow_flatbuf_DictionaryEncoding_call_args , v0, v1, v2, v3 +static inline org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_DictionaryEncoding_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding, org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier, org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier) + +#define __org_apache_arrow_flatbuf_Field_formal_args ,\ + flatbuffers_string_ref_t v0, flatbuffers_bool_t v1, org_apache_arrow_flatbuf_Type_union_ref_t v3, org_apache_arrow_flatbuf_DictionaryEncoding_ref_t v4, org_apache_arrow_flatbuf_Field_vec_ref_t v5, org_apache_arrow_flatbuf_KeyValue_vec_ref_t v6 +#define __org_apache_arrow_flatbuf_Field_call_args ,\ + v0, v1, v3, v4, v5, v6 +static inline org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Field_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Field, org_apache_arrow_flatbuf_Field_file_identifier, org_apache_arrow_flatbuf_Field_type_identifier) + +#define __org_apache_arrow_flatbuf_Schema_formal_args , org_apache_arrow_flatbuf_Endianness_enum_t v0, org_apache_arrow_flatbuf_Field_vec_ref_t v1, org_apache_arrow_flatbuf_KeyValue_vec_ref_t v2, org_apache_arrow_flatbuf_Feature_vec_ref_t v3 +#define __org_apache_arrow_flatbuf_Schema_call_args , v0, v1, v2, v3 +static inline org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Schema_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Schema, org_apache_arrow_flatbuf_Schema_file_identifier, org_apache_arrow_flatbuf_Schema_type_identifier) + +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_NONE(void) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_NONE; uref.value = 0; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Null(org_apache_arrow_flatbuf_Null_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Null; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Int(org_apache_arrow_flatbuf_Int_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Int; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_FloatingPoint(org_apache_arrow_flatbuf_FloatingPoint_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_FloatingPoint; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Binary(org_apache_arrow_flatbuf_Binary_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Binary; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Utf8(org_apache_arrow_flatbuf_Utf8_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Utf8; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Bool(org_apache_arrow_flatbuf_Bool_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Bool; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Decimal(org_apache_arrow_flatbuf_Decimal_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Decimal; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Date(org_apache_arrow_flatbuf_Date_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Date; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Time(org_apache_arrow_flatbuf_Time_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Time; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Timestamp(org_apache_arrow_flatbuf_Timestamp_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Timestamp; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Interval(org_apache_arrow_flatbuf_Interval_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Interval; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_List(org_apache_arrow_flatbuf_List_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_List; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Struct_(org_apache_arrow_flatbuf_Struct__ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Struct_; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Union(org_apache_arrow_flatbuf_Union_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Union; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_FixedSizeBinary(org_apache_arrow_flatbuf_FixedSizeBinary_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_FixedSizeBinary; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_FixedSizeList(org_apache_arrow_flatbuf_FixedSizeList_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_FixedSizeList; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Map(org_apache_arrow_flatbuf_Map_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Map; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Duration(org_apache_arrow_flatbuf_Duration_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Duration; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeBinary(org_apache_arrow_flatbuf_LargeBinary_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeBinary; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeUtf8(org_apache_arrow_flatbuf_LargeUtf8_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeUtf8; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeList(org_apache_arrow_flatbuf_LargeList_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeList; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_RunEndEncoded(org_apache_arrow_flatbuf_RunEndEncoded_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_RunEndEncoded; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_BinaryView(org_apache_arrow_flatbuf_BinaryView_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_BinaryView; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Utf8View(org_apache_arrow_flatbuf_Utf8View_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Utf8View; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_ListView(org_apache_arrow_flatbuf_ListView_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_ListView; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeListView(org_apache_arrow_flatbuf_LargeListView_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeListView; uref.value = ref; return uref; } +__flatbuffers_build_union_vector(flatbuffers_, org_apache_arrow_flatbuf_Type) + +static org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Type_union_t u) +{ + switch (u.type) { + case 1: return org_apache_arrow_flatbuf_Type_as_Null(org_apache_arrow_flatbuf_Null_clone(B, (org_apache_arrow_flatbuf_Null_table_t)u.value)); + case 2: return org_apache_arrow_flatbuf_Type_as_Int(org_apache_arrow_flatbuf_Int_clone(B, (org_apache_arrow_flatbuf_Int_table_t)u.value)); + case 3: return org_apache_arrow_flatbuf_Type_as_FloatingPoint(org_apache_arrow_flatbuf_FloatingPoint_clone(B, (org_apache_arrow_flatbuf_FloatingPoint_table_t)u.value)); + case 4: return org_apache_arrow_flatbuf_Type_as_Binary(org_apache_arrow_flatbuf_Binary_clone(B, (org_apache_arrow_flatbuf_Binary_table_t)u.value)); + case 5: return org_apache_arrow_flatbuf_Type_as_Utf8(org_apache_arrow_flatbuf_Utf8_clone(B, (org_apache_arrow_flatbuf_Utf8_table_t)u.value)); + case 6: return org_apache_arrow_flatbuf_Type_as_Bool(org_apache_arrow_flatbuf_Bool_clone(B, (org_apache_arrow_flatbuf_Bool_table_t)u.value)); + case 7: return org_apache_arrow_flatbuf_Type_as_Decimal(org_apache_arrow_flatbuf_Decimal_clone(B, (org_apache_arrow_flatbuf_Decimal_table_t)u.value)); + case 8: return org_apache_arrow_flatbuf_Type_as_Date(org_apache_arrow_flatbuf_Date_clone(B, (org_apache_arrow_flatbuf_Date_table_t)u.value)); + case 9: return org_apache_arrow_flatbuf_Type_as_Time(org_apache_arrow_flatbuf_Time_clone(B, (org_apache_arrow_flatbuf_Time_table_t)u.value)); + case 10: return org_apache_arrow_flatbuf_Type_as_Timestamp(org_apache_arrow_flatbuf_Timestamp_clone(B, (org_apache_arrow_flatbuf_Timestamp_table_t)u.value)); + case 11: return org_apache_arrow_flatbuf_Type_as_Interval(org_apache_arrow_flatbuf_Interval_clone(B, (org_apache_arrow_flatbuf_Interval_table_t)u.value)); + case 12: return org_apache_arrow_flatbuf_Type_as_List(org_apache_arrow_flatbuf_List_clone(B, (org_apache_arrow_flatbuf_List_table_t)u.value)); + case 13: return org_apache_arrow_flatbuf_Type_as_Struct_(org_apache_arrow_flatbuf_Struct__clone(B, (org_apache_arrow_flatbuf_Struct__table_t)u.value)); + case 14: return org_apache_arrow_flatbuf_Type_as_Union(org_apache_arrow_flatbuf_Union_clone(B, (org_apache_arrow_flatbuf_Union_table_t)u.value)); + case 15: return org_apache_arrow_flatbuf_Type_as_FixedSizeBinary(org_apache_arrow_flatbuf_FixedSizeBinary_clone(B, (org_apache_arrow_flatbuf_FixedSizeBinary_table_t)u.value)); + case 16: return org_apache_arrow_flatbuf_Type_as_FixedSizeList(org_apache_arrow_flatbuf_FixedSizeList_clone(B, (org_apache_arrow_flatbuf_FixedSizeList_table_t)u.value)); + case 17: return org_apache_arrow_flatbuf_Type_as_Map(org_apache_arrow_flatbuf_Map_clone(B, (org_apache_arrow_flatbuf_Map_table_t)u.value)); + case 18: return org_apache_arrow_flatbuf_Type_as_Duration(org_apache_arrow_flatbuf_Duration_clone(B, (org_apache_arrow_flatbuf_Duration_table_t)u.value)); + case 19: return org_apache_arrow_flatbuf_Type_as_LargeBinary(org_apache_arrow_flatbuf_LargeBinary_clone(B, (org_apache_arrow_flatbuf_LargeBinary_table_t)u.value)); + case 20: return org_apache_arrow_flatbuf_Type_as_LargeUtf8(org_apache_arrow_flatbuf_LargeUtf8_clone(B, (org_apache_arrow_flatbuf_LargeUtf8_table_t)u.value)); + case 21: return org_apache_arrow_flatbuf_Type_as_LargeList(org_apache_arrow_flatbuf_LargeList_clone(B, (org_apache_arrow_flatbuf_LargeList_table_t)u.value)); + case 22: return org_apache_arrow_flatbuf_Type_as_RunEndEncoded(org_apache_arrow_flatbuf_RunEndEncoded_clone(B, (org_apache_arrow_flatbuf_RunEndEncoded_table_t)u.value)); + case 23: return org_apache_arrow_flatbuf_Type_as_BinaryView(org_apache_arrow_flatbuf_BinaryView_clone(B, (org_apache_arrow_flatbuf_BinaryView_table_t)u.value)); + case 24: return org_apache_arrow_flatbuf_Type_as_Utf8View(org_apache_arrow_flatbuf_Utf8View_clone(B, (org_apache_arrow_flatbuf_Utf8View_table_t)u.value)); + case 25: return org_apache_arrow_flatbuf_Type_as_ListView(org_apache_arrow_flatbuf_ListView_clone(B, (org_apache_arrow_flatbuf_ListView_table_t)u.value)); + case 26: return org_apache_arrow_flatbuf_Type_as_LargeListView(org_apache_arrow_flatbuf_LargeListView_clone(B, (org_apache_arrow_flatbuf_LargeListView_table_t)u.value)); + default: return org_apache_arrow_flatbuf_Type_as_NONE(); + } +} + + +static inline org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Null_formal_args) +{ + if (org_apache_arrow_flatbuf_Null_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Null_end(B); +} + +static org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Null_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Null_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Null_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Struct__formal_args) +{ + if (org_apache_arrow_flatbuf_Struct__start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Struct__end(B); +} + +static org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Struct__table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Struct__start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Struct__end(B)); +} + + +static inline org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_List_formal_args) +{ + if (org_apache_arrow_flatbuf_List_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_List_end(B); +} + +static org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_List_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_List_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_List_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeList_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeList_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeList_end(B); +} + +static org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeList_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeList_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeList_end(B)); +} + + +static inline org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_ListView_formal_args) +{ + if (org_apache_arrow_flatbuf_ListView_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_ListView_end(B); +} + +static org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_ListView_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_ListView_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_ListView_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeListView_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeListView_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeListView_end(B); +} + +static org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeListView_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeListView_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeListView_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_FixedSizeList_listSize, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_FixedSizeList) + +static inline org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeList_formal_args) +{ + if (org_apache_arrow_flatbuf_FixedSizeList_start(B) + || org_apache_arrow_flatbuf_FixedSizeList_listSize_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_FixedSizeList_end(B); +} + +static org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeList_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_FixedSizeList_start(B) + || org_apache_arrow_flatbuf_FixedSizeList_listSize_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_FixedSizeList_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Map_keysSorted, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_Map) + +static inline org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Map_formal_args) +{ + if (org_apache_arrow_flatbuf_Map_start(B) + || org_apache_arrow_flatbuf_Map_keysSorted_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Map_end(B); +} + +static org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Map_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Map_start(B) + || org_apache_arrow_flatbuf_Map_keysSorted_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Map_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Union_mode, org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Union) +__flatbuffers_build_vector_field(1, flatbuffers_, org_apache_arrow_flatbuf_Union_typeIds, flatbuffers_int32, int32_t, org_apache_arrow_flatbuf_Union) + +static inline org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Union_formal_args) +{ + if (org_apache_arrow_flatbuf_Union_start(B) + || org_apache_arrow_flatbuf_Union_typeIds_add(B, v1) + || org_apache_arrow_flatbuf_Union_mode_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Union_end(B); +} + +static org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Union_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Union_start(B) + || org_apache_arrow_flatbuf_Union_typeIds_pick(B, t) + || org_apache_arrow_flatbuf_Union_mode_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Union_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Int_bitWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_Int) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Int_is_signed, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_Int) + +static inline org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Int_formal_args) +{ + if (org_apache_arrow_flatbuf_Int_start(B) + || org_apache_arrow_flatbuf_Int_bitWidth_add(B, v0) + || org_apache_arrow_flatbuf_Int_is_signed_add(B, v1)) { + return 0; + } + return org_apache_arrow_flatbuf_Int_end(B); +} + +static org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Int_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Int_start(B) + || org_apache_arrow_flatbuf_Int_bitWidth_pick(B, t) + || org_apache_arrow_flatbuf_Int_is_signed_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Int_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_FloatingPoint_precision, org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_FloatingPoint) + +static inline org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FloatingPoint_formal_args) +{ + if (org_apache_arrow_flatbuf_FloatingPoint_start(B) + || org_apache_arrow_flatbuf_FloatingPoint_precision_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_FloatingPoint_end(B); +} + +static org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FloatingPoint_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_FloatingPoint_start(B) + || org_apache_arrow_flatbuf_FloatingPoint_precision_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_FloatingPoint_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8_formal_args) +{ + if (org_apache_arrow_flatbuf_Utf8_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Utf8_end(B); +} + +static org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Utf8_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Utf8_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Binary_formal_args) +{ + if (org_apache_arrow_flatbuf_Binary_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Binary_end(B); +} + +static org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Binary_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Binary_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Binary_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeUtf8_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeUtf8_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeUtf8_end(B); +} + +static org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeUtf8_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeUtf8_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeUtf8_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeBinary_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeBinary_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeBinary_end(B); +} + +static org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeBinary_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeBinary_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeBinary_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8View_formal_args) +{ + if (org_apache_arrow_flatbuf_Utf8View_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Utf8View_end(B); +} + +static org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8View_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Utf8View_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Utf8View_end(B)); +} + + +static inline org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_BinaryView_formal_args) +{ + if (org_apache_arrow_flatbuf_BinaryView_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_BinaryView_end(B); +} + +static org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_BinaryView_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_BinaryView_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_BinaryView_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_FixedSizeBinary_byteWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_FixedSizeBinary) + +static inline org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeBinary_formal_args) +{ + if (org_apache_arrow_flatbuf_FixedSizeBinary_start(B) + || org_apache_arrow_flatbuf_FixedSizeBinary_byteWidth_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_FixedSizeBinary_end(B); +} + +static org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeBinary_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_FixedSizeBinary_start(B) + || org_apache_arrow_flatbuf_FixedSizeBinary_byteWidth_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_FixedSizeBinary_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Bool_formal_args) +{ + if (org_apache_arrow_flatbuf_Bool_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Bool_end(B); +} + +static org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Bool_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Bool_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Bool_end(B)); +} + + +static inline org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_RunEndEncoded_formal_args) +{ + if (org_apache_arrow_flatbuf_RunEndEncoded_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_RunEndEncoded_end(B); +} + +static org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_RunEndEncoded_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_RunEndEncoded_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_RunEndEncoded_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Decimal_precision, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Decimal_scale, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_scalar_field(2, flatbuffers_, org_apache_arrow_flatbuf_Decimal_bitWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(128), org_apache_arrow_flatbuf_Decimal) + +static inline org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Decimal_formal_args) +{ + if (org_apache_arrow_flatbuf_Decimal_start(B) + || org_apache_arrow_flatbuf_Decimal_precision_add(B, v0) + || org_apache_arrow_flatbuf_Decimal_scale_add(B, v1) + || org_apache_arrow_flatbuf_Decimal_bitWidth_add(B, v2)) { + return 0; + } + return org_apache_arrow_flatbuf_Decimal_end(B); +} + +static org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Decimal_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Decimal_start(B) + || org_apache_arrow_flatbuf_Decimal_precision_pick(B, t) + || org_apache_arrow_flatbuf_Decimal_scale_pick(B, t) + || org_apache_arrow_flatbuf_Decimal_bitWidth_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Decimal_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Date_unit, org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t, 2, 2, INT16_C(1), org_apache_arrow_flatbuf_Date) + +static inline org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Date_formal_args) +{ + if (org_apache_arrow_flatbuf_Date_start(B) + || org_apache_arrow_flatbuf_Date_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Date_end(B); +} + +static org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Date_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Date_start(B) + || org_apache_arrow_flatbuf_Date_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Date_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Time_unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 2, 2, INT16_C(1), org_apache_arrow_flatbuf_Time) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Time_bitWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(32), org_apache_arrow_flatbuf_Time) + +static inline org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Time_formal_args) +{ + if (org_apache_arrow_flatbuf_Time_start(B) + || org_apache_arrow_flatbuf_Time_bitWidth_add(B, v1) + || org_apache_arrow_flatbuf_Time_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Time_end(B); +} + +static org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Time_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Time_start(B) + || org_apache_arrow_flatbuf_Time_bitWidth_pick(B, t) + || org_apache_arrow_flatbuf_Time_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Time_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Timestamp_unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Timestamp) +__flatbuffers_build_string_field(1, flatbuffers_, org_apache_arrow_flatbuf_Timestamp_timezone, org_apache_arrow_flatbuf_Timestamp) + +static inline org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Timestamp_formal_args) +{ + if (org_apache_arrow_flatbuf_Timestamp_start(B) + || org_apache_arrow_flatbuf_Timestamp_timezone_add(B, v1) + || org_apache_arrow_flatbuf_Timestamp_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Timestamp_end(B); +} + +static org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Timestamp_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Timestamp_start(B) + || org_apache_arrow_flatbuf_Timestamp_timezone_pick(B, t) + || org_apache_arrow_flatbuf_Timestamp_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Timestamp_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Interval_unit, org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Interval) + +static inline org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Interval_formal_args) +{ + if (org_apache_arrow_flatbuf_Interval_start(B) + || org_apache_arrow_flatbuf_Interval_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Interval_end(B); +} + +static org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Interval_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Interval_start(B) + || org_apache_arrow_flatbuf_Interval_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Interval_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Duration_unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 2, 2, INT16_C(1), org_apache_arrow_flatbuf_Duration) + +static inline org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Duration_formal_args) +{ + if (org_apache_arrow_flatbuf_Duration_start(B) + || org_apache_arrow_flatbuf_Duration_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Duration_end(B); +} + +static org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Duration_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Duration_start(B) + || org_apache_arrow_flatbuf_Duration_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Duration_end(B)); +} + +__flatbuffers_build_string_field(0, flatbuffers_, org_apache_arrow_flatbuf_KeyValue_key, org_apache_arrow_flatbuf_KeyValue) +__flatbuffers_build_string_field(1, flatbuffers_, org_apache_arrow_flatbuf_KeyValue_value, org_apache_arrow_flatbuf_KeyValue) + +static inline org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_KeyValue_formal_args) +{ + if (org_apache_arrow_flatbuf_KeyValue_start(B) + || org_apache_arrow_flatbuf_KeyValue_key_add(B, v0) + || org_apache_arrow_flatbuf_KeyValue_value_add(B, v1)) { + return 0; + } + return org_apache_arrow_flatbuf_KeyValue_end(B); +} + +static org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_KeyValue_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_KeyValue_start(B) + || org_apache_arrow_flatbuf_KeyValue_key_pick(B, t) + || org_apache_arrow_flatbuf_KeyValue_value_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_KeyValue_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_id, flatbuffers_int64, int64_t, 8, 8, INT64_C(0), org_apache_arrow_flatbuf_DictionaryEncoding) +__flatbuffers_build_table_field(1, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_indexType, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_DictionaryEncoding) +__flatbuffers_build_scalar_field(2, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_isOrdered, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_DictionaryEncoding) +__flatbuffers_build_scalar_field(3, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_dictionaryKind, org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_DictionaryEncoding) + +static inline org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_DictionaryEncoding_formal_args) +{ + if (org_apache_arrow_flatbuf_DictionaryEncoding_start(B) + || org_apache_arrow_flatbuf_DictionaryEncoding_id_add(B, v0) + || org_apache_arrow_flatbuf_DictionaryEncoding_indexType_add(B, v1) + || org_apache_arrow_flatbuf_DictionaryEncoding_dictionaryKind_add(B, v3) + || org_apache_arrow_flatbuf_DictionaryEncoding_isOrdered_add(B, v2)) { + return 0; + } + return org_apache_arrow_flatbuf_DictionaryEncoding_end(B); +} + +static org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_DictionaryEncoding_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_DictionaryEncoding_start(B) + || org_apache_arrow_flatbuf_DictionaryEncoding_id_pick(B, t) + || org_apache_arrow_flatbuf_DictionaryEncoding_indexType_pick(B, t) + || org_apache_arrow_flatbuf_DictionaryEncoding_dictionaryKind_pick(B, t) + || org_apache_arrow_flatbuf_DictionaryEncoding_isOrdered_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_DictionaryEncoding_end(B)); +} + +__flatbuffers_build_string_field(0, flatbuffers_, org_apache_arrow_flatbuf_Field_name, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Field_nullable, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_Field) +__flatbuffers_build_union_field(3, flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Null, org_apache_arrow_flatbuf_Null) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Int, org_apache_arrow_flatbuf_Int) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, FloatingPoint, org_apache_arrow_flatbuf_FloatingPoint) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Binary, org_apache_arrow_flatbuf_Binary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Utf8, org_apache_arrow_flatbuf_Utf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Bool, org_apache_arrow_flatbuf_Bool) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Decimal, org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Date, org_apache_arrow_flatbuf_Date) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Time, org_apache_arrow_flatbuf_Time) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Timestamp, org_apache_arrow_flatbuf_Timestamp) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Interval, org_apache_arrow_flatbuf_Interval) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, List, org_apache_arrow_flatbuf_List) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Struct_, org_apache_arrow_flatbuf_Struct_) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Union, org_apache_arrow_flatbuf_Union) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, FixedSizeBinary, org_apache_arrow_flatbuf_FixedSizeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, FixedSizeList, org_apache_arrow_flatbuf_FixedSizeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Map, org_apache_arrow_flatbuf_Map) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Duration, org_apache_arrow_flatbuf_Duration) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeBinary, org_apache_arrow_flatbuf_LargeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeUtf8, org_apache_arrow_flatbuf_LargeUtf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeList, org_apache_arrow_flatbuf_LargeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, RunEndEncoded, org_apache_arrow_flatbuf_RunEndEncoded) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, BinaryView, org_apache_arrow_flatbuf_BinaryView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Utf8View, org_apache_arrow_flatbuf_Utf8View) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, ListView, org_apache_arrow_flatbuf_ListView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeListView, org_apache_arrow_flatbuf_LargeListView) +__flatbuffers_build_table_field(4, flatbuffers_, org_apache_arrow_flatbuf_Field_dictionary, org_apache_arrow_flatbuf_DictionaryEncoding, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_table_vector_field(5, flatbuffers_, org_apache_arrow_flatbuf_Field_children, org_apache_arrow_flatbuf_Field, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_table_vector_field(6, flatbuffers_, org_apache_arrow_flatbuf_Field_custom_metadata, org_apache_arrow_flatbuf_KeyValue, org_apache_arrow_flatbuf_Field) + +static inline org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Field_formal_args) +{ + if (org_apache_arrow_flatbuf_Field_start(B) + || org_apache_arrow_flatbuf_Field_name_add(B, v0) + || org_apache_arrow_flatbuf_Field_type_add_value(B, v3) + || org_apache_arrow_flatbuf_Field_dictionary_add(B, v4) + || org_apache_arrow_flatbuf_Field_children_add(B, v5) + || org_apache_arrow_flatbuf_Field_custom_metadata_add(B, v6) + || org_apache_arrow_flatbuf_Field_nullable_add(B, v1) + || org_apache_arrow_flatbuf_Field_type_add_type(B, v3.type)) { + return 0; + } + return org_apache_arrow_flatbuf_Field_end(B); +} + +static org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Field_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Field_start(B) + || org_apache_arrow_flatbuf_Field_name_pick(B, t) + || org_apache_arrow_flatbuf_Field_type_pick(B, t) + || org_apache_arrow_flatbuf_Field_dictionary_pick(B, t) + || org_apache_arrow_flatbuf_Field_children_pick(B, t) + || org_apache_arrow_flatbuf_Field_custom_metadata_pick(B, t) + || org_apache_arrow_flatbuf_Field_nullable_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Field_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Schema_endianness, org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Schema) +__flatbuffers_build_table_vector_field(1, flatbuffers_, org_apache_arrow_flatbuf_Schema_fields, org_apache_arrow_flatbuf_Field, org_apache_arrow_flatbuf_Schema) +__flatbuffers_build_table_vector_field(2, flatbuffers_, org_apache_arrow_flatbuf_Schema_custom_metadata, org_apache_arrow_flatbuf_KeyValue, org_apache_arrow_flatbuf_Schema) +__flatbuffers_build_vector_field(3, flatbuffers_, org_apache_arrow_flatbuf_Schema_features, org_apache_arrow_flatbuf_Feature, org_apache_arrow_flatbuf_Feature_enum_t, org_apache_arrow_flatbuf_Schema) + +static inline org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Schema_formal_args) +{ + if (org_apache_arrow_flatbuf_Schema_start(B) + || org_apache_arrow_flatbuf_Schema_fields_add(B, v1) + || org_apache_arrow_flatbuf_Schema_custom_metadata_add(B, v2) + || org_apache_arrow_flatbuf_Schema_features_add(B, v3) + || org_apache_arrow_flatbuf_Schema_endianness_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Schema_end(B); +} + +static org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Schema_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Schema_start(B) + || org_apache_arrow_flatbuf_Schema_fields_pick(B, t) + || org_apache_arrow_flatbuf_Schema_custom_metadata_pick(B, t) + || org_apache_arrow_flatbuf_Schema_features_pick(B, t) + || org_apache_arrow_flatbuf_Schema_endianness_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Schema_end(B)); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* SCHEMA_BUILDER_H */ +#ifndef SCHEMA_VERIFIER_H +#define SCHEMA_VERIFIER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef SCHEMA_READER_H +#include "Schema_reader.h" +#endif +#include "flatcc/flatcc_verifier.h" +#include "flatcc/flatcc_prologue.h" + +static int org_apache_arrow_flatbuf_Null_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Struct__verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_List_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeList_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_ListView_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeListView_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_FixedSizeList_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Map_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Union_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Int_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_FloatingPoint_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Utf8_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Binary_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeUtf8_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeBinary_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Utf8View_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_BinaryView_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_FixedSizeBinary_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Bool_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_RunEndEncoded_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Decimal_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Date_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Time_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Timestamp_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Interval_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Duration_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_KeyValue_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_DictionaryEncoding_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Field_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Schema_verify_table(flatcc_table_verifier_descriptor_t *td); + +static int org_apache_arrow_flatbuf_Type_union_verifier(flatcc_union_verifier_descriptor_t *ud) +{ + switch (ud->type) { + case 1: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Null_verify_table); /* Null */ + case 2: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Int_verify_table); /* Int */ + case 3: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_FloatingPoint_verify_table); /* FloatingPoint */ + case 4: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Binary_verify_table); /* Binary */ + case 5: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Utf8_verify_table); /* Utf8 */ + case 6: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Bool_verify_table); /* Bool */ + case 7: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Decimal_verify_table); /* Decimal */ + case 8: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Date_verify_table); /* Date */ + case 9: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Time_verify_table); /* Time */ + case 10: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Timestamp_verify_table); /* Timestamp */ + case 11: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Interval_verify_table); /* Interval */ + case 12: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_List_verify_table); /* List */ + case 13: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Struct__verify_table); /* Struct_ */ + case 14: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Union_verify_table); /* Union */ + case 15: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); /* FixedSizeBinary */ + case 16: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_FixedSizeList_verify_table); /* FixedSizeList */ + case 17: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Map_verify_table); /* Map */ + case 18: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Duration_verify_table); /* Duration */ + case 19: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeBinary_verify_table); /* LargeBinary */ + case 20: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeUtf8_verify_table); /* LargeUtf8 */ + case 21: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeList_verify_table); /* LargeList */ + case 22: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_RunEndEncoded_verify_table); /* RunEndEncoded */ + case 23: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_BinaryView_verify_table); /* BinaryView */ + case 24: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Utf8View_verify_table); /* Utf8View */ + case 25: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_ListView_verify_table); /* ListView */ + case 26: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeListView_verify_table); /* LargeListView */ + default: return flatcc_verify_ok; + } +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_identifier, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_identifier, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_typed_root(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_type_hash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_typed_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_type_hash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_struct_as_typed_root(buf, bufsiz, thash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_struct_as_typed_root_with_size(buf, bufsiz, thash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_struct_as_root(buf, bufsiz, fid, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_struct_as_root_with_size(buf, bufsiz, fid, 16, 8); +} + +static int org_apache_arrow_flatbuf_Null_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Null_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Null_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Null_type_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Null_type_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static int org_apache_arrow_flatbuf_Struct__verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Struct__identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Struct__identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Struct__type_identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Struct__type_identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static int org_apache_arrow_flatbuf_List_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_List_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_List_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_List_type_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_List_type_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_List_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeList_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_type_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_type_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static int org_apache_arrow_flatbuf_ListView_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_ListView_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_ListView_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_ListView_type_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_ListView_type_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeListView_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_type_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_type_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static int org_apache_arrow_flatbuf_FixedSizeList_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* listSize */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_type_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_type_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static int org_apache_arrow_flatbuf_Map_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 1, 1) /* keysSorted */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Map_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Map_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Map_type_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Map_type_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static int org_apache_arrow_flatbuf_Union_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* mode */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 1, 0, 4, 4, INT64_C(1073741823)) /* typeIds */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Union_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Union_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Union_type_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Union_type_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static int org_apache_arrow_flatbuf_Int_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* bitWidth */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 1, 1) /* is_signed */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Int_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Int_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Int_type_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Int_type_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static int org_apache_arrow_flatbuf_FloatingPoint_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* precision */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_type_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_type_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static int org_apache_arrow_flatbuf_Utf8_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_type_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_type_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static int org_apache_arrow_flatbuf_Binary_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Binary_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Binary_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Binary_type_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Binary_type_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeUtf8_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_type_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_type_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeBinary_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_type_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_type_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static int org_apache_arrow_flatbuf_Utf8View_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_type_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_type_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static int org_apache_arrow_flatbuf_BinaryView_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_type_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_type_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static int org_apache_arrow_flatbuf_FixedSizeBinary_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* byteWidth */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static int org_apache_arrow_flatbuf_Bool_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Bool_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Bool_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Bool_type_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Bool_type_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static int org_apache_arrow_flatbuf_RunEndEncoded_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_type_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_type_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static int org_apache_arrow_flatbuf_Decimal_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* precision */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 4, 4) /* scale */)) return ret; + if ((ret = flatcc_verify_field(td, 2, 4, 4) /* bitWidth */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_type_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_type_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static int org_apache_arrow_flatbuf_Date_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Date_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Date_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Date_type_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Date_type_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static int org_apache_arrow_flatbuf_Time_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 4, 4) /* bitWidth */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Time_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Time_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Time_type_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Time_type_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static int org_apache_arrow_flatbuf_Timestamp_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + if ((ret = flatcc_verify_string_field(td, 1, 0) /* timezone */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_type_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_type_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static int org_apache_arrow_flatbuf_Interval_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Interval_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Interval_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Interval_type_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Interval_type_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static int org_apache_arrow_flatbuf_Duration_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Duration_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Duration_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Duration_type_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Duration_type_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static int org_apache_arrow_flatbuf_KeyValue_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_string_field(td, 0, 0) /* key */)) return ret; + if ((ret = flatcc_verify_string_field(td, 1, 0) /* value */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_type_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_type_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static int org_apache_arrow_flatbuf_DictionaryEncoding_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 8, 8) /* id */)) return ret; + if ((ret = flatcc_verify_table_field(td, 1, 0, &org_apache_arrow_flatbuf_Int_verify_table) /* indexType */)) return ret; + if ((ret = flatcc_verify_field(td, 2, 1, 1) /* isOrdered */)) return ret; + if ((ret = flatcc_verify_field(td, 3, 2, 2) /* dictionaryKind */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static int org_apache_arrow_flatbuf_Field_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_string_field(td, 0, 0) /* name */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 1, 1) /* nullable */)) return ret; + if ((ret = flatcc_verify_union_field(td, 3, 0, &org_apache_arrow_flatbuf_Type_union_verifier) /* type */)) return ret; + if ((ret = flatcc_verify_table_field(td, 4, 0, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table) /* dictionary */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 5, 0, &org_apache_arrow_flatbuf_Field_verify_table) /* children */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 6, 0, &org_apache_arrow_flatbuf_KeyValue_verify_table) /* custom_metadata */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Field_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Field_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Field_type_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Field_type_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static int org_apache_arrow_flatbuf_Schema_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* endianness */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 1, 0, &org_apache_arrow_flatbuf_Field_verify_table) /* fields */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 2, 0, &org_apache_arrow_flatbuf_KeyValue_verify_table) /* custom_metadata */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 3, 0, 8, 8, INT64_C(536870911)) /* features */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Schema_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Schema_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Schema_type_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Schema_type_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* SCHEMA_VERIFIER_H */ +#ifndef TENSOR_READER_H +#define TENSOR_READER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef FLATBUFFERS_COMMON_READER_H +#include "flatbuffers_common_reader.h" +#endif +#ifndef SCHEMA_READER_H +#include "Schema_reader.h" +#endif +#include "flatcc/flatcc_flatbuffers.h" +#ifndef __alignas_is_defined +#include +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + + +typedef const struct org_apache_arrow_flatbuf_TensorDim_table *org_apache_arrow_flatbuf_TensorDim_table_t; +typedef struct org_apache_arrow_flatbuf_TensorDim_table *org_apache_arrow_flatbuf_TensorDim_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_TensorDim_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_TensorDim_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Tensor_table *org_apache_arrow_flatbuf_Tensor_table_t; +typedef struct org_apache_arrow_flatbuf_Tensor_table *org_apache_arrow_flatbuf_Tensor_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Tensor_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Tensor_mutable_vec_t; +#ifndef org_apache_arrow_flatbuf_TensorDim_file_identifier +#define org_apache_arrow_flatbuf_TensorDim_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_TensorDim_file_identifier */ +#ifndef org_apache_arrow_flatbuf_TensorDim_identifier +#define org_apache_arrow_flatbuf_TensorDim_identifier 0 +#endif +#define org_apache_arrow_flatbuf_TensorDim_type_hash ((flatbuffers_thash_t)0xbc6d7b25) +#define org_apache_arrow_flatbuf_TensorDim_type_identifier "\x25\x7b\x6d\xbc" +#ifndef org_apache_arrow_flatbuf_TensorDim_file_extension +#define org_apache_arrow_flatbuf_TensorDim_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Tensor_file_identifier +#define org_apache_arrow_flatbuf_Tensor_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Tensor_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Tensor_identifier +#define org_apache_arrow_flatbuf_Tensor_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Tensor_type_hash ((flatbuffers_thash_t)0x1764df19) +#define org_apache_arrow_flatbuf_Tensor_type_identifier "\x19\xdf\x64\x17" +#ifndef org_apache_arrow_flatbuf_Tensor_file_extension +#define org_apache_arrow_flatbuf_Tensor_file_extension "bin" +#endif + + + +/** ---------------------------------------------------------------------- + * Data structures for dense tensors + * Shape data for a single axis in a tensor */ +struct org_apache_arrow_flatbuf_TensorDim_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_TensorDim_vec_len(org_apache_arrow_flatbuf_TensorDim_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_TensorDim_table_t org_apache_arrow_flatbuf_TensorDim_vec_at(org_apache_arrow_flatbuf_TensorDim_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_TensorDim_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_TensorDim) + +/** Length of dimension */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_TensorDim, size, flatbuffers_int64, int64_t, INT64_C(0)) +/** Name of the dimension, optional */ +__flatbuffers_define_string_field(1, org_apache_arrow_flatbuf_TensorDim, name, 0) + +struct org_apache_arrow_flatbuf_Tensor_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Tensor_vec_len(org_apache_arrow_flatbuf_Tensor_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Tensor_table_t org_apache_arrow_flatbuf_Tensor_vec_at(org_apache_arrow_flatbuf_Tensor_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Tensor_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Tensor) + +/** The type of data contained in a value cell. Currently only fixed-width + * value types are supported, no strings or nested types */ +__flatbuffers_define_union_field(flatbuffers_, 1, org_apache_arrow_flatbuf_Tensor, type, org_apache_arrow_flatbuf_Type, 1) +/** The dimensions of the tensor, optionally named */ +__flatbuffers_define_vector_field(2, org_apache_arrow_flatbuf_Tensor, shape, org_apache_arrow_flatbuf_TensorDim_vec_t, 1) +/** Non-negative byte offsets to advance one value cell along each dimension + * If omitted, default to row-major order (C-like). */ +__flatbuffers_define_vector_field(3, org_apache_arrow_flatbuf_Tensor, strides, flatbuffers_int64_vec_t, 0) +/** The location and size of the tensor's data */ +__flatbuffers_define_struct_field(4, org_apache_arrow_flatbuf_Tensor, data, org_apache_arrow_flatbuf_Buffer_struct_t, 1) + + +#include "flatcc/flatcc_epilogue.h" +#endif /* TENSOR_READER_H */ +#ifndef TENSOR_BUILDER_H +#define TENSOR_BUILDER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef TENSOR_READER_H +#include "Tensor_reader.h" +#endif +#ifndef FLATBUFFERS_COMMON_BUILDER_H +#include "flatbuffers_common_builder.h" +#endif +#ifndef SCHEMA_BUILDER_H +#include "Schema_builder.h" +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_TensorDim_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_TensorDim_ref_t; +static org_apache_arrow_flatbuf_TensorDim_ref_t org_apache_arrow_flatbuf_TensorDim_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_TensorDim_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_TensorDim, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Tensor_required[] = { 1, 2, 4, 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Tensor_ref_t; +static org_apache_arrow_flatbuf_Tensor_ref_t org_apache_arrow_flatbuf_Tensor_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Tensor_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Tensor, 5) + +#define __org_apache_arrow_flatbuf_TensorDim_formal_args , int64_t v0, flatbuffers_string_ref_t v1 +#define __org_apache_arrow_flatbuf_TensorDim_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_TensorDim_ref_t org_apache_arrow_flatbuf_TensorDim_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_TensorDim_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_TensorDim, org_apache_arrow_flatbuf_TensorDim_file_identifier, org_apache_arrow_flatbuf_TensorDim_type_identifier) + +#define __org_apache_arrow_flatbuf_Tensor_formal_args , org_apache_arrow_flatbuf_Type_union_ref_t v1, org_apache_arrow_flatbuf_TensorDim_vec_ref_t v2, flatbuffers_int64_vec_ref_t v3, org_apache_arrow_flatbuf_Buffer_t *v4 +#define __org_apache_arrow_flatbuf_Tensor_call_args , v1, v2, v3, v4 +static inline org_apache_arrow_flatbuf_Tensor_ref_t org_apache_arrow_flatbuf_Tensor_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Tensor_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Tensor, org_apache_arrow_flatbuf_Tensor_file_identifier, org_apache_arrow_flatbuf_Tensor_type_identifier) + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_TensorDim_size, flatbuffers_int64, int64_t, 8, 8, INT64_C(0), org_apache_arrow_flatbuf_TensorDim) +__flatbuffers_build_string_field(1, flatbuffers_, org_apache_arrow_flatbuf_TensorDim_name, org_apache_arrow_flatbuf_TensorDim) + +static inline org_apache_arrow_flatbuf_TensorDim_ref_t org_apache_arrow_flatbuf_TensorDim_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_TensorDim_formal_args) +{ + if (org_apache_arrow_flatbuf_TensorDim_start(B) + || org_apache_arrow_flatbuf_TensorDim_size_add(B, v0) + || org_apache_arrow_flatbuf_TensorDim_name_add(B, v1)) { + return 0; + } + return org_apache_arrow_flatbuf_TensorDim_end(B); +} + +static org_apache_arrow_flatbuf_TensorDim_ref_t org_apache_arrow_flatbuf_TensorDim_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_TensorDim_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_TensorDim_start(B) + || org_apache_arrow_flatbuf_TensorDim_size_pick(B, t) + || org_apache_arrow_flatbuf_TensorDim_name_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_TensorDim_end(B)); +} + +__flatbuffers_build_union_field(1, flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, org_apache_arrow_flatbuf_Tensor) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Null, org_apache_arrow_flatbuf_Null) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Int, org_apache_arrow_flatbuf_Int) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, FloatingPoint, org_apache_arrow_flatbuf_FloatingPoint) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Binary, org_apache_arrow_flatbuf_Binary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Utf8, org_apache_arrow_flatbuf_Utf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Bool, org_apache_arrow_flatbuf_Bool) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Decimal, org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Date, org_apache_arrow_flatbuf_Date) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Time, org_apache_arrow_flatbuf_Time) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Timestamp, org_apache_arrow_flatbuf_Timestamp) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Interval, org_apache_arrow_flatbuf_Interval) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, List, org_apache_arrow_flatbuf_List) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Struct_, org_apache_arrow_flatbuf_Struct_) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Union, org_apache_arrow_flatbuf_Union) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, FixedSizeBinary, org_apache_arrow_flatbuf_FixedSizeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, FixedSizeList, org_apache_arrow_flatbuf_FixedSizeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Map, org_apache_arrow_flatbuf_Map) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Duration, org_apache_arrow_flatbuf_Duration) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, LargeBinary, org_apache_arrow_flatbuf_LargeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, LargeUtf8, org_apache_arrow_flatbuf_LargeUtf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, LargeList, org_apache_arrow_flatbuf_LargeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, RunEndEncoded, org_apache_arrow_flatbuf_RunEndEncoded) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, BinaryView, org_apache_arrow_flatbuf_BinaryView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Utf8View, org_apache_arrow_flatbuf_Utf8View) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, ListView, org_apache_arrow_flatbuf_ListView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, LargeListView, org_apache_arrow_flatbuf_LargeListView) +__flatbuffers_build_table_vector_field(2, flatbuffers_, org_apache_arrow_flatbuf_Tensor_shape, org_apache_arrow_flatbuf_TensorDim, org_apache_arrow_flatbuf_Tensor) +__flatbuffers_build_vector_field(3, flatbuffers_, org_apache_arrow_flatbuf_Tensor_strides, flatbuffers_int64, int64_t, org_apache_arrow_flatbuf_Tensor) +__flatbuffers_build_struct_field(4, flatbuffers_, org_apache_arrow_flatbuf_Tensor_data, org_apache_arrow_flatbuf_Buffer, 16, 8, org_apache_arrow_flatbuf_Tensor) + +static inline org_apache_arrow_flatbuf_Tensor_ref_t org_apache_arrow_flatbuf_Tensor_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Tensor_formal_args) +{ + if (org_apache_arrow_flatbuf_Tensor_start(B) + || org_apache_arrow_flatbuf_Tensor_data_add(B, v4) + || org_apache_arrow_flatbuf_Tensor_type_add_value(B, v1) + || org_apache_arrow_flatbuf_Tensor_shape_add(B, v2) + || org_apache_arrow_flatbuf_Tensor_strides_add(B, v3) + || org_apache_arrow_flatbuf_Tensor_type_add_type(B, v1.type)) { + return 0; + } + return org_apache_arrow_flatbuf_Tensor_end(B); +} + +static org_apache_arrow_flatbuf_Tensor_ref_t org_apache_arrow_flatbuf_Tensor_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Tensor_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Tensor_start(B) + || org_apache_arrow_flatbuf_Tensor_data_pick(B, t) + || org_apache_arrow_flatbuf_Tensor_type_pick(B, t) + || org_apache_arrow_flatbuf_Tensor_shape_pick(B, t) + || org_apache_arrow_flatbuf_Tensor_strides_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Tensor_end(B)); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* TENSOR_BUILDER_H */ +#ifndef TENSOR_VERIFIER_H +#define TENSOR_VERIFIER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef TENSOR_READER_H +#include "Tensor_reader.h" +#endif +#include "flatcc/flatcc_verifier.h" +#ifndef SCHEMA_VERIFIER_H +#include "Schema_verifier.h" +#endif +#include "flatcc/flatcc_prologue.h" + +static int org_apache_arrow_flatbuf_TensorDim_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Tensor_verify_table(flatcc_table_verifier_descriptor_t *td); + +static int org_apache_arrow_flatbuf_TensorDim_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 8, 8) /* size */)) return ret; + if ((ret = flatcc_verify_string_field(td, 1, 0) /* name */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_TensorDim_identifier, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_TensorDim_identifier, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_TensorDim_type_identifier, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_TensorDim_type_identifier, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static int org_apache_arrow_flatbuf_Tensor_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_union_field(td, 1, 1, &org_apache_arrow_flatbuf_Type_union_verifier) /* type */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 2, 1, &org_apache_arrow_flatbuf_TensorDim_verify_table) /* shape */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 3, 0, 8, 8, INT64_C(536870911)) /* strides */)) return ret; + if ((ret = flatcc_verify_field(td, 4, 16, 8) /* data */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Tensor_identifier, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Tensor_identifier, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Tensor_type_identifier, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Tensor_type_identifier, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* TENSOR_VERIFIER_H */ +#ifndef SPARSETENSOR_READER_H +#define SPARSETENSOR_READER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef FLATBUFFERS_COMMON_READER_H +#include "flatbuffers_common_reader.h" +#endif +#ifndef TENSOR_READER_H +#include "Tensor_reader.h" +#endif +#include "flatcc/flatcc_flatbuffers.h" +#ifndef __alignas_is_defined +#include +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + + +typedef const struct org_apache_arrow_flatbuf_SparseTensorIndexCOO_table *org_apache_arrow_flatbuf_SparseTensorIndexCOO_table_t; +typedef struct org_apache_arrow_flatbuf_SparseTensorIndexCOO_table *org_apache_arrow_flatbuf_SparseTensorIndexCOO_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_SparseTensorIndexCOO_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_SparseTensorIndexCOO_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_SparseMatrixIndexCSX_table *org_apache_arrow_flatbuf_SparseMatrixIndexCSX_table_t; +typedef struct org_apache_arrow_flatbuf_SparseMatrixIndexCSX_table *org_apache_arrow_flatbuf_SparseMatrixIndexCSX_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_SparseMatrixIndexCSX_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_SparseMatrixIndexCSX_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_SparseTensorIndexCSF_table *org_apache_arrow_flatbuf_SparseTensorIndexCSF_table_t; +typedef struct org_apache_arrow_flatbuf_SparseTensorIndexCSF_table *org_apache_arrow_flatbuf_SparseTensorIndexCSF_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_SparseTensorIndexCSF_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_SparseTensorIndexCSF_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_SparseTensor_table *org_apache_arrow_flatbuf_SparseTensor_table_t; +typedef struct org_apache_arrow_flatbuf_SparseTensor_table *org_apache_arrow_flatbuf_SparseTensor_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_SparseTensor_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_SparseTensor_mutable_vec_t; +#ifndef org_apache_arrow_flatbuf_SparseTensorIndexCOO_file_identifier +#define org_apache_arrow_flatbuf_SparseTensorIndexCOO_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_SparseTensorIndexCOO_file_identifier */ +#ifndef org_apache_arrow_flatbuf_SparseTensorIndexCOO_identifier +#define org_apache_arrow_flatbuf_SparseTensorIndexCOO_identifier 0 +#endif +#define org_apache_arrow_flatbuf_SparseTensorIndexCOO_type_hash ((flatbuffers_thash_t)0x3b31385a) +#define org_apache_arrow_flatbuf_SparseTensorIndexCOO_type_identifier "\x5a\x38\x31\x3b" +#ifndef org_apache_arrow_flatbuf_SparseTensorIndexCOO_file_extension +#define org_apache_arrow_flatbuf_SparseTensorIndexCOO_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_SparseMatrixIndexCSX_file_identifier +#define org_apache_arrow_flatbuf_SparseMatrixIndexCSX_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_SparseMatrixIndexCSX_file_identifier */ +#ifndef org_apache_arrow_flatbuf_SparseMatrixIndexCSX_identifier +#define org_apache_arrow_flatbuf_SparseMatrixIndexCSX_identifier 0 +#endif +#define org_apache_arrow_flatbuf_SparseMatrixIndexCSX_type_hash ((flatbuffers_thash_t)0xec57ea87) +#define org_apache_arrow_flatbuf_SparseMatrixIndexCSX_type_identifier "\x87\xea\x57\xec" +#ifndef org_apache_arrow_flatbuf_SparseMatrixIndexCSX_file_extension +#define org_apache_arrow_flatbuf_SparseMatrixIndexCSX_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_SparseTensorIndexCSF_file_identifier +#define org_apache_arrow_flatbuf_SparseTensorIndexCSF_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_SparseTensorIndexCSF_file_identifier */ +#ifndef org_apache_arrow_flatbuf_SparseTensorIndexCSF_identifier +#define org_apache_arrow_flatbuf_SparseTensorIndexCSF_identifier 0 +#endif +#define org_apache_arrow_flatbuf_SparseTensorIndexCSF_type_hash ((flatbuffers_thash_t)0xf44edda9) +#define org_apache_arrow_flatbuf_SparseTensorIndexCSF_type_identifier "\xa9\xdd\x4e\xf4" +#ifndef org_apache_arrow_flatbuf_SparseTensorIndexCSF_file_extension +#define org_apache_arrow_flatbuf_SparseTensorIndexCSF_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_SparseTensor_file_identifier +#define org_apache_arrow_flatbuf_SparseTensor_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_SparseTensor_file_identifier */ +#ifndef org_apache_arrow_flatbuf_SparseTensor_identifier +#define org_apache_arrow_flatbuf_SparseTensor_identifier 0 +#endif +#define org_apache_arrow_flatbuf_SparseTensor_type_hash ((flatbuffers_thash_t)0xae6f7239) +#define org_apache_arrow_flatbuf_SparseTensor_type_identifier "\x39\x72\x6f\xae" +#ifndef org_apache_arrow_flatbuf_SparseTensor_file_extension +#define org_apache_arrow_flatbuf_SparseTensor_file_extension "bin" +#endif + +typedef int16_t org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_SparseMatrixCompressedAxis, org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t, 16) +#define org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_Row ((org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_Column ((org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t)INT16_C(1)) + +static inline const char *org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_name(org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_Row: return "Row"; + case org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_Column: return "Column"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_is_known_value(org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_Row: return 1; + case org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_Column: return 1; + default: return 0; + } +} + + + +/** ---------------------------------------------------------------------- + * EXPERIMENTAL: Data structures for sparse tensors + * Coordinate (COO) format of sparse tensor index. + * + * COO's index list are represented as a NxM matrix, + * where N is the number of non-zero values, + * and M is the number of dimensions of a sparse tensor. + * + * indicesBuffer stores the location and size of the data of this indices + * matrix. The value type and the stride of the indices matrix is + * specified in indicesType and indicesStrides fields. + * + * For example, let X be a 2x3x4x5 tensor, and it has the following + * 6 non-zero values: + * ```text + * X[0, 1, 2, 0] := 1 + * X[1, 1, 2, 3] := 2 + * X[0, 2, 1, 0] := 3 + * X[0, 1, 3, 0] := 4 + * X[0, 1, 2, 1] := 5 + * X[1, 2, 0, 4] := 6 + * ``` + * In COO format, the index matrix of X is the following 4x6 matrix: + * ```text + * [[0, 0, 0, 0, 1, 1], + * [1, 1, 1, 2, 1, 2], + * [2, 2, 3, 1, 2, 0], + * [0, 1, 0, 0, 3, 4]] + * ``` + * When isCanonical is true, the indices is sorted in lexicographical order + * (row-major order), and it does not have duplicated entries. Otherwise, + * the indices may not be sorted, or may have duplicated entries. */ +struct org_apache_arrow_flatbuf_SparseTensorIndexCOO_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_SparseTensorIndexCOO_vec_len(org_apache_arrow_flatbuf_SparseTensorIndexCOO_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_SparseTensorIndexCOO_table_t org_apache_arrow_flatbuf_SparseTensorIndexCOO_vec_at(org_apache_arrow_flatbuf_SparseTensorIndexCOO_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_SparseTensorIndexCOO_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_SparseTensorIndexCOO) + +/** The type of values in indicesBuffer */ +__flatbuffers_define_table_field(0, org_apache_arrow_flatbuf_SparseTensorIndexCOO, indicesType, org_apache_arrow_flatbuf_Int_table_t, 1) +/** Non-negative byte offsets to advance one value cell along each dimension + * If omitted, default to row-major order (C-like). */ +__flatbuffers_define_vector_field(1, org_apache_arrow_flatbuf_SparseTensorIndexCOO, indicesStrides, flatbuffers_int64_vec_t, 0) +/** The location and size of the indices matrix's data */ +__flatbuffers_define_struct_field(2, org_apache_arrow_flatbuf_SparseTensorIndexCOO, indicesBuffer, org_apache_arrow_flatbuf_Buffer_struct_t, 1) +/** This flag is true if and only if the indices matrix is sorted in + * row-major order, and does not have duplicated entries. + * This sort order is the same as of Tensorflow's SparseTensor, + * but it is inverse order of SciPy's canonical coo_matrix + * (SciPy employs column-major order for its coo_matrix). */ +__flatbuffers_define_scalar_field(3, org_apache_arrow_flatbuf_SparseTensorIndexCOO, isCanonical, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) + +/** Compressed Sparse format, that is matrix-specific. */ +struct org_apache_arrow_flatbuf_SparseMatrixIndexCSX_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_SparseMatrixIndexCSX_vec_len(org_apache_arrow_flatbuf_SparseMatrixIndexCSX_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_SparseMatrixIndexCSX_table_t org_apache_arrow_flatbuf_SparseMatrixIndexCSX_vec_at(org_apache_arrow_flatbuf_SparseMatrixIndexCSX_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_SparseMatrixIndexCSX_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_SparseMatrixIndexCSX) + +/** Which axis, row or column, is compressed */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_SparseMatrixIndexCSX, compressedAxis, org_apache_arrow_flatbuf_SparseMatrixCompressedAxis, org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t, INT16_C(0)) +/** The type of values in indptrBuffer */ +__flatbuffers_define_table_field(1, org_apache_arrow_flatbuf_SparseMatrixIndexCSX, indptrType, org_apache_arrow_flatbuf_Int_table_t, 1) +/** indptrBuffer stores the location and size of indptr array that + * represents the range of the rows. + * The i-th row spans from `indptr[i]` to `indptr[i+1]` in the data. + * The length of this array is 1 + (the number of rows), and the type + * of index value is long. + * + * For example, let X be the following 6x4 matrix: + * ```text + * X := [[0, 1, 2, 0], + * [0, 0, 3, 0], + * [0, 4, 0, 5], + * [0, 0, 0, 0], + * [6, 0, 7, 8], + * [0, 9, 0, 0]]. + * ``` + * The array of non-zero values in X is: + * ```text + * values(X) = [1, 2, 3, 4, 5, 6, 7, 8, 9]. + * ``` + * And the indptr of X is: + * ```text + * indptr(X) = [0, 2, 3, 5, 5, 8, 10]. + * ``` */ +__flatbuffers_define_struct_field(2, org_apache_arrow_flatbuf_SparseMatrixIndexCSX, indptrBuffer, org_apache_arrow_flatbuf_Buffer_struct_t, 1) +/** The type of values in indicesBuffer */ +__flatbuffers_define_table_field(3, org_apache_arrow_flatbuf_SparseMatrixIndexCSX, indicesType, org_apache_arrow_flatbuf_Int_table_t, 1) +/** indicesBuffer stores the location and size of the array that + * contains the column indices of the corresponding non-zero values. + * The type of index value is long. + * + * For example, the indices of the above X is: + * ```text + * indices(X) = [1, 2, 2, 1, 3, 0, 2, 3, 1]. + * ``` + * Note that the indices are sorted in lexicographical order for each row. */ +__flatbuffers_define_struct_field(4, org_apache_arrow_flatbuf_SparseMatrixIndexCSX, indicesBuffer, org_apache_arrow_flatbuf_Buffer_struct_t, 1) + +/** Compressed Sparse Fiber (CSF) sparse tensor index. */ +struct org_apache_arrow_flatbuf_SparseTensorIndexCSF_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_SparseTensorIndexCSF_vec_len(org_apache_arrow_flatbuf_SparseTensorIndexCSF_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_SparseTensorIndexCSF_table_t org_apache_arrow_flatbuf_SparseTensorIndexCSF_vec_at(org_apache_arrow_flatbuf_SparseTensorIndexCSF_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_SparseTensorIndexCSF_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_SparseTensorIndexCSF) + +/** CSF is a generalization of compressed sparse row (CSR) index. + * See [smith2017knl](http://shaden.io/pub-files/smith2017knl.pdf) + * + * CSF index recursively compresses each dimension of a tensor into a set + * of prefix trees. Each path from a root to leaf forms one tensor + * non-zero index. CSF is implemented with two arrays of buffers and one + * arrays of integers. + * + * For example, let X be a 2x3x4x5 tensor and let it have the following + * 8 non-zero values: + * ```text + * X[0, 0, 0, 1] := 1 + * X[0, 0, 0, 2] := 2 + * X[0, 1, 0, 0] := 3 + * X[0, 1, 0, 2] := 4 + * X[0, 1, 1, 0] := 5 + * X[1, 1, 1, 0] := 6 + * X[1, 1, 1, 1] := 7 + * X[1, 1, 1, 2] := 8 + * ``` + * As a prefix tree this would be represented as: + * ```text + * 0 1 + * / \ | + * 0 1 1 + * / / \ | + * 0 0 1 1 + * /| /| | /| | + * 1 2 0 2 0 0 1 2 + * ``` + * The type of values in indptrBuffers */ +__flatbuffers_define_table_field(0, org_apache_arrow_flatbuf_SparseTensorIndexCSF, indptrType, org_apache_arrow_flatbuf_Int_table_t, 1) +/** indptrBuffers stores the sparsity structure. + * Each two consecutive dimensions in a tensor correspond to a buffer in + * indptrBuffers. A pair of consecutive values at `indptrBuffers[dim][i]` + * and `indptrBuffers[dim][i + 1]` signify a range of nodes in + * `indicesBuffers[dim + 1]` who are children of `indicesBuffers[dim][i]` node. + * + * For example, the indptrBuffers for the above X is: + * ```text + * indptrBuffer(X) = [ + * [0, 2, 3], + * [0, 1, 3, 4], + * [0, 2, 4, 5, 8] + * ]. + * ``` */ +__flatbuffers_define_vector_field(1, org_apache_arrow_flatbuf_SparseTensorIndexCSF, indptrBuffers, org_apache_arrow_flatbuf_Buffer_vec_t, 1) +/** The type of values in indicesBuffers */ +__flatbuffers_define_table_field(2, org_apache_arrow_flatbuf_SparseTensorIndexCSF, indicesType, org_apache_arrow_flatbuf_Int_table_t, 1) +/** indicesBuffers stores values of nodes. + * Each tensor dimension corresponds to a buffer in indicesBuffers. + * For example, the indicesBuffers for the above X is: + * ```text + * indicesBuffer(X) = [ + * [0, 1], + * [0, 1, 1], + * [0, 0, 1, 1], + * [1, 2, 0, 2, 0, 0, 1, 2] + * ]. + * ``` */ +__flatbuffers_define_vector_field(3, org_apache_arrow_flatbuf_SparseTensorIndexCSF, indicesBuffers, org_apache_arrow_flatbuf_Buffer_vec_t, 1) +/** axisOrder stores the sequence in which dimensions were traversed to + * produce the prefix tree. + * For example, the axisOrder for the above X is: + * ```text + * axisOrder(X) = [0, 1, 2, 3]. + * ``` */ +__flatbuffers_define_vector_field(4, org_apache_arrow_flatbuf_SparseTensorIndexCSF, axisOrder, flatbuffers_int32_vec_t, 1) +typedef uint8_t org_apache_arrow_flatbuf_SparseTensorIndex_union_type_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_SparseTensorIndex, org_apache_arrow_flatbuf_SparseTensorIndex_union_type_t, 8) +__flatbuffers_define_union(flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndex) +#define org_apache_arrow_flatbuf_SparseTensorIndex_NONE ((org_apache_arrow_flatbuf_SparseTensorIndex_union_type_t)UINT8_C(0)) +#define org_apache_arrow_flatbuf_SparseTensorIndex_SparseTensorIndexCOO ((org_apache_arrow_flatbuf_SparseTensorIndex_union_type_t)UINT8_C(1)) +#define org_apache_arrow_flatbuf_SparseTensorIndex_SparseMatrixIndexCSX ((org_apache_arrow_flatbuf_SparseTensorIndex_union_type_t)UINT8_C(2)) +#define org_apache_arrow_flatbuf_SparseTensorIndex_SparseTensorIndexCSF ((org_apache_arrow_flatbuf_SparseTensorIndex_union_type_t)UINT8_C(3)) + +static inline const char *org_apache_arrow_flatbuf_SparseTensorIndex_type_name(org_apache_arrow_flatbuf_SparseTensorIndex_union_type_t type) +{ + switch (type) { + case org_apache_arrow_flatbuf_SparseTensorIndex_NONE: return "NONE"; + case org_apache_arrow_flatbuf_SparseTensorIndex_SparseTensorIndexCOO: return "SparseTensorIndexCOO"; + case org_apache_arrow_flatbuf_SparseTensorIndex_SparseMatrixIndexCSX: return "SparseMatrixIndexCSX"; + case org_apache_arrow_flatbuf_SparseTensorIndex_SparseTensorIndexCSF: return "SparseTensorIndexCSF"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndex_is_known_type(org_apache_arrow_flatbuf_SparseTensorIndex_union_type_t type) +{ + switch (type) { + case org_apache_arrow_flatbuf_SparseTensorIndex_NONE: return 1; + case org_apache_arrow_flatbuf_SparseTensorIndex_SparseTensorIndexCOO: return 1; + case org_apache_arrow_flatbuf_SparseTensorIndex_SparseMatrixIndexCSX: return 1; + case org_apache_arrow_flatbuf_SparseTensorIndex_SparseTensorIndexCSF: return 1; + default: return 0; + } +} + + +struct org_apache_arrow_flatbuf_SparseTensor_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_SparseTensor_vec_len(org_apache_arrow_flatbuf_SparseTensor_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_SparseTensor_table_t org_apache_arrow_flatbuf_SparseTensor_vec_at(org_apache_arrow_flatbuf_SparseTensor_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_SparseTensor_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_SparseTensor) + +/** The type of data contained in a value cell. + * Currently only fixed-width value types are supported, + * no strings or nested types. */ +__flatbuffers_define_union_field(flatbuffers_, 1, org_apache_arrow_flatbuf_SparseTensor, type, org_apache_arrow_flatbuf_Type, 1) +/** The dimensions of the tensor, optionally named. */ +__flatbuffers_define_vector_field(2, org_apache_arrow_flatbuf_SparseTensor, shape, org_apache_arrow_flatbuf_TensorDim_vec_t, 1) +/** The number of non-zero values in a sparse tensor. */ +__flatbuffers_define_scalar_field(3, org_apache_arrow_flatbuf_SparseTensor, non_zero_length, flatbuffers_int64, int64_t, INT64_C(0)) +/** Sparse tensor index */ +__flatbuffers_define_union_field(flatbuffers_, 5, org_apache_arrow_flatbuf_SparseTensor, sparseIndex, org_apache_arrow_flatbuf_SparseTensorIndex, 1) +/** The location and size of the tensor's data */ +__flatbuffers_define_struct_field(6, org_apache_arrow_flatbuf_SparseTensor, data, org_apache_arrow_flatbuf_Buffer_struct_t, 1) + + +#include "flatcc/flatcc_epilogue.h" +#endif /* SPARSETENSOR_READER_H */ +#ifndef SPARSETENSOR_BUILDER_H +#define SPARSETENSOR_BUILDER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef SPARSETENSOR_READER_H +#include "SparseTensor_reader.h" +#endif +#ifndef FLATBUFFERS_COMMON_BUILDER_H +#include "flatbuffers_common_builder.h" +#endif +#ifndef TENSOR_BUILDER_H +#include "Tensor_builder.h" +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + +#define __org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_formal_args , org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t v0 +#define __org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_SparseMatrixCompressedAxis, org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t) + +typedef flatbuffers_union_ref_t org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t; +typedef flatbuffers_union_vec_ref_t org_apache_arrow_flatbuf_SparseTensorIndex_union_vec_ref_t; +static org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t org_apache_arrow_flatbuf_SparseTensorIndex_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseTensorIndex_union_t t); + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_SparseTensorIndexCOO_required[] = { 0, 2, 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCOO_ref_t; +static org_apache_arrow_flatbuf_SparseTensorIndexCOO_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCOO_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseTensorIndexCOO_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCOO, 4) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_SparseMatrixIndexCSX_required[] = { 1, 2, 3, 4, 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_SparseMatrixIndexCSX_ref_t; +static org_apache_arrow_flatbuf_SparseMatrixIndexCSX_ref_t org_apache_arrow_flatbuf_SparseMatrixIndexCSX_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_SparseMatrixIndexCSX, 5) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_SparseTensorIndexCSF_required[] = { 0, 1, 2, 3, 4, 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCSF_ref_t; +static org_apache_arrow_flatbuf_SparseTensorIndexCSF_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCSF_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseTensorIndexCSF_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCSF, 5) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_SparseTensor_required[] = { 1, 2, 5, 6, 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_SparseTensor_ref_t; +static org_apache_arrow_flatbuf_SparseTensor_ref_t org_apache_arrow_flatbuf_SparseTensor_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseTensor_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor, 7) + +#define __org_apache_arrow_flatbuf_SparseTensorIndexCOO_formal_args , org_apache_arrow_flatbuf_Int_ref_t v0, flatbuffers_int64_vec_ref_t v1, org_apache_arrow_flatbuf_Buffer_t *v2, flatbuffers_bool_t v3 +#define __org_apache_arrow_flatbuf_SparseTensorIndexCOO_call_args , v0, v1, v2, v3 +static inline org_apache_arrow_flatbuf_SparseTensorIndexCOO_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCOO_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_SparseTensorIndexCOO_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCOO, org_apache_arrow_flatbuf_SparseTensorIndexCOO_file_identifier, org_apache_arrow_flatbuf_SparseTensorIndexCOO_type_identifier) + +#define __org_apache_arrow_flatbuf_SparseMatrixIndexCSX_formal_args ,\ + org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t v0, org_apache_arrow_flatbuf_Int_ref_t v1, org_apache_arrow_flatbuf_Buffer_t *v2, org_apache_arrow_flatbuf_Int_ref_t v3, org_apache_arrow_flatbuf_Buffer_t *v4 +#define __org_apache_arrow_flatbuf_SparseMatrixIndexCSX_call_args ,\ + v0, v1, v2, v3, v4 +static inline org_apache_arrow_flatbuf_SparseMatrixIndexCSX_ref_t org_apache_arrow_flatbuf_SparseMatrixIndexCSX_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_SparseMatrixIndexCSX_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_SparseMatrixIndexCSX, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_file_identifier, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_type_identifier) + +#define __org_apache_arrow_flatbuf_SparseTensorIndexCSF_formal_args ,\ + org_apache_arrow_flatbuf_Int_ref_t v0, org_apache_arrow_flatbuf_Buffer_vec_ref_t v1, org_apache_arrow_flatbuf_Int_ref_t v2, org_apache_arrow_flatbuf_Buffer_vec_ref_t v3, flatbuffers_int32_vec_ref_t v4 +#define __org_apache_arrow_flatbuf_SparseTensorIndexCSF_call_args ,\ + v0, v1, v2, v3, v4 +static inline org_apache_arrow_flatbuf_SparseTensorIndexCSF_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCSF_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_SparseTensorIndexCSF_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCSF, org_apache_arrow_flatbuf_SparseTensorIndexCSF_file_identifier, org_apache_arrow_flatbuf_SparseTensorIndexCSF_type_identifier) + +#define __org_apache_arrow_flatbuf_SparseTensor_formal_args ,\ + org_apache_arrow_flatbuf_Type_union_ref_t v1, org_apache_arrow_flatbuf_TensorDim_vec_ref_t v2, int64_t v3, org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t v5, org_apache_arrow_flatbuf_Buffer_t *v6 +#define __org_apache_arrow_flatbuf_SparseTensor_call_args ,\ + v1, v2, v3, v5, v6 +static inline org_apache_arrow_flatbuf_SparseTensor_ref_t org_apache_arrow_flatbuf_SparseTensor_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_SparseTensor_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor, org_apache_arrow_flatbuf_SparseTensor_file_identifier, org_apache_arrow_flatbuf_SparseTensor_type_identifier) + +static inline org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t org_apache_arrow_flatbuf_SparseTensorIndex_as_NONE(void) +{ org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_SparseTensorIndex_NONE; uref.value = 0; return uref; } +static inline org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t org_apache_arrow_flatbuf_SparseTensorIndex_as_SparseTensorIndexCOO(org_apache_arrow_flatbuf_SparseTensorIndexCOO_ref_t ref) +{ org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_SparseTensorIndex_SparseTensorIndexCOO; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t org_apache_arrow_flatbuf_SparseTensorIndex_as_SparseMatrixIndexCSX(org_apache_arrow_flatbuf_SparseMatrixIndexCSX_ref_t ref) +{ org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_SparseTensorIndex_SparseMatrixIndexCSX; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t org_apache_arrow_flatbuf_SparseTensorIndex_as_SparseTensorIndexCSF(org_apache_arrow_flatbuf_SparseTensorIndexCSF_ref_t ref) +{ org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_SparseTensorIndex_SparseTensorIndexCSF; uref.value = ref; return uref; } +__flatbuffers_build_union_vector(flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndex) + +static org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t org_apache_arrow_flatbuf_SparseTensorIndex_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseTensorIndex_union_t u) +{ + switch (u.type) { + case 1: return org_apache_arrow_flatbuf_SparseTensorIndex_as_SparseTensorIndexCOO(org_apache_arrow_flatbuf_SparseTensorIndexCOO_clone(B, (org_apache_arrow_flatbuf_SparseTensorIndexCOO_table_t)u.value)); + case 2: return org_apache_arrow_flatbuf_SparseTensorIndex_as_SparseMatrixIndexCSX(org_apache_arrow_flatbuf_SparseMatrixIndexCSX_clone(B, (org_apache_arrow_flatbuf_SparseMatrixIndexCSX_table_t)u.value)); + case 3: return org_apache_arrow_flatbuf_SparseTensorIndex_as_SparseTensorIndexCSF(org_apache_arrow_flatbuf_SparseTensorIndexCSF_clone(B, (org_apache_arrow_flatbuf_SparseTensorIndexCSF_table_t)u.value)); + default: return org_apache_arrow_flatbuf_SparseTensorIndex_as_NONE(); + } +} + +__flatbuffers_build_table_field(0, flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCOO_indicesType, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_SparseTensorIndexCOO) +__flatbuffers_build_vector_field(1, flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCOO_indicesStrides, flatbuffers_int64, int64_t, org_apache_arrow_flatbuf_SparseTensorIndexCOO) +__flatbuffers_build_struct_field(2, flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCOO_indicesBuffer, org_apache_arrow_flatbuf_Buffer, 16, 8, org_apache_arrow_flatbuf_SparseTensorIndexCOO) +__flatbuffers_build_scalar_field(3, flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCOO_isCanonical, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_SparseTensorIndexCOO) + +static inline org_apache_arrow_flatbuf_SparseTensorIndexCOO_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCOO_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_SparseTensorIndexCOO_formal_args) +{ + if (org_apache_arrow_flatbuf_SparseTensorIndexCOO_start(B) + || org_apache_arrow_flatbuf_SparseTensorIndexCOO_indicesBuffer_add(B, v2) + || org_apache_arrow_flatbuf_SparseTensorIndexCOO_indicesType_add(B, v0) + || org_apache_arrow_flatbuf_SparseTensorIndexCOO_indicesStrides_add(B, v1) + || org_apache_arrow_flatbuf_SparseTensorIndexCOO_isCanonical_add(B, v3)) { + return 0; + } + return org_apache_arrow_flatbuf_SparseTensorIndexCOO_end(B); +} + +static org_apache_arrow_flatbuf_SparseTensorIndexCOO_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCOO_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseTensorIndexCOO_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_SparseTensorIndexCOO_start(B) + || org_apache_arrow_flatbuf_SparseTensorIndexCOO_indicesBuffer_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensorIndexCOO_indicesType_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensorIndexCOO_indicesStrides_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensorIndexCOO_isCanonical_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_SparseTensorIndexCOO_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_compressedAxis, org_apache_arrow_flatbuf_SparseMatrixCompressedAxis, org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_SparseMatrixIndexCSX) +__flatbuffers_build_table_field(1, flatbuffers_, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indptrType, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_SparseMatrixIndexCSX) +__flatbuffers_build_struct_field(2, flatbuffers_, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indptrBuffer, org_apache_arrow_flatbuf_Buffer, 16, 8, org_apache_arrow_flatbuf_SparseMatrixIndexCSX) +__flatbuffers_build_table_field(3, flatbuffers_, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indicesType, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_SparseMatrixIndexCSX) +__flatbuffers_build_struct_field(4, flatbuffers_, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indicesBuffer, org_apache_arrow_flatbuf_Buffer, 16, 8, org_apache_arrow_flatbuf_SparseMatrixIndexCSX) + +static inline org_apache_arrow_flatbuf_SparseMatrixIndexCSX_ref_t org_apache_arrow_flatbuf_SparseMatrixIndexCSX_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_SparseMatrixIndexCSX_formal_args) +{ + if (org_apache_arrow_flatbuf_SparseMatrixIndexCSX_start(B) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indptrBuffer_add(B, v2) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indicesBuffer_add(B, v4) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indptrType_add(B, v1) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indicesType_add(B, v3) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_compressedAxis_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_SparseMatrixIndexCSX_end(B); +} + +static org_apache_arrow_flatbuf_SparseMatrixIndexCSX_ref_t org_apache_arrow_flatbuf_SparseMatrixIndexCSX_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_SparseMatrixIndexCSX_start(B) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indptrBuffer_pick(B, t) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indicesBuffer_pick(B, t) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indptrType_pick(B, t) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indicesType_pick(B, t) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_compressedAxis_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_end(B)); +} + +__flatbuffers_build_table_field(0, flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCSF_indptrType, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_SparseTensorIndexCSF) +__flatbuffers_build_vector_field(1, flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCSF_indptrBuffers, org_apache_arrow_flatbuf_Buffer, org_apache_arrow_flatbuf_Buffer_t, org_apache_arrow_flatbuf_SparseTensorIndexCSF) +__flatbuffers_build_table_field(2, flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCSF_indicesType, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_SparseTensorIndexCSF) +__flatbuffers_build_vector_field(3, flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCSF_indicesBuffers, org_apache_arrow_flatbuf_Buffer, org_apache_arrow_flatbuf_Buffer_t, org_apache_arrow_flatbuf_SparseTensorIndexCSF) +__flatbuffers_build_vector_field(4, flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCSF_axisOrder, flatbuffers_int32, int32_t, org_apache_arrow_flatbuf_SparseTensorIndexCSF) + +static inline org_apache_arrow_flatbuf_SparseTensorIndexCSF_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCSF_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_SparseTensorIndexCSF_formal_args) +{ + if (org_apache_arrow_flatbuf_SparseTensorIndexCSF_start(B) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_indptrType_add(B, v0) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_indptrBuffers_add(B, v1) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_indicesType_add(B, v2) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_indicesBuffers_add(B, v3) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_axisOrder_add(B, v4)) { + return 0; + } + return org_apache_arrow_flatbuf_SparseTensorIndexCSF_end(B); +} + +static org_apache_arrow_flatbuf_SparseTensorIndexCSF_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCSF_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseTensorIndexCSF_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_SparseTensorIndexCSF_start(B) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_indptrType_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_indptrBuffers_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_indicesType_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_indicesBuffers_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_axisOrder_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_SparseTensorIndexCSF_end(B)); +} + +__flatbuffers_build_union_field(1, flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, org_apache_arrow_flatbuf_SparseTensor) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Null, org_apache_arrow_flatbuf_Null) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Int, org_apache_arrow_flatbuf_Int) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, FloatingPoint, org_apache_arrow_flatbuf_FloatingPoint) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Binary, org_apache_arrow_flatbuf_Binary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Utf8, org_apache_arrow_flatbuf_Utf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Bool, org_apache_arrow_flatbuf_Bool) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Decimal, org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Date, org_apache_arrow_flatbuf_Date) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Time, org_apache_arrow_flatbuf_Time) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Timestamp, org_apache_arrow_flatbuf_Timestamp) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Interval, org_apache_arrow_flatbuf_Interval) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, List, org_apache_arrow_flatbuf_List) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Struct_, org_apache_arrow_flatbuf_Struct_) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Union, org_apache_arrow_flatbuf_Union) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, FixedSizeBinary, org_apache_arrow_flatbuf_FixedSizeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, FixedSizeList, org_apache_arrow_flatbuf_FixedSizeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Map, org_apache_arrow_flatbuf_Map) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Duration, org_apache_arrow_flatbuf_Duration) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, LargeBinary, org_apache_arrow_flatbuf_LargeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, LargeUtf8, org_apache_arrow_flatbuf_LargeUtf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, LargeList, org_apache_arrow_flatbuf_LargeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, RunEndEncoded, org_apache_arrow_flatbuf_RunEndEncoded) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, BinaryView, org_apache_arrow_flatbuf_BinaryView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Utf8View, org_apache_arrow_flatbuf_Utf8View) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, ListView, org_apache_arrow_flatbuf_ListView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, LargeListView, org_apache_arrow_flatbuf_LargeListView) +__flatbuffers_build_table_vector_field(2, flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_shape, org_apache_arrow_flatbuf_TensorDim, org_apache_arrow_flatbuf_SparseTensor) +__flatbuffers_build_scalar_field(3, flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_non_zero_length, flatbuffers_int64, int64_t, 8, 8, INT64_C(0), org_apache_arrow_flatbuf_SparseTensor) +__flatbuffers_build_union_field(5, flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_sparseIndex, org_apache_arrow_flatbuf_SparseTensorIndex, org_apache_arrow_flatbuf_SparseTensor) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_sparseIndex, org_apache_arrow_flatbuf_SparseTensorIndex, SparseTensorIndexCOO, org_apache_arrow_flatbuf_SparseTensorIndexCOO) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_sparseIndex, org_apache_arrow_flatbuf_SparseTensorIndex, SparseMatrixIndexCSX, org_apache_arrow_flatbuf_SparseMatrixIndexCSX) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_sparseIndex, org_apache_arrow_flatbuf_SparseTensorIndex, SparseTensorIndexCSF, org_apache_arrow_flatbuf_SparseTensorIndexCSF) +__flatbuffers_build_struct_field(6, flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_data, org_apache_arrow_flatbuf_Buffer, 16, 8, org_apache_arrow_flatbuf_SparseTensor) + +static inline org_apache_arrow_flatbuf_SparseTensor_ref_t org_apache_arrow_flatbuf_SparseTensor_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_SparseTensor_formal_args) +{ + if (org_apache_arrow_flatbuf_SparseTensor_start(B) + || org_apache_arrow_flatbuf_SparseTensor_non_zero_length_add(B, v3) + || org_apache_arrow_flatbuf_SparseTensor_data_add(B, v6) + || org_apache_arrow_flatbuf_SparseTensor_type_add_value(B, v1) + || org_apache_arrow_flatbuf_SparseTensor_shape_add(B, v2) + || org_apache_arrow_flatbuf_SparseTensor_sparseIndex_add_value(B, v5) + || org_apache_arrow_flatbuf_SparseTensor_type_add_type(B, v1.type) + || org_apache_arrow_flatbuf_SparseTensor_sparseIndex_add_type(B, v5.type)) { + return 0; + } + return org_apache_arrow_flatbuf_SparseTensor_end(B); +} + +static org_apache_arrow_flatbuf_SparseTensor_ref_t org_apache_arrow_flatbuf_SparseTensor_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseTensor_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_SparseTensor_start(B) + || org_apache_arrow_flatbuf_SparseTensor_non_zero_length_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensor_data_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensor_type_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensor_shape_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensor_sparseIndex_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_SparseTensor_end(B)); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* SPARSETENSOR_BUILDER_H */ +#ifndef SPARSETENSOR_VERIFIER_H +#define SPARSETENSOR_VERIFIER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef SPARSETENSOR_READER_H +#include "SparseTensor_reader.h" +#endif +#include "flatcc/flatcc_verifier.h" +#ifndef TENSOR_VERIFIER_H +#include "Tensor_verifier.h" +#endif +#include "flatcc/flatcc_prologue.h" + +static int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_SparseTensor_verify_table(flatcc_table_verifier_descriptor_t *td); + +static int org_apache_arrow_flatbuf_SparseTensorIndex_union_verifier(flatcc_union_verifier_descriptor_t *ud) +{ + switch (ud->type) { + case 1: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table); /* SparseTensorIndexCOO */ + case 2: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table); /* SparseMatrixIndexCSX */ + case 3: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table); /* SparseTensorIndexCSF */ + default: return flatcc_verify_ok; + } +} + +static int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_table_field(td, 0, 1, &org_apache_arrow_flatbuf_Int_verify_table) /* indicesType */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 1, 0, 8, 8, INT64_C(536870911)) /* indicesStrides */)) return ret; + if ((ret = flatcc_verify_field(td, 2, 16, 8) /* indicesBuffer */)) return ret; + if ((ret = flatcc_verify_field(td, 3, 1, 1) /* isCanonical */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensorIndexCOO_identifier, &org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensorIndexCOO_identifier, &org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensorIndexCOO_type_identifier, &org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensorIndexCOO_type_identifier, &org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table); +} + +static int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* compressedAxis */)) return ret; + if ((ret = flatcc_verify_table_field(td, 1, 1, &org_apache_arrow_flatbuf_Int_verify_table) /* indptrType */)) return ret; + if ((ret = flatcc_verify_field(td, 2, 16, 8) /* indptrBuffer */)) return ret; + if ((ret = flatcc_verify_table_field(td, 3, 1, &org_apache_arrow_flatbuf_Int_verify_table) /* indicesType */)) return ret; + if ((ret = flatcc_verify_field(td, 4, 16, 8) /* indicesBuffer */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_identifier, &org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_identifier, &org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_type_identifier, &org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_type_identifier, &org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table); +} + +static int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_table_field(td, 0, 1, &org_apache_arrow_flatbuf_Int_verify_table) /* indptrType */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 1, 1, 16, 8, INT64_C(268435455)) /* indptrBuffers */)) return ret; + if ((ret = flatcc_verify_table_field(td, 2, 1, &org_apache_arrow_flatbuf_Int_verify_table) /* indicesType */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 3, 1, 16, 8, INT64_C(268435455)) /* indicesBuffers */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 4, 1, 4, 4, INT64_C(1073741823)) /* axisOrder */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensorIndexCSF_identifier, &org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensorIndexCSF_identifier, &org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensorIndexCSF_type_identifier, &org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensorIndexCSF_type_identifier, &org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table); +} + +static int org_apache_arrow_flatbuf_SparseTensor_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_union_field(td, 1, 1, &org_apache_arrow_flatbuf_Type_union_verifier) /* type */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 2, 1, &org_apache_arrow_flatbuf_TensorDim_verify_table) /* shape */)) return ret; + if ((ret = flatcc_verify_field(td, 3, 8, 8) /* non_zero_length */)) return ret; + if ((ret = flatcc_verify_union_field(td, 5, 1, &org_apache_arrow_flatbuf_SparseTensorIndex_union_verifier) /* sparseIndex */)) return ret; + if ((ret = flatcc_verify_field(td, 6, 16, 8) /* data */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_SparseTensor_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensor_identifier, &org_apache_arrow_flatbuf_SparseTensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensor_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensor_identifier, &org_apache_arrow_flatbuf_SparseTensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensor_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensor_type_identifier, &org_apache_arrow_flatbuf_SparseTensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensor_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensor_type_identifier, &org_apache_arrow_flatbuf_SparseTensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensor_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_SparseTensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensor_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_SparseTensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensor_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_SparseTensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensor_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_SparseTensor_verify_table); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* SPARSETENSOR_VERIFIER_H */ +#ifndef MESSAGE_READER_H +#define MESSAGE_READER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef FLATBUFFERS_COMMON_READER_H +#include "flatbuffers_common_reader.h" +#endif +#ifndef TENSOR_READER_H +#include "Tensor_reader.h" +#endif +#ifndef SPARSETENSOR_READER_H +#include "SparseTensor_reader.h" +#endif +#ifndef SCHEMA_READER_H +#include "Schema_reader.h" +#endif +#include "flatcc/flatcc_flatbuffers.h" +#ifndef __alignas_is_defined +#include +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + +typedef struct org_apache_arrow_flatbuf_FieldNode org_apache_arrow_flatbuf_FieldNode_t; +typedef const org_apache_arrow_flatbuf_FieldNode_t *org_apache_arrow_flatbuf_FieldNode_struct_t; +typedef org_apache_arrow_flatbuf_FieldNode_t *org_apache_arrow_flatbuf_FieldNode_mutable_struct_t; +typedef const org_apache_arrow_flatbuf_FieldNode_t *org_apache_arrow_flatbuf_FieldNode_vec_t; +typedef org_apache_arrow_flatbuf_FieldNode_t *org_apache_arrow_flatbuf_FieldNode_mutable_vec_t; + +typedef const struct org_apache_arrow_flatbuf_BodyCompression_table *org_apache_arrow_flatbuf_BodyCompression_table_t; +typedef struct org_apache_arrow_flatbuf_BodyCompression_table *org_apache_arrow_flatbuf_BodyCompression_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_BodyCompression_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_BodyCompression_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_RecordBatch_table *org_apache_arrow_flatbuf_RecordBatch_table_t; +typedef struct org_apache_arrow_flatbuf_RecordBatch_table *org_apache_arrow_flatbuf_RecordBatch_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_RecordBatch_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_RecordBatch_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_DictionaryBatch_table *org_apache_arrow_flatbuf_DictionaryBatch_table_t; +typedef struct org_apache_arrow_flatbuf_DictionaryBatch_table *org_apache_arrow_flatbuf_DictionaryBatch_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_DictionaryBatch_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_DictionaryBatch_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Message_table *org_apache_arrow_flatbuf_Message_table_t; +typedef struct org_apache_arrow_flatbuf_Message_table *org_apache_arrow_flatbuf_Message_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Message_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Message_mutable_vec_t; +#ifndef org_apache_arrow_flatbuf_FieldNode_file_identifier +#define org_apache_arrow_flatbuf_FieldNode_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_FieldNode_file_identifier */ +#ifndef org_apache_arrow_flatbuf_FieldNode_identifier +#define org_apache_arrow_flatbuf_FieldNode_identifier 0 +#endif +#define org_apache_arrow_flatbuf_FieldNode_type_hash ((flatbuffers_thash_t)0x931857b8) +#define org_apache_arrow_flatbuf_FieldNode_type_identifier "\xb8\x57\x18\x93" +#ifndef org_apache_arrow_flatbuf_FieldNode_file_extension +#define org_apache_arrow_flatbuf_FieldNode_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_BodyCompression_file_identifier +#define org_apache_arrow_flatbuf_BodyCompression_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_BodyCompression_file_identifier */ +#ifndef org_apache_arrow_flatbuf_BodyCompression_identifier +#define org_apache_arrow_flatbuf_BodyCompression_identifier 0 +#endif +#define org_apache_arrow_flatbuf_BodyCompression_type_hash ((flatbuffers_thash_t)0xbc821116) +#define org_apache_arrow_flatbuf_BodyCompression_type_identifier "\x16\x11\x82\xbc" +#ifndef org_apache_arrow_flatbuf_BodyCompression_file_extension +#define org_apache_arrow_flatbuf_BodyCompression_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_RecordBatch_file_identifier +#define org_apache_arrow_flatbuf_RecordBatch_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_RecordBatch_file_identifier */ +#ifndef org_apache_arrow_flatbuf_RecordBatch_identifier +#define org_apache_arrow_flatbuf_RecordBatch_identifier 0 +#endif +#define org_apache_arrow_flatbuf_RecordBatch_type_hash ((flatbuffers_thash_t)0x43c558b) +#define org_apache_arrow_flatbuf_RecordBatch_type_identifier "\x8b\x55\x3c\x04" +#ifndef org_apache_arrow_flatbuf_RecordBatch_file_extension +#define org_apache_arrow_flatbuf_RecordBatch_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_DictionaryBatch_file_identifier +#define org_apache_arrow_flatbuf_DictionaryBatch_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_DictionaryBatch_file_identifier */ +#ifndef org_apache_arrow_flatbuf_DictionaryBatch_identifier +#define org_apache_arrow_flatbuf_DictionaryBatch_identifier 0 +#endif +#define org_apache_arrow_flatbuf_DictionaryBatch_type_hash ((flatbuffers_thash_t)0x5c6da7bc) +#define org_apache_arrow_flatbuf_DictionaryBatch_type_identifier "\xbc\xa7\x6d\x5c" +#ifndef org_apache_arrow_flatbuf_DictionaryBatch_file_extension +#define org_apache_arrow_flatbuf_DictionaryBatch_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Message_file_identifier +#define org_apache_arrow_flatbuf_Message_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Message_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Message_identifier +#define org_apache_arrow_flatbuf_Message_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Message_type_hash ((flatbuffers_thash_t)0xc3efd227) +#define org_apache_arrow_flatbuf_Message_type_identifier "\x27\xd2\xef\xc3" +#ifndef org_apache_arrow_flatbuf_Message_file_extension +#define org_apache_arrow_flatbuf_Message_file_extension "bin" +#endif + +typedef int8_t org_apache_arrow_flatbuf_CompressionType_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_CompressionType, org_apache_arrow_flatbuf_CompressionType_enum_t, 8) +#define org_apache_arrow_flatbuf_CompressionType_LZ4_FRAME ((org_apache_arrow_flatbuf_CompressionType_enum_t)INT8_C(0)) +#define org_apache_arrow_flatbuf_CompressionType_ZSTD ((org_apache_arrow_flatbuf_CompressionType_enum_t)INT8_C(1)) + +static inline const char *org_apache_arrow_flatbuf_CompressionType_name(org_apache_arrow_flatbuf_CompressionType_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_CompressionType_LZ4_FRAME: return "LZ4_FRAME"; + case org_apache_arrow_flatbuf_CompressionType_ZSTD: return "ZSTD"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_CompressionType_is_known_value(org_apache_arrow_flatbuf_CompressionType_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_CompressionType_LZ4_FRAME: return 1; + case org_apache_arrow_flatbuf_CompressionType_ZSTD: return 1; + default: return 0; + } +} + +/** 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 */ +typedef int8_t org_apache_arrow_flatbuf_BodyCompressionMethod_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_BodyCompressionMethod, org_apache_arrow_flatbuf_BodyCompressionMethod_enum_t, 8) +/** 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. */ +#define org_apache_arrow_flatbuf_BodyCompressionMethod_BUFFER ((org_apache_arrow_flatbuf_BodyCompressionMethod_enum_t)INT8_C(0)) + +static inline const char *org_apache_arrow_flatbuf_BodyCompressionMethod_name(org_apache_arrow_flatbuf_BodyCompressionMethod_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_BodyCompressionMethod_BUFFER: return "BUFFER"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_BodyCompressionMethod_is_known_value(org_apache_arrow_flatbuf_BodyCompressionMethod_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_BodyCompressionMethod_BUFFER: return 1; + default: return 0; + } +} + + +/** ---------------------------------------------------------------------- + * 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 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 */ +struct org_apache_arrow_flatbuf_FieldNode { + /** The number of value slots in the Arrow array at this level of a nested + * tree */ + alignas(8) int64_t 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. */ + alignas(8) int64_t null_count; +}; +static_assert(sizeof(org_apache_arrow_flatbuf_FieldNode_t) == 16, "struct size mismatch"); + +static inline const org_apache_arrow_flatbuf_FieldNode_t *org_apache_arrow_flatbuf_FieldNode__const_ptr_add(const org_apache_arrow_flatbuf_FieldNode_t *p, size_t i) { return p + i; } +static inline org_apache_arrow_flatbuf_FieldNode_t *org_apache_arrow_flatbuf_FieldNode__ptr_add(org_apache_arrow_flatbuf_FieldNode_t *p, size_t i) { return p + i; } +static inline org_apache_arrow_flatbuf_FieldNode_struct_t org_apache_arrow_flatbuf_FieldNode_vec_at(org_apache_arrow_flatbuf_FieldNode_vec_t vec, size_t i) +__flatbuffers_struct_vec_at(vec, i) +static inline size_t org_apache_arrow_flatbuf_FieldNode__size(void) { return 16; } +static inline size_t org_apache_arrow_flatbuf_FieldNode_vec_len(org_apache_arrow_flatbuf_FieldNode_vec_t vec) +__flatbuffers_vec_len(vec) +__flatbuffers_struct_as_root(org_apache_arrow_flatbuf_FieldNode) + +__flatbuffers_define_struct_scalar_field(org_apache_arrow_flatbuf_FieldNode, length, flatbuffers_int64, int64_t) +__flatbuffers_define_struct_scalar_field(org_apache_arrow_flatbuf_FieldNode, null_count, flatbuffers_int64, int64_t) + + +/** Optional compression for the memory buffers constituting IPC message + * bodies. Intended for use with RecordBatch but could be used for other + * message types */ +struct org_apache_arrow_flatbuf_BodyCompression_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_BodyCompression_vec_len(org_apache_arrow_flatbuf_BodyCompression_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_BodyCompression_table_t org_apache_arrow_flatbuf_BodyCompression_vec_at(org_apache_arrow_flatbuf_BodyCompression_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_BodyCompression_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_BodyCompression) + +/** Compressor library. + * For LZ4_FRAME, each compressed buffer must consist of a single frame. */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_BodyCompression, codec, org_apache_arrow_flatbuf_CompressionType, org_apache_arrow_flatbuf_CompressionType_enum_t, INT8_C(0)) +/** Indicates the way the record batch body was compressed */ +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_BodyCompression, method, org_apache_arrow_flatbuf_BodyCompressionMethod, org_apache_arrow_flatbuf_BodyCompressionMethod_enum_t, INT8_C(0)) + +/** 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 org_apache_arrow_flatbuf_RecordBatch_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_RecordBatch_vec_len(org_apache_arrow_flatbuf_RecordBatch_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_RecordBatch_table_t org_apache_arrow_flatbuf_RecordBatch_vec_at(org_apache_arrow_flatbuf_RecordBatch_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_RecordBatch_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_RecordBatch) + +/** number of records / rows. The arrays in the batch should all have this + * length */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_RecordBatch, length, flatbuffers_int64, int64_t, INT64_C(0)) +/** Nodes correspond to the pre-ordered flattened logical schema */ +__flatbuffers_define_vector_field(1, org_apache_arrow_flatbuf_RecordBatch, nodes, org_apache_arrow_flatbuf_FieldNode_vec_t, 0) +/** 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 */ +__flatbuffers_define_vector_field(2, org_apache_arrow_flatbuf_RecordBatch, buffers, org_apache_arrow_flatbuf_Buffer_vec_t, 0) +/** Optional compression of the message body */ +__flatbuffers_define_table_field(3, org_apache_arrow_flatbuf_RecordBatch, compression, org_apache_arrow_flatbuf_BodyCompression_table_t, 0) +/** Some types such as Utf8View are represented using a variable number of buffers. + * For each such Field in the pre-ordered flattened logical schema, there will be + * an entry in variadicBufferCounts to indicate the number of number of variadic + * buffers which belong to that Field in the current RecordBatch. + * + * For example, the schema + * col1: Struct + * col2: Utf8View + * contains two Fields with variadic buffers so variadicBufferCounts will have + * two entries, the first counting the variadic buffers of `col1.beta` and the + * second counting `col2`'s. + * + * This field may be omitted if and only if the schema contains no Fields with + * a variable number of buffers, such as BinaryView and Utf8View. */ +__flatbuffers_define_vector_field(4, org_apache_arrow_flatbuf_RecordBatch, variadicBufferCounts, flatbuffers_int64_vec_t, 0) + +/** 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 org_apache_arrow_flatbuf_DictionaryBatch_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_DictionaryBatch_vec_len(org_apache_arrow_flatbuf_DictionaryBatch_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_DictionaryBatch_table_t org_apache_arrow_flatbuf_DictionaryBatch_vec_at(org_apache_arrow_flatbuf_DictionaryBatch_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_DictionaryBatch_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_DictionaryBatch) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_DictionaryBatch, id, flatbuffers_int64, int64_t, INT64_C(0)) +__flatbuffers_define_table_field(1, org_apache_arrow_flatbuf_DictionaryBatch, data, org_apache_arrow_flatbuf_RecordBatch_table_t, 0) +/** 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. */ +__flatbuffers_define_scalar_field(2, org_apache_arrow_flatbuf_DictionaryBatch, isDelta, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) +/** ---------------------------------------------------------------------- + * 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 */ +typedef uint8_t org_apache_arrow_flatbuf_MessageHeader_union_type_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_MessageHeader, org_apache_arrow_flatbuf_MessageHeader_union_type_t, 8) +__flatbuffers_define_union(flatbuffers_, org_apache_arrow_flatbuf_MessageHeader) +#define org_apache_arrow_flatbuf_MessageHeader_NONE ((org_apache_arrow_flatbuf_MessageHeader_union_type_t)UINT8_C(0)) +#define org_apache_arrow_flatbuf_MessageHeader_Schema ((org_apache_arrow_flatbuf_MessageHeader_union_type_t)UINT8_C(1)) +#define org_apache_arrow_flatbuf_MessageHeader_DictionaryBatch ((org_apache_arrow_flatbuf_MessageHeader_union_type_t)UINT8_C(2)) +#define org_apache_arrow_flatbuf_MessageHeader_RecordBatch ((org_apache_arrow_flatbuf_MessageHeader_union_type_t)UINT8_C(3)) +#define org_apache_arrow_flatbuf_MessageHeader_Tensor ((org_apache_arrow_flatbuf_MessageHeader_union_type_t)UINT8_C(4)) +#define org_apache_arrow_flatbuf_MessageHeader_SparseTensor ((org_apache_arrow_flatbuf_MessageHeader_union_type_t)UINT8_C(5)) + +static inline const char *org_apache_arrow_flatbuf_MessageHeader_type_name(org_apache_arrow_flatbuf_MessageHeader_union_type_t type) +{ + switch (type) { + case org_apache_arrow_flatbuf_MessageHeader_NONE: return "NONE"; + case org_apache_arrow_flatbuf_MessageHeader_Schema: return "Schema"; + case org_apache_arrow_flatbuf_MessageHeader_DictionaryBatch: return "DictionaryBatch"; + case org_apache_arrow_flatbuf_MessageHeader_RecordBatch: return "RecordBatch"; + case org_apache_arrow_flatbuf_MessageHeader_Tensor: return "Tensor"; + case org_apache_arrow_flatbuf_MessageHeader_SparseTensor: return "SparseTensor"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_MessageHeader_is_known_type(org_apache_arrow_flatbuf_MessageHeader_union_type_t type) +{ + switch (type) { + case org_apache_arrow_flatbuf_MessageHeader_NONE: return 1; + case org_apache_arrow_flatbuf_MessageHeader_Schema: return 1; + case org_apache_arrow_flatbuf_MessageHeader_DictionaryBatch: return 1; + case org_apache_arrow_flatbuf_MessageHeader_RecordBatch: return 1; + case org_apache_arrow_flatbuf_MessageHeader_Tensor: return 1; + case org_apache_arrow_flatbuf_MessageHeader_SparseTensor: return 1; + default: return 0; + } +} + + +struct org_apache_arrow_flatbuf_Message_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Message_vec_len(org_apache_arrow_flatbuf_Message_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Message_table_t org_apache_arrow_flatbuf_Message_vec_at(org_apache_arrow_flatbuf_Message_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Message_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Message) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Message, version, org_apache_arrow_flatbuf_MetadataVersion, org_apache_arrow_flatbuf_MetadataVersion_enum_t, INT16_C(0)) +__flatbuffers_define_union_field(flatbuffers_, 2, org_apache_arrow_flatbuf_Message, header, org_apache_arrow_flatbuf_MessageHeader, 0) +__flatbuffers_define_scalar_field(3, org_apache_arrow_flatbuf_Message, bodyLength, flatbuffers_int64, int64_t, INT64_C(0)) +__flatbuffers_define_vector_field(4, org_apache_arrow_flatbuf_Message, custom_metadata, org_apache_arrow_flatbuf_KeyValue_vec_t, 0) + + +#include "flatcc/flatcc_epilogue.h" +#endif /* MESSAGE_READER_H */ +#ifndef MESSAGE_BUILDER_H +#define MESSAGE_BUILDER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef MESSAGE_READER_H +#include "Message_reader.h" +#endif +#ifndef FLATBUFFERS_COMMON_BUILDER_H +#include "flatbuffers_common_builder.h" +#endif +#ifndef TENSOR_BUILDER_H +#include "Tensor_builder.h" +#endif +#ifndef SPARSETENSOR_BUILDER_H +#include "SparseTensor_builder.h" +#endif +#ifndef SCHEMA_BUILDER_H +#include "Schema_builder.h" +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + +#define __org_apache_arrow_flatbuf_CompressionType_formal_args , org_apache_arrow_flatbuf_CompressionType_enum_t v0 +#define __org_apache_arrow_flatbuf_CompressionType_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_CompressionType, org_apache_arrow_flatbuf_CompressionType_enum_t) +#define __org_apache_arrow_flatbuf_BodyCompressionMethod_formal_args , org_apache_arrow_flatbuf_BodyCompressionMethod_enum_t v0 +#define __org_apache_arrow_flatbuf_BodyCompressionMethod_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_BodyCompressionMethod, org_apache_arrow_flatbuf_BodyCompressionMethod_enum_t) + +#define __org_apache_arrow_flatbuf_FieldNode_formal_args , int64_t v0, int64_t v1 +#define __org_apache_arrow_flatbuf_FieldNode_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_FieldNode_t *org_apache_arrow_flatbuf_FieldNode_assign(org_apache_arrow_flatbuf_FieldNode_t *p, int64_t v0, int64_t v1) +{ p->length = v0; p->null_count = v1; + return p; } +static inline org_apache_arrow_flatbuf_FieldNode_t *org_apache_arrow_flatbuf_FieldNode_copy(org_apache_arrow_flatbuf_FieldNode_t *p, const org_apache_arrow_flatbuf_FieldNode_t *p2) +{ p->length = p2->length; p->null_count = p2->null_count; + return p; } +static inline org_apache_arrow_flatbuf_FieldNode_t *org_apache_arrow_flatbuf_FieldNode_assign_to_pe(org_apache_arrow_flatbuf_FieldNode_t *p, int64_t v0, int64_t v1) +{ flatbuffers_int64_assign_to_pe(&p->length, v0); flatbuffers_int64_assign_to_pe(&p->null_count, v1); + return p; } +static inline org_apache_arrow_flatbuf_FieldNode_t *org_apache_arrow_flatbuf_FieldNode_copy_to_pe(org_apache_arrow_flatbuf_FieldNode_t *p, const org_apache_arrow_flatbuf_FieldNode_t *p2) +{ flatbuffers_int64_copy_to_pe(&p->length, &p2->length); flatbuffers_int64_copy_to_pe(&p->null_count, &p2->null_count); + return p; } +static inline org_apache_arrow_flatbuf_FieldNode_t *org_apache_arrow_flatbuf_FieldNode_assign_from_pe(org_apache_arrow_flatbuf_FieldNode_t *p, int64_t v0, int64_t v1) +{ flatbuffers_int64_assign_from_pe(&p->length, v0); flatbuffers_int64_assign_from_pe(&p->null_count, v1); + return p; } +static inline org_apache_arrow_flatbuf_FieldNode_t *org_apache_arrow_flatbuf_FieldNode_copy_from_pe(org_apache_arrow_flatbuf_FieldNode_t *p, const org_apache_arrow_flatbuf_FieldNode_t *p2) +{ flatbuffers_int64_copy_from_pe(&p->length, &p2->length); flatbuffers_int64_copy_from_pe(&p->null_count, &p2->null_count); + return p; } +__flatbuffers_build_struct(flatbuffers_, org_apache_arrow_flatbuf_FieldNode, 16, 8, org_apache_arrow_flatbuf_FieldNode_file_identifier, org_apache_arrow_flatbuf_FieldNode_type_identifier) +__flatbuffers_define_fixed_array_primitives(flatbuffers_, org_apache_arrow_flatbuf_FieldNode, org_apache_arrow_flatbuf_FieldNode_t) + +typedef flatbuffers_union_ref_t org_apache_arrow_flatbuf_MessageHeader_union_ref_t; +typedef flatbuffers_union_vec_ref_t org_apache_arrow_flatbuf_MessageHeader_union_vec_ref_t; +static org_apache_arrow_flatbuf_MessageHeader_union_ref_t org_apache_arrow_flatbuf_MessageHeader_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_MessageHeader_union_t t); + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_BodyCompression_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_BodyCompression_ref_t; +static org_apache_arrow_flatbuf_BodyCompression_ref_t org_apache_arrow_flatbuf_BodyCompression_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_BodyCompression_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_BodyCompression, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_RecordBatch_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_RecordBatch_ref_t; +static org_apache_arrow_flatbuf_RecordBatch_ref_t org_apache_arrow_flatbuf_RecordBatch_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_RecordBatch_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_RecordBatch, 5) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_DictionaryBatch_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_DictionaryBatch_ref_t; +static org_apache_arrow_flatbuf_DictionaryBatch_ref_t org_apache_arrow_flatbuf_DictionaryBatch_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_DictionaryBatch_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_DictionaryBatch, 3) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Message_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Message_ref_t; +static org_apache_arrow_flatbuf_Message_ref_t org_apache_arrow_flatbuf_Message_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Message_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Message, 5) + +#define __org_apache_arrow_flatbuf_BodyCompression_formal_args , org_apache_arrow_flatbuf_CompressionType_enum_t v0, org_apache_arrow_flatbuf_BodyCompressionMethod_enum_t v1 +#define __org_apache_arrow_flatbuf_BodyCompression_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_BodyCompression_ref_t org_apache_arrow_flatbuf_BodyCompression_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_BodyCompression_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_BodyCompression, org_apache_arrow_flatbuf_BodyCompression_file_identifier, org_apache_arrow_flatbuf_BodyCompression_type_identifier) + +#define __org_apache_arrow_flatbuf_RecordBatch_formal_args ,\ + int64_t v0, org_apache_arrow_flatbuf_FieldNode_vec_ref_t v1, org_apache_arrow_flatbuf_Buffer_vec_ref_t v2, org_apache_arrow_flatbuf_BodyCompression_ref_t v3, flatbuffers_int64_vec_ref_t v4 +#define __org_apache_arrow_flatbuf_RecordBatch_call_args ,\ + v0, v1, v2, v3, v4 +static inline org_apache_arrow_flatbuf_RecordBatch_ref_t org_apache_arrow_flatbuf_RecordBatch_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_RecordBatch_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_RecordBatch, org_apache_arrow_flatbuf_RecordBatch_file_identifier, org_apache_arrow_flatbuf_RecordBatch_type_identifier) + +#define __org_apache_arrow_flatbuf_DictionaryBatch_formal_args , int64_t v0, org_apache_arrow_flatbuf_RecordBatch_ref_t v1, flatbuffers_bool_t v2 +#define __org_apache_arrow_flatbuf_DictionaryBatch_call_args , v0, v1, v2 +static inline org_apache_arrow_flatbuf_DictionaryBatch_ref_t org_apache_arrow_flatbuf_DictionaryBatch_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_DictionaryBatch_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_DictionaryBatch, org_apache_arrow_flatbuf_DictionaryBatch_file_identifier, org_apache_arrow_flatbuf_DictionaryBatch_type_identifier) + +#define __org_apache_arrow_flatbuf_Message_formal_args , org_apache_arrow_flatbuf_MetadataVersion_enum_t v0, org_apache_arrow_flatbuf_MessageHeader_union_ref_t v2, int64_t v3, org_apache_arrow_flatbuf_KeyValue_vec_ref_t v4 +#define __org_apache_arrow_flatbuf_Message_call_args , v0, v2, v3, v4 +static inline org_apache_arrow_flatbuf_Message_ref_t org_apache_arrow_flatbuf_Message_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Message_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Message, org_apache_arrow_flatbuf_Message_file_identifier, org_apache_arrow_flatbuf_Message_type_identifier) + +static inline org_apache_arrow_flatbuf_MessageHeader_union_ref_t org_apache_arrow_flatbuf_MessageHeader_as_NONE(void) +{ org_apache_arrow_flatbuf_MessageHeader_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_MessageHeader_NONE; uref.value = 0; return uref; } +static inline org_apache_arrow_flatbuf_MessageHeader_union_ref_t org_apache_arrow_flatbuf_MessageHeader_as_Schema(org_apache_arrow_flatbuf_Schema_ref_t ref) +{ org_apache_arrow_flatbuf_MessageHeader_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_MessageHeader_Schema; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_MessageHeader_union_ref_t org_apache_arrow_flatbuf_MessageHeader_as_DictionaryBatch(org_apache_arrow_flatbuf_DictionaryBatch_ref_t ref) +{ org_apache_arrow_flatbuf_MessageHeader_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_MessageHeader_DictionaryBatch; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_MessageHeader_union_ref_t org_apache_arrow_flatbuf_MessageHeader_as_RecordBatch(org_apache_arrow_flatbuf_RecordBatch_ref_t ref) +{ org_apache_arrow_flatbuf_MessageHeader_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_MessageHeader_RecordBatch; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_MessageHeader_union_ref_t org_apache_arrow_flatbuf_MessageHeader_as_Tensor(org_apache_arrow_flatbuf_Tensor_ref_t ref) +{ org_apache_arrow_flatbuf_MessageHeader_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_MessageHeader_Tensor; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_MessageHeader_union_ref_t org_apache_arrow_flatbuf_MessageHeader_as_SparseTensor(org_apache_arrow_flatbuf_SparseTensor_ref_t ref) +{ org_apache_arrow_flatbuf_MessageHeader_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_MessageHeader_SparseTensor; uref.value = ref; return uref; } +__flatbuffers_build_union_vector(flatbuffers_, org_apache_arrow_flatbuf_MessageHeader) + +static org_apache_arrow_flatbuf_MessageHeader_union_ref_t org_apache_arrow_flatbuf_MessageHeader_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_MessageHeader_union_t u) +{ + switch (u.type) { + case 1: return org_apache_arrow_flatbuf_MessageHeader_as_Schema(org_apache_arrow_flatbuf_Schema_clone(B, (org_apache_arrow_flatbuf_Schema_table_t)u.value)); + case 2: return org_apache_arrow_flatbuf_MessageHeader_as_DictionaryBatch(org_apache_arrow_flatbuf_DictionaryBatch_clone(B, (org_apache_arrow_flatbuf_DictionaryBatch_table_t)u.value)); + case 3: return org_apache_arrow_flatbuf_MessageHeader_as_RecordBatch(org_apache_arrow_flatbuf_RecordBatch_clone(B, (org_apache_arrow_flatbuf_RecordBatch_table_t)u.value)); + case 4: return org_apache_arrow_flatbuf_MessageHeader_as_Tensor(org_apache_arrow_flatbuf_Tensor_clone(B, (org_apache_arrow_flatbuf_Tensor_table_t)u.value)); + case 5: return org_apache_arrow_flatbuf_MessageHeader_as_SparseTensor(org_apache_arrow_flatbuf_SparseTensor_clone(B, (org_apache_arrow_flatbuf_SparseTensor_table_t)u.value)); + default: return org_apache_arrow_flatbuf_MessageHeader_as_NONE(); + } +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_BodyCompression_codec, org_apache_arrow_flatbuf_CompressionType, org_apache_arrow_flatbuf_CompressionType_enum_t, 1, 1, INT8_C(0), org_apache_arrow_flatbuf_BodyCompression) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_BodyCompression_method, org_apache_arrow_flatbuf_BodyCompressionMethod, org_apache_arrow_flatbuf_BodyCompressionMethod_enum_t, 1, 1, INT8_C(0), org_apache_arrow_flatbuf_BodyCompression) + +static inline org_apache_arrow_flatbuf_BodyCompression_ref_t org_apache_arrow_flatbuf_BodyCompression_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_BodyCompression_formal_args) +{ + if (org_apache_arrow_flatbuf_BodyCompression_start(B) + || org_apache_arrow_flatbuf_BodyCompression_codec_add(B, v0) + || org_apache_arrow_flatbuf_BodyCompression_method_add(B, v1)) { + return 0; + } + return org_apache_arrow_flatbuf_BodyCompression_end(B); +} + +static org_apache_arrow_flatbuf_BodyCompression_ref_t org_apache_arrow_flatbuf_BodyCompression_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_BodyCompression_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_BodyCompression_start(B) + || org_apache_arrow_flatbuf_BodyCompression_codec_pick(B, t) + || org_apache_arrow_flatbuf_BodyCompression_method_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_BodyCompression_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_RecordBatch_length, flatbuffers_int64, int64_t, 8, 8, INT64_C(0), org_apache_arrow_flatbuf_RecordBatch) +__flatbuffers_build_vector_field(1, flatbuffers_, org_apache_arrow_flatbuf_RecordBatch_nodes, org_apache_arrow_flatbuf_FieldNode, org_apache_arrow_flatbuf_FieldNode_t, org_apache_arrow_flatbuf_RecordBatch) +__flatbuffers_build_vector_field(2, flatbuffers_, org_apache_arrow_flatbuf_RecordBatch_buffers, org_apache_arrow_flatbuf_Buffer, org_apache_arrow_flatbuf_Buffer_t, org_apache_arrow_flatbuf_RecordBatch) +__flatbuffers_build_table_field(3, flatbuffers_, org_apache_arrow_flatbuf_RecordBatch_compression, org_apache_arrow_flatbuf_BodyCompression, org_apache_arrow_flatbuf_RecordBatch) +__flatbuffers_build_vector_field(4, flatbuffers_, org_apache_arrow_flatbuf_RecordBatch_variadicBufferCounts, flatbuffers_int64, int64_t, org_apache_arrow_flatbuf_RecordBatch) + +static inline org_apache_arrow_flatbuf_RecordBatch_ref_t org_apache_arrow_flatbuf_RecordBatch_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_RecordBatch_formal_args) +{ + if (org_apache_arrow_flatbuf_RecordBatch_start(B) + || org_apache_arrow_flatbuf_RecordBatch_length_add(B, v0) + || org_apache_arrow_flatbuf_RecordBatch_nodes_add(B, v1) + || org_apache_arrow_flatbuf_RecordBatch_buffers_add(B, v2) + || org_apache_arrow_flatbuf_RecordBatch_compression_add(B, v3) + || org_apache_arrow_flatbuf_RecordBatch_variadicBufferCounts_add(B, v4)) { + return 0; + } + return org_apache_arrow_flatbuf_RecordBatch_end(B); +} + +static org_apache_arrow_flatbuf_RecordBatch_ref_t org_apache_arrow_flatbuf_RecordBatch_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_RecordBatch_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_RecordBatch_start(B) + || org_apache_arrow_flatbuf_RecordBatch_length_pick(B, t) + || org_apache_arrow_flatbuf_RecordBatch_nodes_pick(B, t) + || org_apache_arrow_flatbuf_RecordBatch_buffers_pick(B, t) + || org_apache_arrow_flatbuf_RecordBatch_compression_pick(B, t) + || org_apache_arrow_flatbuf_RecordBatch_variadicBufferCounts_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_RecordBatch_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_DictionaryBatch_id, flatbuffers_int64, int64_t, 8, 8, INT64_C(0), org_apache_arrow_flatbuf_DictionaryBatch) +__flatbuffers_build_table_field(1, flatbuffers_, org_apache_arrow_flatbuf_DictionaryBatch_data, org_apache_arrow_flatbuf_RecordBatch, org_apache_arrow_flatbuf_DictionaryBatch) +__flatbuffers_build_scalar_field(2, flatbuffers_, org_apache_arrow_flatbuf_DictionaryBatch_isDelta, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_DictionaryBatch) + +static inline org_apache_arrow_flatbuf_DictionaryBatch_ref_t org_apache_arrow_flatbuf_DictionaryBatch_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_DictionaryBatch_formal_args) +{ + if (org_apache_arrow_flatbuf_DictionaryBatch_start(B) + || org_apache_arrow_flatbuf_DictionaryBatch_id_add(B, v0) + || org_apache_arrow_flatbuf_DictionaryBatch_data_add(B, v1) + || org_apache_arrow_flatbuf_DictionaryBatch_isDelta_add(B, v2)) { + return 0; + } + return org_apache_arrow_flatbuf_DictionaryBatch_end(B); +} + +static org_apache_arrow_flatbuf_DictionaryBatch_ref_t org_apache_arrow_flatbuf_DictionaryBatch_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_DictionaryBatch_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_DictionaryBatch_start(B) + || org_apache_arrow_flatbuf_DictionaryBatch_id_pick(B, t) + || org_apache_arrow_flatbuf_DictionaryBatch_data_pick(B, t) + || org_apache_arrow_flatbuf_DictionaryBatch_isDelta_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_DictionaryBatch_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Message_version, org_apache_arrow_flatbuf_MetadataVersion, org_apache_arrow_flatbuf_MetadataVersion_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Message) +__flatbuffers_build_union_field(2, flatbuffers_, org_apache_arrow_flatbuf_Message_header, org_apache_arrow_flatbuf_MessageHeader, org_apache_arrow_flatbuf_Message) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Message_header, org_apache_arrow_flatbuf_MessageHeader, Schema, org_apache_arrow_flatbuf_Schema) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Message_header, org_apache_arrow_flatbuf_MessageHeader, DictionaryBatch, org_apache_arrow_flatbuf_DictionaryBatch) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Message_header, org_apache_arrow_flatbuf_MessageHeader, RecordBatch, org_apache_arrow_flatbuf_RecordBatch) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Message_header, org_apache_arrow_flatbuf_MessageHeader, Tensor, org_apache_arrow_flatbuf_Tensor) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Message_header, org_apache_arrow_flatbuf_MessageHeader, SparseTensor, org_apache_arrow_flatbuf_SparseTensor) +__flatbuffers_build_scalar_field(3, flatbuffers_, org_apache_arrow_flatbuf_Message_bodyLength, flatbuffers_int64, int64_t, 8, 8, INT64_C(0), org_apache_arrow_flatbuf_Message) +__flatbuffers_build_table_vector_field(4, flatbuffers_, org_apache_arrow_flatbuf_Message_custom_metadata, org_apache_arrow_flatbuf_KeyValue, org_apache_arrow_flatbuf_Message) + +static inline org_apache_arrow_flatbuf_Message_ref_t org_apache_arrow_flatbuf_Message_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Message_formal_args) +{ + if (org_apache_arrow_flatbuf_Message_start(B) + || org_apache_arrow_flatbuf_Message_bodyLength_add(B, v3) + || org_apache_arrow_flatbuf_Message_header_add_value(B, v2) + || org_apache_arrow_flatbuf_Message_custom_metadata_add(B, v4) + || org_apache_arrow_flatbuf_Message_version_add(B, v0) + || org_apache_arrow_flatbuf_Message_header_add_type(B, v2.type)) { + return 0; + } + return org_apache_arrow_flatbuf_Message_end(B); +} + +static org_apache_arrow_flatbuf_Message_ref_t org_apache_arrow_flatbuf_Message_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Message_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Message_start(B) + || org_apache_arrow_flatbuf_Message_bodyLength_pick(B, t) + || org_apache_arrow_flatbuf_Message_header_pick(B, t) + || org_apache_arrow_flatbuf_Message_custom_metadata_pick(B, t) + || org_apache_arrow_flatbuf_Message_version_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Message_end(B)); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* MESSAGE_BUILDER_H */ +#ifndef MESSAGE_VERIFIER_H +#define MESSAGE_VERIFIER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef MESSAGE_READER_H +#include "Message_reader.h" +#endif +#include "flatcc/flatcc_verifier.h" +#ifndef TENSOR_VERIFIER_H +#include "Tensor_verifier.h" +#endif +#ifndef SPARSETENSOR_VERIFIER_H +#include "SparseTensor_verifier.h" +#endif +#ifndef SCHEMA_VERIFIER_H +#include "Schema_verifier.h" +#endif +#include "flatcc/flatcc_prologue.h" + +static int org_apache_arrow_flatbuf_BodyCompression_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_RecordBatch_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_DictionaryBatch_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Message_verify_table(flatcc_table_verifier_descriptor_t *td); + +static int org_apache_arrow_flatbuf_MessageHeader_union_verifier(flatcc_union_verifier_descriptor_t *ud) +{ + switch (ud->type) { + case 1: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Schema_verify_table); /* Schema */ + case 2: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_DictionaryBatch_verify_table); /* DictionaryBatch */ + case 3: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_RecordBatch_verify_table); /* RecordBatch */ + case 4: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Tensor_verify_table); /* Tensor */ + case 5: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_SparseTensor_verify_table); /* SparseTensor */ + default: return flatcc_verify_ok; + } +} + +static inline int org_apache_arrow_flatbuf_FieldNode_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FieldNode_identifier, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_FieldNode_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FieldNode_identifier, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_FieldNode_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_typed_root(buf, bufsiz, org_apache_arrow_flatbuf_FieldNode_type_hash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_FieldNode_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_typed_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FieldNode_type_hash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_FieldNode_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_struct_as_typed_root(buf, bufsiz, thash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_FieldNode_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_struct_as_typed_root_with_size(buf, bufsiz, thash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_FieldNode_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_struct_as_root(buf, bufsiz, fid, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_FieldNode_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_struct_as_root_with_size(buf, bufsiz, fid, 16, 8); +} + +static int org_apache_arrow_flatbuf_BodyCompression_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 1, 1) /* codec */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 1, 1) /* method */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_BodyCompression_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_BodyCompression_identifier, &org_apache_arrow_flatbuf_BodyCompression_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BodyCompression_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_BodyCompression_identifier, &org_apache_arrow_flatbuf_BodyCompression_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BodyCompression_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_BodyCompression_type_identifier, &org_apache_arrow_flatbuf_BodyCompression_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BodyCompression_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_BodyCompression_type_identifier, &org_apache_arrow_flatbuf_BodyCompression_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BodyCompression_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_BodyCompression_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BodyCompression_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_BodyCompression_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BodyCompression_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_BodyCompression_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BodyCompression_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_BodyCompression_verify_table); +} + +static int org_apache_arrow_flatbuf_RecordBatch_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 8, 8) /* length */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 1, 0, 16, 8, INT64_C(268435455)) /* nodes */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 2, 0, 16, 8, INT64_C(268435455)) /* buffers */)) return ret; + if ((ret = flatcc_verify_table_field(td, 3, 0, &org_apache_arrow_flatbuf_BodyCompression_verify_table) /* compression */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 4, 0, 8, 8, INT64_C(536870911)) /* variadicBufferCounts */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_RecordBatch_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_RecordBatch_identifier, &org_apache_arrow_flatbuf_RecordBatch_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RecordBatch_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_RecordBatch_identifier, &org_apache_arrow_flatbuf_RecordBatch_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RecordBatch_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_RecordBatch_type_identifier, &org_apache_arrow_flatbuf_RecordBatch_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RecordBatch_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_RecordBatch_type_identifier, &org_apache_arrow_flatbuf_RecordBatch_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RecordBatch_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_RecordBatch_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RecordBatch_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_RecordBatch_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RecordBatch_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_RecordBatch_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RecordBatch_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_RecordBatch_verify_table); +} + +static int org_apache_arrow_flatbuf_DictionaryBatch_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 8, 8) /* id */)) return ret; + if ((ret = flatcc_verify_table_field(td, 1, 0, &org_apache_arrow_flatbuf_RecordBatch_verify_table) /* data */)) return ret; + if ((ret = flatcc_verify_field(td, 2, 1, 1) /* isDelta */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_DictionaryBatch_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryBatch_identifier, &org_apache_arrow_flatbuf_DictionaryBatch_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryBatch_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryBatch_identifier, &org_apache_arrow_flatbuf_DictionaryBatch_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryBatch_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryBatch_type_identifier, &org_apache_arrow_flatbuf_DictionaryBatch_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryBatch_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryBatch_type_identifier, &org_apache_arrow_flatbuf_DictionaryBatch_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryBatch_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_DictionaryBatch_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryBatch_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_DictionaryBatch_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryBatch_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_DictionaryBatch_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryBatch_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_DictionaryBatch_verify_table); +} + +static int org_apache_arrow_flatbuf_Message_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* version */)) return ret; + if ((ret = flatcc_verify_union_field(td, 2, 0, &org_apache_arrow_flatbuf_MessageHeader_union_verifier) /* header */)) return ret; + if ((ret = flatcc_verify_field(td, 3, 8, 8) /* bodyLength */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 4, 0, &org_apache_arrow_flatbuf_KeyValue_verify_table) /* custom_metadata */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Message_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Message_identifier, &org_apache_arrow_flatbuf_Message_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Message_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Message_identifier, &org_apache_arrow_flatbuf_Message_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Message_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Message_type_identifier, &org_apache_arrow_flatbuf_Message_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Message_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Message_type_identifier, &org_apache_arrow_flatbuf_Message_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Message_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Message_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Message_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Message_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Message_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Message_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Message_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Message_verify_table); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* MESSAGE_VERIFIER_H */ +#ifndef SCHEMA_READER_H +#define SCHEMA_READER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef FLATBUFFERS_COMMON_READER_H +#include "flatbuffers_common_reader.h" +#endif +#include "flatcc/flatcc_flatbuffers.h" +#ifndef __alignas_is_defined +#include +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + +typedef struct org_apache_arrow_flatbuf_Buffer org_apache_arrow_flatbuf_Buffer_t; +typedef const org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_struct_t; +typedef org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_mutable_struct_t; +typedef const org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_vec_t; +typedef org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_mutable_vec_t; + +typedef const struct org_apache_arrow_flatbuf_Null_table *org_apache_arrow_flatbuf_Null_table_t; +typedef struct org_apache_arrow_flatbuf_Null_table *org_apache_arrow_flatbuf_Null_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Null_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Null_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Struct__table *org_apache_arrow_flatbuf_Struct__table_t; +typedef struct org_apache_arrow_flatbuf_Struct__table *org_apache_arrow_flatbuf_Struct__mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Struct__vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Struct__mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_List_table *org_apache_arrow_flatbuf_List_table_t; +typedef struct org_apache_arrow_flatbuf_List_table *org_apache_arrow_flatbuf_List_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_List_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_List_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeList_table *org_apache_arrow_flatbuf_LargeList_table_t; +typedef struct org_apache_arrow_flatbuf_LargeList_table *org_apache_arrow_flatbuf_LargeList_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeList_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeList_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_ListView_table *org_apache_arrow_flatbuf_ListView_table_t; +typedef struct org_apache_arrow_flatbuf_ListView_table *org_apache_arrow_flatbuf_ListView_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_ListView_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_ListView_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeListView_table *org_apache_arrow_flatbuf_LargeListView_table_t; +typedef struct org_apache_arrow_flatbuf_LargeListView_table *org_apache_arrow_flatbuf_LargeListView_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeListView_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeListView_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_FixedSizeList_table *org_apache_arrow_flatbuf_FixedSizeList_table_t; +typedef struct org_apache_arrow_flatbuf_FixedSizeList_table *org_apache_arrow_flatbuf_FixedSizeList_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeList_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeList_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Map_table *org_apache_arrow_flatbuf_Map_table_t; +typedef struct org_apache_arrow_flatbuf_Map_table *org_apache_arrow_flatbuf_Map_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Map_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Map_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Union_table *org_apache_arrow_flatbuf_Union_table_t; +typedef struct org_apache_arrow_flatbuf_Union_table *org_apache_arrow_flatbuf_Union_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Union_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Union_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Int_table *org_apache_arrow_flatbuf_Int_table_t; +typedef struct org_apache_arrow_flatbuf_Int_table *org_apache_arrow_flatbuf_Int_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Int_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Int_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_FloatingPoint_table *org_apache_arrow_flatbuf_FloatingPoint_table_t; +typedef struct org_apache_arrow_flatbuf_FloatingPoint_table *org_apache_arrow_flatbuf_FloatingPoint_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FloatingPoint_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FloatingPoint_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Utf8_table *org_apache_arrow_flatbuf_Utf8_table_t; +typedef struct org_apache_arrow_flatbuf_Utf8_table *org_apache_arrow_flatbuf_Utf8_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Binary_table *org_apache_arrow_flatbuf_Binary_table_t; +typedef struct org_apache_arrow_flatbuf_Binary_table *org_apache_arrow_flatbuf_Binary_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Binary_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Binary_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeUtf8_table *org_apache_arrow_flatbuf_LargeUtf8_table_t; +typedef struct org_apache_arrow_flatbuf_LargeUtf8_table *org_apache_arrow_flatbuf_LargeUtf8_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeUtf8_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeUtf8_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeBinary_table *org_apache_arrow_flatbuf_LargeBinary_table_t; +typedef struct org_apache_arrow_flatbuf_LargeBinary_table *org_apache_arrow_flatbuf_LargeBinary_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeBinary_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeBinary_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Utf8View_table *org_apache_arrow_flatbuf_Utf8View_table_t; +typedef struct org_apache_arrow_flatbuf_Utf8View_table *org_apache_arrow_flatbuf_Utf8View_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8View_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8View_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_BinaryView_table *org_apache_arrow_flatbuf_BinaryView_table_t; +typedef struct org_apache_arrow_flatbuf_BinaryView_table *org_apache_arrow_flatbuf_BinaryView_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_BinaryView_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_BinaryView_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_FixedSizeBinary_table *org_apache_arrow_flatbuf_FixedSizeBinary_table_t; +typedef struct org_apache_arrow_flatbuf_FixedSizeBinary_table *org_apache_arrow_flatbuf_FixedSizeBinary_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeBinary_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeBinary_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Bool_table *org_apache_arrow_flatbuf_Bool_table_t; +typedef struct org_apache_arrow_flatbuf_Bool_table *org_apache_arrow_flatbuf_Bool_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Bool_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Bool_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_RunEndEncoded_table *org_apache_arrow_flatbuf_RunEndEncoded_table_t; +typedef struct org_apache_arrow_flatbuf_RunEndEncoded_table *org_apache_arrow_flatbuf_RunEndEncoded_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_RunEndEncoded_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_RunEndEncoded_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Decimal_table *org_apache_arrow_flatbuf_Decimal_table_t; +typedef struct org_apache_arrow_flatbuf_Decimal_table *org_apache_arrow_flatbuf_Decimal_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Decimal_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Decimal_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Date_table *org_apache_arrow_flatbuf_Date_table_t; +typedef struct org_apache_arrow_flatbuf_Date_table *org_apache_arrow_flatbuf_Date_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Date_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Date_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Time_table *org_apache_arrow_flatbuf_Time_table_t; +typedef struct org_apache_arrow_flatbuf_Time_table *org_apache_arrow_flatbuf_Time_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Time_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Time_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Timestamp_table *org_apache_arrow_flatbuf_Timestamp_table_t; +typedef struct org_apache_arrow_flatbuf_Timestamp_table *org_apache_arrow_flatbuf_Timestamp_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Timestamp_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Timestamp_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Interval_table *org_apache_arrow_flatbuf_Interval_table_t; +typedef struct org_apache_arrow_flatbuf_Interval_table *org_apache_arrow_flatbuf_Interval_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Interval_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Interval_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Duration_table *org_apache_arrow_flatbuf_Duration_table_t; +typedef struct org_apache_arrow_flatbuf_Duration_table *org_apache_arrow_flatbuf_Duration_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Duration_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Duration_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_KeyValue_table *org_apache_arrow_flatbuf_KeyValue_table_t; +typedef struct org_apache_arrow_flatbuf_KeyValue_table *org_apache_arrow_flatbuf_KeyValue_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_KeyValue_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_KeyValue_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_DictionaryEncoding_table *org_apache_arrow_flatbuf_DictionaryEncoding_table_t; +typedef struct org_apache_arrow_flatbuf_DictionaryEncoding_table *org_apache_arrow_flatbuf_DictionaryEncoding_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_DictionaryEncoding_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_DictionaryEncoding_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Field_table *org_apache_arrow_flatbuf_Field_table_t; +typedef struct org_apache_arrow_flatbuf_Field_table *org_apache_arrow_flatbuf_Field_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Field_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Field_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Schema_table *org_apache_arrow_flatbuf_Schema_table_t; +typedef struct org_apache_arrow_flatbuf_Schema_table *org_apache_arrow_flatbuf_Schema_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Schema_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Schema_mutable_vec_t; +#ifndef org_apache_arrow_flatbuf_Null_file_identifier +#define org_apache_arrow_flatbuf_Null_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Null_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Null_identifier +#define org_apache_arrow_flatbuf_Null_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Null_type_hash ((flatbuffers_thash_t)0x7b36a4dd) +#define org_apache_arrow_flatbuf_Null_type_identifier "\xdd\xa4\x36\x7b" +#ifndef org_apache_arrow_flatbuf_Null_file_extension +#define org_apache_arrow_flatbuf_Null_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Struct__file_identifier +#define org_apache_arrow_flatbuf_Struct__file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Struct__file_identifier */ +#ifndef org_apache_arrow_flatbuf_Struct__identifier +#define org_apache_arrow_flatbuf_Struct__identifier 0 +#endif +#define org_apache_arrow_flatbuf_Struct__type_hash ((flatbuffers_thash_t)0x6310f362) +#define org_apache_arrow_flatbuf_Struct__type_identifier "\x62\xf3\x10\x63" +#ifndef org_apache_arrow_flatbuf_Struct__file_extension +#define org_apache_arrow_flatbuf_Struct__file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_List_file_identifier +#define org_apache_arrow_flatbuf_List_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_List_file_identifier */ +#ifndef org_apache_arrow_flatbuf_List_identifier +#define org_apache_arrow_flatbuf_List_identifier 0 +#endif +#define org_apache_arrow_flatbuf_List_type_hash ((flatbuffers_thash_t)0xd4ce5878) +#define org_apache_arrow_flatbuf_List_type_identifier "\x78\x58\xce\xd4" +#ifndef org_apache_arrow_flatbuf_List_file_extension +#define org_apache_arrow_flatbuf_List_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeList_file_identifier +#define org_apache_arrow_flatbuf_LargeList_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeList_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeList_identifier +#define org_apache_arrow_flatbuf_LargeList_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeList_type_hash ((flatbuffers_thash_t)0x38aa7e27) +#define org_apache_arrow_flatbuf_LargeList_type_identifier "\x27\x7e\xaa\x38" +#ifndef org_apache_arrow_flatbuf_LargeList_file_extension +#define org_apache_arrow_flatbuf_LargeList_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_ListView_file_identifier +#define org_apache_arrow_flatbuf_ListView_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_ListView_file_identifier */ +#ifndef org_apache_arrow_flatbuf_ListView_identifier +#define org_apache_arrow_flatbuf_ListView_identifier 0 +#endif +#define org_apache_arrow_flatbuf_ListView_type_hash ((flatbuffers_thash_t)0x23d37919) +#define org_apache_arrow_flatbuf_ListView_type_identifier "\x19\x79\xd3\x23" +#ifndef org_apache_arrow_flatbuf_ListView_file_extension +#define org_apache_arrow_flatbuf_ListView_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeListView_file_identifier +#define org_apache_arrow_flatbuf_LargeListView_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeListView_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeListView_identifier +#define org_apache_arrow_flatbuf_LargeListView_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeListView_type_hash ((flatbuffers_thash_t)0x28efac02) +#define org_apache_arrow_flatbuf_LargeListView_type_identifier "\x02\xac\xef\x28" +#ifndef org_apache_arrow_flatbuf_LargeListView_file_extension +#define org_apache_arrow_flatbuf_LargeListView_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_FixedSizeList_file_identifier +#define org_apache_arrow_flatbuf_FixedSizeList_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_FixedSizeList_file_identifier */ +#ifndef org_apache_arrow_flatbuf_FixedSizeList_identifier +#define org_apache_arrow_flatbuf_FixedSizeList_identifier 0 +#endif +#define org_apache_arrow_flatbuf_FixedSizeList_type_hash ((flatbuffers_thash_t)0xcef245bb) +#define org_apache_arrow_flatbuf_FixedSizeList_type_identifier "\xbb\x45\xf2\xce" +#ifndef org_apache_arrow_flatbuf_FixedSizeList_file_extension +#define org_apache_arrow_flatbuf_FixedSizeList_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Map_file_identifier +#define org_apache_arrow_flatbuf_Map_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Map_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Map_identifier +#define org_apache_arrow_flatbuf_Map_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Map_type_hash ((flatbuffers_thash_t)0xcebef8e6) +#define org_apache_arrow_flatbuf_Map_type_identifier "\xe6\xf8\xbe\xce" +#ifndef org_apache_arrow_flatbuf_Map_file_extension +#define org_apache_arrow_flatbuf_Map_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Union_file_identifier +#define org_apache_arrow_flatbuf_Union_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Union_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Union_identifier +#define org_apache_arrow_flatbuf_Union_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Union_type_hash ((flatbuffers_thash_t)0x896bda57) +#define org_apache_arrow_flatbuf_Union_type_identifier "\x57\xda\x6b\x89" +#ifndef org_apache_arrow_flatbuf_Union_file_extension +#define org_apache_arrow_flatbuf_Union_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Int_file_identifier +#define org_apache_arrow_flatbuf_Int_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Int_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Int_identifier +#define org_apache_arrow_flatbuf_Int_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Int_type_hash ((flatbuffers_thash_t)0x30789001) +#define org_apache_arrow_flatbuf_Int_type_identifier "\x01\x90\x78\x30" +#ifndef org_apache_arrow_flatbuf_Int_file_extension +#define org_apache_arrow_flatbuf_Int_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_FloatingPoint_file_identifier +#define org_apache_arrow_flatbuf_FloatingPoint_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_FloatingPoint_file_identifier */ +#ifndef org_apache_arrow_flatbuf_FloatingPoint_identifier +#define org_apache_arrow_flatbuf_FloatingPoint_identifier 0 +#endif +#define org_apache_arrow_flatbuf_FloatingPoint_type_hash ((flatbuffers_thash_t)0xf7d06268) +#define org_apache_arrow_flatbuf_FloatingPoint_type_identifier "\x68\x62\xd0\xf7" +#ifndef org_apache_arrow_flatbuf_FloatingPoint_file_extension +#define org_apache_arrow_flatbuf_FloatingPoint_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Utf8_file_identifier +#define org_apache_arrow_flatbuf_Utf8_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Utf8_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Utf8_identifier +#define org_apache_arrow_flatbuf_Utf8_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Utf8_type_hash ((flatbuffers_thash_t)0x8fe60d37) +#define org_apache_arrow_flatbuf_Utf8_type_identifier "\x37\x0d\xe6\x8f" +#ifndef org_apache_arrow_flatbuf_Utf8_file_extension +#define org_apache_arrow_flatbuf_Utf8_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Binary_file_identifier +#define org_apache_arrow_flatbuf_Binary_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Binary_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Binary_identifier +#define org_apache_arrow_flatbuf_Binary_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Binary_type_hash ((flatbuffers_thash_t)0x8e21a795) +#define org_apache_arrow_flatbuf_Binary_type_identifier "\x95\xa7\x21\x8e" +#ifndef org_apache_arrow_flatbuf_Binary_file_extension +#define org_apache_arrow_flatbuf_Binary_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeUtf8_file_identifier +#define org_apache_arrow_flatbuf_LargeUtf8_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeUtf8_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeUtf8_identifier +#define org_apache_arrow_flatbuf_LargeUtf8_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeUtf8_type_hash ((flatbuffers_thash_t)0x24ed2fb0) +#define org_apache_arrow_flatbuf_LargeUtf8_type_identifier "\xb0\x2f\xed\x24" +#ifndef org_apache_arrow_flatbuf_LargeUtf8_file_extension +#define org_apache_arrow_flatbuf_LargeUtf8_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeBinary_file_identifier +#define org_apache_arrow_flatbuf_LargeBinary_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeBinary_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeBinary_identifier +#define org_apache_arrow_flatbuf_LargeBinary_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeBinary_type_hash ((flatbuffers_thash_t)0xbd437872) +#define org_apache_arrow_flatbuf_LargeBinary_type_identifier "\x72\x78\x43\xbd" +#ifndef org_apache_arrow_flatbuf_LargeBinary_file_extension +#define org_apache_arrow_flatbuf_LargeBinary_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Utf8View_file_identifier +#define org_apache_arrow_flatbuf_Utf8View_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Utf8View_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Utf8View_identifier +#define org_apache_arrow_flatbuf_Utf8View_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Utf8View_type_hash ((flatbuffers_thash_t)0xab7692) +#define org_apache_arrow_flatbuf_Utf8View_type_identifier "\x92\x76\xab\x00" +#ifndef org_apache_arrow_flatbuf_Utf8View_file_extension +#define org_apache_arrow_flatbuf_Utf8View_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_BinaryView_file_identifier +#define org_apache_arrow_flatbuf_BinaryView_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_BinaryView_file_identifier */ +#ifndef org_apache_arrow_flatbuf_BinaryView_identifier +#define org_apache_arrow_flatbuf_BinaryView_identifier 0 +#endif +#define org_apache_arrow_flatbuf_BinaryView_type_hash ((flatbuffers_thash_t)0x18c52428) +#define org_apache_arrow_flatbuf_BinaryView_type_identifier "\x28\x24\xc5\x18" +#ifndef org_apache_arrow_flatbuf_BinaryView_file_extension +#define org_apache_arrow_flatbuf_BinaryView_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier +#define org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier */ +#ifndef org_apache_arrow_flatbuf_FixedSizeBinary_identifier +#define org_apache_arrow_flatbuf_FixedSizeBinary_identifier 0 +#endif +#define org_apache_arrow_flatbuf_FixedSizeBinary_type_hash ((flatbuffers_thash_t)0x80d0f4ce) +#define org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier "\xce\xf4\xd0\x80" +#ifndef org_apache_arrow_flatbuf_FixedSizeBinary_file_extension +#define org_apache_arrow_flatbuf_FixedSizeBinary_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Bool_file_identifier +#define org_apache_arrow_flatbuf_Bool_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Bool_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Bool_identifier +#define org_apache_arrow_flatbuf_Bool_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Bool_type_hash ((flatbuffers_thash_t)0x96bf83f0) +#define org_apache_arrow_flatbuf_Bool_type_identifier "\xf0\x83\xbf\x96" +#ifndef org_apache_arrow_flatbuf_Bool_file_extension +#define org_apache_arrow_flatbuf_Bool_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_RunEndEncoded_file_identifier +#define org_apache_arrow_flatbuf_RunEndEncoded_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_RunEndEncoded_file_identifier */ +#ifndef org_apache_arrow_flatbuf_RunEndEncoded_identifier +#define org_apache_arrow_flatbuf_RunEndEncoded_identifier 0 +#endif +#define org_apache_arrow_flatbuf_RunEndEncoded_type_hash ((flatbuffers_thash_t)0x5a98bcc) +#define org_apache_arrow_flatbuf_RunEndEncoded_type_identifier "\xcc\x8b\xa9\x05" +#ifndef org_apache_arrow_flatbuf_RunEndEncoded_file_extension +#define org_apache_arrow_flatbuf_RunEndEncoded_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Decimal_file_identifier +#define org_apache_arrow_flatbuf_Decimal_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Decimal_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Decimal_identifier +#define org_apache_arrow_flatbuf_Decimal_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Decimal_type_hash ((flatbuffers_thash_t)0x91d1beb7) +#define org_apache_arrow_flatbuf_Decimal_type_identifier "\xb7\xbe\xd1\x91" +#ifndef org_apache_arrow_flatbuf_Decimal_file_extension +#define org_apache_arrow_flatbuf_Decimal_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Date_file_identifier +#define org_apache_arrow_flatbuf_Date_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Date_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Date_identifier +#define org_apache_arrow_flatbuf_Date_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Date_type_hash ((flatbuffers_thash_t)0xe0ccf624) +#define org_apache_arrow_flatbuf_Date_type_identifier "\x24\xf6\xcc\xe0" +#ifndef org_apache_arrow_flatbuf_Date_file_extension +#define org_apache_arrow_flatbuf_Date_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Time_file_identifier +#define org_apache_arrow_flatbuf_Time_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Time_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Time_identifier +#define org_apache_arrow_flatbuf_Time_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Time_type_hash ((flatbuffers_thash_t)0x2442a489) +#define org_apache_arrow_flatbuf_Time_type_identifier "\x89\xa4\x42\x24" +#ifndef org_apache_arrow_flatbuf_Time_file_extension +#define org_apache_arrow_flatbuf_Time_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Timestamp_file_identifier +#define org_apache_arrow_flatbuf_Timestamp_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Timestamp_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Timestamp_identifier +#define org_apache_arrow_flatbuf_Timestamp_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Timestamp_type_hash ((flatbuffers_thash_t)0x1fddf080) +#define org_apache_arrow_flatbuf_Timestamp_type_identifier "\x80\xf0\xdd\x1f" +#ifndef org_apache_arrow_flatbuf_Timestamp_file_extension +#define org_apache_arrow_flatbuf_Timestamp_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Interval_file_identifier +#define org_apache_arrow_flatbuf_Interval_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Interval_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Interval_identifier +#define org_apache_arrow_flatbuf_Interval_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Interval_type_hash ((flatbuffers_thash_t)0x1e2d6809) +#define org_apache_arrow_flatbuf_Interval_type_identifier "\x09\x68\x2d\x1e" +#ifndef org_apache_arrow_flatbuf_Interval_file_extension +#define org_apache_arrow_flatbuf_Interval_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Duration_file_identifier +#define org_apache_arrow_flatbuf_Duration_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Duration_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Duration_identifier +#define org_apache_arrow_flatbuf_Duration_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Duration_type_hash ((flatbuffers_thash_t)0x1ecea6b0) +#define org_apache_arrow_flatbuf_Duration_type_identifier "\xb0\xa6\xce\x1e" +#ifndef org_apache_arrow_flatbuf_Duration_file_extension +#define org_apache_arrow_flatbuf_Duration_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_KeyValue_file_identifier +#define org_apache_arrow_flatbuf_KeyValue_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_KeyValue_file_identifier */ +#ifndef org_apache_arrow_flatbuf_KeyValue_identifier +#define org_apache_arrow_flatbuf_KeyValue_identifier 0 +#endif +#define org_apache_arrow_flatbuf_KeyValue_type_hash ((flatbuffers_thash_t)0x3b264744) +#define org_apache_arrow_flatbuf_KeyValue_type_identifier "\x44\x47\x26\x3b" +#ifndef org_apache_arrow_flatbuf_KeyValue_file_extension +#define org_apache_arrow_flatbuf_KeyValue_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier +#define org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier */ +#ifndef org_apache_arrow_flatbuf_DictionaryEncoding_identifier +#define org_apache_arrow_flatbuf_DictionaryEncoding_identifier 0 +#endif +#define org_apache_arrow_flatbuf_DictionaryEncoding_type_hash ((flatbuffers_thash_t)0x8c703261) +#define org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier "\x61\x32\x70\x8c" +#ifndef org_apache_arrow_flatbuf_DictionaryEncoding_file_extension +#define org_apache_arrow_flatbuf_DictionaryEncoding_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Field_file_identifier +#define org_apache_arrow_flatbuf_Field_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Field_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Field_identifier +#define org_apache_arrow_flatbuf_Field_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Field_type_hash ((flatbuffers_thash_t)0xd981525c) +#define org_apache_arrow_flatbuf_Field_type_identifier "\x5c\x52\x81\xd9" +#ifndef org_apache_arrow_flatbuf_Field_file_extension +#define org_apache_arrow_flatbuf_Field_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Buffer_file_identifier +#define org_apache_arrow_flatbuf_Buffer_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Buffer_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Buffer_identifier +#define org_apache_arrow_flatbuf_Buffer_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Buffer_type_hash ((flatbuffers_thash_t)0x519d7fea) +#define org_apache_arrow_flatbuf_Buffer_type_identifier "\xea\x7f\x9d\x51" +#ifndef org_apache_arrow_flatbuf_Buffer_file_extension +#define org_apache_arrow_flatbuf_Buffer_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Schema_file_identifier +#define org_apache_arrow_flatbuf_Schema_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Schema_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Schema_identifier +#define org_apache_arrow_flatbuf_Schema_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Schema_type_hash ((flatbuffers_thash_t)0x406570b) +#define org_apache_arrow_flatbuf_Schema_type_identifier "\x0b\x57\x06\x04" +#ifndef org_apache_arrow_flatbuf_Schema_file_extension +#define org_apache_arrow_flatbuf_Schema_file_extension "bin" +#endif + +typedef int16_t org_apache_arrow_flatbuf_MetadataVersion_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_MetadataVersion, org_apache_arrow_flatbuf_MetadataVersion_enum_t, 16) +/** 0.1.0 (October 2016). */ +#define org_apache_arrow_flatbuf_MetadataVersion_V1 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_MetadataVersion_V2 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_MetadataVersion_V3 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(2)) +#define org_apache_arrow_flatbuf_MetadataVersion_V4 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(3)) +#define org_apache_arrow_flatbuf_MetadataVersion_V5 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(4)) + +static inline const char *org_apache_arrow_flatbuf_MetadataVersion_name(org_apache_arrow_flatbuf_MetadataVersion_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_MetadataVersion_V1: return "V1"; + case org_apache_arrow_flatbuf_MetadataVersion_V2: return "V2"; + case org_apache_arrow_flatbuf_MetadataVersion_V3: return "V3"; + case org_apache_arrow_flatbuf_MetadataVersion_V4: return "V4"; + case org_apache_arrow_flatbuf_MetadataVersion_V5: return "V5"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_MetadataVersion_is_known_value(org_apache_arrow_flatbuf_MetadataVersion_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_MetadataVersion_V1: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V2: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V3: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V4: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V5: return 1; + default: return 0; + } +} + +/** Represents Arrow Features that might not have full support + * within implementations. This is intended to be used in + * two scenarios: + * 1. A mechanism for readers of Arrow Streams + * and files to understand that the stream or file makes + * use of a feature that isn't supported or unknown to + * the implementation (and therefore can meet the Arrow + * forward compatibility guarantees). + * 2. A means of negotiating between a client and server + * what features a stream is allowed to use. The enums + * values here are intented to represent higher level + * features, additional details maybe negotiated + * with key-value pairs specific to the protocol. + * + * Enums added to this list should be assigned power-of-two values + * to facilitate exchanging and comparing bitmaps for supported + * features. */ +typedef int64_t org_apache_arrow_flatbuf_Feature_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Feature, org_apache_arrow_flatbuf_Feature_enum_t, 64) +/** Needed to make flatbuffers happy. */ +#define org_apache_arrow_flatbuf_Feature_UNUSED ((org_apache_arrow_flatbuf_Feature_enum_t)INT64_C(0)) +#define org_apache_arrow_flatbuf_Feature_DICTIONARY_REPLACEMENT ((org_apache_arrow_flatbuf_Feature_enum_t)INT64_C(1)) +#define org_apache_arrow_flatbuf_Feature_COMPRESSED_BODY ((org_apache_arrow_flatbuf_Feature_enum_t)INT64_C(2)) + +static inline const char *org_apache_arrow_flatbuf_Feature_name(org_apache_arrow_flatbuf_Feature_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Feature_UNUSED: return "UNUSED"; + case org_apache_arrow_flatbuf_Feature_DICTIONARY_REPLACEMENT: return "DICTIONARY_REPLACEMENT"; + case org_apache_arrow_flatbuf_Feature_COMPRESSED_BODY: return "COMPRESSED_BODY"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Feature_is_known_value(org_apache_arrow_flatbuf_Feature_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Feature_UNUSED: return 1; + case org_apache_arrow_flatbuf_Feature_DICTIONARY_REPLACEMENT: return 1; + case org_apache_arrow_flatbuf_Feature_COMPRESSED_BODY: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_UnionMode_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t, 16) +#define org_apache_arrow_flatbuf_UnionMode_Sparse ((org_apache_arrow_flatbuf_UnionMode_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_UnionMode_Dense ((org_apache_arrow_flatbuf_UnionMode_enum_t)INT16_C(1)) + +static inline const char *org_apache_arrow_flatbuf_UnionMode_name(org_apache_arrow_flatbuf_UnionMode_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_UnionMode_Sparse: return "Sparse"; + case org_apache_arrow_flatbuf_UnionMode_Dense: return "Dense"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_UnionMode_is_known_value(org_apache_arrow_flatbuf_UnionMode_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_UnionMode_Sparse: return 1; + case org_apache_arrow_flatbuf_UnionMode_Dense: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_Precision_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t, 16) +#define org_apache_arrow_flatbuf_Precision_HALF ((org_apache_arrow_flatbuf_Precision_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_Precision_SINGLE ((org_apache_arrow_flatbuf_Precision_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_Precision_DOUBLE ((org_apache_arrow_flatbuf_Precision_enum_t)INT16_C(2)) + +static inline const char *org_apache_arrow_flatbuf_Precision_name(org_apache_arrow_flatbuf_Precision_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Precision_HALF: return "HALF"; + case org_apache_arrow_flatbuf_Precision_SINGLE: return "SINGLE"; + case org_apache_arrow_flatbuf_Precision_DOUBLE: return "DOUBLE"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Precision_is_known_value(org_apache_arrow_flatbuf_Precision_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Precision_HALF: return 1; + case org_apache_arrow_flatbuf_Precision_SINGLE: return 1; + case org_apache_arrow_flatbuf_Precision_DOUBLE: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_DateUnit_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t, 16) +#define org_apache_arrow_flatbuf_DateUnit_DAY ((org_apache_arrow_flatbuf_DateUnit_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_DateUnit_MILLISECOND ((org_apache_arrow_flatbuf_DateUnit_enum_t)INT16_C(1)) + +static inline const char *org_apache_arrow_flatbuf_DateUnit_name(org_apache_arrow_flatbuf_DateUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DateUnit_DAY: return "DAY"; + case org_apache_arrow_flatbuf_DateUnit_MILLISECOND: return "MILLISECOND"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_DateUnit_is_known_value(org_apache_arrow_flatbuf_DateUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DateUnit_DAY: return 1; + case org_apache_arrow_flatbuf_DateUnit_MILLISECOND: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_TimeUnit_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 16) +#define org_apache_arrow_flatbuf_TimeUnit_SECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_TimeUnit_MILLISECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_TimeUnit_MICROSECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(2)) +#define org_apache_arrow_flatbuf_TimeUnit_NANOSECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(3)) + +static inline const char *org_apache_arrow_flatbuf_TimeUnit_name(org_apache_arrow_flatbuf_TimeUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_TimeUnit_SECOND: return "SECOND"; + case org_apache_arrow_flatbuf_TimeUnit_MILLISECOND: return "MILLISECOND"; + case org_apache_arrow_flatbuf_TimeUnit_MICROSECOND: return "MICROSECOND"; + case org_apache_arrow_flatbuf_TimeUnit_NANOSECOND: return "NANOSECOND"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_TimeUnit_is_known_value(org_apache_arrow_flatbuf_TimeUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_TimeUnit_SECOND: return 1; + case org_apache_arrow_flatbuf_TimeUnit_MILLISECOND: return 1; + case org_apache_arrow_flatbuf_TimeUnit_MICROSECOND: return 1; + case org_apache_arrow_flatbuf_TimeUnit_NANOSECOND: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_IntervalUnit_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t, 16) +#define org_apache_arrow_flatbuf_IntervalUnit_YEAR_MONTH ((org_apache_arrow_flatbuf_IntervalUnit_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_IntervalUnit_DAY_TIME ((org_apache_arrow_flatbuf_IntervalUnit_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_IntervalUnit_MONTH_DAY_NANO ((org_apache_arrow_flatbuf_IntervalUnit_enum_t)INT16_C(2)) + +static inline const char *org_apache_arrow_flatbuf_IntervalUnit_name(org_apache_arrow_flatbuf_IntervalUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_IntervalUnit_YEAR_MONTH: return "YEAR_MONTH"; + case org_apache_arrow_flatbuf_IntervalUnit_DAY_TIME: return "DAY_TIME"; + case org_apache_arrow_flatbuf_IntervalUnit_MONTH_DAY_NANO: return "MONTH_DAY_NANO"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_IntervalUnit_is_known_value(org_apache_arrow_flatbuf_IntervalUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_IntervalUnit_YEAR_MONTH: return 1; + case org_apache_arrow_flatbuf_IntervalUnit_DAY_TIME: return 1; + case org_apache_arrow_flatbuf_IntervalUnit_MONTH_DAY_NANO: return 1; + default: return 0; + } +} + +/** ---------------------------------------------------------------------- + * Dictionary encoding metadata + * Maintained for forwards compatibility, in the future + * Dictionaries might be explicit maps between integers and values + * allowing for non-contiguous index values */ +typedef int16_t org_apache_arrow_flatbuf_DictionaryKind_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t, 16) +#define org_apache_arrow_flatbuf_DictionaryKind_DenseArray ((org_apache_arrow_flatbuf_DictionaryKind_enum_t)INT16_C(0)) + +static inline const char *org_apache_arrow_flatbuf_DictionaryKind_name(org_apache_arrow_flatbuf_DictionaryKind_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DictionaryKind_DenseArray: return "DenseArray"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_DictionaryKind_is_known_value(org_apache_arrow_flatbuf_DictionaryKind_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DictionaryKind_DenseArray: return 1; + default: return 0; + } +} + +/** ---------------------------------------------------------------------- + * Endianness of the platform producing the data */ +typedef int16_t org_apache_arrow_flatbuf_Endianness_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t, 16) +#define org_apache_arrow_flatbuf_Endianness_Little ((org_apache_arrow_flatbuf_Endianness_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_Endianness_Big ((org_apache_arrow_flatbuf_Endianness_enum_t)INT16_C(1)) + +static inline const char *org_apache_arrow_flatbuf_Endianness_name(org_apache_arrow_flatbuf_Endianness_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Endianness_Little: return "Little"; + case org_apache_arrow_flatbuf_Endianness_Big: return "Big"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Endianness_is_known_value(org_apache_arrow_flatbuf_Endianness_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Endianness_Little: return 1; + case org_apache_arrow_flatbuf_Endianness_Big: return 1; + default: return 0; + } +} + + +/** ---------------------------------------------------------------------- + * A Buffer represents a single contiguous memory segment */ +struct org_apache_arrow_flatbuf_Buffer { + /** The relative offset into the shared memory page where the bytes for this + * buffer starts */ + alignas(8) int64_t offset; + /** The absolute length (in bytes) of the memory buffer. The memory is found + * from offset (inclusive) to offset + length (non-inclusive). When building + * messages using the encapsulated IPC message, padding bytes may be written + * after a buffer, but such padding bytes do not need to be accounted for in + * the size here. */ + alignas(8) int64_t length; +}; +static_assert(sizeof(org_apache_arrow_flatbuf_Buffer_t) == 16, "struct size mismatch"); + +static inline const org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer__const_ptr_add(const org_apache_arrow_flatbuf_Buffer_t *p, size_t i) { return p + i; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer__ptr_add(org_apache_arrow_flatbuf_Buffer_t *p, size_t i) { return p + i; } +static inline org_apache_arrow_flatbuf_Buffer_struct_t org_apache_arrow_flatbuf_Buffer_vec_at(org_apache_arrow_flatbuf_Buffer_vec_t vec, size_t i) +__flatbuffers_struct_vec_at(vec, i) +static inline size_t org_apache_arrow_flatbuf_Buffer__size(void) { return 16; } +static inline size_t org_apache_arrow_flatbuf_Buffer_vec_len(org_apache_arrow_flatbuf_Buffer_vec_t vec) +__flatbuffers_vec_len(vec) +__flatbuffers_struct_as_root(org_apache_arrow_flatbuf_Buffer) + +__flatbuffers_define_struct_scalar_field(org_apache_arrow_flatbuf_Buffer, offset, flatbuffers_int64, int64_t) +__flatbuffers_define_struct_scalar_field(org_apache_arrow_flatbuf_Buffer, length, flatbuffers_int64, int64_t) + + +/** These are stored in the flatbuffer in the Type union below */ +struct org_apache_arrow_flatbuf_Null_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Null_vec_len(org_apache_arrow_flatbuf_Null_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Null_table_t org_apache_arrow_flatbuf_Null_vec_at(org_apache_arrow_flatbuf_Null_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Null_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Null) + + +/** A Struct_ in the flatbuffer metadata is the same as an Arrow Struct + * (according to the physical memory layout). We used Struct_ here as + * Struct is a reserved word in Flatbuffers */ +struct org_apache_arrow_flatbuf_Struct__table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Struct__vec_len(org_apache_arrow_flatbuf_Struct__vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Struct__table_t org_apache_arrow_flatbuf_Struct__vec_at(org_apache_arrow_flatbuf_Struct__vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Struct__table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Struct_) + + +struct org_apache_arrow_flatbuf_List_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_List_vec_len(org_apache_arrow_flatbuf_List_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_List_table_t org_apache_arrow_flatbuf_List_vec_at(org_apache_arrow_flatbuf_List_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_List_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_List) + + +/** Same as List, but with 64-bit offsets, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeList_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeList_vec_len(org_apache_arrow_flatbuf_LargeList_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeList_table_t org_apache_arrow_flatbuf_LargeList_vec_at(org_apache_arrow_flatbuf_LargeList_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeList_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeList) + + +/** Represents the same logical types that List can, but contains offsets and + * sizes allowing for writes in any order and sharing of child values among + * list values. */ +struct org_apache_arrow_flatbuf_ListView_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_ListView_vec_len(org_apache_arrow_flatbuf_ListView_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_ListView_table_t org_apache_arrow_flatbuf_ListView_vec_at(org_apache_arrow_flatbuf_ListView_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_ListView_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_ListView) + + +/** Same as ListView, but with 64-bit offsets and sizes, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeListView_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeListView_vec_len(org_apache_arrow_flatbuf_LargeListView_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeListView_table_t org_apache_arrow_flatbuf_LargeListView_vec_at(org_apache_arrow_flatbuf_LargeListView_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeListView_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeListView) + + +struct org_apache_arrow_flatbuf_FixedSizeList_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_FixedSizeList_vec_len(org_apache_arrow_flatbuf_FixedSizeList_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_FixedSizeList_table_t org_apache_arrow_flatbuf_FixedSizeList_vec_at(org_apache_arrow_flatbuf_FixedSizeList_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_FixedSizeList_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_FixedSizeList) + +/** Number of list items per value */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_FixedSizeList, listSize, flatbuffers_int32, int32_t, INT32_C(0)) + +/** A Map is a logical nested type that is represented as + * + * List> + * + * In this layout, the keys and values are each respectively contiguous. We do + * not constrain the key and value types, so the application is responsible + * for ensuring that the keys are hashable and unique. Whether the keys are sorted + * may be set in the metadata for this field. + * + * In a field with Map type, the field has a child Struct field, which then + * has two children: key type and the second the value type. The names of the + * child fields may be respectively "entries", "key", and "value", but this is + * not enforced. + * + * Map + * ```text + * - child[0] entries: Struct + * - child[0] key: K + * - child[1] value: V + * ``` + * Neither the "entries" field nor the "key" field may be nullable. + * + * The metadata is structured so that Arrow systems without special handling + * for Map can make Map an alias for List. The "layout" attribute for the Map + * field must have the same contents as a List. */ +struct org_apache_arrow_flatbuf_Map_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Map_vec_len(org_apache_arrow_flatbuf_Map_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Map_table_t org_apache_arrow_flatbuf_Map_vec_at(org_apache_arrow_flatbuf_Map_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Map_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Map) + +/** Set to true if the keys within each value are sorted */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Map, keysSorted, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) + +/** A union is a complex type with children in Field + * By default ids in the type vector refer to the offsets in the children + * optionally typeIds provides an indirection between the child offset and the type id + * for each child `typeIds[offset]` is the id used in the type vector */ +struct org_apache_arrow_flatbuf_Union_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Union_vec_len(org_apache_arrow_flatbuf_Union_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Union_table_t org_apache_arrow_flatbuf_Union_vec_at(org_apache_arrow_flatbuf_Union_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Union_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Union) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Union, mode, org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t, INT16_C(0)) +__flatbuffers_define_vector_field(1, org_apache_arrow_flatbuf_Union, typeIds, flatbuffers_int32_vec_t, 0) + +struct org_apache_arrow_flatbuf_Int_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Int_vec_len(org_apache_arrow_flatbuf_Int_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Int_table_t org_apache_arrow_flatbuf_Int_vec_at(org_apache_arrow_flatbuf_Int_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Int_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Int) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Int, bitWidth, flatbuffers_int32, int32_t, INT32_C(0)) +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Int, is_signed, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) + +struct org_apache_arrow_flatbuf_FloatingPoint_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_FloatingPoint_vec_len(org_apache_arrow_flatbuf_FloatingPoint_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_FloatingPoint_table_t org_apache_arrow_flatbuf_FloatingPoint_vec_at(org_apache_arrow_flatbuf_FloatingPoint_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_FloatingPoint_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_FloatingPoint) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_FloatingPoint, precision, org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t, INT16_C(0)) + +/** Unicode with UTF-8 encoding */ +struct org_apache_arrow_flatbuf_Utf8_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Utf8_vec_len(org_apache_arrow_flatbuf_Utf8_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Utf8_table_t org_apache_arrow_flatbuf_Utf8_vec_at(org_apache_arrow_flatbuf_Utf8_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Utf8_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Utf8) + + +/** Opaque binary data */ +struct org_apache_arrow_flatbuf_Binary_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Binary_vec_len(org_apache_arrow_flatbuf_Binary_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Binary_table_t org_apache_arrow_flatbuf_Binary_vec_at(org_apache_arrow_flatbuf_Binary_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Binary_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Binary) + + +/** Same as Utf8, but with 64-bit offsets, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeUtf8_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeUtf8_vec_len(org_apache_arrow_flatbuf_LargeUtf8_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeUtf8_table_t org_apache_arrow_flatbuf_LargeUtf8_vec_at(org_apache_arrow_flatbuf_LargeUtf8_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeUtf8_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeUtf8) + + +/** Same as Binary, but with 64-bit offsets, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeBinary_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeBinary_vec_len(org_apache_arrow_flatbuf_LargeBinary_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeBinary_table_t org_apache_arrow_flatbuf_LargeBinary_vec_at(org_apache_arrow_flatbuf_LargeBinary_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeBinary_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeBinary) + + +/** Logically the same as Utf8, but the internal representation uses a view + * struct that contains the string length and either the string's entire data + * inline (for small strings) or an inlined prefix, an index of another buffer, + * and an offset pointing to a slice in that buffer (for non-small strings). + * + * Since it uses a variable number of data buffers, each Field with this type + * must have a corresponding entry in `variadicBufferCounts`. */ +struct org_apache_arrow_flatbuf_Utf8View_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Utf8View_vec_len(org_apache_arrow_flatbuf_Utf8View_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Utf8View_table_t org_apache_arrow_flatbuf_Utf8View_vec_at(org_apache_arrow_flatbuf_Utf8View_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Utf8View_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Utf8View) + + +/** Logically the same as Binary, but the internal representation uses a view + * struct that contains the string length and either the string's entire data + * inline (for small strings) or an inlined prefix, an index of another buffer, + * and an offset pointing to a slice in that buffer (for non-small strings). + * + * Since it uses a variable number of data buffers, each Field with this type + * must have a corresponding entry in `variadicBufferCounts`. */ +struct org_apache_arrow_flatbuf_BinaryView_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_BinaryView_vec_len(org_apache_arrow_flatbuf_BinaryView_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_BinaryView_table_t org_apache_arrow_flatbuf_BinaryView_vec_at(org_apache_arrow_flatbuf_BinaryView_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_BinaryView_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_BinaryView) + + +struct org_apache_arrow_flatbuf_FixedSizeBinary_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_FixedSizeBinary_vec_len(org_apache_arrow_flatbuf_FixedSizeBinary_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_FixedSizeBinary_table_t org_apache_arrow_flatbuf_FixedSizeBinary_vec_at(org_apache_arrow_flatbuf_FixedSizeBinary_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_FixedSizeBinary_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_FixedSizeBinary) + +/** Number of bytes per value */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_FixedSizeBinary, byteWidth, flatbuffers_int32, int32_t, INT32_C(0)) + +struct org_apache_arrow_flatbuf_Bool_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Bool_vec_len(org_apache_arrow_flatbuf_Bool_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Bool_table_t org_apache_arrow_flatbuf_Bool_vec_at(org_apache_arrow_flatbuf_Bool_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Bool_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Bool) + + +/** Contains two child arrays, run_ends and values. + * The run_ends child array must be a 16/32/64-bit integer array + * which encodes the indices at which the run with the value in + * each corresponding index in the values child array ends. + * Like list/struct types, the value array can be of any type. */ +struct org_apache_arrow_flatbuf_RunEndEncoded_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_RunEndEncoded_vec_len(org_apache_arrow_flatbuf_RunEndEncoded_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_RunEndEncoded_table_t org_apache_arrow_flatbuf_RunEndEncoded_vec_at(org_apache_arrow_flatbuf_RunEndEncoded_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_RunEndEncoded_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_RunEndEncoded) + + +/** Exact decimal value represented as an integer value in two's + * complement. Currently only 128-bit (16-byte) and 256-bit (32-byte) integers + * are used. The representation uses the endianness indicated + * in the Schema. */ +struct org_apache_arrow_flatbuf_Decimal_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Decimal_vec_len(org_apache_arrow_flatbuf_Decimal_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Decimal_table_t org_apache_arrow_flatbuf_Decimal_vec_at(org_apache_arrow_flatbuf_Decimal_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Decimal_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Decimal) + +/** Total number of decimal digits */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Decimal, precision, flatbuffers_int32, int32_t, INT32_C(0)) +/** Number of digits after the decimal point "." */ +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Decimal, scale, flatbuffers_int32, int32_t, INT32_C(0)) +/** Number of bits per value. The only accepted widths are 128 and 256. + * We use bitWidth for consistency with Int::bitWidth. */ +__flatbuffers_define_scalar_field(2, org_apache_arrow_flatbuf_Decimal, bitWidth, flatbuffers_int32, int32_t, INT32_C(128)) + +/** Date is either a 32-bit or 64-bit signed integer type representing an + * elapsed time since UNIX epoch (1970-01-01), stored in either of two units: + * + * * Milliseconds (64 bits) indicating UNIX time elapsed since the epoch (no + * leap seconds), where the values are evenly divisible by 86400000 + * * Days (32 bits) since the UNIX epoch */ +struct org_apache_arrow_flatbuf_Date_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Date_vec_len(org_apache_arrow_flatbuf_Date_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Date_table_t org_apache_arrow_flatbuf_Date_vec_at(org_apache_arrow_flatbuf_Date_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Date_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Date) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Date, unit, org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t, INT16_C(1)) + +/** Time is either a 32-bit or 64-bit signed integer type representing an + * elapsed time since midnight, stored in either of four units: seconds, + * milliseconds, microseconds or nanoseconds. + * + * The integer `bitWidth` depends on the `unit` and must be one of the following: + * * SECOND and MILLISECOND: 32 bits + * * MICROSECOND and NANOSECOND: 64 bits + * + * The allowed values are between 0 (inclusive) and 86400 (=24*60*60) seconds + * (exclusive), adjusted for the time unit (for example, up to 86400000 + * exclusive for the MILLISECOND unit). + * This definition doesn't allow for leap seconds. Time values from + * measurements with leap seconds will need to be corrected when ingesting + * into Arrow (for example by replacing the value 86400 with 86399). */ +struct org_apache_arrow_flatbuf_Time_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Time_vec_len(org_apache_arrow_flatbuf_Time_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Time_table_t org_apache_arrow_flatbuf_Time_vec_at(org_apache_arrow_flatbuf_Time_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Time_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Time) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Time, unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, INT16_C(1)) +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Time, bitWidth, flatbuffers_int32, int32_t, INT32_C(32)) + +/** Timestamp is a 64-bit signed integer representing an elapsed time since a + * fixed epoch, stored in either of four units: seconds, milliseconds, + * microseconds or nanoseconds, and is optionally annotated with a timezone. + * + * Timestamp values do not include any leap seconds (in other words, all + * days are considered 86400 seconds long). + * + * Timestamps with a non-empty timezone + * ------------------------------------ + * + * If a Timestamp column has a non-empty timezone value, its epoch is + * 1970-01-01 00:00:00 (January 1st 1970, midnight) in the *UTC* timezone + * (the Unix epoch), regardless of the Timestamp's own timezone. + * + * Therefore, timestamp values with a non-empty timezone correspond to + * physical points in time together with some additional information about + * how the data was obtained and/or how to display it (the timezone). + * + * For example, the timestamp value 0 with the timezone string "Europe/Paris" + * corresponds to "January 1st 1970, 00h00" in the UTC timezone, but the + * application may prefer to display it as "January 1st 1970, 01h00" in + * the Europe/Paris timezone (which is the same physical point in time). + * + * One consequence is that timestamp values with a non-empty timezone + * can be compared and ordered directly, since they all share the same + * well-known point of reference (the Unix epoch). + * + * Timestamps with an unset / empty timezone + * ----------------------------------------- + * + * If a Timestamp column has no timezone value, its epoch is + * 1970-01-01 00:00:00 (January 1st 1970, midnight) in an *unknown* timezone. + * + * Therefore, timestamp values without a timezone cannot be meaningfully + * interpreted as physical points in time, but only as calendar / clock + * indications ("wall clock time") in an unspecified timezone. + * + * For example, the timestamp value 0 with an empty timezone string + * corresponds to "January 1st 1970, 00h00" in an unknown timezone: there + * is not enough information to interpret it as a well-defined physical + * point in time. + * + * One consequence is that timestamp values without a timezone cannot + * be reliably compared or ordered, since they may have different points of + * reference. In particular, it is *not* possible to interpret an unset + * or empty timezone as the same as "UTC". + * + * Conversion between timezones + * ---------------------------- + * + * If a Timestamp column has a non-empty timezone, changing the timezone + * to a different non-empty value is a metadata-only operation: + * the timestamp values need not change as their point of reference remains + * the same (the Unix epoch). + * + * However, if a Timestamp column has no timezone value, changing it to a + * non-empty value requires to think about the desired semantics. + * One possibility is to assume that the original timestamp values are + * relative to the epoch of the timezone being set; timestamp values should + * then adjusted to the Unix epoch (for example, changing the timezone from + * empty to "Europe/Paris" would require converting the timestamp values + * from "Europe/Paris" to "UTC", which seems counter-intuitive but is + * nevertheless correct). + * + * Guidelines for encoding data from external libraries + * ---------------------------------------------------- + * + * Date & time libraries often have multiple different data types for temporal + * data. In order to ease interoperability between different implementations the + * Arrow project has some recommendations for encoding these types into a Timestamp + * column. + * + * An "instant" represents a physical point in time that has no relevant timezone + * (for example, astronomical data). To encode an instant, use a Timestamp with + * the timezone string set to "UTC", and make sure the Timestamp values + * are relative to the UTC epoch (January 1st 1970, midnight). + * + * A "zoned date-time" represents a physical point in time annotated with an + * informative timezone (for example, the timezone in which the data was + * recorded). To encode a zoned date-time, use a Timestamp with the timezone + * string set to the name of the timezone, and make sure the Timestamp values + * are relative to the UTC epoch (January 1st 1970, midnight). + * + * (There is some ambiguity between an instant and a zoned date-time with the + * UTC timezone. Both of these are stored the same in Arrow. Typically, + * this distinction does not matter. If it does, then an application should + * use custom metadata or an extension type to distinguish between the two cases.) + * + * An "offset date-time" represents a physical point in time combined with an + * explicit offset from UTC. To encode an offset date-time, use a Timestamp + * with the timezone string set to the numeric timezone offset string + * (e.g. "+03:00"), and make sure the Timestamp values are relative to + * the UTC epoch (January 1st 1970, midnight). + * + * A "naive date-time" (also called "local date-time" in some libraries) + * represents a wall clock time combined with a calendar date, but with + * no indication of how to map this information to a physical point in time. + * Naive date-times must be handled with care because of this missing + * information, and also because daylight saving time (DST) may make + * some values ambiguous or nonexistent. A naive date-time may be + * stored as a struct with Date and Time fields. However, it may also be + * encoded into a Timestamp column with an empty timezone. The timestamp + * values should be computed "as if" the timezone of the date-time values + * was UTC; for example, the naive date-time "January 1st 1970, 00h00" would + * be encoded as timestamp value 0. */ +struct org_apache_arrow_flatbuf_Timestamp_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Timestamp_vec_len(org_apache_arrow_flatbuf_Timestamp_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Timestamp_table_t org_apache_arrow_flatbuf_Timestamp_vec_at(org_apache_arrow_flatbuf_Timestamp_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Timestamp_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Timestamp) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Timestamp, unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, INT16_C(0)) +/** The timezone is an optional string indicating the name of a timezone, + * one of: + * + * * As used in the Olson timezone database (the "tz database" or + * "tzdata"), such as "America/New_York". + * * An absolute timezone offset of the form "+XX:XX" or "-XX:XX", + * such as "+07:30". + * + * Whether a timezone string is present indicates different semantics about + * the data (see above). */ +__flatbuffers_define_string_field(1, org_apache_arrow_flatbuf_Timestamp, timezone, 0) + +struct org_apache_arrow_flatbuf_Interval_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Interval_vec_len(org_apache_arrow_flatbuf_Interval_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Interval_table_t org_apache_arrow_flatbuf_Interval_vec_at(org_apache_arrow_flatbuf_Interval_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Interval_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Interval) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Interval, unit, org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t, INT16_C(0)) + +struct org_apache_arrow_flatbuf_Duration_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Duration_vec_len(org_apache_arrow_flatbuf_Duration_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Duration_table_t org_apache_arrow_flatbuf_Duration_vec_at(org_apache_arrow_flatbuf_Duration_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Duration_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Duration) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Duration, unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, INT16_C(1)) +/** ---------------------------------------------------------------------- + * Top-level Type value, enabling extensible type-specific metadata. We can + * add new logical types to Type without breaking backwards compatibility */ +typedef uint8_t org_apache_arrow_flatbuf_Type_union_type_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Type, org_apache_arrow_flatbuf_Type_union_type_t, 8) +__flatbuffers_define_union(flatbuffers_, org_apache_arrow_flatbuf_Type) +/** ---------------------------------------------------------------------- + * user defined key value pairs to add custom metadata to arrow + * key namespacing is the responsibility of the user */ +#define org_apache_arrow_flatbuf_Type_NONE ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(0)) +#define org_apache_arrow_flatbuf_Type_Null ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(1)) +#define org_apache_arrow_flatbuf_Type_Int ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(2)) +#define org_apache_arrow_flatbuf_Type_FloatingPoint ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(3)) +#define org_apache_arrow_flatbuf_Type_Binary ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(4)) +#define org_apache_arrow_flatbuf_Type_Utf8 ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(5)) +#define org_apache_arrow_flatbuf_Type_Bool ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(6)) +#define org_apache_arrow_flatbuf_Type_Decimal ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(7)) +#define org_apache_arrow_flatbuf_Type_Date ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(8)) +#define org_apache_arrow_flatbuf_Type_Time ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(9)) +#define org_apache_arrow_flatbuf_Type_Timestamp ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(10)) +#define org_apache_arrow_flatbuf_Type_Interval ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(11)) +#define org_apache_arrow_flatbuf_Type_List ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(12)) +#define org_apache_arrow_flatbuf_Type_Struct_ ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(13)) +#define org_apache_arrow_flatbuf_Type_Union ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(14)) +#define org_apache_arrow_flatbuf_Type_FixedSizeBinary ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(15)) +#define org_apache_arrow_flatbuf_Type_FixedSizeList ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(16)) +#define org_apache_arrow_flatbuf_Type_Map ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(17)) +#define org_apache_arrow_flatbuf_Type_Duration ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(18)) +#define org_apache_arrow_flatbuf_Type_LargeBinary ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(19)) +#define org_apache_arrow_flatbuf_Type_LargeUtf8 ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(20)) +#define org_apache_arrow_flatbuf_Type_LargeList ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(21)) +#define org_apache_arrow_flatbuf_Type_RunEndEncoded ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(22)) +#define org_apache_arrow_flatbuf_Type_BinaryView ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(23)) +#define org_apache_arrow_flatbuf_Type_Utf8View ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(24)) +#define org_apache_arrow_flatbuf_Type_ListView ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(25)) +#define org_apache_arrow_flatbuf_Type_LargeListView ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(26)) + +static inline const char *org_apache_arrow_flatbuf_Type_type_name(org_apache_arrow_flatbuf_Type_union_type_t type) +{ + switch (type) { + case org_apache_arrow_flatbuf_Type_NONE: return "NONE"; + case org_apache_arrow_flatbuf_Type_Null: return "Null"; + case org_apache_arrow_flatbuf_Type_Int: return "Int"; + case org_apache_arrow_flatbuf_Type_FloatingPoint: return "FloatingPoint"; + case org_apache_arrow_flatbuf_Type_Binary: return "Binary"; + case org_apache_arrow_flatbuf_Type_Utf8: return "Utf8"; + case org_apache_arrow_flatbuf_Type_Bool: return "Bool"; + case org_apache_arrow_flatbuf_Type_Decimal: return "Decimal"; + case org_apache_arrow_flatbuf_Type_Date: return "Date"; + case org_apache_arrow_flatbuf_Type_Time: return "Time"; + case org_apache_arrow_flatbuf_Type_Timestamp: return "Timestamp"; + case org_apache_arrow_flatbuf_Type_Interval: return "Interval"; + case org_apache_arrow_flatbuf_Type_List: return "List"; + case org_apache_arrow_flatbuf_Type_Struct_: return "Struct_"; + case org_apache_arrow_flatbuf_Type_Union: return "Union"; + case org_apache_arrow_flatbuf_Type_FixedSizeBinary: return "FixedSizeBinary"; + case org_apache_arrow_flatbuf_Type_FixedSizeList: return "FixedSizeList"; + case org_apache_arrow_flatbuf_Type_Map: return "Map"; + case org_apache_arrow_flatbuf_Type_Duration: return "Duration"; + case org_apache_arrow_flatbuf_Type_LargeBinary: return "LargeBinary"; + case org_apache_arrow_flatbuf_Type_LargeUtf8: return "LargeUtf8"; + case org_apache_arrow_flatbuf_Type_LargeList: return "LargeList"; + case org_apache_arrow_flatbuf_Type_RunEndEncoded: return "RunEndEncoded"; + case org_apache_arrow_flatbuf_Type_BinaryView: return "BinaryView"; + case org_apache_arrow_flatbuf_Type_Utf8View: return "Utf8View"; + case org_apache_arrow_flatbuf_Type_ListView: return "ListView"; + case org_apache_arrow_flatbuf_Type_LargeListView: return "LargeListView"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Type_is_known_type(org_apache_arrow_flatbuf_Type_union_type_t type) +{ + switch (type) { + case org_apache_arrow_flatbuf_Type_NONE: return 1; + case org_apache_arrow_flatbuf_Type_Null: return 1; + case org_apache_arrow_flatbuf_Type_Int: return 1; + case org_apache_arrow_flatbuf_Type_FloatingPoint: return 1; + case org_apache_arrow_flatbuf_Type_Binary: return 1; + case org_apache_arrow_flatbuf_Type_Utf8: return 1; + case org_apache_arrow_flatbuf_Type_Bool: return 1; + case org_apache_arrow_flatbuf_Type_Decimal: return 1; + case org_apache_arrow_flatbuf_Type_Date: return 1; + case org_apache_arrow_flatbuf_Type_Time: return 1; + case org_apache_arrow_flatbuf_Type_Timestamp: return 1; + case org_apache_arrow_flatbuf_Type_Interval: return 1; + case org_apache_arrow_flatbuf_Type_List: return 1; + case org_apache_arrow_flatbuf_Type_Struct_: return 1; + case org_apache_arrow_flatbuf_Type_Union: return 1; + case org_apache_arrow_flatbuf_Type_FixedSizeBinary: return 1; + case org_apache_arrow_flatbuf_Type_FixedSizeList: return 1; + case org_apache_arrow_flatbuf_Type_Map: return 1; + case org_apache_arrow_flatbuf_Type_Duration: return 1; + case org_apache_arrow_flatbuf_Type_LargeBinary: return 1; + case org_apache_arrow_flatbuf_Type_LargeUtf8: return 1; + case org_apache_arrow_flatbuf_Type_LargeList: return 1; + case org_apache_arrow_flatbuf_Type_RunEndEncoded: return 1; + case org_apache_arrow_flatbuf_Type_BinaryView: return 1; + case org_apache_arrow_flatbuf_Type_Utf8View: return 1; + case org_apache_arrow_flatbuf_Type_ListView: return 1; + case org_apache_arrow_flatbuf_Type_LargeListView: return 1; + default: return 0; + } +} + + +struct org_apache_arrow_flatbuf_KeyValue_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_KeyValue_vec_len(org_apache_arrow_flatbuf_KeyValue_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_KeyValue_table_t org_apache_arrow_flatbuf_KeyValue_vec_at(org_apache_arrow_flatbuf_KeyValue_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_KeyValue_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_KeyValue) + +__flatbuffers_define_string_field(0, org_apache_arrow_flatbuf_KeyValue, key, 0) +__flatbuffers_define_string_field(1, org_apache_arrow_flatbuf_KeyValue, value, 0) + +struct org_apache_arrow_flatbuf_DictionaryEncoding_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_DictionaryEncoding_vec_len(org_apache_arrow_flatbuf_DictionaryEncoding_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_DictionaryEncoding_table_t org_apache_arrow_flatbuf_DictionaryEncoding_vec_at(org_apache_arrow_flatbuf_DictionaryEncoding_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_DictionaryEncoding_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_DictionaryEncoding) + +/** The known dictionary id in the application where this data is used. In + * the file or streaming formats, the dictionary ids are found in the + * DictionaryBatch messages */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_DictionaryEncoding, id, flatbuffers_int64, int64_t, INT64_C(0)) +/** The dictionary indices are constrained to be non-negative integers. If + * this field is null, the indices must be signed int32. To maximize + * cross-language compatibility and performance, implementations are + * recommended to prefer signed integer types over unsigned integer types + * and to avoid uint64 indices unless they are required by an application. */ +__flatbuffers_define_table_field(1, org_apache_arrow_flatbuf_DictionaryEncoding, indexType, org_apache_arrow_flatbuf_Int_table_t, 0) +/** By default, dictionaries are not ordered, or the order does not have + * semantic meaning. In some statistical, applications, dictionary-encoding + * is used to represent ordered categorical data, and we provide a way to + * preserve that metadata here */ +__flatbuffers_define_scalar_field(2, org_apache_arrow_flatbuf_DictionaryEncoding, isOrdered, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) +__flatbuffers_define_scalar_field(3, org_apache_arrow_flatbuf_DictionaryEncoding, dictionaryKind, org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t, INT16_C(0)) + +/** ---------------------------------------------------------------------- + * A field represents a named column in a record / row batch or child of a + * nested type. */ +struct org_apache_arrow_flatbuf_Field_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Field_vec_len(org_apache_arrow_flatbuf_Field_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Field_table_t org_apache_arrow_flatbuf_Field_vec_at(org_apache_arrow_flatbuf_Field_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Field_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Field) + +/** Name is not required, in i.e. a List */ +__flatbuffers_define_string_field(0, org_apache_arrow_flatbuf_Field, name, 0) +/** Whether or not this field can contain nulls. Should be true in general. */ +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Field, nullable, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) +/** This is the type of the decoded value if the field is dictionary encoded. */ +__flatbuffers_define_union_field(flatbuffers_, 3, org_apache_arrow_flatbuf_Field, type, org_apache_arrow_flatbuf_Type, 0) +/** Present only if the field is dictionary encoded. */ +__flatbuffers_define_table_field(4, org_apache_arrow_flatbuf_Field, dictionary, org_apache_arrow_flatbuf_DictionaryEncoding_table_t, 0) +/** children apply only to nested data types like Struct, List and Union. For + * primitive types children will have length 0. */ +__flatbuffers_define_vector_field(5, org_apache_arrow_flatbuf_Field, children, org_apache_arrow_flatbuf_Field_vec_t, 0) +/** User-defined metadata */ +__flatbuffers_define_vector_field(6, org_apache_arrow_flatbuf_Field, custom_metadata, org_apache_arrow_flatbuf_KeyValue_vec_t, 0) + +/** ---------------------------------------------------------------------- + * A Schema describes the columns in a row batch */ +struct org_apache_arrow_flatbuf_Schema_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Schema_vec_len(org_apache_arrow_flatbuf_Schema_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Schema_table_t org_apache_arrow_flatbuf_Schema_vec_at(org_apache_arrow_flatbuf_Schema_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Schema_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Schema) + +/** endianness of the buffer + * it is Little Endian by default + * if endianness doesn't match the underlying system then the vectors need to be converted */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Schema, endianness, org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t, INT16_C(0)) +__flatbuffers_define_vector_field(1, org_apache_arrow_flatbuf_Schema, fields, org_apache_arrow_flatbuf_Field_vec_t, 0) +__flatbuffers_define_vector_field(2, org_apache_arrow_flatbuf_Schema, custom_metadata, org_apache_arrow_flatbuf_KeyValue_vec_t, 0) +/** Features used in the stream/file. */ +__flatbuffers_define_vector_field(3, org_apache_arrow_flatbuf_Schema, features, org_apache_arrow_flatbuf_Feature_vec_t, 0) + + +#include "flatcc/flatcc_epilogue.h" +#endif /* SCHEMA_READER_H */ +#ifndef SCHEMA_BUILDER_H +#define SCHEMA_BUILDER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef SCHEMA_READER_H +#include "Schema_reader.h" +#endif +#ifndef FLATBUFFERS_COMMON_BUILDER_H +#include "flatbuffers_common_builder.h" +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + +#define __org_apache_arrow_flatbuf_MetadataVersion_formal_args , org_apache_arrow_flatbuf_MetadataVersion_enum_t v0 +#define __org_apache_arrow_flatbuf_MetadataVersion_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_MetadataVersion, org_apache_arrow_flatbuf_MetadataVersion_enum_t) +#define __org_apache_arrow_flatbuf_Feature_formal_args , org_apache_arrow_flatbuf_Feature_enum_t v0 +#define __org_apache_arrow_flatbuf_Feature_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_Feature, org_apache_arrow_flatbuf_Feature_enum_t) +#define __org_apache_arrow_flatbuf_UnionMode_formal_args , org_apache_arrow_flatbuf_UnionMode_enum_t v0 +#define __org_apache_arrow_flatbuf_UnionMode_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t) +#define __org_apache_arrow_flatbuf_Precision_formal_args , org_apache_arrow_flatbuf_Precision_enum_t v0 +#define __org_apache_arrow_flatbuf_Precision_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t) +#define __org_apache_arrow_flatbuf_DateUnit_formal_args , org_apache_arrow_flatbuf_DateUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_DateUnit_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t) +#define __org_apache_arrow_flatbuf_TimeUnit_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_TimeUnit_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t) +#define __org_apache_arrow_flatbuf_IntervalUnit_formal_args , org_apache_arrow_flatbuf_IntervalUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_IntervalUnit_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t) +#define __org_apache_arrow_flatbuf_DictionaryKind_formal_args , org_apache_arrow_flatbuf_DictionaryKind_enum_t v0 +#define __org_apache_arrow_flatbuf_DictionaryKind_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t) +#define __org_apache_arrow_flatbuf_Endianness_formal_args , org_apache_arrow_flatbuf_Endianness_enum_t v0 +#define __org_apache_arrow_flatbuf_Endianness_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t) + +#define __org_apache_arrow_flatbuf_Buffer_formal_args , int64_t v0, int64_t v1 +#define __org_apache_arrow_flatbuf_Buffer_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_assign(org_apache_arrow_flatbuf_Buffer_t *p, int64_t v0, int64_t v1) +{ p->offset = v0; p->length = v1; + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_copy(org_apache_arrow_flatbuf_Buffer_t *p, const org_apache_arrow_flatbuf_Buffer_t *p2) +{ p->offset = p2->offset; p->length = p2->length; + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_assign_to_pe(org_apache_arrow_flatbuf_Buffer_t *p, int64_t v0, int64_t v1) +{ flatbuffers_int64_assign_to_pe(&p->offset, v0); flatbuffers_int64_assign_to_pe(&p->length, v1); + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_copy_to_pe(org_apache_arrow_flatbuf_Buffer_t *p, const org_apache_arrow_flatbuf_Buffer_t *p2) +{ flatbuffers_int64_copy_to_pe(&p->offset, &p2->offset); flatbuffers_int64_copy_to_pe(&p->length, &p2->length); + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_assign_from_pe(org_apache_arrow_flatbuf_Buffer_t *p, int64_t v0, int64_t v1) +{ flatbuffers_int64_assign_from_pe(&p->offset, v0); flatbuffers_int64_assign_from_pe(&p->length, v1); + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_copy_from_pe(org_apache_arrow_flatbuf_Buffer_t *p, const org_apache_arrow_flatbuf_Buffer_t *p2) +{ flatbuffers_int64_copy_from_pe(&p->offset, &p2->offset); flatbuffers_int64_copy_from_pe(&p->length, &p2->length); + return p; } +__flatbuffers_build_struct(flatbuffers_, org_apache_arrow_flatbuf_Buffer, 16, 8, org_apache_arrow_flatbuf_Buffer_file_identifier, org_apache_arrow_flatbuf_Buffer_type_identifier) +__flatbuffers_define_fixed_array_primitives(flatbuffers_, org_apache_arrow_flatbuf_Buffer, org_apache_arrow_flatbuf_Buffer_t) + +typedef flatbuffers_union_ref_t org_apache_arrow_flatbuf_Type_union_ref_t; +typedef flatbuffers_union_vec_ref_t org_apache_arrow_flatbuf_Type_union_vec_ref_t; +static org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Type_union_t t); + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Null_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Null_ref_t; +static org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Null_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Null, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Struct__required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Struct__ref_t; +static org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Struct__table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Struct_, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_List_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_List_ref_t; +static org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_List_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_List, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeList_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeList_ref_t; +static org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeList_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeList, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_ListView_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_ListView_ref_t; +static org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_ListView_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_ListView, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeListView_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeListView_ref_t; +static org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeListView_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeListView, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_FixedSizeList_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_FixedSizeList_ref_t; +static org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeList_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeList, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Map_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Map_ref_t; +static org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Map_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Map, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Union_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Union_ref_t; +static org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Union_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Union, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Int_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Int_ref_t; +static org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Int_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Int, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_FloatingPoint_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_FloatingPoint_ref_t; +static org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FloatingPoint_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_FloatingPoint, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Utf8_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Utf8_ref_t; +static org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Utf8, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Binary_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Binary_ref_t; +static org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Binary_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Binary, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeUtf8_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeUtf8_ref_t; +static org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeUtf8_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeUtf8, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeBinary_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeBinary_ref_t; +static org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeBinary_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeBinary, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Utf8View_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Utf8View_ref_t; +static org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8View_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Utf8View, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_BinaryView_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_BinaryView_ref_t; +static org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_BinaryView_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_BinaryView, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_FixedSizeBinary_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_ref_t; +static org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeBinary_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeBinary, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Bool_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Bool_ref_t; +static org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Bool_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Bool, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_RunEndEncoded_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_RunEndEncoded_ref_t; +static org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_RunEndEncoded_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_RunEndEncoded, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Decimal_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Decimal_ref_t; +static org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Decimal_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Decimal, 3) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Date_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Date_ref_t; +static org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Date_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Date, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Time_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Time_ref_t; +static org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Time_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Time, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Timestamp_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Timestamp_ref_t; +static org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Timestamp_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Timestamp, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Interval_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Interval_ref_t; +static org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Interval_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Interval, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Duration_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Duration_ref_t; +static org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Duration_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Duration, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_KeyValue_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_KeyValue_ref_t; +static org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_KeyValue_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_KeyValue, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_DictionaryEncoding_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_ref_t; +static org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_DictionaryEncoding_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding, 4) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Field_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Field_ref_t; +static org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Field_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Field, 7) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Schema_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Schema_ref_t; +static org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Schema_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Schema, 4) + +#define __org_apache_arrow_flatbuf_Null_formal_args +#define __org_apache_arrow_flatbuf_Null_call_args +static inline org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Null_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Null, org_apache_arrow_flatbuf_Null_file_identifier, org_apache_arrow_flatbuf_Null_type_identifier) + +#define __org_apache_arrow_flatbuf_Struct__formal_args +#define __org_apache_arrow_flatbuf_Struct__call_args +static inline org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Struct__formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Struct_, org_apache_arrow_flatbuf_Struct__file_identifier, org_apache_arrow_flatbuf_Struct__type_identifier) + +#define __org_apache_arrow_flatbuf_List_formal_args +#define __org_apache_arrow_flatbuf_List_call_args +static inline org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_List_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_List, org_apache_arrow_flatbuf_List_file_identifier, org_apache_arrow_flatbuf_List_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeList_formal_args +#define __org_apache_arrow_flatbuf_LargeList_call_args +static inline org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeList_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeList, org_apache_arrow_flatbuf_LargeList_file_identifier, org_apache_arrow_flatbuf_LargeList_type_identifier) + +#define __org_apache_arrow_flatbuf_ListView_formal_args +#define __org_apache_arrow_flatbuf_ListView_call_args +static inline org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_ListView_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_ListView, org_apache_arrow_flatbuf_ListView_file_identifier, org_apache_arrow_flatbuf_ListView_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeListView_formal_args +#define __org_apache_arrow_flatbuf_LargeListView_call_args +static inline org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeListView_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeListView, org_apache_arrow_flatbuf_LargeListView_file_identifier, org_apache_arrow_flatbuf_LargeListView_type_identifier) + +#define __org_apache_arrow_flatbuf_FixedSizeList_formal_args , int32_t v0 +#define __org_apache_arrow_flatbuf_FixedSizeList_call_args , v0 +static inline org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeList_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeList, org_apache_arrow_flatbuf_FixedSizeList_file_identifier, org_apache_arrow_flatbuf_FixedSizeList_type_identifier) + +#define __org_apache_arrow_flatbuf_Map_formal_args , flatbuffers_bool_t v0 +#define __org_apache_arrow_flatbuf_Map_call_args , v0 +static inline org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Map_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Map, org_apache_arrow_flatbuf_Map_file_identifier, org_apache_arrow_flatbuf_Map_type_identifier) + +#define __org_apache_arrow_flatbuf_Union_formal_args , org_apache_arrow_flatbuf_UnionMode_enum_t v0, flatbuffers_int32_vec_ref_t v1 +#define __org_apache_arrow_flatbuf_Union_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Union_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Union, org_apache_arrow_flatbuf_Union_file_identifier, org_apache_arrow_flatbuf_Union_type_identifier) + +#define __org_apache_arrow_flatbuf_Int_formal_args , int32_t v0, flatbuffers_bool_t v1 +#define __org_apache_arrow_flatbuf_Int_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Int_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_Int_file_identifier, org_apache_arrow_flatbuf_Int_type_identifier) + +#define __org_apache_arrow_flatbuf_FloatingPoint_formal_args , org_apache_arrow_flatbuf_Precision_enum_t v0 +#define __org_apache_arrow_flatbuf_FloatingPoint_call_args , v0 +static inline org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FloatingPoint_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_FloatingPoint, org_apache_arrow_flatbuf_FloatingPoint_file_identifier, org_apache_arrow_flatbuf_FloatingPoint_type_identifier) + +#define __org_apache_arrow_flatbuf_Utf8_formal_args +#define __org_apache_arrow_flatbuf_Utf8_call_args +static inline org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Utf8, org_apache_arrow_flatbuf_Utf8_file_identifier, org_apache_arrow_flatbuf_Utf8_type_identifier) + +#define __org_apache_arrow_flatbuf_Binary_formal_args +#define __org_apache_arrow_flatbuf_Binary_call_args +static inline org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Binary_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Binary, org_apache_arrow_flatbuf_Binary_file_identifier, org_apache_arrow_flatbuf_Binary_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeUtf8_formal_args +#define __org_apache_arrow_flatbuf_LargeUtf8_call_args +static inline org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeUtf8_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeUtf8, org_apache_arrow_flatbuf_LargeUtf8_file_identifier, org_apache_arrow_flatbuf_LargeUtf8_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeBinary_formal_args +#define __org_apache_arrow_flatbuf_LargeBinary_call_args +static inline org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeBinary_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeBinary, org_apache_arrow_flatbuf_LargeBinary_file_identifier, org_apache_arrow_flatbuf_LargeBinary_type_identifier) + +#define __org_apache_arrow_flatbuf_Utf8View_formal_args +#define __org_apache_arrow_flatbuf_Utf8View_call_args +static inline org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8View_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Utf8View, org_apache_arrow_flatbuf_Utf8View_file_identifier, org_apache_arrow_flatbuf_Utf8View_type_identifier) + +#define __org_apache_arrow_flatbuf_BinaryView_formal_args +#define __org_apache_arrow_flatbuf_BinaryView_call_args +static inline org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_BinaryView_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_BinaryView, org_apache_arrow_flatbuf_BinaryView_file_identifier, org_apache_arrow_flatbuf_BinaryView_type_identifier) + +#define __org_apache_arrow_flatbuf_FixedSizeBinary_formal_args , int32_t v0 +#define __org_apache_arrow_flatbuf_FixedSizeBinary_call_args , v0 +static inline org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeBinary_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeBinary, org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier, org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier) + +#define __org_apache_arrow_flatbuf_Bool_formal_args +#define __org_apache_arrow_flatbuf_Bool_call_args +static inline org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Bool_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Bool, org_apache_arrow_flatbuf_Bool_file_identifier, org_apache_arrow_flatbuf_Bool_type_identifier) + +#define __org_apache_arrow_flatbuf_RunEndEncoded_formal_args +#define __org_apache_arrow_flatbuf_RunEndEncoded_call_args +static inline org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_RunEndEncoded_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_RunEndEncoded, org_apache_arrow_flatbuf_RunEndEncoded_file_identifier, org_apache_arrow_flatbuf_RunEndEncoded_type_identifier) + +#define __org_apache_arrow_flatbuf_Decimal_formal_args , int32_t v0, int32_t v1, int32_t v2 +#define __org_apache_arrow_flatbuf_Decimal_call_args , v0, v1, v2 +static inline org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Decimal_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Decimal, org_apache_arrow_flatbuf_Decimal_file_identifier, org_apache_arrow_flatbuf_Decimal_type_identifier) + +#define __org_apache_arrow_flatbuf_Date_formal_args , org_apache_arrow_flatbuf_DateUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_Date_call_args , v0 +static inline org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Date_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Date, org_apache_arrow_flatbuf_Date_file_identifier, org_apache_arrow_flatbuf_Date_type_identifier) + +#define __org_apache_arrow_flatbuf_Time_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0, int32_t v1 +#define __org_apache_arrow_flatbuf_Time_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Time_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Time, org_apache_arrow_flatbuf_Time_file_identifier, org_apache_arrow_flatbuf_Time_type_identifier) + +#define __org_apache_arrow_flatbuf_Timestamp_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0, flatbuffers_string_ref_t v1 +#define __org_apache_arrow_flatbuf_Timestamp_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Timestamp_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Timestamp, org_apache_arrow_flatbuf_Timestamp_file_identifier, org_apache_arrow_flatbuf_Timestamp_type_identifier) + +#define __org_apache_arrow_flatbuf_Interval_formal_args , org_apache_arrow_flatbuf_IntervalUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_Interval_call_args , v0 +static inline org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Interval_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Interval, org_apache_arrow_flatbuf_Interval_file_identifier, org_apache_arrow_flatbuf_Interval_type_identifier) + +#define __org_apache_arrow_flatbuf_Duration_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_Duration_call_args , v0 +static inline org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Duration_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Duration, org_apache_arrow_flatbuf_Duration_file_identifier, org_apache_arrow_flatbuf_Duration_type_identifier) + +#define __org_apache_arrow_flatbuf_KeyValue_formal_args , flatbuffers_string_ref_t v0, flatbuffers_string_ref_t v1 +#define __org_apache_arrow_flatbuf_KeyValue_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_KeyValue_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_KeyValue, org_apache_arrow_flatbuf_KeyValue_file_identifier, org_apache_arrow_flatbuf_KeyValue_type_identifier) + +#define __org_apache_arrow_flatbuf_DictionaryEncoding_formal_args , int64_t v0, org_apache_arrow_flatbuf_Int_ref_t v1, flatbuffers_bool_t v2, org_apache_arrow_flatbuf_DictionaryKind_enum_t v3 +#define __org_apache_arrow_flatbuf_DictionaryEncoding_call_args , v0, v1, v2, v3 +static inline org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_DictionaryEncoding_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding, org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier, org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier) + +#define __org_apache_arrow_flatbuf_Field_formal_args ,\ + flatbuffers_string_ref_t v0, flatbuffers_bool_t v1, org_apache_arrow_flatbuf_Type_union_ref_t v3, org_apache_arrow_flatbuf_DictionaryEncoding_ref_t v4, org_apache_arrow_flatbuf_Field_vec_ref_t v5, org_apache_arrow_flatbuf_KeyValue_vec_ref_t v6 +#define __org_apache_arrow_flatbuf_Field_call_args ,\ + v0, v1, v3, v4, v5, v6 +static inline org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Field_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Field, org_apache_arrow_flatbuf_Field_file_identifier, org_apache_arrow_flatbuf_Field_type_identifier) + +#define __org_apache_arrow_flatbuf_Schema_formal_args , org_apache_arrow_flatbuf_Endianness_enum_t v0, org_apache_arrow_flatbuf_Field_vec_ref_t v1, org_apache_arrow_flatbuf_KeyValue_vec_ref_t v2, org_apache_arrow_flatbuf_Feature_vec_ref_t v3 +#define __org_apache_arrow_flatbuf_Schema_call_args , v0, v1, v2, v3 +static inline org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Schema_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Schema, org_apache_arrow_flatbuf_Schema_file_identifier, org_apache_arrow_flatbuf_Schema_type_identifier) + +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_NONE(void) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_NONE; uref.value = 0; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Null(org_apache_arrow_flatbuf_Null_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Null; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Int(org_apache_arrow_flatbuf_Int_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Int; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_FloatingPoint(org_apache_arrow_flatbuf_FloatingPoint_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_FloatingPoint; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Binary(org_apache_arrow_flatbuf_Binary_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Binary; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Utf8(org_apache_arrow_flatbuf_Utf8_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Utf8; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Bool(org_apache_arrow_flatbuf_Bool_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Bool; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Decimal(org_apache_arrow_flatbuf_Decimal_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Decimal; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Date(org_apache_arrow_flatbuf_Date_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Date; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Time(org_apache_arrow_flatbuf_Time_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Time; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Timestamp(org_apache_arrow_flatbuf_Timestamp_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Timestamp; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Interval(org_apache_arrow_flatbuf_Interval_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Interval; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_List(org_apache_arrow_flatbuf_List_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_List; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Struct_(org_apache_arrow_flatbuf_Struct__ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Struct_; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Union(org_apache_arrow_flatbuf_Union_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Union; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_FixedSizeBinary(org_apache_arrow_flatbuf_FixedSizeBinary_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_FixedSizeBinary; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_FixedSizeList(org_apache_arrow_flatbuf_FixedSizeList_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_FixedSizeList; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Map(org_apache_arrow_flatbuf_Map_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Map; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Duration(org_apache_arrow_flatbuf_Duration_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Duration; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeBinary(org_apache_arrow_flatbuf_LargeBinary_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeBinary; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeUtf8(org_apache_arrow_flatbuf_LargeUtf8_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeUtf8; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeList(org_apache_arrow_flatbuf_LargeList_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeList; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_RunEndEncoded(org_apache_arrow_flatbuf_RunEndEncoded_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_RunEndEncoded; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_BinaryView(org_apache_arrow_flatbuf_BinaryView_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_BinaryView; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Utf8View(org_apache_arrow_flatbuf_Utf8View_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Utf8View; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_ListView(org_apache_arrow_flatbuf_ListView_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_ListView; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeListView(org_apache_arrow_flatbuf_LargeListView_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeListView; uref.value = ref; return uref; } +__flatbuffers_build_union_vector(flatbuffers_, org_apache_arrow_flatbuf_Type) + +static org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Type_union_t u) +{ + switch (u.type) { + case 1: return org_apache_arrow_flatbuf_Type_as_Null(org_apache_arrow_flatbuf_Null_clone(B, (org_apache_arrow_flatbuf_Null_table_t)u.value)); + case 2: return org_apache_arrow_flatbuf_Type_as_Int(org_apache_arrow_flatbuf_Int_clone(B, (org_apache_arrow_flatbuf_Int_table_t)u.value)); + case 3: return org_apache_arrow_flatbuf_Type_as_FloatingPoint(org_apache_arrow_flatbuf_FloatingPoint_clone(B, (org_apache_arrow_flatbuf_FloatingPoint_table_t)u.value)); + case 4: return org_apache_arrow_flatbuf_Type_as_Binary(org_apache_arrow_flatbuf_Binary_clone(B, (org_apache_arrow_flatbuf_Binary_table_t)u.value)); + case 5: return org_apache_arrow_flatbuf_Type_as_Utf8(org_apache_arrow_flatbuf_Utf8_clone(B, (org_apache_arrow_flatbuf_Utf8_table_t)u.value)); + case 6: return org_apache_arrow_flatbuf_Type_as_Bool(org_apache_arrow_flatbuf_Bool_clone(B, (org_apache_arrow_flatbuf_Bool_table_t)u.value)); + case 7: return org_apache_arrow_flatbuf_Type_as_Decimal(org_apache_arrow_flatbuf_Decimal_clone(B, (org_apache_arrow_flatbuf_Decimal_table_t)u.value)); + case 8: return org_apache_arrow_flatbuf_Type_as_Date(org_apache_arrow_flatbuf_Date_clone(B, (org_apache_arrow_flatbuf_Date_table_t)u.value)); + case 9: return org_apache_arrow_flatbuf_Type_as_Time(org_apache_arrow_flatbuf_Time_clone(B, (org_apache_arrow_flatbuf_Time_table_t)u.value)); + case 10: return org_apache_arrow_flatbuf_Type_as_Timestamp(org_apache_arrow_flatbuf_Timestamp_clone(B, (org_apache_arrow_flatbuf_Timestamp_table_t)u.value)); + case 11: return org_apache_arrow_flatbuf_Type_as_Interval(org_apache_arrow_flatbuf_Interval_clone(B, (org_apache_arrow_flatbuf_Interval_table_t)u.value)); + case 12: return org_apache_arrow_flatbuf_Type_as_List(org_apache_arrow_flatbuf_List_clone(B, (org_apache_arrow_flatbuf_List_table_t)u.value)); + case 13: return org_apache_arrow_flatbuf_Type_as_Struct_(org_apache_arrow_flatbuf_Struct__clone(B, (org_apache_arrow_flatbuf_Struct__table_t)u.value)); + case 14: return org_apache_arrow_flatbuf_Type_as_Union(org_apache_arrow_flatbuf_Union_clone(B, (org_apache_arrow_flatbuf_Union_table_t)u.value)); + case 15: return org_apache_arrow_flatbuf_Type_as_FixedSizeBinary(org_apache_arrow_flatbuf_FixedSizeBinary_clone(B, (org_apache_arrow_flatbuf_FixedSizeBinary_table_t)u.value)); + case 16: return org_apache_arrow_flatbuf_Type_as_FixedSizeList(org_apache_arrow_flatbuf_FixedSizeList_clone(B, (org_apache_arrow_flatbuf_FixedSizeList_table_t)u.value)); + case 17: return org_apache_arrow_flatbuf_Type_as_Map(org_apache_arrow_flatbuf_Map_clone(B, (org_apache_arrow_flatbuf_Map_table_t)u.value)); + case 18: return org_apache_arrow_flatbuf_Type_as_Duration(org_apache_arrow_flatbuf_Duration_clone(B, (org_apache_arrow_flatbuf_Duration_table_t)u.value)); + case 19: return org_apache_arrow_flatbuf_Type_as_LargeBinary(org_apache_arrow_flatbuf_LargeBinary_clone(B, (org_apache_arrow_flatbuf_LargeBinary_table_t)u.value)); + case 20: return org_apache_arrow_flatbuf_Type_as_LargeUtf8(org_apache_arrow_flatbuf_LargeUtf8_clone(B, (org_apache_arrow_flatbuf_LargeUtf8_table_t)u.value)); + case 21: return org_apache_arrow_flatbuf_Type_as_LargeList(org_apache_arrow_flatbuf_LargeList_clone(B, (org_apache_arrow_flatbuf_LargeList_table_t)u.value)); + case 22: return org_apache_arrow_flatbuf_Type_as_RunEndEncoded(org_apache_arrow_flatbuf_RunEndEncoded_clone(B, (org_apache_arrow_flatbuf_RunEndEncoded_table_t)u.value)); + case 23: return org_apache_arrow_flatbuf_Type_as_BinaryView(org_apache_arrow_flatbuf_BinaryView_clone(B, (org_apache_arrow_flatbuf_BinaryView_table_t)u.value)); + case 24: return org_apache_arrow_flatbuf_Type_as_Utf8View(org_apache_arrow_flatbuf_Utf8View_clone(B, (org_apache_arrow_flatbuf_Utf8View_table_t)u.value)); + case 25: return org_apache_arrow_flatbuf_Type_as_ListView(org_apache_arrow_flatbuf_ListView_clone(B, (org_apache_arrow_flatbuf_ListView_table_t)u.value)); + case 26: return org_apache_arrow_flatbuf_Type_as_LargeListView(org_apache_arrow_flatbuf_LargeListView_clone(B, (org_apache_arrow_flatbuf_LargeListView_table_t)u.value)); + default: return org_apache_arrow_flatbuf_Type_as_NONE(); + } +} + + +static inline org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Null_formal_args) +{ + if (org_apache_arrow_flatbuf_Null_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Null_end(B); +} + +static org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Null_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Null_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Null_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Struct__formal_args) +{ + if (org_apache_arrow_flatbuf_Struct__start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Struct__end(B); +} + +static org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Struct__table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Struct__start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Struct__end(B)); +} + + +static inline org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_List_formal_args) +{ + if (org_apache_arrow_flatbuf_List_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_List_end(B); +} + +static org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_List_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_List_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_List_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeList_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeList_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeList_end(B); +} + +static org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeList_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeList_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeList_end(B)); +} + + +static inline org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_ListView_formal_args) +{ + if (org_apache_arrow_flatbuf_ListView_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_ListView_end(B); +} + +static org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_ListView_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_ListView_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_ListView_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeListView_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeListView_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeListView_end(B); +} + +static org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeListView_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeListView_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeListView_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_FixedSizeList_listSize, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_FixedSizeList) + +static inline org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeList_formal_args) +{ + if (org_apache_arrow_flatbuf_FixedSizeList_start(B) + || org_apache_arrow_flatbuf_FixedSizeList_listSize_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_FixedSizeList_end(B); +} + +static org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeList_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_FixedSizeList_start(B) + || org_apache_arrow_flatbuf_FixedSizeList_listSize_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_FixedSizeList_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Map_keysSorted, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_Map) + +static inline org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Map_formal_args) +{ + if (org_apache_arrow_flatbuf_Map_start(B) + || org_apache_arrow_flatbuf_Map_keysSorted_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Map_end(B); +} + +static org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Map_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Map_start(B) + || org_apache_arrow_flatbuf_Map_keysSorted_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Map_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Union_mode, org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Union) +__flatbuffers_build_vector_field(1, flatbuffers_, org_apache_arrow_flatbuf_Union_typeIds, flatbuffers_int32, int32_t, org_apache_arrow_flatbuf_Union) + +static inline org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Union_formal_args) +{ + if (org_apache_arrow_flatbuf_Union_start(B) + || org_apache_arrow_flatbuf_Union_typeIds_add(B, v1) + || org_apache_arrow_flatbuf_Union_mode_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Union_end(B); +} + +static org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Union_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Union_start(B) + || org_apache_arrow_flatbuf_Union_typeIds_pick(B, t) + || org_apache_arrow_flatbuf_Union_mode_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Union_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Int_bitWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_Int) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Int_is_signed, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_Int) + +static inline org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Int_formal_args) +{ + if (org_apache_arrow_flatbuf_Int_start(B) + || org_apache_arrow_flatbuf_Int_bitWidth_add(B, v0) + || org_apache_arrow_flatbuf_Int_is_signed_add(B, v1)) { + return 0; + } + return org_apache_arrow_flatbuf_Int_end(B); +} + +static org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Int_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Int_start(B) + || org_apache_arrow_flatbuf_Int_bitWidth_pick(B, t) + || org_apache_arrow_flatbuf_Int_is_signed_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Int_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_FloatingPoint_precision, org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_FloatingPoint) + +static inline org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FloatingPoint_formal_args) +{ + if (org_apache_arrow_flatbuf_FloatingPoint_start(B) + || org_apache_arrow_flatbuf_FloatingPoint_precision_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_FloatingPoint_end(B); +} + +static org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FloatingPoint_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_FloatingPoint_start(B) + || org_apache_arrow_flatbuf_FloatingPoint_precision_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_FloatingPoint_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8_formal_args) +{ + if (org_apache_arrow_flatbuf_Utf8_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Utf8_end(B); +} + +static org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Utf8_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Utf8_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Binary_formal_args) +{ + if (org_apache_arrow_flatbuf_Binary_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Binary_end(B); +} + +static org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Binary_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Binary_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Binary_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeUtf8_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeUtf8_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeUtf8_end(B); +} + +static org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeUtf8_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeUtf8_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeUtf8_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeBinary_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeBinary_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeBinary_end(B); +} + +static org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeBinary_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeBinary_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeBinary_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8View_formal_args) +{ + if (org_apache_arrow_flatbuf_Utf8View_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Utf8View_end(B); +} + +static org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8View_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Utf8View_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Utf8View_end(B)); +} + + +static inline org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_BinaryView_formal_args) +{ + if (org_apache_arrow_flatbuf_BinaryView_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_BinaryView_end(B); +} + +static org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_BinaryView_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_BinaryView_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_BinaryView_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_FixedSizeBinary_byteWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_FixedSizeBinary) + +static inline org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeBinary_formal_args) +{ + if (org_apache_arrow_flatbuf_FixedSizeBinary_start(B) + || org_apache_arrow_flatbuf_FixedSizeBinary_byteWidth_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_FixedSizeBinary_end(B); +} + +static org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeBinary_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_FixedSizeBinary_start(B) + || org_apache_arrow_flatbuf_FixedSizeBinary_byteWidth_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_FixedSizeBinary_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Bool_formal_args) +{ + if (org_apache_arrow_flatbuf_Bool_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Bool_end(B); +} + +static org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Bool_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Bool_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Bool_end(B)); +} + + +static inline org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_RunEndEncoded_formal_args) +{ + if (org_apache_arrow_flatbuf_RunEndEncoded_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_RunEndEncoded_end(B); +} + +static org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_RunEndEncoded_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_RunEndEncoded_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_RunEndEncoded_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Decimal_precision, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Decimal_scale, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_scalar_field(2, flatbuffers_, org_apache_arrow_flatbuf_Decimal_bitWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(128), org_apache_arrow_flatbuf_Decimal) + +static inline org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Decimal_formal_args) +{ + if (org_apache_arrow_flatbuf_Decimal_start(B) + || org_apache_arrow_flatbuf_Decimal_precision_add(B, v0) + || org_apache_arrow_flatbuf_Decimal_scale_add(B, v1) + || org_apache_arrow_flatbuf_Decimal_bitWidth_add(B, v2)) { + return 0; + } + return org_apache_arrow_flatbuf_Decimal_end(B); +} + +static org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Decimal_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Decimal_start(B) + || org_apache_arrow_flatbuf_Decimal_precision_pick(B, t) + || org_apache_arrow_flatbuf_Decimal_scale_pick(B, t) + || org_apache_arrow_flatbuf_Decimal_bitWidth_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Decimal_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Date_unit, org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t, 2, 2, INT16_C(1), org_apache_arrow_flatbuf_Date) + +static inline org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Date_formal_args) +{ + if (org_apache_arrow_flatbuf_Date_start(B) + || org_apache_arrow_flatbuf_Date_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Date_end(B); +} + +static org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Date_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Date_start(B) + || org_apache_arrow_flatbuf_Date_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Date_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Time_unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 2, 2, INT16_C(1), org_apache_arrow_flatbuf_Time) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Time_bitWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(32), org_apache_arrow_flatbuf_Time) + +static inline org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Time_formal_args) +{ + if (org_apache_arrow_flatbuf_Time_start(B) + || org_apache_arrow_flatbuf_Time_bitWidth_add(B, v1) + || org_apache_arrow_flatbuf_Time_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Time_end(B); +} + +static org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Time_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Time_start(B) + || org_apache_arrow_flatbuf_Time_bitWidth_pick(B, t) + || org_apache_arrow_flatbuf_Time_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Time_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Timestamp_unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Timestamp) +__flatbuffers_build_string_field(1, flatbuffers_, org_apache_arrow_flatbuf_Timestamp_timezone, org_apache_arrow_flatbuf_Timestamp) + +static inline org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Timestamp_formal_args) +{ + if (org_apache_arrow_flatbuf_Timestamp_start(B) + || org_apache_arrow_flatbuf_Timestamp_timezone_add(B, v1) + || org_apache_arrow_flatbuf_Timestamp_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Timestamp_end(B); +} + +static org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Timestamp_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Timestamp_start(B) + || org_apache_arrow_flatbuf_Timestamp_timezone_pick(B, t) + || org_apache_arrow_flatbuf_Timestamp_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Timestamp_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Interval_unit, org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Interval) + +static inline org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Interval_formal_args) +{ + if (org_apache_arrow_flatbuf_Interval_start(B) + || org_apache_arrow_flatbuf_Interval_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Interval_end(B); +} + +static org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Interval_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Interval_start(B) + || org_apache_arrow_flatbuf_Interval_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Interval_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Duration_unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 2, 2, INT16_C(1), org_apache_arrow_flatbuf_Duration) + +static inline org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Duration_formal_args) +{ + if (org_apache_arrow_flatbuf_Duration_start(B) + || org_apache_arrow_flatbuf_Duration_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Duration_end(B); +} + +static org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Duration_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Duration_start(B) + || org_apache_arrow_flatbuf_Duration_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Duration_end(B)); +} + +__flatbuffers_build_string_field(0, flatbuffers_, org_apache_arrow_flatbuf_KeyValue_key, org_apache_arrow_flatbuf_KeyValue) +__flatbuffers_build_string_field(1, flatbuffers_, org_apache_arrow_flatbuf_KeyValue_value, org_apache_arrow_flatbuf_KeyValue) + +static inline org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_KeyValue_formal_args) +{ + if (org_apache_arrow_flatbuf_KeyValue_start(B) + || org_apache_arrow_flatbuf_KeyValue_key_add(B, v0) + || org_apache_arrow_flatbuf_KeyValue_value_add(B, v1)) { + return 0; + } + return org_apache_arrow_flatbuf_KeyValue_end(B); +} + +static org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_KeyValue_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_KeyValue_start(B) + || org_apache_arrow_flatbuf_KeyValue_key_pick(B, t) + || org_apache_arrow_flatbuf_KeyValue_value_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_KeyValue_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_id, flatbuffers_int64, int64_t, 8, 8, INT64_C(0), org_apache_arrow_flatbuf_DictionaryEncoding) +__flatbuffers_build_table_field(1, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_indexType, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_DictionaryEncoding) +__flatbuffers_build_scalar_field(2, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_isOrdered, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_DictionaryEncoding) +__flatbuffers_build_scalar_field(3, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_dictionaryKind, org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_DictionaryEncoding) + +static inline org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_DictionaryEncoding_formal_args) +{ + if (org_apache_arrow_flatbuf_DictionaryEncoding_start(B) + || org_apache_arrow_flatbuf_DictionaryEncoding_id_add(B, v0) + || org_apache_arrow_flatbuf_DictionaryEncoding_indexType_add(B, v1) + || org_apache_arrow_flatbuf_DictionaryEncoding_dictionaryKind_add(B, v3) + || org_apache_arrow_flatbuf_DictionaryEncoding_isOrdered_add(B, v2)) { + return 0; + } + return org_apache_arrow_flatbuf_DictionaryEncoding_end(B); +} + +static org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_DictionaryEncoding_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_DictionaryEncoding_start(B) + || org_apache_arrow_flatbuf_DictionaryEncoding_id_pick(B, t) + || org_apache_arrow_flatbuf_DictionaryEncoding_indexType_pick(B, t) + || org_apache_arrow_flatbuf_DictionaryEncoding_dictionaryKind_pick(B, t) + || org_apache_arrow_flatbuf_DictionaryEncoding_isOrdered_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_DictionaryEncoding_end(B)); +} + +__flatbuffers_build_string_field(0, flatbuffers_, org_apache_arrow_flatbuf_Field_name, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Field_nullable, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_Field) +__flatbuffers_build_union_field(3, flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Null, org_apache_arrow_flatbuf_Null) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Int, org_apache_arrow_flatbuf_Int) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, FloatingPoint, org_apache_arrow_flatbuf_FloatingPoint) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Binary, org_apache_arrow_flatbuf_Binary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Utf8, org_apache_arrow_flatbuf_Utf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Bool, org_apache_arrow_flatbuf_Bool) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Decimal, org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Date, org_apache_arrow_flatbuf_Date) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Time, org_apache_arrow_flatbuf_Time) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Timestamp, org_apache_arrow_flatbuf_Timestamp) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Interval, org_apache_arrow_flatbuf_Interval) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, List, org_apache_arrow_flatbuf_List) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Struct_, org_apache_arrow_flatbuf_Struct_) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Union, org_apache_arrow_flatbuf_Union) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, FixedSizeBinary, org_apache_arrow_flatbuf_FixedSizeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, FixedSizeList, org_apache_arrow_flatbuf_FixedSizeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Map, org_apache_arrow_flatbuf_Map) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Duration, org_apache_arrow_flatbuf_Duration) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeBinary, org_apache_arrow_flatbuf_LargeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeUtf8, org_apache_arrow_flatbuf_LargeUtf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeList, org_apache_arrow_flatbuf_LargeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, RunEndEncoded, org_apache_arrow_flatbuf_RunEndEncoded) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, BinaryView, org_apache_arrow_flatbuf_BinaryView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Utf8View, org_apache_arrow_flatbuf_Utf8View) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, ListView, org_apache_arrow_flatbuf_ListView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeListView, org_apache_arrow_flatbuf_LargeListView) +__flatbuffers_build_table_field(4, flatbuffers_, org_apache_arrow_flatbuf_Field_dictionary, org_apache_arrow_flatbuf_DictionaryEncoding, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_table_vector_field(5, flatbuffers_, org_apache_arrow_flatbuf_Field_children, org_apache_arrow_flatbuf_Field, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_table_vector_field(6, flatbuffers_, org_apache_arrow_flatbuf_Field_custom_metadata, org_apache_arrow_flatbuf_KeyValue, org_apache_arrow_flatbuf_Field) + +static inline org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Field_formal_args) +{ + if (org_apache_arrow_flatbuf_Field_start(B) + || org_apache_arrow_flatbuf_Field_name_add(B, v0) + || org_apache_arrow_flatbuf_Field_type_add_value(B, v3) + || org_apache_arrow_flatbuf_Field_dictionary_add(B, v4) + || org_apache_arrow_flatbuf_Field_children_add(B, v5) + || org_apache_arrow_flatbuf_Field_custom_metadata_add(B, v6) + || org_apache_arrow_flatbuf_Field_nullable_add(B, v1) + || org_apache_arrow_flatbuf_Field_type_add_type(B, v3.type)) { + return 0; + } + return org_apache_arrow_flatbuf_Field_end(B); +} + +static org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Field_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Field_start(B) + || org_apache_arrow_flatbuf_Field_name_pick(B, t) + || org_apache_arrow_flatbuf_Field_type_pick(B, t) + || org_apache_arrow_flatbuf_Field_dictionary_pick(B, t) + || org_apache_arrow_flatbuf_Field_children_pick(B, t) + || org_apache_arrow_flatbuf_Field_custom_metadata_pick(B, t) + || org_apache_arrow_flatbuf_Field_nullable_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Field_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Schema_endianness, org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Schema) +__flatbuffers_build_table_vector_field(1, flatbuffers_, org_apache_arrow_flatbuf_Schema_fields, org_apache_arrow_flatbuf_Field, org_apache_arrow_flatbuf_Schema) +__flatbuffers_build_table_vector_field(2, flatbuffers_, org_apache_arrow_flatbuf_Schema_custom_metadata, org_apache_arrow_flatbuf_KeyValue, org_apache_arrow_flatbuf_Schema) +__flatbuffers_build_vector_field(3, flatbuffers_, org_apache_arrow_flatbuf_Schema_features, org_apache_arrow_flatbuf_Feature, org_apache_arrow_flatbuf_Feature_enum_t, org_apache_arrow_flatbuf_Schema) + +static inline org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Schema_formal_args) +{ + if (org_apache_arrow_flatbuf_Schema_start(B) + || org_apache_arrow_flatbuf_Schema_fields_add(B, v1) + || org_apache_arrow_flatbuf_Schema_custom_metadata_add(B, v2) + || org_apache_arrow_flatbuf_Schema_features_add(B, v3) + || org_apache_arrow_flatbuf_Schema_endianness_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Schema_end(B); +} + +static org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Schema_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Schema_start(B) + || org_apache_arrow_flatbuf_Schema_fields_pick(B, t) + || org_apache_arrow_flatbuf_Schema_custom_metadata_pick(B, t) + || org_apache_arrow_flatbuf_Schema_features_pick(B, t) + || org_apache_arrow_flatbuf_Schema_endianness_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Schema_end(B)); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* SCHEMA_BUILDER_H */ +#ifndef SCHEMA_VERIFIER_H +#define SCHEMA_VERIFIER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef SCHEMA_READER_H +#include "Schema_reader.h" +#endif +#include "flatcc/flatcc_verifier.h" +#include "flatcc/flatcc_prologue.h" + +static int org_apache_arrow_flatbuf_Null_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Struct__verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_List_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeList_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_ListView_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeListView_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_FixedSizeList_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Map_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Union_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Int_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_FloatingPoint_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Utf8_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Binary_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeUtf8_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeBinary_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Utf8View_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_BinaryView_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_FixedSizeBinary_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Bool_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_RunEndEncoded_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Decimal_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Date_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Time_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Timestamp_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Interval_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Duration_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_KeyValue_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_DictionaryEncoding_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Field_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Schema_verify_table(flatcc_table_verifier_descriptor_t *td); + +static int org_apache_arrow_flatbuf_Type_union_verifier(flatcc_union_verifier_descriptor_t *ud) +{ + switch (ud->type) { + case 1: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Null_verify_table); /* Null */ + case 2: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Int_verify_table); /* Int */ + case 3: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_FloatingPoint_verify_table); /* FloatingPoint */ + case 4: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Binary_verify_table); /* Binary */ + case 5: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Utf8_verify_table); /* Utf8 */ + case 6: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Bool_verify_table); /* Bool */ + case 7: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Decimal_verify_table); /* Decimal */ + case 8: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Date_verify_table); /* Date */ + case 9: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Time_verify_table); /* Time */ + case 10: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Timestamp_verify_table); /* Timestamp */ + case 11: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Interval_verify_table); /* Interval */ + case 12: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_List_verify_table); /* List */ + case 13: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Struct__verify_table); /* Struct_ */ + case 14: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Union_verify_table); /* Union */ + case 15: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); /* FixedSizeBinary */ + case 16: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_FixedSizeList_verify_table); /* FixedSizeList */ + case 17: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Map_verify_table); /* Map */ + case 18: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Duration_verify_table); /* Duration */ + case 19: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeBinary_verify_table); /* LargeBinary */ + case 20: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeUtf8_verify_table); /* LargeUtf8 */ + case 21: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeList_verify_table); /* LargeList */ + case 22: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_RunEndEncoded_verify_table); /* RunEndEncoded */ + case 23: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_BinaryView_verify_table); /* BinaryView */ + case 24: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Utf8View_verify_table); /* Utf8View */ + case 25: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_ListView_verify_table); /* ListView */ + case 26: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeListView_verify_table); /* LargeListView */ + default: return flatcc_verify_ok; + } +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_identifier, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_identifier, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_typed_root(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_type_hash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_typed_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_type_hash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_struct_as_typed_root(buf, bufsiz, thash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_struct_as_typed_root_with_size(buf, bufsiz, thash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_struct_as_root(buf, bufsiz, fid, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_struct_as_root_with_size(buf, bufsiz, fid, 16, 8); +} + +static int org_apache_arrow_flatbuf_Null_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Null_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Null_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Null_type_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Null_type_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static int org_apache_arrow_flatbuf_Struct__verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Struct__identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Struct__identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Struct__type_identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Struct__type_identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static int org_apache_arrow_flatbuf_List_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_List_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_List_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_List_type_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_List_type_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_List_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeList_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_type_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_type_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static int org_apache_arrow_flatbuf_ListView_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_ListView_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_ListView_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_ListView_type_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_ListView_type_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeListView_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_type_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_type_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static int org_apache_arrow_flatbuf_FixedSizeList_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* listSize */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_type_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_type_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static int org_apache_arrow_flatbuf_Map_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 1, 1) /* keysSorted */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Map_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Map_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Map_type_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Map_type_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static int org_apache_arrow_flatbuf_Union_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* mode */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 1, 0, 4, 4, INT64_C(1073741823)) /* typeIds */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Union_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Union_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Union_type_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Union_type_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static int org_apache_arrow_flatbuf_Int_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* bitWidth */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 1, 1) /* is_signed */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Int_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Int_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Int_type_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Int_type_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static int org_apache_arrow_flatbuf_FloatingPoint_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* precision */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_type_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_type_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static int org_apache_arrow_flatbuf_Utf8_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_type_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_type_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static int org_apache_arrow_flatbuf_Binary_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Binary_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Binary_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Binary_type_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Binary_type_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeUtf8_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_type_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_type_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeBinary_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_type_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_type_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static int org_apache_arrow_flatbuf_Utf8View_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_type_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_type_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static int org_apache_arrow_flatbuf_BinaryView_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_type_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_type_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static int org_apache_arrow_flatbuf_FixedSizeBinary_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* byteWidth */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static int org_apache_arrow_flatbuf_Bool_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Bool_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Bool_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Bool_type_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Bool_type_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static int org_apache_arrow_flatbuf_RunEndEncoded_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_type_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_type_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static int org_apache_arrow_flatbuf_Decimal_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* precision */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 4, 4) /* scale */)) return ret; + if ((ret = flatcc_verify_field(td, 2, 4, 4) /* bitWidth */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_type_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_type_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static int org_apache_arrow_flatbuf_Date_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Date_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Date_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Date_type_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Date_type_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static int org_apache_arrow_flatbuf_Time_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 4, 4) /* bitWidth */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Time_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Time_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Time_type_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Time_type_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static int org_apache_arrow_flatbuf_Timestamp_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + if ((ret = flatcc_verify_string_field(td, 1, 0) /* timezone */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_type_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_type_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static int org_apache_arrow_flatbuf_Interval_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Interval_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Interval_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Interval_type_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Interval_type_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static int org_apache_arrow_flatbuf_Duration_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Duration_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Duration_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Duration_type_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Duration_type_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static int org_apache_arrow_flatbuf_KeyValue_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_string_field(td, 0, 0) /* key */)) return ret; + if ((ret = flatcc_verify_string_field(td, 1, 0) /* value */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_type_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_type_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static int org_apache_arrow_flatbuf_DictionaryEncoding_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 8, 8) /* id */)) return ret; + if ((ret = flatcc_verify_table_field(td, 1, 0, &org_apache_arrow_flatbuf_Int_verify_table) /* indexType */)) return ret; + if ((ret = flatcc_verify_field(td, 2, 1, 1) /* isOrdered */)) return ret; + if ((ret = flatcc_verify_field(td, 3, 2, 2) /* dictionaryKind */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static int org_apache_arrow_flatbuf_Field_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_string_field(td, 0, 0) /* name */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 1, 1) /* nullable */)) return ret; + if ((ret = flatcc_verify_union_field(td, 3, 0, &org_apache_arrow_flatbuf_Type_union_verifier) /* type */)) return ret; + if ((ret = flatcc_verify_table_field(td, 4, 0, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table) /* dictionary */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 5, 0, &org_apache_arrow_flatbuf_Field_verify_table) /* children */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 6, 0, &org_apache_arrow_flatbuf_KeyValue_verify_table) /* custom_metadata */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Field_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Field_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Field_type_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Field_type_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static int org_apache_arrow_flatbuf_Schema_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* endianness */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 1, 0, &org_apache_arrow_flatbuf_Field_verify_table) /* fields */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 2, 0, &org_apache_arrow_flatbuf_KeyValue_verify_table) /* custom_metadata */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 3, 0, 8, 8, INT64_C(536870911)) /* features */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Schema_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Schema_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Schema_type_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Schema_type_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* SCHEMA_VERIFIER_H */ +#ifndef SCHEMA_READER_H +#define SCHEMA_READER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef FLATBUFFERS_COMMON_READER_H +#include "flatbuffers_common_reader.h" +#endif +#include "flatcc/flatcc_flatbuffers.h" +#ifndef __alignas_is_defined +#include +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + +typedef struct org_apache_arrow_flatbuf_Buffer org_apache_arrow_flatbuf_Buffer_t; +typedef const org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_struct_t; +typedef org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_mutable_struct_t; +typedef const org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_vec_t; +typedef org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_mutable_vec_t; + +typedef const struct org_apache_arrow_flatbuf_Null_table *org_apache_arrow_flatbuf_Null_table_t; +typedef struct org_apache_arrow_flatbuf_Null_table *org_apache_arrow_flatbuf_Null_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Null_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Null_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Struct__table *org_apache_arrow_flatbuf_Struct__table_t; +typedef struct org_apache_arrow_flatbuf_Struct__table *org_apache_arrow_flatbuf_Struct__mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Struct__vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Struct__mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_List_table *org_apache_arrow_flatbuf_List_table_t; +typedef struct org_apache_arrow_flatbuf_List_table *org_apache_arrow_flatbuf_List_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_List_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_List_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeList_table *org_apache_arrow_flatbuf_LargeList_table_t; +typedef struct org_apache_arrow_flatbuf_LargeList_table *org_apache_arrow_flatbuf_LargeList_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeList_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeList_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_ListView_table *org_apache_arrow_flatbuf_ListView_table_t; +typedef struct org_apache_arrow_flatbuf_ListView_table *org_apache_arrow_flatbuf_ListView_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_ListView_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_ListView_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeListView_table *org_apache_arrow_flatbuf_LargeListView_table_t; +typedef struct org_apache_arrow_flatbuf_LargeListView_table *org_apache_arrow_flatbuf_LargeListView_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeListView_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeListView_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_FixedSizeList_table *org_apache_arrow_flatbuf_FixedSizeList_table_t; +typedef struct org_apache_arrow_flatbuf_FixedSizeList_table *org_apache_arrow_flatbuf_FixedSizeList_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeList_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeList_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Map_table *org_apache_arrow_flatbuf_Map_table_t; +typedef struct org_apache_arrow_flatbuf_Map_table *org_apache_arrow_flatbuf_Map_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Map_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Map_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Union_table *org_apache_arrow_flatbuf_Union_table_t; +typedef struct org_apache_arrow_flatbuf_Union_table *org_apache_arrow_flatbuf_Union_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Union_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Union_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Int_table *org_apache_arrow_flatbuf_Int_table_t; +typedef struct org_apache_arrow_flatbuf_Int_table *org_apache_arrow_flatbuf_Int_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Int_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Int_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_FloatingPoint_table *org_apache_arrow_flatbuf_FloatingPoint_table_t; +typedef struct org_apache_arrow_flatbuf_FloatingPoint_table *org_apache_arrow_flatbuf_FloatingPoint_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FloatingPoint_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FloatingPoint_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Utf8_table *org_apache_arrow_flatbuf_Utf8_table_t; +typedef struct org_apache_arrow_flatbuf_Utf8_table *org_apache_arrow_flatbuf_Utf8_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Binary_table *org_apache_arrow_flatbuf_Binary_table_t; +typedef struct org_apache_arrow_flatbuf_Binary_table *org_apache_arrow_flatbuf_Binary_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Binary_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Binary_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeUtf8_table *org_apache_arrow_flatbuf_LargeUtf8_table_t; +typedef struct org_apache_arrow_flatbuf_LargeUtf8_table *org_apache_arrow_flatbuf_LargeUtf8_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeUtf8_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeUtf8_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeBinary_table *org_apache_arrow_flatbuf_LargeBinary_table_t; +typedef struct org_apache_arrow_flatbuf_LargeBinary_table *org_apache_arrow_flatbuf_LargeBinary_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeBinary_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeBinary_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Utf8View_table *org_apache_arrow_flatbuf_Utf8View_table_t; +typedef struct org_apache_arrow_flatbuf_Utf8View_table *org_apache_arrow_flatbuf_Utf8View_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8View_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8View_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_BinaryView_table *org_apache_arrow_flatbuf_BinaryView_table_t; +typedef struct org_apache_arrow_flatbuf_BinaryView_table *org_apache_arrow_flatbuf_BinaryView_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_BinaryView_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_BinaryView_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_FixedSizeBinary_table *org_apache_arrow_flatbuf_FixedSizeBinary_table_t; +typedef struct org_apache_arrow_flatbuf_FixedSizeBinary_table *org_apache_arrow_flatbuf_FixedSizeBinary_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeBinary_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeBinary_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Bool_table *org_apache_arrow_flatbuf_Bool_table_t; +typedef struct org_apache_arrow_flatbuf_Bool_table *org_apache_arrow_flatbuf_Bool_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Bool_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Bool_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_RunEndEncoded_table *org_apache_arrow_flatbuf_RunEndEncoded_table_t; +typedef struct org_apache_arrow_flatbuf_RunEndEncoded_table *org_apache_arrow_flatbuf_RunEndEncoded_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_RunEndEncoded_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_RunEndEncoded_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Decimal_table *org_apache_arrow_flatbuf_Decimal_table_t; +typedef struct org_apache_arrow_flatbuf_Decimal_table *org_apache_arrow_flatbuf_Decimal_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Decimal_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Decimal_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Date_table *org_apache_arrow_flatbuf_Date_table_t; +typedef struct org_apache_arrow_flatbuf_Date_table *org_apache_arrow_flatbuf_Date_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Date_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Date_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Time_table *org_apache_arrow_flatbuf_Time_table_t; +typedef struct org_apache_arrow_flatbuf_Time_table *org_apache_arrow_flatbuf_Time_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Time_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Time_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Timestamp_table *org_apache_arrow_flatbuf_Timestamp_table_t; +typedef struct org_apache_arrow_flatbuf_Timestamp_table *org_apache_arrow_flatbuf_Timestamp_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Timestamp_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Timestamp_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Interval_table *org_apache_arrow_flatbuf_Interval_table_t; +typedef struct org_apache_arrow_flatbuf_Interval_table *org_apache_arrow_flatbuf_Interval_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Interval_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Interval_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Duration_table *org_apache_arrow_flatbuf_Duration_table_t; +typedef struct org_apache_arrow_flatbuf_Duration_table *org_apache_arrow_flatbuf_Duration_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Duration_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Duration_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_KeyValue_table *org_apache_arrow_flatbuf_KeyValue_table_t; +typedef struct org_apache_arrow_flatbuf_KeyValue_table *org_apache_arrow_flatbuf_KeyValue_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_KeyValue_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_KeyValue_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_DictionaryEncoding_table *org_apache_arrow_flatbuf_DictionaryEncoding_table_t; +typedef struct org_apache_arrow_flatbuf_DictionaryEncoding_table *org_apache_arrow_flatbuf_DictionaryEncoding_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_DictionaryEncoding_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_DictionaryEncoding_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Field_table *org_apache_arrow_flatbuf_Field_table_t; +typedef struct org_apache_arrow_flatbuf_Field_table *org_apache_arrow_flatbuf_Field_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Field_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Field_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Schema_table *org_apache_arrow_flatbuf_Schema_table_t; +typedef struct org_apache_arrow_flatbuf_Schema_table *org_apache_arrow_flatbuf_Schema_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Schema_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Schema_mutable_vec_t; +#ifndef org_apache_arrow_flatbuf_Null_file_identifier +#define org_apache_arrow_flatbuf_Null_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Null_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Null_identifier +#define org_apache_arrow_flatbuf_Null_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Null_type_hash ((flatbuffers_thash_t)0x7b36a4dd) +#define org_apache_arrow_flatbuf_Null_type_identifier "\xdd\xa4\x36\x7b" +#ifndef org_apache_arrow_flatbuf_Null_file_extension +#define org_apache_arrow_flatbuf_Null_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Struct__file_identifier +#define org_apache_arrow_flatbuf_Struct__file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Struct__file_identifier */ +#ifndef org_apache_arrow_flatbuf_Struct__identifier +#define org_apache_arrow_flatbuf_Struct__identifier 0 +#endif +#define org_apache_arrow_flatbuf_Struct__type_hash ((flatbuffers_thash_t)0x6310f362) +#define org_apache_arrow_flatbuf_Struct__type_identifier "\x62\xf3\x10\x63" +#ifndef org_apache_arrow_flatbuf_Struct__file_extension +#define org_apache_arrow_flatbuf_Struct__file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_List_file_identifier +#define org_apache_arrow_flatbuf_List_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_List_file_identifier */ +#ifndef org_apache_arrow_flatbuf_List_identifier +#define org_apache_arrow_flatbuf_List_identifier 0 +#endif +#define org_apache_arrow_flatbuf_List_type_hash ((flatbuffers_thash_t)0xd4ce5878) +#define org_apache_arrow_flatbuf_List_type_identifier "\x78\x58\xce\xd4" +#ifndef org_apache_arrow_flatbuf_List_file_extension +#define org_apache_arrow_flatbuf_List_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeList_file_identifier +#define org_apache_arrow_flatbuf_LargeList_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeList_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeList_identifier +#define org_apache_arrow_flatbuf_LargeList_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeList_type_hash ((flatbuffers_thash_t)0x38aa7e27) +#define org_apache_arrow_flatbuf_LargeList_type_identifier "\x27\x7e\xaa\x38" +#ifndef org_apache_arrow_flatbuf_LargeList_file_extension +#define org_apache_arrow_flatbuf_LargeList_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_ListView_file_identifier +#define org_apache_arrow_flatbuf_ListView_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_ListView_file_identifier */ +#ifndef org_apache_arrow_flatbuf_ListView_identifier +#define org_apache_arrow_flatbuf_ListView_identifier 0 +#endif +#define org_apache_arrow_flatbuf_ListView_type_hash ((flatbuffers_thash_t)0x23d37919) +#define org_apache_arrow_flatbuf_ListView_type_identifier "\x19\x79\xd3\x23" +#ifndef org_apache_arrow_flatbuf_ListView_file_extension +#define org_apache_arrow_flatbuf_ListView_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeListView_file_identifier +#define org_apache_arrow_flatbuf_LargeListView_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeListView_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeListView_identifier +#define org_apache_arrow_flatbuf_LargeListView_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeListView_type_hash ((flatbuffers_thash_t)0x28efac02) +#define org_apache_arrow_flatbuf_LargeListView_type_identifier "\x02\xac\xef\x28" +#ifndef org_apache_arrow_flatbuf_LargeListView_file_extension +#define org_apache_arrow_flatbuf_LargeListView_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_FixedSizeList_file_identifier +#define org_apache_arrow_flatbuf_FixedSizeList_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_FixedSizeList_file_identifier */ +#ifndef org_apache_arrow_flatbuf_FixedSizeList_identifier +#define org_apache_arrow_flatbuf_FixedSizeList_identifier 0 +#endif +#define org_apache_arrow_flatbuf_FixedSizeList_type_hash ((flatbuffers_thash_t)0xcef245bb) +#define org_apache_arrow_flatbuf_FixedSizeList_type_identifier "\xbb\x45\xf2\xce" +#ifndef org_apache_arrow_flatbuf_FixedSizeList_file_extension +#define org_apache_arrow_flatbuf_FixedSizeList_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Map_file_identifier +#define org_apache_arrow_flatbuf_Map_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Map_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Map_identifier +#define org_apache_arrow_flatbuf_Map_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Map_type_hash ((flatbuffers_thash_t)0xcebef8e6) +#define org_apache_arrow_flatbuf_Map_type_identifier "\xe6\xf8\xbe\xce" +#ifndef org_apache_arrow_flatbuf_Map_file_extension +#define org_apache_arrow_flatbuf_Map_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Union_file_identifier +#define org_apache_arrow_flatbuf_Union_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Union_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Union_identifier +#define org_apache_arrow_flatbuf_Union_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Union_type_hash ((flatbuffers_thash_t)0x896bda57) +#define org_apache_arrow_flatbuf_Union_type_identifier "\x57\xda\x6b\x89" +#ifndef org_apache_arrow_flatbuf_Union_file_extension +#define org_apache_arrow_flatbuf_Union_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Int_file_identifier +#define org_apache_arrow_flatbuf_Int_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Int_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Int_identifier +#define org_apache_arrow_flatbuf_Int_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Int_type_hash ((flatbuffers_thash_t)0x30789001) +#define org_apache_arrow_flatbuf_Int_type_identifier "\x01\x90\x78\x30" +#ifndef org_apache_arrow_flatbuf_Int_file_extension +#define org_apache_arrow_flatbuf_Int_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_FloatingPoint_file_identifier +#define org_apache_arrow_flatbuf_FloatingPoint_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_FloatingPoint_file_identifier */ +#ifndef org_apache_arrow_flatbuf_FloatingPoint_identifier +#define org_apache_arrow_flatbuf_FloatingPoint_identifier 0 +#endif +#define org_apache_arrow_flatbuf_FloatingPoint_type_hash ((flatbuffers_thash_t)0xf7d06268) +#define org_apache_arrow_flatbuf_FloatingPoint_type_identifier "\x68\x62\xd0\xf7" +#ifndef org_apache_arrow_flatbuf_FloatingPoint_file_extension +#define org_apache_arrow_flatbuf_FloatingPoint_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Utf8_file_identifier +#define org_apache_arrow_flatbuf_Utf8_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Utf8_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Utf8_identifier +#define org_apache_arrow_flatbuf_Utf8_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Utf8_type_hash ((flatbuffers_thash_t)0x8fe60d37) +#define org_apache_arrow_flatbuf_Utf8_type_identifier "\x37\x0d\xe6\x8f" +#ifndef org_apache_arrow_flatbuf_Utf8_file_extension +#define org_apache_arrow_flatbuf_Utf8_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Binary_file_identifier +#define org_apache_arrow_flatbuf_Binary_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Binary_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Binary_identifier +#define org_apache_arrow_flatbuf_Binary_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Binary_type_hash ((flatbuffers_thash_t)0x8e21a795) +#define org_apache_arrow_flatbuf_Binary_type_identifier "\x95\xa7\x21\x8e" +#ifndef org_apache_arrow_flatbuf_Binary_file_extension +#define org_apache_arrow_flatbuf_Binary_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeUtf8_file_identifier +#define org_apache_arrow_flatbuf_LargeUtf8_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeUtf8_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeUtf8_identifier +#define org_apache_arrow_flatbuf_LargeUtf8_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeUtf8_type_hash ((flatbuffers_thash_t)0x24ed2fb0) +#define org_apache_arrow_flatbuf_LargeUtf8_type_identifier "\xb0\x2f\xed\x24" +#ifndef org_apache_arrow_flatbuf_LargeUtf8_file_extension +#define org_apache_arrow_flatbuf_LargeUtf8_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeBinary_file_identifier +#define org_apache_arrow_flatbuf_LargeBinary_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeBinary_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeBinary_identifier +#define org_apache_arrow_flatbuf_LargeBinary_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeBinary_type_hash ((flatbuffers_thash_t)0xbd437872) +#define org_apache_arrow_flatbuf_LargeBinary_type_identifier "\x72\x78\x43\xbd" +#ifndef org_apache_arrow_flatbuf_LargeBinary_file_extension +#define org_apache_arrow_flatbuf_LargeBinary_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Utf8View_file_identifier +#define org_apache_arrow_flatbuf_Utf8View_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Utf8View_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Utf8View_identifier +#define org_apache_arrow_flatbuf_Utf8View_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Utf8View_type_hash ((flatbuffers_thash_t)0xab7692) +#define org_apache_arrow_flatbuf_Utf8View_type_identifier "\x92\x76\xab\x00" +#ifndef org_apache_arrow_flatbuf_Utf8View_file_extension +#define org_apache_arrow_flatbuf_Utf8View_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_BinaryView_file_identifier +#define org_apache_arrow_flatbuf_BinaryView_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_BinaryView_file_identifier */ +#ifndef org_apache_arrow_flatbuf_BinaryView_identifier +#define org_apache_arrow_flatbuf_BinaryView_identifier 0 +#endif +#define org_apache_arrow_flatbuf_BinaryView_type_hash ((flatbuffers_thash_t)0x18c52428) +#define org_apache_arrow_flatbuf_BinaryView_type_identifier "\x28\x24\xc5\x18" +#ifndef org_apache_arrow_flatbuf_BinaryView_file_extension +#define org_apache_arrow_flatbuf_BinaryView_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier +#define org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier */ +#ifndef org_apache_arrow_flatbuf_FixedSizeBinary_identifier +#define org_apache_arrow_flatbuf_FixedSizeBinary_identifier 0 +#endif +#define org_apache_arrow_flatbuf_FixedSizeBinary_type_hash ((flatbuffers_thash_t)0x80d0f4ce) +#define org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier "\xce\xf4\xd0\x80" +#ifndef org_apache_arrow_flatbuf_FixedSizeBinary_file_extension +#define org_apache_arrow_flatbuf_FixedSizeBinary_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Bool_file_identifier +#define org_apache_arrow_flatbuf_Bool_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Bool_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Bool_identifier +#define org_apache_arrow_flatbuf_Bool_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Bool_type_hash ((flatbuffers_thash_t)0x96bf83f0) +#define org_apache_arrow_flatbuf_Bool_type_identifier "\xf0\x83\xbf\x96" +#ifndef org_apache_arrow_flatbuf_Bool_file_extension +#define org_apache_arrow_flatbuf_Bool_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_RunEndEncoded_file_identifier +#define org_apache_arrow_flatbuf_RunEndEncoded_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_RunEndEncoded_file_identifier */ +#ifndef org_apache_arrow_flatbuf_RunEndEncoded_identifier +#define org_apache_arrow_flatbuf_RunEndEncoded_identifier 0 +#endif +#define org_apache_arrow_flatbuf_RunEndEncoded_type_hash ((flatbuffers_thash_t)0x5a98bcc) +#define org_apache_arrow_flatbuf_RunEndEncoded_type_identifier "\xcc\x8b\xa9\x05" +#ifndef org_apache_arrow_flatbuf_RunEndEncoded_file_extension +#define org_apache_arrow_flatbuf_RunEndEncoded_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Decimal_file_identifier +#define org_apache_arrow_flatbuf_Decimal_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Decimal_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Decimal_identifier +#define org_apache_arrow_flatbuf_Decimal_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Decimal_type_hash ((flatbuffers_thash_t)0x91d1beb7) +#define org_apache_arrow_flatbuf_Decimal_type_identifier "\xb7\xbe\xd1\x91" +#ifndef org_apache_arrow_flatbuf_Decimal_file_extension +#define org_apache_arrow_flatbuf_Decimal_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Date_file_identifier +#define org_apache_arrow_flatbuf_Date_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Date_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Date_identifier +#define org_apache_arrow_flatbuf_Date_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Date_type_hash ((flatbuffers_thash_t)0xe0ccf624) +#define org_apache_arrow_flatbuf_Date_type_identifier "\x24\xf6\xcc\xe0" +#ifndef org_apache_arrow_flatbuf_Date_file_extension +#define org_apache_arrow_flatbuf_Date_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Time_file_identifier +#define org_apache_arrow_flatbuf_Time_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Time_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Time_identifier +#define org_apache_arrow_flatbuf_Time_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Time_type_hash ((flatbuffers_thash_t)0x2442a489) +#define org_apache_arrow_flatbuf_Time_type_identifier "\x89\xa4\x42\x24" +#ifndef org_apache_arrow_flatbuf_Time_file_extension +#define org_apache_arrow_flatbuf_Time_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Timestamp_file_identifier +#define org_apache_arrow_flatbuf_Timestamp_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Timestamp_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Timestamp_identifier +#define org_apache_arrow_flatbuf_Timestamp_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Timestamp_type_hash ((flatbuffers_thash_t)0x1fddf080) +#define org_apache_arrow_flatbuf_Timestamp_type_identifier "\x80\xf0\xdd\x1f" +#ifndef org_apache_arrow_flatbuf_Timestamp_file_extension +#define org_apache_arrow_flatbuf_Timestamp_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Interval_file_identifier +#define org_apache_arrow_flatbuf_Interval_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Interval_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Interval_identifier +#define org_apache_arrow_flatbuf_Interval_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Interval_type_hash ((flatbuffers_thash_t)0x1e2d6809) +#define org_apache_arrow_flatbuf_Interval_type_identifier "\x09\x68\x2d\x1e" +#ifndef org_apache_arrow_flatbuf_Interval_file_extension +#define org_apache_arrow_flatbuf_Interval_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Duration_file_identifier +#define org_apache_arrow_flatbuf_Duration_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Duration_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Duration_identifier +#define org_apache_arrow_flatbuf_Duration_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Duration_type_hash ((flatbuffers_thash_t)0x1ecea6b0) +#define org_apache_arrow_flatbuf_Duration_type_identifier "\xb0\xa6\xce\x1e" +#ifndef org_apache_arrow_flatbuf_Duration_file_extension +#define org_apache_arrow_flatbuf_Duration_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_KeyValue_file_identifier +#define org_apache_arrow_flatbuf_KeyValue_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_KeyValue_file_identifier */ +#ifndef org_apache_arrow_flatbuf_KeyValue_identifier +#define org_apache_arrow_flatbuf_KeyValue_identifier 0 +#endif +#define org_apache_arrow_flatbuf_KeyValue_type_hash ((flatbuffers_thash_t)0x3b264744) +#define org_apache_arrow_flatbuf_KeyValue_type_identifier "\x44\x47\x26\x3b" +#ifndef org_apache_arrow_flatbuf_KeyValue_file_extension +#define org_apache_arrow_flatbuf_KeyValue_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier +#define org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier */ +#ifndef org_apache_arrow_flatbuf_DictionaryEncoding_identifier +#define org_apache_arrow_flatbuf_DictionaryEncoding_identifier 0 +#endif +#define org_apache_arrow_flatbuf_DictionaryEncoding_type_hash ((flatbuffers_thash_t)0x8c703261) +#define org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier "\x61\x32\x70\x8c" +#ifndef org_apache_arrow_flatbuf_DictionaryEncoding_file_extension +#define org_apache_arrow_flatbuf_DictionaryEncoding_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Field_file_identifier +#define org_apache_arrow_flatbuf_Field_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Field_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Field_identifier +#define org_apache_arrow_flatbuf_Field_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Field_type_hash ((flatbuffers_thash_t)0xd981525c) +#define org_apache_arrow_flatbuf_Field_type_identifier "\x5c\x52\x81\xd9" +#ifndef org_apache_arrow_flatbuf_Field_file_extension +#define org_apache_arrow_flatbuf_Field_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Buffer_file_identifier +#define org_apache_arrow_flatbuf_Buffer_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Buffer_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Buffer_identifier +#define org_apache_arrow_flatbuf_Buffer_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Buffer_type_hash ((flatbuffers_thash_t)0x519d7fea) +#define org_apache_arrow_flatbuf_Buffer_type_identifier "\xea\x7f\x9d\x51" +#ifndef org_apache_arrow_flatbuf_Buffer_file_extension +#define org_apache_arrow_flatbuf_Buffer_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Schema_file_identifier +#define org_apache_arrow_flatbuf_Schema_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Schema_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Schema_identifier +#define org_apache_arrow_flatbuf_Schema_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Schema_type_hash ((flatbuffers_thash_t)0x406570b) +#define org_apache_arrow_flatbuf_Schema_type_identifier "\x0b\x57\x06\x04" +#ifndef org_apache_arrow_flatbuf_Schema_file_extension +#define org_apache_arrow_flatbuf_Schema_file_extension "bin" +#endif + +typedef int16_t org_apache_arrow_flatbuf_MetadataVersion_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_MetadataVersion, org_apache_arrow_flatbuf_MetadataVersion_enum_t, 16) +/** 0.1.0 (October 2016). */ +#define org_apache_arrow_flatbuf_MetadataVersion_V1 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_MetadataVersion_V2 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_MetadataVersion_V3 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(2)) +#define org_apache_arrow_flatbuf_MetadataVersion_V4 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(3)) +#define org_apache_arrow_flatbuf_MetadataVersion_V5 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(4)) + +static inline const char *org_apache_arrow_flatbuf_MetadataVersion_name(org_apache_arrow_flatbuf_MetadataVersion_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_MetadataVersion_V1: return "V1"; + case org_apache_arrow_flatbuf_MetadataVersion_V2: return "V2"; + case org_apache_arrow_flatbuf_MetadataVersion_V3: return "V3"; + case org_apache_arrow_flatbuf_MetadataVersion_V4: return "V4"; + case org_apache_arrow_flatbuf_MetadataVersion_V5: return "V5"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_MetadataVersion_is_known_value(org_apache_arrow_flatbuf_MetadataVersion_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_MetadataVersion_V1: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V2: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V3: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V4: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V5: return 1; + default: return 0; + } +} + +/** Represents Arrow Features that might not have full support + * within implementations. This is intended to be used in + * two scenarios: + * 1. A mechanism for readers of Arrow Streams + * and files to understand that the stream or file makes + * use of a feature that isn't supported or unknown to + * the implementation (and therefore can meet the Arrow + * forward compatibility guarantees). + * 2. A means of negotiating between a client and server + * what features a stream is allowed to use. The enums + * values here are intented to represent higher level + * features, additional details maybe negotiated + * with key-value pairs specific to the protocol. + * + * Enums added to this list should be assigned power-of-two values + * to facilitate exchanging and comparing bitmaps for supported + * features. */ +typedef int64_t org_apache_arrow_flatbuf_Feature_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Feature, org_apache_arrow_flatbuf_Feature_enum_t, 64) +/** Needed to make flatbuffers happy. */ +#define org_apache_arrow_flatbuf_Feature_UNUSED ((org_apache_arrow_flatbuf_Feature_enum_t)INT64_C(0)) +#define org_apache_arrow_flatbuf_Feature_DICTIONARY_REPLACEMENT ((org_apache_arrow_flatbuf_Feature_enum_t)INT64_C(1)) +#define org_apache_arrow_flatbuf_Feature_COMPRESSED_BODY ((org_apache_arrow_flatbuf_Feature_enum_t)INT64_C(2)) + +static inline const char *org_apache_arrow_flatbuf_Feature_name(org_apache_arrow_flatbuf_Feature_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Feature_UNUSED: return "UNUSED"; + case org_apache_arrow_flatbuf_Feature_DICTIONARY_REPLACEMENT: return "DICTIONARY_REPLACEMENT"; + case org_apache_arrow_flatbuf_Feature_COMPRESSED_BODY: return "COMPRESSED_BODY"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Feature_is_known_value(org_apache_arrow_flatbuf_Feature_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Feature_UNUSED: return 1; + case org_apache_arrow_flatbuf_Feature_DICTIONARY_REPLACEMENT: return 1; + case org_apache_arrow_flatbuf_Feature_COMPRESSED_BODY: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_UnionMode_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t, 16) +#define org_apache_arrow_flatbuf_UnionMode_Sparse ((org_apache_arrow_flatbuf_UnionMode_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_UnionMode_Dense ((org_apache_arrow_flatbuf_UnionMode_enum_t)INT16_C(1)) + +static inline const char *org_apache_arrow_flatbuf_UnionMode_name(org_apache_arrow_flatbuf_UnionMode_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_UnionMode_Sparse: return "Sparse"; + case org_apache_arrow_flatbuf_UnionMode_Dense: return "Dense"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_UnionMode_is_known_value(org_apache_arrow_flatbuf_UnionMode_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_UnionMode_Sparse: return 1; + case org_apache_arrow_flatbuf_UnionMode_Dense: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_Precision_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t, 16) +#define org_apache_arrow_flatbuf_Precision_HALF ((org_apache_arrow_flatbuf_Precision_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_Precision_SINGLE ((org_apache_arrow_flatbuf_Precision_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_Precision_DOUBLE ((org_apache_arrow_flatbuf_Precision_enum_t)INT16_C(2)) + +static inline const char *org_apache_arrow_flatbuf_Precision_name(org_apache_arrow_flatbuf_Precision_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Precision_HALF: return "HALF"; + case org_apache_arrow_flatbuf_Precision_SINGLE: return "SINGLE"; + case org_apache_arrow_flatbuf_Precision_DOUBLE: return "DOUBLE"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Precision_is_known_value(org_apache_arrow_flatbuf_Precision_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Precision_HALF: return 1; + case org_apache_arrow_flatbuf_Precision_SINGLE: return 1; + case org_apache_arrow_flatbuf_Precision_DOUBLE: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_DateUnit_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t, 16) +#define org_apache_arrow_flatbuf_DateUnit_DAY ((org_apache_arrow_flatbuf_DateUnit_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_DateUnit_MILLISECOND ((org_apache_arrow_flatbuf_DateUnit_enum_t)INT16_C(1)) + +static inline const char *org_apache_arrow_flatbuf_DateUnit_name(org_apache_arrow_flatbuf_DateUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DateUnit_DAY: return "DAY"; + case org_apache_arrow_flatbuf_DateUnit_MILLISECOND: return "MILLISECOND"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_DateUnit_is_known_value(org_apache_arrow_flatbuf_DateUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DateUnit_DAY: return 1; + case org_apache_arrow_flatbuf_DateUnit_MILLISECOND: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_TimeUnit_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 16) +#define org_apache_arrow_flatbuf_TimeUnit_SECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_TimeUnit_MILLISECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_TimeUnit_MICROSECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(2)) +#define org_apache_arrow_flatbuf_TimeUnit_NANOSECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(3)) + +static inline const char *org_apache_arrow_flatbuf_TimeUnit_name(org_apache_arrow_flatbuf_TimeUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_TimeUnit_SECOND: return "SECOND"; + case org_apache_arrow_flatbuf_TimeUnit_MILLISECOND: return "MILLISECOND"; + case org_apache_arrow_flatbuf_TimeUnit_MICROSECOND: return "MICROSECOND"; + case org_apache_arrow_flatbuf_TimeUnit_NANOSECOND: return "NANOSECOND"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_TimeUnit_is_known_value(org_apache_arrow_flatbuf_TimeUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_TimeUnit_SECOND: return 1; + case org_apache_arrow_flatbuf_TimeUnit_MILLISECOND: return 1; + case org_apache_arrow_flatbuf_TimeUnit_MICROSECOND: return 1; + case org_apache_arrow_flatbuf_TimeUnit_NANOSECOND: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_IntervalUnit_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t, 16) +#define org_apache_arrow_flatbuf_IntervalUnit_YEAR_MONTH ((org_apache_arrow_flatbuf_IntervalUnit_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_IntervalUnit_DAY_TIME ((org_apache_arrow_flatbuf_IntervalUnit_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_IntervalUnit_MONTH_DAY_NANO ((org_apache_arrow_flatbuf_IntervalUnit_enum_t)INT16_C(2)) + +static inline const char *org_apache_arrow_flatbuf_IntervalUnit_name(org_apache_arrow_flatbuf_IntervalUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_IntervalUnit_YEAR_MONTH: return "YEAR_MONTH"; + case org_apache_arrow_flatbuf_IntervalUnit_DAY_TIME: return "DAY_TIME"; + case org_apache_arrow_flatbuf_IntervalUnit_MONTH_DAY_NANO: return "MONTH_DAY_NANO"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_IntervalUnit_is_known_value(org_apache_arrow_flatbuf_IntervalUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_IntervalUnit_YEAR_MONTH: return 1; + case org_apache_arrow_flatbuf_IntervalUnit_DAY_TIME: return 1; + case org_apache_arrow_flatbuf_IntervalUnit_MONTH_DAY_NANO: return 1; + default: return 0; + } +} + +/** ---------------------------------------------------------------------- + * Dictionary encoding metadata + * Maintained for forwards compatibility, in the future + * Dictionaries might be explicit maps between integers and values + * allowing for non-contiguous index values */ +typedef int16_t org_apache_arrow_flatbuf_DictionaryKind_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t, 16) +#define org_apache_arrow_flatbuf_DictionaryKind_DenseArray ((org_apache_arrow_flatbuf_DictionaryKind_enum_t)INT16_C(0)) + +static inline const char *org_apache_arrow_flatbuf_DictionaryKind_name(org_apache_arrow_flatbuf_DictionaryKind_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DictionaryKind_DenseArray: return "DenseArray"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_DictionaryKind_is_known_value(org_apache_arrow_flatbuf_DictionaryKind_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DictionaryKind_DenseArray: return 1; + default: return 0; + } +} + +/** ---------------------------------------------------------------------- + * Endianness of the platform producing the data */ +typedef int16_t org_apache_arrow_flatbuf_Endianness_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t, 16) +#define org_apache_arrow_flatbuf_Endianness_Little ((org_apache_arrow_flatbuf_Endianness_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_Endianness_Big ((org_apache_arrow_flatbuf_Endianness_enum_t)INT16_C(1)) + +static inline const char *org_apache_arrow_flatbuf_Endianness_name(org_apache_arrow_flatbuf_Endianness_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Endianness_Little: return "Little"; + case org_apache_arrow_flatbuf_Endianness_Big: return "Big"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Endianness_is_known_value(org_apache_arrow_flatbuf_Endianness_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Endianness_Little: return 1; + case org_apache_arrow_flatbuf_Endianness_Big: return 1; + default: return 0; + } +} + + +/** ---------------------------------------------------------------------- + * A Buffer represents a single contiguous memory segment */ +struct org_apache_arrow_flatbuf_Buffer { + /** The relative offset into the shared memory page where the bytes for this + * buffer starts */ + alignas(8) int64_t offset; + /** The absolute length (in bytes) of the memory buffer. The memory is found + * from offset (inclusive) to offset + length (non-inclusive). When building + * messages using the encapsulated IPC message, padding bytes may be written + * after a buffer, but such padding bytes do not need to be accounted for in + * the size here. */ + alignas(8) int64_t length; +}; +static_assert(sizeof(org_apache_arrow_flatbuf_Buffer_t) == 16, "struct size mismatch"); + +static inline const org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer__const_ptr_add(const org_apache_arrow_flatbuf_Buffer_t *p, size_t i) { return p + i; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer__ptr_add(org_apache_arrow_flatbuf_Buffer_t *p, size_t i) { return p + i; } +static inline org_apache_arrow_flatbuf_Buffer_struct_t org_apache_arrow_flatbuf_Buffer_vec_at(org_apache_arrow_flatbuf_Buffer_vec_t vec, size_t i) +__flatbuffers_struct_vec_at(vec, i) +static inline size_t org_apache_arrow_flatbuf_Buffer__size(void) { return 16; } +static inline size_t org_apache_arrow_flatbuf_Buffer_vec_len(org_apache_arrow_flatbuf_Buffer_vec_t vec) +__flatbuffers_vec_len(vec) +__flatbuffers_struct_as_root(org_apache_arrow_flatbuf_Buffer) + +__flatbuffers_define_struct_scalar_field(org_apache_arrow_flatbuf_Buffer, offset, flatbuffers_int64, int64_t) +__flatbuffers_define_struct_scalar_field(org_apache_arrow_flatbuf_Buffer, length, flatbuffers_int64, int64_t) + + +/** These are stored in the flatbuffer in the Type union below */ +struct org_apache_arrow_flatbuf_Null_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Null_vec_len(org_apache_arrow_flatbuf_Null_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Null_table_t org_apache_arrow_flatbuf_Null_vec_at(org_apache_arrow_flatbuf_Null_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Null_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Null) + + +/** A Struct_ in the flatbuffer metadata is the same as an Arrow Struct + * (according to the physical memory layout). We used Struct_ here as + * Struct is a reserved word in Flatbuffers */ +struct org_apache_arrow_flatbuf_Struct__table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Struct__vec_len(org_apache_arrow_flatbuf_Struct__vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Struct__table_t org_apache_arrow_flatbuf_Struct__vec_at(org_apache_arrow_flatbuf_Struct__vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Struct__table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Struct_) + + +struct org_apache_arrow_flatbuf_List_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_List_vec_len(org_apache_arrow_flatbuf_List_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_List_table_t org_apache_arrow_flatbuf_List_vec_at(org_apache_arrow_flatbuf_List_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_List_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_List) + + +/** Same as List, but with 64-bit offsets, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeList_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeList_vec_len(org_apache_arrow_flatbuf_LargeList_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeList_table_t org_apache_arrow_flatbuf_LargeList_vec_at(org_apache_arrow_flatbuf_LargeList_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeList_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeList) + + +/** Represents the same logical types that List can, but contains offsets and + * sizes allowing for writes in any order and sharing of child values among + * list values. */ +struct org_apache_arrow_flatbuf_ListView_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_ListView_vec_len(org_apache_arrow_flatbuf_ListView_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_ListView_table_t org_apache_arrow_flatbuf_ListView_vec_at(org_apache_arrow_flatbuf_ListView_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_ListView_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_ListView) + + +/** Same as ListView, but with 64-bit offsets and sizes, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeListView_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeListView_vec_len(org_apache_arrow_flatbuf_LargeListView_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeListView_table_t org_apache_arrow_flatbuf_LargeListView_vec_at(org_apache_arrow_flatbuf_LargeListView_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeListView_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeListView) + + +struct org_apache_arrow_flatbuf_FixedSizeList_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_FixedSizeList_vec_len(org_apache_arrow_flatbuf_FixedSizeList_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_FixedSizeList_table_t org_apache_arrow_flatbuf_FixedSizeList_vec_at(org_apache_arrow_flatbuf_FixedSizeList_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_FixedSizeList_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_FixedSizeList) + +/** Number of list items per value */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_FixedSizeList, listSize, flatbuffers_int32, int32_t, INT32_C(0)) + +/** A Map is a logical nested type that is represented as + * + * List> + * + * In this layout, the keys and values are each respectively contiguous. We do + * not constrain the key and value types, so the application is responsible + * for ensuring that the keys are hashable and unique. Whether the keys are sorted + * may be set in the metadata for this field. + * + * In a field with Map type, the field has a child Struct field, which then + * has two children: key type and the second the value type. The names of the + * child fields may be respectively "entries", "key", and "value", but this is + * not enforced. + * + * Map + * ```text + * - child[0] entries: Struct + * - child[0] key: K + * - child[1] value: V + * ``` + * Neither the "entries" field nor the "key" field may be nullable. + * + * The metadata is structured so that Arrow systems without special handling + * for Map can make Map an alias for List. The "layout" attribute for the Map + * field must have the same contents as a List. */ +struct org_apache_arrow_flatbuf_Map_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Map_vec_len(org_apache_arrow_flatbuf_Map_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Map_table_t org_apache_arrow_flatbuf_Map_vec_at(org_apache_arrow_flatbuf_Map_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Map_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Map) + +/** Set to true if the keys within each value are sorted */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Map, keysSorted, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) + +/** A union is a complex type with children in Field + * By default ids in the type vector refer to the offsets in the children + * optionally typeIds provides an indirection between the child offset and the type id + * for each child `typeIds[offset]` is the id used in the type vector */ +struct org_apache_arrow_flatbuf_Union_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Union_vec_len(org_apache_arrow_flatbuf_Union_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Union_table_t org_apache_arrow_flatbuf_Union_vec_at(org_apache_arrow_flatbuf_Union_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Union_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Union) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Union, mode, org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t, INT16_C(0)) +__flatbuffers_define_vector_field(1, org_apache_arrow_flatbuf_Union, typeIds, flatbuffers_int32_vec_t, 0) + +struct org_apache_arrow_flatbuf_Int_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Int_vec_len(org_apache_arrow_flatbuf_Int_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Int_table_t org_apache_arrow_flatbuf_Int_vec_at(org_apache_arrow_flatbuf_Int_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Int_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Int) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Int, bitWidth, flatbuffers_int32, int32_t, INT32_C(0)) +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Int, is_signed, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) + +struct org_apache_arrow_flatbuf_FloatingPoint_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_FloatingPoint_vec_len(org_apache_arrow_flatbuf_FloatingPoint_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_FloatingPoint_table_t org_apache_arrow_flatbuf_FloatingPoint_vec_at(org_apache_arrow_flatbuf_FloatingPoint_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_FloatingPoint_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_FloatingPoint) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_FloatingPoint, precision, org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t, INT16_C(0)) + +/** Unicode with UTF-8 encoding */ +struct org_apache_arrow_flatbuf_Utf8_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Utf8_vec_len(org_apache_arrow_flatbuf_Utf8_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Utf8_table_t org_apache_arrow_flatbuf_Utf8_vec_at(org_apache_arrow_flatbuf_Utf8_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Utf8_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Utf8) + + +/** Opaque binary data */ +struct org_apache_arrow_flatbuf_Binary_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Binary_vec_len(org_apache_arrow_flatbuf_Binary_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Binary_table_t org_apache_arrow_flatbuf_Binary_vec_at(org_apache_arrow_flatbuf_Binary_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Binary_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Binary) + + +/** Same as Utf8, but with 64-bit offsets, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeUtf8_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeUtf8_vec_len(org_apache_arrow_flatbuf_LargeUtf8_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeUtf8_table_t org_apache_arrow_flatbuf_LargeUtf8_vec_at(org_apache_arrow_flatbuf_LargeUtf8_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeUtf8_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeUtf8) + + +/** Same as Binary, but with 64-bit offsets, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeBinary_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeBinary_vec_len(org_apache_arrow_flatbuf_LargeBinary_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeBinary_table_t org_apache_arrow_flatbuf_LargeBinary_vec_at(org_apache_arrow_flatbuf_LargeBinary_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeBinary_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeBinary) + + +/** Logically the same as Utf8, but the internal representation uses a view + * struct that contains the string length and either the string's entire data + * inline (for small strings) or an inlined prefix, an index of another buffer, + * and an offset pointing to a slice in that buffer (for non-small strings). + * + * Since it uses a variable number of data buffers, each Field with this type + * must have a corresponding entry in `variadicBufferCounts`. */ +struct org_apache_arrow_flatbuf_Utf8View_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Utf8View_vec_len(org_apache_arrow_flatbuf_Utf8View_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Utf8View_table_t org_apache_arrow_flatbuf_Utf8View_vec_at(org_apache_arrow_flatbuf_Utf8View_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Utf8View_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Utf8View) + + +/** Logically the same as Binary, but the internal representation uses a view + * struct that contains the string length and either the string's entire data + * inline (for small strings) or an inlined prefix, an index of another buffer, + * and an offset pointing to a slice in that buffer (for non-small strings). + * + * Since it uses a variable number of data buffers, each Field with this type + * must have a corresponding entry in `variadicBufferCounts`. */ +struct org_apache_arrow_flatbuf_BinaryView_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_BinaryView_vec_len(org_apache_arrow_flatbuf_BinaryView_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_BinaryView_table_t org_apache_arrow_flatbuf_BinaryView_vec_at(org_apache_arrow_flatbuf_BinaryView_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_BinaryView_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_BinaryView) + + +struct org_apache_arrow_flatbuf_FixedSizeBinary_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_FixedSizeBinary_vec_len(org_apache_arrow_flatbuf_FixedSizeBinary_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_FixedSizeBinary_table_t org_apache_arrow_flatbuf_FixedSizeBinary_vec_at(org_apache_arrow_flatbuf_FixedSizeBinary_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_FixedSizeBinary_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_FixedSizeBinary) + +/** Number of bytes per value */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_FixedSizeBinary, byteWidth, flatbuffers_int32, int32_t, INT32_C(0)) + +struct org_apache_arrow_flatbuf_Bool_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Bool_vec_len(org_apache_arrow_flatbuf_Bool_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Bool_table_t org_apache_arrow_flatbuf_Bool_vec_at(org_apache_arrow_flatbuf_Bool_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Bool_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Bool) + + +/** Contains two child arrays, run_ends and values. + * The run_ends child array must be a 16/32/64-bit integer array + * which encodes the indices at which the run with the value in + * each corresponding index in the values child array ends. + * Like list/struct types, the value array can be of any type. */ +struct org_apache_arrow_flatbuf_RunEndEncoded_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_RunEndEncoded_vec_len(org_apache_arrow_flatbuf_RunEndEncoded_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_RunEndEncoded_table_t org_apache_arrow_flatbuf_RunEndEncoded_vec_at(org_apache_arrow_flatbuf_RunEndEncoded_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_RunEndEncoded_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_RunEndEncoded) + + +/** Exact decimal value represented as an integer value in two's + * complement. Currently only 128-bit (16-byte) and 256-bit (32-byte) integers + * are used. The representation uses the endianness indicated + * in the Schema. */ +struct org_apache_arrow_flatbuf_Decimal_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Decimal_vec_len(org_apache_arrow_flatbuf_Decimal_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Decimal_table_t org_apache_arrow_flatbuf_Decimal_vec_at(org_apache_arrow_flatbuf_Decimal_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Decimal_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Decimal) + +/** Total number of decimal digits */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Decimal, precision, flatbuffers_int32, int32_t, INT32_C(0)) +/** Number of digits after the decimal point "." */ +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Decimal, scale, flatbuffers_int32, int32_t, INT32_C(0)) +/** Number of bits per value. The only accepted widths are 128 and 256. + * We use bitWidth for consistency with Int::bitWidth. */ +__flatbuffers_define_scalar_field(2, org_apache_arrow_flatbuf_Decimal, bitWidth, flatbuffers_int32, int32_t, INT32_C(128)) + +/** Date is either a 32-bit or 64-bit signed integer type representing an + * elapsed time since UNIX epoch (1970-01-01), stored in either of two units: + * + * * Milliseconds (64 bits) indicating UNIX time elapsed since the epoch (no + * leap seconds), where the values are evenly divisible by 86400000 + * * Days (32 bits) since the UNIX epoch */ +struct org_apache_arrow_flatbuf_Date_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Date_vec_len(org_apache_arrow_flatbuf_Date_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Date_table_t org_apache_arrow_flatbuf_Date_vec_at(org_apache_arrow_flatbuf_Date_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Date_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Date) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Date, unit, org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t, INT16_C(1)) + +/** Time is either a 32-bit or 64-bit signed integer type representing an + * elapsed time since midnight, stored in either of four units: seconds, + * milliseconds, microseconds or nanoseconds. + * + * The integer `bitWidth` depends on the `unit` and must be one of the following: + * * SECOND and MILLISECOND: 32 bits + * * MICROSECOND and NANOSECOND: 64 bits + * + * The allowed values are between 0 (inclusive) and 86400 (=24*60*60) seconds + * (exclusive), adjusted for the time unit (for example, up to 86400000 + * exclusive for the MILLISECOND unit). + * This definition doesn't allow for leap seconds. Time values from + * measurements with leap seconds will need to be corrected when ingesting + * into Arrow (for example by replacing the value 86400 with 86399). */ +struct org_apache_arrow_flatbuf_Time_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Time_vec_len(org_apache_arrow_flatbuf_Time_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Time_table_t org_apache_arrow_flatbuf_Time_vec_at(org_apache_arrow_flatbuf_Time_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Time_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Time) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Time, unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, INT16_C(1)) +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Time, bitWidth, flatbuffers_int32, int32_t, INT32_C(32)) + +/** Timestamp is a 64-bit signed integer representing an elapsed time since a + * fixed epoch, stored in either of four units: seconds, milliseconds, + * microseconds or nanoseconds, and is optionally annotated with a timezone. + * + * Timestamp values do not include any leap seconds (in other words, all + * days are considered 86400 seconds long). + * + * Timestamps with a non-empty timezone + * ------------------------------------ + * + * If a Timestamp column has a non-empty timezone value, its epoch is + * 1970-01-01 00:00:00 (January 1st 1970, midnight) in the *UTC* timezone + * (the Unix epoch), regardless of the Timestamp's own timezone. + * + * Therefore, timestamp values with a non-empty timezone correspond to + * physical points in time together with some additional information about + * how the data was obtained and/or how to display it (the timezone). + * + * For example, the timestamp value 0 with the timezone string "Europe/Paris" + * corresponds to "January 1st 1970, 00h00" in the UTC timezone, but the + * application may prefer to display it as "January 1st 1970, 01h00" in + * the Europe/Paris timezone (which is the same physical point in time). + * + * One consequence is that timestamp values with a non-empty timezone + * can be compared and ordered directly, since they all share the same + * well-known point of reference (the Unix epoch). + * + * Timestamps with an unset / empty timezone + * ----------------------------------------- + * + * If a Timestamp column has no timezone value, its epoch is + * 1970-01-01 00:00:00 (January 1st 1970, midnight) in an *unknown* timezone. + * + * Therefore, timestamp values without a timezone cannot be meaningfully + * interpreted as physical points in time, but only as calendar / clock + * indications ("wall clock time") in an unspecified timezone. + * + * For example, the timestamp value 0 with an empty timezone string + * corresponds to "January 1st 1970, 00h00" in an unknown timezone: there + * is not enough information to interpret it as a well-defined physical + * point in time. + * + * One consequence is that timestamp values without a timezone cannot + * be reliably compared or ordered, since they may have different points of + * reference. In particular, it is *not* possible to interpret an unset + * or empty timezone as the same as "UTC". + * + * Conversion between timezones + * ---------------------------- + * + * If a Timestamp column has a non-empty timezone, changing the timezone + * to a different non-empty value is a metadata-only operation: + * the timestamp values need not change as their point of reference remains + * the same (the Unix epoch). + * + * However, if a Timestamp column has no timezone value, changing it to a + * non-empty value requires to think about the desired semantics. + * One possibility is to assume that the original timestamp values are + * relative to the epoch of the timezone being set; timestamp values should + * then adjusted to the Unix epoch (for example, changing the timezone from + * empty to "Europe/Paris" would require converting the timestamp values + * from "Europe/Paris" to "UTC", which seems counter-intuitive but is + * nevertheless correct). + * + * Guidelines for encoding data from external libraries + * ---------------------------------------------------- + * + * Date & time libraries often have multiple different data types for temporal + * data. In order to ease interoperability between different implementations the + * Arrow project has some recommendations for encoding these types into a Timestamp + * column. + * + * An "instant" represents a physical point in time that has no relevant timezone + * (for example, astronomical data). To encode an instant, use a Timestamp with + * the timezone string set to "UTC", and make sure the Timestamp values + * are relative to the UTC epoch (January 1st 1970, midnight). + * + * A "zoned date-time" represents a physical point in time annotated with an + * informative timezone (for example, the timezone in which the data was + * recorded). To encode a zoned date-time, use a Timestamp with the timezone + * string set to the name of the timezone, and make sure the Timestamp values + * are relative to the UTC epoch (January 1st 1970, midnight). + * + * (There is some ambiguity between an instant and a zoned date-time with the + * UTC timezone. Both of these are stored the same in Arrow. Typically, + * this distinction does not matter. If it does, then an application should + * use custom metadata or an extension type to distinguish between the two cases.) + * + * An "offset date-time" represents a physical point in time combined with an + * explicit offset from UTC. To encode an offset date-time, use a Timestamp + * with the timezone string set to the numeric timezone offset string + * (e.g. "+03:00"), and make sure the Timestamp values are relative to + * the UTC epoch (January 1st 1970, midnight). + * + * A "naive date-time" (also called "local date-time" in some libraries) + * represents a wall clock time combined with a calendar date, but with + * no indication of how to map this information to a physical point in time. + * Naive date-times must be handled with care because of this missing + * information, and also because daylight saving time (DST) may make + * some values ambiguous or nonexistent. A naive date-time may be + * stored as a struct with Date and Time fields. However, it may also be + * encoded into a Timestamp column with an empty timezone. The timestamp + * values should be computed "as if" the timezone of the date-time values + * was UTC; for example, the naive date-time "January 1st 1970, 00h00" would + * be encoded as timestamp value 0. */ +struct org_apache_arrow_flatbuf_Timestamp_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Timestamp_vec_len(org_apache_arrow_flatbuf_Timestamp_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Timestamp_table_t org_apache_arrow_flatbuf_Timestamp_vec_at(org_apache_arrow_flatbuf_Timestamp_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Timestamp_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Timestamp) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Timestamp, unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, INT16_C(0)) +/** The timezone is an optional string indicating the name of a timezone, + * one of: + * + * * As used in the Olson timezone database (the "tz database" or + * "tzdata"), such as "America/New_York". + * * An absolute timezone offset of the form "+XX:XX" or "-XX:XX", + * such as "+07:30". + * + * Whether a timezone string is present indicates different semantics about + * the data (see above). */ +__flatbuffers_define_string_field(1, org_apache_arrow_flatbuf_Timestamp, timezone, 0) + +struct org_apache_arrow_flatbuf_Interval_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Interval_vec_len(org_apache_arrow_flatbuf_Interval_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Interval_table_t org_apache_arrow_flatbuf_Interval_vec_at(org_apache_arrow_flatbuf_Interval_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Interval_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Interval) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Interval, unit, org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t, INT16_C(0)) + +struct org_apache_arrow_flatbuf_Duration_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Duration_vec_len(org_apache_arrow_flatbuf_Duration_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Duration_table_t org_apache_arrow_flatbuf_Duration_vec_at(org_apache_arrow_flatbuf_Duration_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Duration_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Duration) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Duration, unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, INT16_C(1)) +/** ---------------------------------------------------------------------- + * Top-level Type value, enabling extensible type-specific metadata. We can + * add new logical types to Type without breaking backwards compatibility */ +typedef uint8_t org_apache_arrow_flatbuf_Type_union_type_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Type, org_apache_arrow_flatbuf_Type_union_type_t, 8) +__flatbuffers_define_union(flatbuffers_, org_apache_arrow_flatbuf_Type) +/** ---------------------------------------------------------------------- + * user defined key value pairs to add custom metadata to arrow + * key namespacing is the responsibility of the user */ +#define org_apache_arrow_flatbuf_Type_NONE ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(0)) +#define org_apache_arrow_flatbuf_Type_Null ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(1)) +#define org_apache_arrow_flatbuf_Type_Int ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(2)) +#define org_apache_arrow_flatbuf_Type_FloatingPoint ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(3)) +#define org_apache_arrow_flatbuf_Type_Binary ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(4)) +#define org_apache_arrow_flatbuf_Type_Utf8 ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(5)) +#define org_apache_arrow_flatbuf_Type_Bool ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(6)) +#define org_apache_arrow_flatbuf_Type_Decimal ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(7)) +#define org_apache_arrow_flatbuf_Type_Date ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(8)) +#define org_apache_arrow_flatbuf_Type_Time ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(9)) +#define org_apache_arrow_flatbuf_Type_Timestamp ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(10)) +#define org_apache_arrow_flatbuf_Type_Interval ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(11)) +#define org_apache_arrow_flatbuf_Type_List ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(12)) +#define org_apache_arrow_flatbuf_Type_Struct_ ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(13)) +#define org_apache_arrow_flatbuf_Type_Union ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(14)) +#define org_apache_arrow_flatbuf_Type_FixedSizeBinary ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(15)) +#define org_apache_arrow_flatbuf_Type_FixedSizeList ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(16)) +#define org_apache_arrow_flatbuf_Type_Map ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(17)) +#define org_apache_arrow_flatbuf_Type_Duration ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(18)) +#define org_apache_arrow_flatbuf_Type_LargeBinary ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(19)) +#define org_apache_arrow_flatbuf_Type_LargeUtf8 ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(20)) +#define org_apache_arrow_flatbuf_Type_LargeList ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(21)) +#define org_apache_arrow_flatbuf_Type_RunEndEncoded ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(22)) +#define org_apache_arrow_flatbuf_Type_BinaryView ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(23)) +#define org_apache_arrow_flatbuf_Type_Utf8View ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(24)) +#define org_apache_arrow_flatbuf_Type_ListView ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(25)) +#define org_apache_arrow_flatbuf_Type_LargeListView ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(26)) + +static inline const char *org_apache_arrow_flatbuf_Type_type_name(org_apache_arrow_flatbuf_Type_union_type_t type) +{ + switch (type) { + case org_apache_arrow_flatbuf_Type_NONE: return "NONE"; + case org_apache_arrow_flatbuf_Type_Null: return "Null"; + case org_apache_arrow_flatbuf_Type_Int: return "Int"; + case org_apache_arrow_flatbuf_Type_FloatingPoint: return "FloatingPoint"; + case org_apache_arrow_flatbuf_Type_Binary: return "Binary"; + case org_apache_arrow_flatbuf_Type_Utf8: return "Utf8"; + case org_apache_arrow_flatbuf_Type_Bool: return "Bool"; + case org_apache_arrow_flatbuf_Type_Decimal: return "Decimal"; + case org_apache_arrow_flatbuf_Type_Date: return "Date"; + case org_apache_arrow_flatbuf_Type_Time: return "Time"; + case org_apache_arrow_flatbuf_Type_Timestamp: return "Timestamp"; + case org_apache_arrow_flatbuf_Type_Interval: return "Interval"; + case org_apache_arrow_flatbuf_Type_List: return "List"; + case org_apache_arrow_flatbuf_Type_Struct_: return "Struct_"; + case org_apache_arrow_flatbuf_Type_Union: return "Union"; + case org_apache_arrow_flatbuf_Type_FixedSizeBinary: return "FixedSizeBinary"; + case org_apache_arrow_flatbuf_Type_FixedSizeList: return "FixedSizeList"; + case org_apache_arrow_flatbuf_Type_Map: return "Map"; + case org_apache_arrow_flatbuf_Type_Duration: return "Duration"; + case org_apache_arrow_flatbuf_Type_LargeBinary: return "LargeBinary"; + case org_apache_arrow_flatbuf_Type_LargeUtf8: return "LargeUtf8"; + case org_apache_arrow_flatbuf_Type_LargeList: return "LargeList"; + case org_apache_arrow_flatbuf_Type_RunEndEncoded: return "RunEndEncoded"; + case org_apache_arrow_flatbuf_Type_BinaryView: return "BinaryView"; + case org_apache_arrow_flatbuf_Type_Utf8View: return "Utf8View"; + case org_apache_arrow_flatbuf_Type_ListView: return "ListView"; + case org_apache_arrow_flatbuf_Type_LargeListView: return "LargeListView"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Type_is_known_type(org_apache_arrow_flatbuf_Type_union_type_t type) +{ + switch (type) { + case org_apache_arrow_flatbuf_Type_NONE: return 1; + case org_apache_arrow_flatbuf_Type_Null: return 1; + case org_apache_arrow_flatbuf_Type_Int: return 1; + case org_apache_arrow_flatbuf_Type_FloatingPoint: return 1; + case org_apache_arrow_flatbuf_Type_Binary: return 1; + case org_apache_arrow_flatbuf_Type_Utf8: return 1; + case org_apache_arrow_flatbuf_Type_Bool: return 1; + case org_apache_arrow_flatbuf_Type_Decimal: return 1; + case org_apache_arrow_flatbuf_Type_Date: return 1; + case org_apache_arrow_flatbuf_Type_Time: return 1; + case org_apache_arrow_flatbuf_Type_Timestamp: return 1; + case org_apache_arrow_flatbuf_Type_Interval: return 1; + case org_apache_arrow_flatbuf_Type_List: return 1; + case org_apache_arrow_flatbuf_Type_Struct_: return 1; + case org_apache_arrow_flatbuf_Type_Union: return 1; + case org_apache_arrow_flatbuf_Type_FixedSizeBinary: return 1; + case org_apache_arrow_flatbuf_Type_FixedSizeList: return 1; + case org_apache_arrow_flatbuf_Type_Map: return 1; + case org_apache_arrow_flatbuf_Type_Duration: return 1; + case org_apache_arrow_flatbuf_Type_LargeBinary: return 1; + case org_apache_arrow_flatbuf_Type_LargeUtf8: return 1; + case org_apache_arrow_flatbuf_Type_LargeList: return 1; + case org_apache_arrow_flatbuf_Type_RunEndEncoded: return 1; + case org_apache_arrow_flatbuf_Type_BinaryView: return 1; + case org_apache_arrow_flatbuf_Type_Utf8View: return 1; + case org_apache_arrow_flatbuf_Type_ListView: return 1; + case org_apache_arrow_flatbuf_Type_LargeListView: return 1; + default: return 0; + } +} + + +struct org_apache_arrow_flatbuf_KeyValue_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_KeyValue_vec_len(org_apache_arrow_flatbuf_KeyValue_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_KeyValue_table_t org_apache_arrow_flatbuf_KeyValue_vec_at(org_apache_arrow_flatbuf_KeyValue_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_KeyValue_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_KeyValue) + +__flatbuffers_define_string_field(0, org_apache_arrow_flatbuf_KeyValue, key, 0) +__flatbuffers_define_string_field(1, org_apache_arrow_flatbuf_KeyValue, value, 0) + +struct org_apache_arrow_flatbuf_DictionaryEncoding_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_DictionaryEncoding_vec_len(org_apache_arrow_flatbuf_DictionaryEncoding_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_DictionaryEncoding_table_t org_apache_arrow_flatbuf_DictionaryEncoding_vec_at(org_apache_arrow_flatbuf_DictionaryEncoding_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_DictionaryEncoding_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_DictionaryEncoding) + +/** The known dictionary id in the application where this data is used. In + * the file or streaming formats, the dictionary ids are found in the + * DictionaryBatch messages */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_DictionaryEncoding, id, flatbuffers_int64, int64_t, INT64_C(0)) +/** The dictionary indices are constrained to be non-negative integers. If + * this field is null, the indices must be signed int32. To maximize + * cross-language compatibility and performance, implementations are + * recommended to prefer signed integer types over unsigned integer types + * and to avoid uint64 indices unless they are required by an application. */ +__flatbuffers_define_table_field(1, org_apache_arrow_flatbuf_DictionaryEncoding, indexType, org_apache_arrow_flatbuf_Int_table_t, 0) +/** By default, dictionaries are not ordered, or the order does not have + * semantic meaning. In some statistical, applications, dictionary-encoding + * is used to represent ordered categorical data, and we provide a way to + * preserve that metadata here */ +__flatbuffers_define_scalar_field(2, org_apache_arrow_flatbuf_DictionaryEncoding, isOrdered, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) +__flatbuffers_define_scalar_field(3, org_apache_arrow_flatbuf_DictionaryEncoding, dictionaryKind, org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t, INT16_C(0)) + +/** ---------------------------------------------------------------------- + * A field represents a named column in a record / row batch or child of a + * nested type. */ +struct org_apache_arrow_flatbuf_Field_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Field_vec_len(org_apache_arrow_flatbuf_Field_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Field_table_t org_apache_arrow_flatbuf_Field_vec_at(org_apache_arrow_flatbuf_Field_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Field_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Field) + +/** Name is not required, in i.e. a List */ +__flatbuffers_define_string_field(0, org_apache_arrow_flatbuf_Field, name, 0) +/** Whether or not this field can contain nulls. Should be true in general. */ +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Field, nullable, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) +/** This is the type of the decoded value if the field is dictionary encoded. */ +__flatbuffers_define_union_field(flatbuffers_, 3, org_apache_arrow_flatbuf_Field, type, org_apache_arrow_flatbuf_Type, 0) +/** Present only if the field is dictionary encoded. */ +__flatbuffers_define_table_field(4, org_apache_arrow_flatbuf_Field, dictionary, org_apache_arrow_flatbuf_DictionaryEncoding_table_t, 0) +/** children apply only to nested data types like Struct, List and Union. For + * primitive types children will have length 0. */ +__flatbuffers_define_vector_field(5, org_apache_arrow_flatbuf_Field, children, org_apache_arrow_flatbuf_Field_vec_t, 0) +/** User-defined metadata */ +__flatbuffers_define_vector_field(6, org_apache_arrow_flatbuf_Field, custom_metadata, org_apache_arrow_flatbuf_KeyValue_vec_t, 0) + +/** ---------------------------------------------------------------------- + * A Schema describes the columns in a row batch */ +struct org_apache_arrow_flatbuf_Schema_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Schema_vec_len(org_apache_arrow_flatbuf_Schema_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Schema_table_t org_apache_arrow_flatbuf_Schema_vec_at(org_apache_arrow_flatbuf_Schema_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Schema_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Schema) + +/** endianness of the buffer + * it is Little Endian by default + * if endianness doesn't match the underlying system then the vectors need to be converted */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Schema, endianness, org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t, INT16_C(0)) +__flatbuffers_define_vector_field(1, org_apache_arrow_flatbuf_Schema, fields, org_apache_arrow_flatbuf_Field_vec_t, 0) +__flatbuffers_define_vector_field(2, org_apache_arrow_flatbuf_Schema, custom_metadata, org_apache_arrow_flatbuf_KeyValue_vec_t, 0) +/** Features used in the stream/file. */ +__flatbuffers_define_vector_field(3, org_apache_arrow_flatbuf_Schema, features, org_apache_arrow_flatbuf_Feature_vec_t, 0) + + +#include "flatcc/flatcc_epilogue.h" +#endif /* SCHEMA_READER_H */ +#ifndef SCHEMA_BUILDER_H +#define SCHEMA_BUILDER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef SCHEMA_READER_H +#include "Schema_reader.h" +#endif +#ifndef FLATBUFFERS_COMMON_BUILDER_H +#include "flatbuffers_common_builder.h" +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + +#define __org_apache_arrow_flatbuf_MetadataVersion_formal_args , org_apache_arrow_flatbuf_MetadataVersion_enum_t v0 +#define __org_apache_arrow_flatbuf_MetadataVersion_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_MetadataVersion, org_apache_arrow_flatbuf_MetadataVersion_enum_t) +#define __org_apache_arrow_flatbuf_Feature_formal_args , org_apache_arrow_flatbuf_Feature_enum_t v0 +#define __org_apache_arrow_flatbuf_Feature_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_Feature, org_apache_arrow_flatbuf_Feature_enum_t) +#define __org_apache_arrow_flatbuf_UnionMode_formal_args , org_apache_arrow_flatbuf_UnionMode_enum_t v0 +#define __org_apache_arrow_flatbuf_UnionMode_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t) +#define __org_apache_arrow_flatbuf_Precision_formal_args , org_apache_arrow_flatbuf_Precision_enum_t v0 +#define __org_apache_arrow_flatbuf_Precision_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t) +#define __org_apache_arrow_flatbuf_DateUnit_formal_args , org_apache_arrow_flatbuf_DateUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_DateUnit_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t) +#define __org_apache_arrow_flatbuf_TimeUnit_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_TimeUnit_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t) +#define __org_apache_arrow_flatbuf_IntervalUnit_formal_args , org_apache_arrow_flatbuf_IntervalUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_IntervalUnit_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t) +#define __org_apache_arrow_flatbuf_DictionaryKind_formal_args , org_apache_arrow_flatbuf_DictionaryKind_enum_t v0 +#define __org_apache_arrow_flatbuf_DictionaryKind_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t) +#define __org_apache_arrow_flatbuf_Endianness_formal_args , org_apache_arrow_flatbuf_Endianness_enum_t v0 +#define __org_apache_arrow_flatbuf_Endianness_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t) + +#define __org_apache_arrow_flatbuf_Buffer_formal_args , int64_t v0, int64_t v1 +#define __org_apache_arrow_flatbuf_Buffer_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_assign(org_apache_arrow_flatbuf_Buffer_t *p, int64_t v0, int64_t v1) +{ p->offset = v0; p->length = v1; + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_copy(org_apache_arrow_flatbuf_Buffer_t *p, const org_apache_arrow_flatbuf_Buffer_t *p2) +{ p->offset = p2->offset; p->length = p2->length; + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_assign_to_pe(org_apache_arrow_flatbuf_Buffer_t *p, int64_t v0, int64_t v1) +{ flatbuffers_int64_assign_to_pe(&p->offset, v0); flatbuffers_int64_assign_to_pe(&p->length, v1); + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_copy_to_pe(org_apache_arrow_flatbuf_Buffer_t *p, const org_apache_arrow_flatbuf_Buffer_t *p2) +{ flatbuffers_int64_copy_to_pe(&p->offset, &p2->offset); flatbuffers_int64_copy_to_pe(&p->length, &p2->length); + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_assign_from_pe(org_apache_arrow_flatbuf_Buffer_t *p, int64_t v0, int64_t v1) +{ flatbuffers_int64_assign_from_pe(&p->offset, v0); flatbuffers_int64_assign_from_pe(&p->length, v1); + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_copy_from_pe(org_apache_arrow_flatbuf_Buffer_t *p, const org_apache_arrow_flatbuf_Buffer_t *p2) +{ flatbuffers_int64_copy_from_pe(&p->offset, &p2->offset); flatbuffers_int64_copy_from_pe(&p->length, &p2->length); + return p; } +__flatbuffers_build_struct(flatbuffers_, org_apache_arrow_flatbuf_Buffer, 16, 8, org_apache_arrow_flatbuf_Buffer_file_identifier, org_apache_arrow_flatbuf_Buffer_type_identifier) +__flatbuffers_define_fixed_array_primitives(flatbuffers_, org_apache_arrow_flatbuf_Buffer, org_apache_arrow_flatbuf_Buffer_t) + +typedef flatbuffers_union_ref_t org_apache_arrow_flatbuf_Type_union_ref_t; +typedef flatbuffers_union_vec_ref_t org_apache_arrow_flatbuf_Type_union_vec_ref_t; +static org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Type_union_t t); + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Null_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Null_ref_t; +static org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Null_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Null, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Struct__required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Struct__ref_t; +static org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Struct__table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Struct_, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_List_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_List_ref_t; +static org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_List_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_List, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeList_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeList_ref_t; +static org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeList_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeList, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_ListView_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_ListView_ref_t; +static org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_ListView_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_ListView, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeListView_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeListView_ref_t; +static org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeListView_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeListView, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_FixedSizeList_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_FixedSizeList_ref_t; +static org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeList_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeList, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Map_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Map_ref_t; +static org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Map_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Map, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Union_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Union_ref_t; +static org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Union_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Union, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Int_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Int_ref_t; +static org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Int_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Int, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_FloatingPoint_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_FloatingPoint_ref_t; +static org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FloatingPoint_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_FloatingPoint, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Utf8_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Utf8_ref_t; +static org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Utf8, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Binary_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Binary_ref_t; +static org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Binary_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Binary, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeUtf8_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeUtf8_ref_t; +static org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeUtf8_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeUtf8, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeBinary_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeBinary_ref_t; +static org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeBinary_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeBinary, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Utf8View_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Utf8View_ref_t; +static org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8View_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Utf8View, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_BinaryView_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_BinaryView_ref_t; +static org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_BinaryView_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_BinaryView, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_FixedSizeBinary_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_ref_t; +static org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeBinary_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeBinary, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Bool_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Bool_ref_t; +static org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Bool_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Bool, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_RunEndEncoded_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_RunEndEncoded_ref_t; +static org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_RunEndEncoded_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_RunEndEncoded, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Decimal_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Decimal_ref_t; +static org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Decimal_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Decimal, 3) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Date_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Date_ref_t; +static org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Date_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Date, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Time_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Time_ref_t; +static org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Time_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Time, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Timestamp_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Timestamp_ref_t; +static org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Timestamp_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Timestamp, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Interval_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Interval_ref_t; +static org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Interval_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Interval, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Duration_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Duration_ref_t; +static org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Duration_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Duration, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_KeyValue_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_KeyValue_ref_t; +static org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_KeyValue_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_KeyValue, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_DictionaryEncoding_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_ref_t; +static org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_DictionaryEncoding_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding, 4) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Field_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Field_ref_t; +static org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Field_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Field, 7) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Schema_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Schema_ref_t; +static org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Schema_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Schema, 4) + +#define __org_apache_arrow_flatbuf_Null_formal_args +#define __org_apache_arrow_flatbuf_Null_call_args +static inline org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Null_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Null, org_apache_arrow_flatbuf_Null_file_identifier, org_apache_arrow_flatbuf_Null_type_identifier) + +#define __org_apache_arrow_flatbuf_Struct__formal_args +#define __org_apache_arrow_flatbuf_Struct__call_args +static inline org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Struct__formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Struct_, org_apache_arrow_flatbuf_Struct__file_identifier, org_apache_arrow_flatbuf_Struct__type_identifier) + +#define __org_apache_arrow_flatbuf_List_formal_args +#define __org_apache_arrow_flatbuf_List_call_args +static inline org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_List_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_List, org_apache_arrow_flatbuf_List_file_identifier, org_apache_arrow_flatbuf_List_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeList_formal_args +#define __org_apache_arrow_flatbuf_LargeList_call_args +static inline org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeList_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeList, org_apache_arrow_flatbuf_LargeList_file_identifier, org_apache_arrow_flatbuf_LargeList_type_identifier) + +#define __org_apache_arrow_flatbuf_ListView_formal_args +#define __org_apache_arrow_flatbuf_ListView_call_args +static inline org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_ListView_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_ListView, org_apache_arrow_flatbuf_ListView_file_identifier, org_apache_arrow_flatbuf_ListView_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeListView_formal_args +#define __org_apache_arrow_flatbuf_LargeListView_call_args +static inline org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeListView_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeListView, org_apache_arrow_flatbuf_LargeListView_file_identifier, org_apache_arrow_flatbuf_LargeListView_type_identifier) + +#define __org_apache_arrow_flatbuf_FixedSizeList_formal_args , int32_t v0 +#define __org_apache_arrow_flatbuf_FixedSizeList_call_args , v0 +static inline org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeList_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeList, org_apache_arrow_flatbuf_FixedSizeList_file_identifier, org_apache_arrow_flatbuf_FixedSizeList_type_identifier) + +#define __org_apache_arrow_flatbuf_Map_formal_args , flatbuffers_bool_t v0 +#define __org_apache_arrow_flatbuf_Map_call_args , v0 +static inline org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Map_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Map, org_apache_arrow_flatbuf_Map_file_identifier, org_apache_arrow_flatbuf_Map_type_identifier) + +#define __org_apache_arrow_flatbuf_Union_formal_args , org_apache_arrow_flatbuf_UnionMode_enum_t v0, flatbuffers_int32_vec_ref_t v1 +#define __org_apache_arrow_flatbuf_Union_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Union_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Union, org_apache_arrow_flatbuf_Union_file_identifier, org_apache_arrow_flatbuf_Union_type_identifier) + +#define __org_apache_arrow_flatbuf_Int_formal_args , int32_t v0, flatbuffers_bool_t v1 +#define __org_apache_arrow_flatbuf_Int_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Int_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_Int_file_identifier, org_apache_arrow_flatbuf_Int_type_identifier) + +#define __org_apache_arrow_flatbuf_FloatingPoint_formal_args , org_apache_arrow_flatbuf_Precision_enum_t v0 +#define __org_apache_arrow_flatbuf_FloatingPoint_call_args , v0 +static inline org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FloatingPoint_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_FloatingPoint, org_apache_arrow_flatbuf_FloatingPoint_file_identifier, org_apache_arrow_flatbuf_FloatingPoint_type_identifier) + +#define __org_apache_arrow_flatbuf_Utf8_formal_args +#define __org_apache_arrow_flatbuf_Utf8_call_args +static inline org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Utf8, org_apache_arrow_flatbuf_Utf8_file_identifier, org_apache_arrow_flatbuf_Utf8_type_identifier) + +#define __org_apache_arrow_flatbuf_Binary_formal_args +#define __org_apache_arrow_flatbuf_Binary_call_args +static inline org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Binary_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Binary, org_apache_arrow_flatbuf_Binary_file_identifier, org_apache_arrow_flatbuf_Binary_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeUtf8_formal_args +#define __org_apache_arrow_flatbuf_LargeUtf8_call_args +static inline org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeUtf8_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeUtf8, org_apache_arrow_flatbuf_LargeUtf8_file_identifier, org_apache_arrow_flatbuf_LargeUtf8_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeBinary_formal_args +#define __org_apache_arrow_flatbuf_LargeBinary_call_args +static inline org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeBinary_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeBinary, org_apache_arrow_flatbuf_LargeBinary_file_identifier, org_apache_arrow_flatbuf_LargeBinary_type_identifier) + +#define __org_apache_arrow_flatbuf_Utf8View_formal_args +#define __org_apache_arrow_flatbuf_Utf8View_call_args +static inline org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8View_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Utf8View, org_apache_arrow_flatbuf_Utf8View_file_identifier, org_apache_arrow_flatbuf_Utf8View_type_identifier) + +#define __org_apache_arrow_flatbuf_BinaryView_formal_args +#define __org_apache_arrow_flatbuf_BinaryView_call_args +static inline org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_BinaryView_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_BinaryView, org_apache_arrow_flatbuf_BinaryView_file_identifier, org_apache_arrow_flatbuf_BinaryView_type_identifier) + +#define __org_apache_arrow_flatbuf_FixedSizeBinary_formal_args , int32_t v0 +#define __org_apache_arrow_flatbuf_FixedSizeBinary_call_args , v0 +static inline org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeBinary_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeBinary, org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier, org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier) + +#define __org_apache_arrow_flatbuf_Bool_formal_args +#define __org_apache_arrow_flatbuf_Bool_call_args +static inline org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Bool_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Bool, org_apache_arrow_flatbuf_Bool_file_identifier, org_apache_arrow_flatbuf_Bool_type_identifier) + +#define __org_apache_arrow_flatbuf_RunEndEncoded_formal_args +#define __org_apache_arrow_flatbuf_RunEndEncoded_call_args +static inline org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_RunEndEncoded_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_RunEndEncoded, org_apache_arrow_flatbuf_RunEndEncoded_file_identifier, org_apache_arrow_flatbuf_RunEndEncoded_type_identifier) + +#define __org_apache_arrow_flatbuf_Decimal_formal_args , int32_t v0, int32_t v1, int32_t v2 +#define __org_apache_arrow_flatbuf_Decimal_call_args , v0, v1, v2 +static inline org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Decimal_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Decimal, org_apache_arrow_flatbuf_Decimal_file_identifier, org_apache_arrow_flatbuf_Decimal_type_identifier) + +#define __org_apache_arrow_flatbuf_Date_formal_args , org_apache_arrow_flatbuf_DateUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_Date_call_args , v0 +static inline org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Date_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Date, org_apache_arrow_flatbuf_Date_file_identifier, org_apache_arrow_flatbuf_Date_type_identifier) + +#define __org_apache_arrow_flatbuf_Time_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0, int32_t v1 +#define __org_apache_arrow_flatbuf_Time_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Time_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Time, org_apache_arrow_flatbuf_Time_file_identifier, org_apache_arrow_flatbuf_Time_type_identifier) + +#define __org_apache_arrow_flatbuf_Timestamp_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0, flatbuffers_string_ref_t v1 +#define __org_apache_arrow_flatbuf_Timestamp_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Timestamp_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Timestamp, org_apache_arrow_flatbuf_Timestamp_file_identifier, org_apache_arrow_flatbuf_Timestamp_type_identifier) + +#define __org_apache_arrow_flatbuf_Interval_formal_args , org_apache_arrow_flatbuf_IntervalUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_Interval_call_args , v0 +static inline org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Interval_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Interval, org_apache_arrow_flatbuf_Interval_file_identifier, org_apache_arrow_flatbuf_Interval_type_identifier) + +#define __org_apache_arrow_flatbuf_Duration_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_Duration_call_args , v0 +static inline org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Duration_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Duration, org_apache_arrow_flatbuf_Duration_file_identifier, org_apache_arrow_flatbuf_Duration_type_identifier) + +#define __org_apache_arrow_flatbuf_KeyValue_formal_args , flatbuffers_string_ref_t v0, flatbuffers_string_ref_t v1 +#define __org_apache_arrow_flatbuf_KeyValue_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_KeyValue_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_KeyValue, org_apache_arrow_flatbuf_KeyValue_file_identifier, org_apache_arrow_flatbuf_KeyValue_type_identifier) + +#define __org_apache_arrow_flatbuf_DictionaryEncoding_formal_args , int64_t v0, org_apache_arrow_flatbuf_Int_ref_t v1, flatbuffers_bool_t v2, org_apache_arrow_flatbuf_DictionaryKind_enum_t v3 +#define __org_apache_arrow_flatbuf_DictionaryEncoding_call_args , v0, v1, v2, v3 +static inline org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_DictionaryEncoding_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding, org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier, org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier) + +#define __org_apache_arrow_flatbuf_Field_formal_args ,\ + flatbuffers_string_ref_t v0, flatbuffers_bool_t v1, org_apache_arrow_flatbuf_Type_union_ref_t v3, org_apache_arrow_flatbuf_DictionaryEncoding_ref_t v4, org_apache_arrow_flatbuf_Field_vec_ref_t v5, org_apache_arrow_flatbuf_KeyValue_vec_ref_t v6 +#define __org_apache_arrow_flatbuf_Field_call_args ,\ + v0, v1, v3, v4, v5, v6 +static inline org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Field_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Field, org_apache_arrow_flatbuf_Field_file_identifier, org_apache_arrow_flatbuf_Field_type_identifier) + +#define __org_apache_arrow_flatbuf_Schema_formal_args , org_apache_arrow_flatbuf_Endianness_enum_t v0, org_apache_arrow_flatbuf_Field_vec_ref_t v1, org_apache_arrow_flatbuf_KeyValue_vec_ref_t v2, org_apache_arrow_flatbuf_Feature_vec_ref_t v3 +#define __org_apache_arrow_flatbuf_Schema_call_args , v0, v1, v2, v3 +static inline org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Schema_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Schema, org_apache_arrow_flatbuf_Schema_file_identifier, org_apache_arrow_flatbuf_Schema_type_identifier) + +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_NONE(void) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_NONE; uref.value = 0; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Null(org_apache_arrow_flatbuf_Null_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Null; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Int(org_apache_arrow_flatbuf_Int_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Int; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_FloatingPoint(org_apache_arrow_flatbuf_FloatingPoint_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_FloatingPoint; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Binary(org_apache_arrow_flatbuf_Binary_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Binary; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Utf8(org_apache_arrow_flatbuf_Utf8_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Utf8; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Bool(org_apache_arrow_flatbuf_Bool_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Bool; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Decimal(org_apache_arrow_flatbuf_Decimal_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Decimal; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Date(org_apache_arrow_flatbuf_Date_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Date; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Time(org_apache_arrow_flatbuf_Time_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Time; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Timestamp(org_apache_arrow_flatbuf_Timestamp_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Timestamp; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Interval(org_apache_arrow_flatbuf_Interval_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Interval; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_List(org_apache_arrow_flatbuf_List_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_List; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Struct_(org_apache_arrow_flatbuf_Struct__ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Struct_; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Union(org_apache_arrow_flatbuf_Union_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Union; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_FixedSizeBinary(org_apache_arrow_flatbuf_FixedSizeBinary_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_FixedSizeBinary; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_FixedSizeList(org_apache_arrow_flatbuf_FixedSizeList_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_FixedSizeList; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Map(org_apache_arrow_flatbuf_Map_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Map; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Duration(org_apache_arrow_flatbuf_Duration_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Duration; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeBinary(org_apache_arrow_flatbuf_LargeBinary_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeBinary; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeUtf8(org_apache_arrow_flatbuf_LargeUtf8_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeUtf8; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeList(org_apache_arrow_flatbuf_LargeList_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeList; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_RunEndEncoded(org_apache_arrow_flatbuf_RunEndEncoded_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_RunEndEncoded; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_BinaryView(org_apache_arrow_flatbuf_BinaryView_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_BinaryView; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Utf8View(org_apache_arrow_flatbuf_Utf8View_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Utf8View; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_ListView(org_apache_arrow_flatbuf_ListView_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_ListView; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeListView(org_apache_arrow_flatbuf_LargeListView_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeListView; uref.value = ref; return uref; } +__flatbuffers_build_union_vector(flatbuffers_, org_apache_arrow_flatbuf_Type) + +static org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Type_union_t u) +{ + switch (u.type) { + case 1: return org_apache_arrow_flatbuf_Type_as_Null(org_apache_arrow_flatbuf_Null_clone(B, (org_apache_arrow_flatbuf_Null_table_t)u.value)); + case 2: return org_apache_arrow_flatbuf_Type_as_Int(org_apache_arrow_flatbuf_Int_clone(B, (org_apache_arrow_flatbuf_Int_table_t)u.value)); + case 3: return org_apache_arrow_flatbuf_Type_as_FloatingPoint(org_apache_arrow_flatbuf_FloatingPoint_clone(B, (org_apache_arrow_flatbuf_FloatingPoint_table_t)u.value)); + case 4: return org_apache_arrow_flatbuf_Type_as_Binary(org_apache_arrow_flatbuf_Binary_clone(B, (org_apache_arrow_flatbuf_Binary_table_t)u.value)); + case 5: return org_apache_arrow_flatbuf_Type_as_Utf8(org_apache_arrow_flatbuf_Utf8_clone(B, (org_apache_arrow_flatbuf_Utf8_table_t)u.value)); + case 6: return org_apache_arrow_flatbuf_Type_as_Bool(org_apache_arrow_flatbuf_Bool_clone(B, (org_apache_arrow_flatbuf_Bool_table_t)u.value)); + case 7: return org_apache_arrow_flatbuf_Type_as_Decimal(org_apache_arrow_flatbuf_Decimal_clone(B, (org_apache_arrow_flatbuf_Decimal_table_t)u.value)); + case 8: return org_apache_arrow_flatbuf_Type_as_Date(org_apache_arrow_flatbuf_Date_clone(B, (org_apache_arrow_flatbuf_Date_table_t)u.value)); + case 9: return org_apache_arrow_flatbuf_Type_as_Time(org_apache_arrow_flatbuf_Time_clone(B, (org_apache_arrow_flatbuf_Time_table_t)u.value)); + case 10: return org_apache_arrow_flatbuf_Type_as_Timestamp(org_apache_arrow_flatbuf_Timestamp_clone(B, (org_apache_arrow_flatbuf_Timestamp_table_t)u.value)); + case 11: return org_apache_arrow_flatbuf_Type_as_Interval(org_apache_arrow_flatbuf_Interval_clone(B, (org_apache_arrow_flatbuf_Interval_table_t)u.value)); + case 12: return org_apache_arrow_flatbuf_Type_as_List(org_apache_arrow_flatbuf_List_clone(B, (org_apache_arrow_flatbuf_List_table_t)u.value)); + case 13: return org_apache_arrow_flatbuf_Type_as_Struct_(org_apache_arrow_flatbuf_Struct__clone(B, (org_apache_arrow_flatbuf_Struct__table_t)u.value)); + case 14: return org_apache_arrow_flatbuf_Type_as_Union(org_apache_arrow_flatbuf_Union_clone(B, (org_apache_arrow_flatbuf_Union_table_t)u.value)); + case 15: return org_apache_arrow_flatbuf_Type_as_FixedSizeBinary(org_apache_arrow_flatbuf_FixedSizeBinary_clone(B, (org_apache_arrow_flatbuf_FixedSizeBinary_table_t)u.value)); + case 16: return org_apache_arrow_flatbuf_Type_as_FixedSizeList(org_apache_arrow_flatbuf_FixedSizeList_clone(B, (org_apache_arrow_flatbuf_FixedSizeList_table_t)u.value)); + case 17: return org_apache_arrow_flatbuf_Type_as_Map(org_apache_arrow_flatbuf_Map_clone(B, (org_apache_arrow_flatbuf_Map_table_t)u.value)); + case 18: return org_apache_arrow_flatbuf_Type_as_Duration(org_apache_arrow_flatbuf_Duration_clone(B, (org_apache_arrow_flatbuf_Duration_table_t)u.value)); + case 19: return org_apache_arrow_flatbuf_Type_as_LargeBinary(org_apache_arrow_flatbuf_LargeBinary_clone(B, (org_apache_arrow_flatbuf_LargeBinary_table_t)u.value)); + case 20: return org_apache_arrow_flatbuf_Type_as_LargeUtf8(org_apache_arrow_flatbuf_LargeUtf8_clone(B, (org_apache_arrow_flatbuf_LargeUtf8_table_t)u.value)); + case 21: return org_apache_arrow_flatbuf_Type_as_LargeList(org_apache_arrow_flatbuf_LargeList_clone(B, (org_apache_arrow_flatbuf_LargeList_table_t)u.value)); + case 22: return org_apache_arrow_flatbuf_Type_as_RunEndEncoded(org_apache_arrow_flatbuf_RunEndEncoded_clone(B, (org_apache_arrow_flatbuf_RunEndEncoded_table_t)u.value)); + case 23: return org_apache_arrow_flatbuf_Type_as_BinaryView(org_apache_arrow_flatbuf_BinaryView_clone(B, (org_apache_arrow_flatbuf_BinaryView_table_t)u.value)); + case 24: return org_apache_arrow_flatbuf_Type_as_Utf8View(org_apache_arrow_flatbuf_Utf8View_clone(B, (org_apache_arrow_flatbuf_Utf8View_table_t)u.value)); + case 25: return org_apache_arrow_flatbuf_Type_as_ListView(org_apache_arrow_flatbuf_ListView_clone(B, (org_apache_arrow_flatbuf_ListView_table_t)u.value)); + case 26: return org_apache_arrow_flatbuf_Type_as_LargeListView(org_apache_arrow_flatbuf_LargeListView_clone(B, (org_apache_arrow_flatbuf_LargeListView_table_t)u.value)); + default: return org_apache_arrow_flatbuf_Type_as_NONE(); + } +} + + +static inline org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Null_formal_args) +{ + if (org_apache_arrow_flatbuf_Null_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Null_end(B); +} + +static org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Null_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Null_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Null_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Struct__formal_args) +{ + if (org_apache_arrow_flatbuf_Struct__start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Struct__end(B); +} + +static org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Struct__table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Struct__start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Struct__end(B)); +} + + +static inline org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_List_formal_args) +{ + if (org_apache_arrow_flatbuf_List_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_List_end(B); +} + +static org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_List_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_List_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_List_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeList_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeList_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeList_end(B); +} + +static org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeList_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeList_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeList_end(B)); +} + + +static inline org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_ListView_formal_args) +{ + if (org_apache_arrow_flatbuf_ListView_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_ListView_end(B); +} + +static org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_ListView_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_ListView_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_ListView_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeListView_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeListView_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeListView_end(B); +} + +static org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeListView_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeListView_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeListView_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_FixedSizeList_listSize, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_FixedSizeList) + +static inline org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeList_formal_args) +{ + if (org_apache_arrow_flatbuf_FixedSizeList_start(B) + || org_apache_arrow_flatbuf_FixedSizeList_listSize_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_FixedSizeList_end(B); +} + +static org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeList_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_FixedSizeList_start(B) + || org_apache_arrow_flatbuf_FixedSizeList_listSize_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_FixedSizeList_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Map_keysSorted, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_Map) + +static inline org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Map_formal_args) +{ + if (org_apache_arrow_flatbuf_Map_start(B) + || org_apache_arrow_flatbuf_Map_keysSorted_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Map_end(B); +} + +static org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Map_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Map_start(B) + || org_apache_arrow_flatbuf_Map_keysSorted_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Map_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Union_mode, org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Union) +__flatbuffers_build_vector_field(1, flatbuffers_, org_apache_arrow_flatbuf_Union_typeIds, flatbuffers_int32, int32_t, org_apache_arrow_flatbuf_Union) + +static inline org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Union_formal_args) +{ + if (org_apache_arrow_flatbuf_Union_start(B) + || org_apache_arrow_flatbuf_Union_typeIds_add(B, v1) + || org_apache_arrow_flatbuf_Union_mode_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Union_end(B); +} + +static org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Union_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Union_start(B) + || org_apache_arrow_flatbuf_Union_typeIds_pick(B, t) + || org_apache_arrow_flatbuf_Union_mode_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Union_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Int_bitWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_Int) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Int_is_signed, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_Int) + +static inline org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Int_formal_args) +{ + if (org_apache_arrow_flatbuf_Int_start(B) + || org_apache_arrow_flatbuf_Int_bitWidth_add(B, v0) + || org_apache_arrow_flatbuf_Int_is_signed_add(B, v1)) { + return 0; + } + return org_apache_arrow_flatbuf_Int_end(B); +} + +static org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Int_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Int_start(B) + || org_apache_arrow_flatbuf_Int_bitWidth_pick(B, t) + || org_apache_arrow_flatbuf_Int_is_signed_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Int_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_FloatingPoint_precision, org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_FloatingPoint) + +static inline org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FloatingPoint_formal_args) +{ + if (org_apache_arrow_flatbuf_FloatingPoint_start(B) + || org_apache_arrow_flatbuf_FloatingPoint_precision_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_FloatingPoint_end(B); +} + +static org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FloatingPoint_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_FloatingPoint_start(B) + || org_apache_arrow_flatbuf_FloatingPoint_precision_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_FloatingPoint_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8_formal_args) +{ + if (org_apache_arrow_flatbuf_Utf8_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Utf8_end(B); +} + +static org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Utf8_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Utf8_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Binary_formal_args) +{ + if (org_apache_arrow_flatbuf_Binary_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Binary_end(B); +} + +static org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Binary_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Binary_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Binary_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeUtf8_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeUtf8_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeUtf8_end(B); +} + +static org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeUtf8_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeUtf8_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeUtf8_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeBinary_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeBinary_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeBinary_end(B); +} + +static org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeBinary_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeBinary_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeBinary_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8View_formal_args) +{ + if (org_apache_arrow_flatbuf_Utf8View_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Utf8View_end(B); +} + +static org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8View_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Utf8View_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Utf8View_end(B)); +} + + +static inline org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_BinaryView_formal_args) +{ + if (org_apache_arrow_flatbuf_BinaryView_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_BinaryView_end(B); +} + +static org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_BinaryView_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_BinaryView_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_BinaryView_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_FixedSizeBinary_byteWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_FixedSizeBinary) + +static inline org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeBinary_formal_args) +{ + if (org_apache_arrow_flatbuf_FixedSizeBinary_start(B) + || org_apache_arrow_flatbuf_FixedSizeBinary_byteWidth_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_FixedSizeBinary_end(B); +} + +static org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeBinary_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_FixedSizeBinary_start(B) + || org_apache_arrow_flatbuf_FixedSizeBinary_byteWidth_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_FixedSizeBinary_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Bool_formal_args) +{ + if (org_apache_arrow_flatbuf_Bool_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Bool_end(B); +} + +static org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Bool_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Bool_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Bool_end(B)); +} + + +static inline org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_RunEndEncoded_formal_args) +{ + if (org_apache_arrow_flatbuf_RunEndEncoded_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_RunEndEncoded_end(B); +} + +static org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_RunEndEncoded_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_RunEndEncoded_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_RunEndEncoded_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Decimal_precision, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Decimal_scale, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_scalar_field(2, flatbuffers_, org_apache_arrow_flatbuf_Decimal_bitWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(128), org_apache_arrow_flatbuf_Decimal) + +static inline org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Decimal_formal_args) +{ + if (org_apache_arrow_flatbuf_Decimal_start(B) + || org_apache_arrow_flatbuf_Decimal_precision_add(B, v0) + || org_apache_arrow_flatbuf_Decimal_scale_add(B, v1) + || org_apache_arrow_flatbuf_Decimal_bitWidth_add(B, v2)) { + return 0; + } + return org_apache_arrow_flatbuf_Decimal_end(B); +} + +static org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Decimal_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Decimal_start(B) + || org_apache_arrow_flatbuf_Decimal_precision_pick(B, t) + || org_apache_arrow_flatbuf_Decimal_scale_pick(B, t) + || org_apache_arrow_flatbuf_Decimal_bitWidth_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Decimal_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Date_unit, org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t, 2, 2, INT16_C(1), org_apache_arrow_flatbuf_Date) + +static inline org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Date_formal_args) +{ + if (org_apache_arrow_flatbuf_Date_start(B) + || org_apache_arrow_flatbuf_Date_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Date_end(B); +} + +static org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Date_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Date_start(B) + || org_apache_arrow_flatbuf_Date_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Date_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Time_unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 2, 2, INT16_C(1), org_apache_arrow_flatbuf_Time) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Time_bitWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(32), org_apache_arrow_flatbuf_Time) + +static inline org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Time_formal_args) +{ + if (org_apache_arrow_flatbuf_Time_start(B) + || org_apache_arrow_flatbuf_Time_bitWidth_add(B, v1) + || org_apache_arrow_flatbuf_Time_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Time_end(B); +} + +static org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Time_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Time_start(B) + || org_apache_arrow_flatbuf_Time_bitWidth_pick(B, t) + || org_apache_arrow_flatbuf_Time_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Time_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Timestamp_unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Timestamp) +__flatbuffers_build_string_field(1, flatbuffers_, org_apache_arrow_flatbuf_Timestamp_timezone, org_apache_arrow_flatbuf_Timestamp) + +static inline org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Timestamp_formal_args) +{ + if (org_apache_arrow_flatbuf_Timestamp_start(B) + || org_apache_arrow_flatbuf_Timestamp_timezone_add(B, v1) + || org_apache_arrow_flatbuf_Timestamp_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Timestamp_end(B); +} + +static org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Timestamp_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Timestamp_start(B) + || org_apache_arrow_flatbuf_Timestamp_timezone_pick(B, t) + || org_apache_arrow_flatbuf_Timestamp_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Timestamp_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Interval_unit, org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Interval) + +static inline org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Interval_formal_args) +{ + if (org_apache_arrow_flatbuf_Interval_start(B) + || org_apache_arrow_flatbuf_Interval_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Interval_end(B); +} + +static org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Interval_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Interval_start(B) + || org_apache_arrow_flatbuf_Interval_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Interval_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Duration_unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 2, 2, INT16_C(1), org_apache_arrow_flatbuf_Duration) + +static inline org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Duration_formal_args) +{ + if (org_apache_arrow_flatbuf_Duration_start(B) + || org_apache_arrow_flatbuf_Duration_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Duration_end(B); +} + +static org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Duration_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Duration_start(B) + || org_apache_arrow_flatbuf_Duration_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Duration_end(B)); +} + +__flatbuffers_build_string_field(0, flatbuffers_, org_apache_arrow_flatbuf_KeyValue_key, org_apache_arrow_flatbuf_KeyValue) +__flatbuffers_build_string_field(1, flatbuffers_, org_apache_arrow_flatbuf_KeyValue_value, org_apache_arrow_flatbuf_KeyValue) + +static inline org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_KeyValue_formal_args) +{ + if (org_apache_arrow_flatbuf_KeyValue_start(B) + || org_apache_arrow_flatbuf_KeyValue_key_add(B, v0) + || org_apache_arrow_flatbuf_KeyValue_value_add(B, v1)) { + return 0; + } + return org_apache_arrow_flatbuf_KeyValue_end(B); +} + +static org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_KeyValue_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_KeyValue_start(B) + || org_apache_arrow_flatbuf_KeyValue_key_pick(B, t) + || org_apache_arrow_flatbuf_KeyValue_value_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_KeyValue_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_id, flatbuffers_int64, int64_t, 8, 8, INT64_C(0), org_apache_arrow_flatbuf_DictionaryEncoding) +__flatbuffers_build_table_field(1, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_indexType, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_DictionaryEncoding) +__flatbuffers_build_scalar_field(2, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_isOrdered, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_DictionaryEncoding) +__flatbuffers_build_scalar_field(3, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_dictionaryKind, org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_DictionaryEncoding) + +static inline org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_DictionaryEncoding_formal_args) +{ + if (org_apache_arrow_flatbuf_DictionaryEncoding_start(B) + || org_apache_arrow_flatbuf_DictionaryEncoding_id_add(B, v0) + || org_apache_arrow_flatbuf_DictionaryEncoding_indexType_add(B, v1) + || org_apache_arrow_flatbuf_DictionaryEncoding_dictionaryKind_add(B, v3) + || org_apache_arrow_flatbuf_DictionaryEncoding_isOrdered_add(B, v2)) { + return 0; + } + return org_apache_arrow_flatbuf_DictionaryEncoding_end(B); +} + +static org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_DictionaryEncoding_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_DictionaryEncoding_start(B) + || org_apache_arrow_flatbuf_DictionaryEncoding_id_pick(B, t) + || org_apache_arrow_flatbuf_DictionaryEncoding_indexType_pick(B, t) + || org_apache_arrow_flatbuf_DictionaryEncoding_dictionaryKind_pick(B, t) + || org_apache_arrow_flatbuf_DictionaryEncoding_isOrdered_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_DictionaryEncoding_end(B)); +} + +__flatbuffers_build_string_field(0, flatbuffers_, org_apache_arrow_flatbuf_Field_name, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Field_nullable, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_Field) +__flatbuffers_build_union_field(3, flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Null, org_apache_arrow_flatbuf_Null) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Int, org_apache_arrow_flatbuf_Int) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, FloatingPoint, org_apache_arrow_flatbuf_FloatingPoint) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Binary, org_apache_arrow_flatbuf_Binary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Utf8, org_apache_arrow_flatbuf_Utf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Bool, org_apache_arrow_flatbuf_Bool) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Decimal, org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Date, org_apache_arrow_flatbuf_Date) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Time, org_apache_arrow_flatbuf_Time) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Timestamp, org_apache_arrow_flatbuf_Timestamp) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Interval, org_apache_arrow_flatbuf_Interval) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, List, org_apache_arrow_flatbuf_List) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Struct_, org_apache_arrow_flatbuf_Struct_) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Union, org_apache_arrow_flatbuf_Union) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, FixedSizeBinary, org_apache_arrow_flatbuf_FixedSizeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, FixedSizeList, org_apache_arrow_flatbuf_FixedSizeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Map, org_apache_arrow_flatbuf_Map) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Duration, org_apache_arrow_flatbuf_Duration) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeBinary, org_apache_arrow_flatbuf_LargeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeUtf8, org_apache_arrow_flatbuf_LargeUtf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeList, org_apache_arrow_flatbuf_LargeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, RunEndEncoded, org_apache_arrow_flatbuf_RunEndEncoded) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, BinaryView, org_apache_arrow_flatbuf_BinaryView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Utf8View, org_apache_arrow_flatbuf_Utf8View) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, ListView, org_apache_arrow_flatbuf_ListView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeListView, org_apache_arrow_flatbuf_LargeListView) +__flatbuffers_build_table_field(4, flatbuffers_, org_apache_arrow_flatbuf_Field_dictionary, org_apache_arrow_flatbuf_DictionaryEncoding, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_table_vector_field(5, flatbuffers_, org_apache_arrow_flatbuf_Field_children, org_apache_arrow_flatbuf_Field, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_table_vector_field(6, flatbuffers_, org_apache_arrow_flatbuf_Field_custom_metadata, org_apache_arrow_flatbuf_KeyValue, org_apache_arrow_flatbuf_Field) + +static inline org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Field_formal_args) +{ + if (org_apache_arrow_flatbuf_Field_start(B) + || org_apache_arrow_flatbuf_Field_name_add(B, v0) + || org_apache_arrow_flatbuf_Field_type_add_value(B, v3) + || org_apache_arrow_flatbuf_Field_dictionary_add(B, v4) + || org_apache_arrow_flatbuf_Field_children_add(B, v5) + || org_apache_arrow_flatbuf_Field_custom_metadata_add(B, v6) + || org_apache_arrow_flatbuf_Field_nullable_add(B, v1) + || org_apache_arrow_flatbuf_Field_type_add_type(B, v3.type)) { + return 0; + } + return org_apache_arrow_flatbuf_Field_end(B); +} + +static org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Field_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Field_start(B) + || org_apache_arrow_flatbuf_Field_name_pick(B, t) + || org_apache_arrow_flatbuf_Field_type_pick(B, t) + || org_apache_arrow_flatbuf_Field_dictionary_pick(B, t) + || org_apache_arrow_flatbuf_Field_children_pick(B, t) + || org_apache_arrow_flatbuf_Field_custom_metadata_pick(B, t) + || org_apache_arrow_flatbuf_Field_nullable_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Field_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Schema_endianness, org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Schema) +__flatbuffers_build_table_vector_field(1, flatbuffers_, org_apache_arrow_flatbuf_Schema_fields, org_apache_arrow_flatbuf_Field, org_apache_arrow_flatbuf_Schema) +__flatbuffers_build_table_vector_field(2, flatbuffers_, org_apache_arrow_flatbuf_Schema_custom_metadata, org_apache_arrow_flatbuf_KeyValue, org_apache_arrow_flatbuf_Schema) +__flatbuffers_build_vector_field(3, flatbuffers_, org_apache_arrow_flatbuf_Schema_features, org_apache_arrow_flatbuf_Feature, org_apache_arrow_flatbuf_Feature_enum_t, org_apache_arrow_flatbuf_Schema) + +static inline org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Schema_formal_args) +{ + if (org_apache_arrow_flatbuf_Schema_start(B) + || org_apache_arrow_flatbuf_Schema_fields_add(B, v1) + || org_apache_arrow_flatbuf_Schema_custom_metadata_add(B, v2) + || org_apache_arrow_flatbuf_Schema_features_add(B, v3) + || org_apache_arrow_flatbuf_Schema_endianness_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Schema_end(B); +} + +static org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Schema_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Schema_start(B) + || org_apache_arrow_flatbuf_Schema_fields_pick(B, t) + || org_apache_arrow_flatbuf_Schema_custom_metadata_pick(B, t) + || org_apache_arrow_flatbuf_Schema_features_pick(B, t) + || org_apache_arrow_flatbuf_Schema_endianness_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Schema_end(B)); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* SCHEMA_BUILDER_H */ +#ifndef SCHEMA_VERIFIER_H +#define SCHEMA_VERIFIER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef SCHEMA_READER_H +#include "Schema_reader.h" +#endif +#include "flatcc/flatcc_verifier.h" +#include "flatcc/flatcc_prologue.h" + +static int org_apache_arrow_flatbuf_Null_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Struct__verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_List_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeList_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_ListView_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeListView_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_FixedSizeList_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Map_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Union_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Int_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_FloatingPoint_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Utf8_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Binary_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeUtf8_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeBinary_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Utf8View_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_BinaryView_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_FixedSizeBinary_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Bool_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_RunEndEncoded_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Decimal_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Date_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Time_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Timestamp_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Interval_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Duration_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_KeyValue_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_DictionaryEncoding_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Field_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Schema_verify_table(flatcc_table_verifier_descriptor_t *td); + +static int org_apache_arrow_flatbuf_Type_union_verifier(flatcc_union_verifier_descriptor_t *ud) +{ + switch (ud->type) { + case 1: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Null_verify_table); /* Null */ + case 2: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Int_verify_table); /* Int */ + case 3: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_FloatingPoint_verify_table); /* FloatingPoint */ + case 4: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Binary_verify_table); /* Binary */ + case 5: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Utf8_verify_table); /* Utf8 */ + case 6: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Bool_verify_table); /* Bool */ + case 7: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Decimal_verify_table); /* Decimal */ + case 8: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Date_verify_table); /* Date */ + case 9: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Time_verify_table); /* Time */ + case 10: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Timestamp_verify_table); /* Timestamp */ + case 11: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Interval_verify_table); /* Interval */ + case 12: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_List_verify_table); /* List */ + case 13: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Struct__verify_table); /* Struct_ */ + case 14: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Union_verify_table); /* Union */ + case 15: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); /* FixedSizeBinary */ + case 16: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_FixedSizeList_verify_table); /* FixedSizeList */ + case 17: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Map_verify_table); /* Map */ + case 18: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Duration_verify_table); /* Duration */ + case 19: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeBinary_verify_table); /* LargeBinary */ + case 20: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeUtf8_verify_table); /* LargeUtf8 */ + case 21: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeList_verify_table); /* LargeList */ + case 22: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_RunEndEncoded_verify_table); /* RunEndEncoded */ + case 23: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_BinaryView_verify_table); /* BinaryView */ + case 24: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Utf8View_verify_table); /* Utf8View */ + case 25: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_ListView_verify_table); /* ListView */ + case 26: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeListView_verify_table); /* LargeListView */ + default: return flatcc_verify_ok; + } +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_identifier, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_identifier, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_typed_root(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_type_hash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_typed_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_type_hash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_struct_as_typed_root(buf, bufsiz, thash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_struct_as_typed_root_with_size(buf, bufsiz, thash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_struct_as_root(buf, bufsiz, fid, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_struct_as_root_with_size(buf, bufsiz, fid, 16, 8); +} + +static int org_apache_arrow_flatbuf_Null_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Null_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Null_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Null_type_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Null_type_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static int org_apache_arrow_flatbuf_Struct__verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Struct__identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Struct__identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Struct__type_identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Struct__type_identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static int org_apache_arrow_flatbuf_List_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_List_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_List_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_List_type_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_List_type_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_List_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeList_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_type_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_type_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static int org_apache_arrow_flatbuf_ListView_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_ListView_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_ListView_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_ListView_type_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_ListView_type_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeListView_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_type_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_type_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static int org_apache_arrow_flatbuf_FixedSizeList_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* listSize */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_type_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_type_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static int org_apache_arrow_flatbuf_Map_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 1, 1) /* keysSorted */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Map_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Map_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Map_type_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Map_type_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static int org_apache_arrow_flatbuf_Union_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* mode */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 1, 0, 4, 4, INT64_C(1073741823)) /* typeIds */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Union_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Union_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Union_type_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Union_type_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static int org_apache_arrow_flatbuf_Int_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* bitWidth */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 1, 1) /* is_signed */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Int_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Int_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Int_type_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Int_type_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static int org_apache_arrow_flatbuf_FloatingPoint_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* precision */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_type_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_type_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static int org_apache_arrow_flatbuf_Utf8_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_type_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_type_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static int org_apache_arrow_flatbuf_Binary_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Binary_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Binary_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Binary_type_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Binary_type_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeUtf8_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_type_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_type_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeBinary_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_type_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_type_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static int org_apache_arrow_flatbuf_Utf8View_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_type_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_type_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static int org_apache_arrow_flatbuf_BinaryView_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_type_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_type_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static int org_apache_arrow_flatbuf_FixedSizeBinary_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* byteWidth */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static int org_apache_arrow_flatbuf_Bool_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Bool_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Bool_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Bool_type_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Bool_type_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static int org_apache_arrow_flatbuf_RunEndEncoded_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_type_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_type_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static int org_apache_arrow_flatbuf_Decimal_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* precision */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 4, 4) /* scale */)) return ret; + if ((ret = flatcc_verify_field(td, 2, 4, 4) /* bitWidth */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_type_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_type_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static int org_apache_arrow_flatbuf_Date_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Date_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Date_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Date_type_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Date_type_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static int org_apache_arrow_flatbuf_Time_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 4, 4) /* bitWidth */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Time_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Time_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Time_type_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Time_type_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static int org_apache_arrow_flatbuf_Timestamp_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + if ((ret = flatcc_verify_string_field(td, 1, 0) /* timezone */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_type_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_type_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static int org_apache_arrow_flatbuf_Interval_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Interval_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Interval_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Interval_type_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Interval_type_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static int org_apache_arrow_flatbuf_Duration_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Duration_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Duration_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Duration_type_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Duration_type_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static int org_apache_arrow_flatbuf_KeyValue_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_string_field(td, 0, 0) /* key */)) return ret; + if ((ret = flatcc_verify_string_field(td, 1, 0) /* value */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_type_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_type_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static int org_apache_arrow_flatbuf_DictionaryEncoding_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 8, 8) /* id */)) return ret; + if ((ret = flatcc_verify_table_field(td, 1, 0, &org_apache_arrow_flatbuf_Int_verify_table) /* indexType */)) return ret; + if ((ret = flatcc_verify_field(td, 2, 1, 1) /* isOrdered */)) return ret; + if ((ret = flatcc_verify_field(td, 3, 2, 2) /* dictionaryKind */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static int org_apache_arrow_flatbuf_Field_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_string_field(td, 0, 0) /* name */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 1, 1) /* nullable */)) return ret; + if ((ret = flatcc_verify_union_field(td, 3, 0, &org_apache_arrow_flatbuf_Type_union_verifier) /* type */)) return ret; + if ((ret = flatcc_verify_table_field(td, 4, 0, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table) /* dictionary */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 5, 0, &org_apache_arrow_flatbuf_Field_verify_table) /* children */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 6, 0, &org_apache_arrow_flatbuf_KeyValue_verify_table) /* custom_metadata */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Field_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Field_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Field_type_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Field_type_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static int org_apache_arrow_flatbuf_Schema_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* endianness */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 1, 0, &org_apache_arrow_flatbuf_Field_verify_table) /* fields */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 2, 0, &org_apache_arrow_flatbuf_KeyValue_verify_table) /* custom_metadata */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 3, 0, 8, 8, INT64_C(536870911)) /* features */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Schema_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Schema_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Schema_type_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Schema_type_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* SCHEMA_VERIFIER_H */ +#ifndef TENSOR_READER_H +#define TENSOR_READER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef FLATBUFFERS_COMMON_READER_H +#include "flatbuffers_common_reader.h" +#endif +#ifndef SCHEMA_READER_H +#include "Schema_reader.h" +#endif +#include "flatcc/flatcc_flatbuffers.h" +#ifndef __alignas_is_defined +#include +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + + +typedef const struct org_apache_arrow_flatbuf_TensorDim_table *org_apache_arrow_flatbuf_TensorDim_table_t; +typedef struct org_apache_arrow_flatbuf_TensorDim_table *org_apache_arrow_flatbuf_TensorDim_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_TensorDim_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_TensorDim_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Tensor_table *org_apache_arrow_flatbuf_Tensor_table_t; +typedef struct org_apache_arrow_flatbuf_Tensor_table *org_apache_arrow_flatbuf_Tensor_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Tensor_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Tensor_mutable_vec_t; +#ifndef org_apache_arrow_flatbuf_TensorDim_file_identifier +#define org_apache_arrow_flatbuf_TensorDim_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_TensorDim_file_identifier */ +#ifndef org_apache_arrow_flatbuf_TensorDim_identifier +#define org_apache_arrow_flatbuf_TensorDim_identifier 0 +#endif +#define org_apache_arrow_flatbuf_TensorDim_type_hash ((flatbuffers_thash_t)0xbc6d7b25) +#define org_apache_arrow_flatbuf_TensorDim_type_identifier "\x25\x7b\x6d\xbc" +#ifndef org_apache_arrow_flatbuf_TensorDim_file_extension +#define org_apache_arrow_flatbuf_TensorDim_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Tensor_file_identifier +#define org_apache_arrow_flatbuf_Tensor_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Tensor_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Tensor_identifier +#define org_apache_arrow_flatbuf_Tensor_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Tensor_type_hash ((flatbuffers_thash_t)0x1764df19) +#define org_apache_arrow_flatbuf_Tensor_type_identifier "\x19\xdf\x64\x17" +#ifndef org_apache_arrow_flatbuf_Tensor_file_extension +#define org_apache_arrow_flatbuf_Tensor_file_extension "bin" +#endif + + + +/** ---------------------------------------------------------------------- + * Data structures for dense tensors + * Shape data for a single axis in a tensor */ +struct org_apache_arrow_flatbuf_TensorDim_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_TensorDim_vec_len(org_apache_arrow_flatbuf_TensorDim_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_TensorDim_table_t org_apache_arrow_flatbuf_TensorDim_vec_at(org_apache_arrow_flatbuf_TensorDim_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_TensorDim_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_TensorDim) + +/** Length of dimension */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_TensorDim, size, flatbuffers_int64, int64_t, INT64_C(0)) +/** Name of the dimension, optional */ +__flatbuffers_define_string_field(1, org_apache_arrow_flatbuf_TensorDim, name, 0) + +struct org_apache_arrow_flatbuf_Tensor_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Tensor_vec_len(org_apache_arrow_flatbuf_Tensor_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Tensor_table_t org_apache_arrow_flatbuf_Tensor_vec_at(org_apache_arrow_flatbuf_Tensor_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Tensor_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Tensor) + +/** The type of data contained in a value cell. Currently only fixed-width + * value types are supported, no strings or nested types */ +__flatbuffers_define_union_field(flatbuffers_, 1, org_apache_arrow_flatbuf_Tensor, type, org_apache_arrow_flatbuf_Type, 1) +/** The dimensions of the tensor, optionally named */ +__flatbuffers_define_vector_field(2, org_apache_arrow_flatbuf_Tensor, shape, org_apache_arrow_flatbuf_TensorDim_vec_t, 1) +/** Non-negative byte offsets to advance one value cell along each dimension + * If omitted, default to row-major order (C-like). */ +__flatbuffers_define_vector_field(3, org_apache_arrow_flatbuf_Tensor, strides, flatbuffers_int64_vec_t, 0) +/** The location and size of the tensor's data */ +__flatbuffers_define_struct_field(4, org_apache_arrow_flatbuf_Tensor, data, org_apache_arrow_flatbuf_Buffer_struct_t, 1) + + +#include "flatcc/flatcc_epilogue.h" +#endif /* TENSOR_READER_H */ +#ifndef TENSOR_BUILDER_H +#define TENSOR_BUILDER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef TENSOR_READER_H +#include "Tensor_reader.h" +#endif +#ifndef FLATBUFFERS_COMMON_BUILDER_H +#include "flatbuffers_common_builder.h" +#endif +#ifndef SCHEMA_BUILDER_H +#include "Schema_builder.h" +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_TensorDim_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_TensorDim_ref_t; +static org_apache_arrow_flatbuf_TensorDim_ref_t org_apache_arrow_flatbuf_TensorDim_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_TensorDim_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_TensorDim, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Tensor_required[] = { 1, 2, 4, 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Tensor_ref_t; +static org_apache_arrow_flatbuf_Tensor_ref_t org_apache_arrow_flatbuf_Tensor_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Tensor_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Tensor, 5) + +#define __org_apache_arrow_flatbuf_TensorDim_formal_args , int64_t v0, flatbuffers_string_ref_t v1 +#define __org_apache_arrow_flatbuf_TensorDim_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_TensorDim_ref_t org_apache_arrow_flatbuf_TensorDim_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_TensorDim_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_TensorDim, org_apache_arrow_flatbuf_TensorDim_file_identifier, org_apache_arrow_flatbuf_TensorDim_type_identifier) + +#define __org_apache_arrow_flatbuf_Tensor_formal_args , org_apache_arrow_flatbuf_Type_union_ref_t v1, org_apache_arrow_flatbuf_TensorDim_vec_ref_t v2, flatbuffers_int64_vec_ref_t v3, org_apache_arrow_flatbuf_Buffer_t *v4 +#define __org_apache_arrow_flatbuf_Tensor_call_args , v1, v2, v3, v4 +static inline org_apache_arrow_flatbuf_Tensor_ref_t org_apache_arrow_flatbuf_Tensor_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Tensor_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Tensor, org_apache_arrow_flatbuf_Tensor_file_identifier, org_apache_arrow_flatbuf_Tensor_type_identifier) + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_TensorDim_size, flatbuffers_int64, int64_t, 8, 8, INT64_C(0), org_apache_arrow_flatbuf_TensorDim) +__flatbuffers_build_string_field(1, flatbuffers_, org_apache_arrow_flatbuf_TensorDim_name, org_apache_arrow_flatbuf_TensorDim) + +static inline org_apache_arrow_flatbuf_TensorDim_ref_t org_apache_arrow_flatbuf_TensorDim_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_TensorDim_formal_args) +{ + if (org_apache_arrow_flatbuf_TensorDim_start(B) + || org_apache_arrow_flatbuf_TensorDim_size_add(B, v0) + || org_apache_arrow_flatbuf_TensorDim_name_add(B, v1)) { + return 0; + } + return org_apache_arrow_flatbuf_TensorDim_end(B); +} + +static org_apache_arrow_flatbuf_TensorDim_ref_t org_apache_arrow_flatbuf_TensorDim_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_TensorDim_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_TensorDim_start(B) + || org_apache_arrow_flatbuf_TensorDim_size_pick(B, t) + || org_apache_arrow_flatbuf_TensorDim_name_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_TensorDim_end(B)); +} + +__flatbuffers_build_union_field(1, flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, org_apache_arrow_flatbuf_Tensor) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Null, org_apache_arrow_flatbuf_Null) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Int, org_apache_arrow_flatbuf_Int) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, FloatingPoint, org_apache_arrow_flatbuf_FloatingPoint) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Binary, org_apache_arrow_flatbuf_Binary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Utf8, org_apache_arrow_flatbuf_Utf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Bool, org_apache_arrow_flatbuf_Bool) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Decimal, org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Date, org_apache_arrow_flatbuf_Date) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Time, org_apache_arrow_flatbuf_Time) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Timestamp, org_apache_arrow_flatbuf_Timestamp) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Interval, org_apache_arrow_flatbuf_Interval) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, List, org_apache_arrow_flatbuf_List) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Struct_, org_apache_arrow_flatbuf_Struct_) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Union, org_apache_arrow_flatbuf_Union) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, FixedSizeBinary, org_apache_arrow_flatbuf_FixedSizeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, FixedSizeList, org_apache_arrow_flatbuf_FixedSizeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Map, org_apache_arrow_flatbuf_Map) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Duration, org_apache_arrow_flatbuf_Duration) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, LargeBinary, org_apache_arrow_flatbuf_LargeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, LargeUtf8, org_apache_arrow_flatbuf_LargeUtf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, LargeList, org_apache_arrow_flatbuf_LargeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, RunEndEncoded, org_apache_arrow_flatbuf_RunEndEncoded) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, BinaryView, org_apache_arrow_flatbuf_BinaryView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Utf8View, org_apache_arrow_flatbuf_Utf8View) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, ListView, org_apache_arrow_flatbuf_ListView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, LargeListView, org_apache_arrow_flatbuf_LargeListView) +__flatbuffers_build_table_vector_field(2, flatbuffers_, org_apache_arrow_flatbuf_Tensor_shape, org_apache_arrow_flatbuf_TensorDim, org_apache_arrow_flatbuf_Tensor) +__flatbuffers_build_vector_field(3, flatbuffers_, org_apache_arrow_flatbuf_Tensor_strides, flatbuffers_int64, int64_t, org_apache_arrow_flatbuf_Tensor) +__flatbuffers_build_struct_field(4, flatbuffers_, org_apache_arrow_flatbuf_Tensor_data, org_apache_arrow_flatbuf_Buffer, 16, 8, org_apache_arrow_flatbuf_Tensor) + +static inline org_apache_arrow_flatbuf_Tensor_ref_t org_apache_arrow_flatbuf_Tensor_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Tensor_formal_args) +{ + if (org_apache_arrow_flatbuf_Tensor_start(B) + || org_apache_arrow_flatbuf_Tensor_data_add(B, v4) + || org_apache_arrow_flatbuf_Tensor_type_add_value(B, v1) + || org_apache_arrow_flatbuf_Tensor_shape_add(B, v2) + || org_apache_arrow_flatbuf_Tensor_strides_add(B, v3) + || org_apache_arrow_flatbuf_Tensor_type_add_type(B, v1.type)) { + return 0; + } + return org_apache_arrow_flatbuf_Tensor_end(B); +} + +static org_apache_arrow_flatbuf_Tensor_ref_t org_apache_arrow_flatbuf_Tensor_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Tensor_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Tensor_start(B) + || org_apache_arrow_flatbuf_Tensor_data_pick(B, t) + || org_apache_arrow_flatbuf_Tensor_type_pick(B, t) + || org_apache_arrow_flatbuf_Tensor_shape_pick(B, t) + || org_apache_arrow_flatbuf_Tensor_strides_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Tensor_end(B)); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* TENSOR_BUILDER_H */ +#ifndef TENSOR_VERIFIER_H +#define TENSOR_VERIFIER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef TENSOR_READER_H +#include "Tensor_reader.h" +#endif +#include "flatcc/flatcc_verifier.h" +#ifndef SCHEMA_VERIFIER_H +#include "Schema_verifier.h" +#endif +#include "flatcc/flatcc_prologue.h" + +static int org_apache_arrow_flatbuf_TensorDim_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Tensor_verify_table(flatcc_table_verifier_descriptor_t *td); + +static int org_apache_arrow_flatbuf_TensorDim_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 8, 8) /* size */)) return ret; + if ((ret = flatcc_verify_string_field(td, 1, 0) /* name */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_TensorDim_identifier, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_TensorDim_identifier, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_TensorDim_type_identifier, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_TensorDim_type_identifier, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static int org_apache_arrow_flatbuf_Tensor_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_union_field(td, 1, 1, &org_apache_arrow_flatbuf_Type_union_verifier) /* type */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 2, 1, &org_apache_arrow_flatbuf_TensorDim_verify_table) /* shape */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 3, 0, 8, 8, INT64_C(536870911)) /* strides */)) return ret; + if ((ret = flatcc_verify_field(td, 4, 16, 8) /* data */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Tensor_identifier, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Tensor_identifier, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Tensor_type_identifier, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Tensor_type_identifier, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* TENSOR_VERIFIER_H */ +#ifndef SPARSETENSOR_READER_H +#define SPARSETENSOR_READER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef FLATBUFFERS_COMMON_READER_H +#include "flatbuffers_common_reader.h" +#endif +#ifndef TENSOR_READER_H +#include "Tensor_reader.h" +#endif +#include "flatcc/flatcc_flatbuffers.h" +#ifndef __alignas_is_defined +#include +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + + +typedef const struct org_apache_arrow_flatbuf_SparseTensorIndexCOO_table *org_apache_arrow_flatbuf_SparseTensorIndexCOO_table_t; +typedef struct org_apache_arrow_flatbuf_SparseTensorIndexCOO_table *org_apache_arrow_flatbuf_SparseTensorIndexCOO_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_SparseTensorIndexCOO_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_SparseTensorIndexCOO_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_SparseMatrixIndexCSX_table *org_apache_arrow_flatbuf_SparseMatrixIndexCSX_table_t; +typedef struct org_apache_arrow_flatbuf_SparseMatrixIndexCSX_table *org_apache_arrow_flatbuf_SparseMatrixIndexCSX_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_SparseMatrixIndexCSX_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_SparseMatrixIndexCSX_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_SparseTensorIndexCSF_table *org_apache_arrow_flatbuf_SparseTensorIndexCSF_table_t; +typedef struct org_apache_arrow_flatbuf_SparseTensorIndexCSF_table *org_apache_arrow_flatbuf_SparseTensorIndexCSF_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_SparseTensorIndexCSF_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_SparseTensorIndexCSF_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_SparseTensor_table *org_apache_arrow_flatbuf_SparseTensor_table_t; +typedef struct org_apache_arrow_flatbuf_SparseTensor_table *org_apache_arrow_flatbuf_SparseTensor_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_SparseTensor_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_SparseTensor_mutable_vec_t; +#ifndef org_apache_arrow_flatbuf_SparseTensorIndexCOO_file_identifier +#define org_apache_arrow_flatbuf_SparseTensorIndexCOO_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_SparseTensorIndexCOO_file_identifier */ +#ifndef org_apache_arrow_flatbuf_SparseTensorIndexCOO_identifier +#define org_apache_arrow_flatbuf_SparseTensorIndexCOO_identifier 0 +#endif +#define org_apache_arrow_flatbuf_SparseTensorIndexCOO_type_hash ((flatbuffers_thash_t)0x3b31385a) +#define org_apache_arrow_flatbuf_SparseTensorIndexCOO_type_identifier "\x5a\x38\x31\x3b" +#ifndef org_apache_arrow_flatbuf_SparseTensorIndexCOO_file_extension +#define org_apache_arrow_flatbuf_SparseTensorIndexCOO_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_SparseMatrixIndexCSX_file_identifier +#define org_apache_arrow_flatbuf_SparseMatrixIndexCSX_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_SparseMatrixIndexCSX_file_identifier */ +#ifndef org_apache_arrow_flatbuf_SparseMatrixIndexCSX_identifier +#define org_apache_arrow_flatbuf_SparseMatrixIndexCSX_identifier 0 +#endif +#define org_apache_arrow_flatbuf_SparseMatrixIndexCSX_type_hash ((flatbuffers_thash_t)0xec57ea87) +#define org_apache_arrow_flatbuf_SparseMatrixIndexCSX_type_identifier "\x87\xea\x57\xec" +#ifndef org_apache_arrow_flatbuf_SparseMatrixIndexCSX_file_extension +#define org_apache_arrow_flatbuf_SparseMatrixIndexCSX_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_SparseTensorIndexCSF_file_identifier +#define org_apache_arrow_flatbuf_SparseTensorIndexCSF_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_SparseTensorIndexCSF_file_identifier */ +#ifndef org_apache_arrow_flatbuf_SparseTensorIndexCSF_identifier +#define org_apache_arrow_flatbuf_SparseTensorIndexCSF_identifier 0 +#endif +#define org_apache_arrow_flatbuf_SparseTensorIndexCSF_type_hash ((flatbuffers_thash_t)0xf44edda9) +#define org_apache_arrow_flatbuf_SparseTensorIndexCSF_type_identifier "\xa9\xdd\x4e\xf4" +#ifndef org_apache_arrow_flatbuf_SparseTensorIndexCSF_file_extension +#define org_apache_arrow_flatbuf_SparseTensorIndexCSF_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_SparseTensor_file_identifier +#define org_apache_arrow_flatbuf_SparseTensor_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_SparseTensor_file_identifier */ +#ifndef org_apache_arrow_flatbuf_SparseTensor_identifier +#define org_apache_arrow_flatbuf_SparseTensor_identifier 0 +#endif +#define org_apache_arrow_flatbuf_SparseTensor_type_hash ((flatbuffers_thash_t)0xae6f7239) +#define org_apache_arrow_flatbuf_SparseTensor_type_identifier "\x39\x72\x6f\xae" +#ifndef org_apache_arrow_flatbuf_SparseTensor_file_extension +#define org_apache_arrow_flatbuf_SparseTensor_file_extension "bin" +#endif + +typedef int16_t org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_SparseMatrixCompressedAxis, org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t, 16) +#define org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_Row ((org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_Column ((org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t)INT16_C(1)) + +static inline const char *org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_name(org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_Row: return "Row"; + case org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_Column: return "Column"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_is_known_value(org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_Row: return 1; + case org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_Column: return 1; + default: return 0; + } +} + + + +/** ---------------------------------------------------------------------- + * EXPERIMENTAL: Data structures for sparse tensors + * Coordinate (COO) format of sparse tensor index. + * + * COO's index list are represented as a NxM matrix, + * where N is the number of non-zero values, + * and M is the number of dimensions of a sparse tensor. + * + * indicesBuffer stores the location and size of the data of this indices + * matrix. The value type and the stride of the indices matrix is + * specified in indicesType and indicesStrides fields. + * + * For example, let X be a 2x3x4x5 tensor, and it has the following + * 6 non-zero values: + * ```text + * X[0, 1, 2, 0] := 1 + * X[1, 1, 2, 3] := 2 + * X[0, 2, 1, 0] := 3 + * X[0, 1, 3, 0] := 4 + * X[0, 1, 2, 1] := 5 + * X[1, 2, 0, 4] := 6 + * ``` + * In COO format, the index matrix of X is the following 4x6 matrix: + * ```text + * [[0, 0, 0, 0, 1, 1], + * [1, 1, 1, 2, 1, 2], + * [2, 2, 3, 1, 2, 0], + * [0, 1, 0, 0, 3, 4]] + * ``` + * When isCanonical is true, the indices is sorted in lexicographical order + * (row-major order), and it does not have duplicated entries. Otherwise, + * the indices may not be sorted, or may have duplicated entries. */ +struct org_apache_arrow_flatbuf_SparseTensorIndexCOO_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_SparseTensorIndexCOO_vec_len(org_apache_arrow_flatbuf_SparseTensorIndexCOO_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_SparseTensorIndexCOO_table_t org_apache_arrow_flatbuf_SparseTensorIndexCOO_vec_at(org_apache_arrow_flatbuf_SparseTensorIndexCOO_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_SparseTensorIndexCOO_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_SparseTensorIndexCOO) + +/** The type of values in indicesBuffer */ +__flatbuffers_define_table_field(0, org_apache_arrow_flatbuf_SparseTensorIndexCOO, indicesType, org_apache_arrow_flatbuf_Int_table_t, 1) +/** Non-negative byte offsets to advance one value cell along each dimension + * If omitted, default to row-major order (C-like). */ +__flatbuffers_define_vector_field(1, org_apache_arrow_flatbuf_SparseTensorIndexCOO, indicesStrides, flatbuffers_int64_vec_t, 0) +/** The location and size of the indices matrix's data */ +__flatbuffers_define_struct_field(2, org_apache_arrow_flatbuf_SparseTensorIndexCOO, indicesBuffer, org_apache_arrow_flatbuf_Buffer_struct_t, 1) +/** This flag is true if and only if the indices matrix is sorted in + * row-major order, and does not have duplicated entries. + * This sort order is the same as of Tensorflow's SparseTensor, + * but it is inverse order of SciPy's canonical coo_matrix + * (SciPy employs column-major order for its coo_matrix). */ +__flatbuffers_define_scalar_field(3, org_apache_arrow_flatbuf_SparseTensorIndexCOO, isCanonical, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) + +/** Compressed Sparse format, that is matrix-specific. */ +struct org_apache_arrow_flatbuf_SparseMatrixIndexCSX_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_SparseMatrixIndexCSX_vec_len(org_apache_arrow_flatbuf_SparseMatrixIndexCSX_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_SparseMatrixIndexCSX_table_t org_apache_arrow_flatbuf_SparseMatrixIndexCSX_vec_at(org_apache_arrow_flatbuf_SparseMatrixIndexCSX_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_SparseMatrixIndexCSX_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_SparseMatrixIndexCSX) + +/** Which axis, row or column, is compressed */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_SparseMatrixIndexCSX, compressedAxis, org_apache_arrow_flatbuf_SparseMatrixCompressedAxis, org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t, INT16_C(0)) +/** The type of values in indptrBuffer */ +__flatbuffers_define_table_field(1, org_apache_arrow_flatbuf_SparseMatrixIndexCSX, indptrType, org_apache_arrow_flatbuf_Int_table_t, 1) +/** indptrBuffer stores the location and size of indptr array that + * represents the range of the rows. + * The i-th row spans from `indptr[i]` to `indptr[i+1]` in the data. + * The length of this array is 1 + (the number of rows), and the type + * of index value is long. + * + * For example, let X be the following 6x4 matrix: + * ```text + * X := [[0, 1, 2, 0], + * [0, 0, 3, 0], + * [0, 4, 0, 5], + * [0, 0, 0, 0], + * [6, 0, 7, 8], + * [0, 9, 0, 0]]. + * ``` + * The array of non-zero values in X is: + * ```text + * values(X) = [1, 2, 3, 4, 5, 6, 7, 8, 9]. + * ``` + * And the indptr of X is: + * ```text + * indptr(X) = [0, 2, 3, 5, 5, 8, 10]. + * ``` */ +__flatbuffers_define_struct_field(2, org_apache_arrow_flatbuf_SparseMatrixIndexCSX, indptrBuffer, org_apache_arrow_flatbuf_Buffer_struct_t, 1) +/** The type of values in indicesBuffer */ +__flatbuffers_define_table_field(3, org_apache_arrow_flatbuf_SparseMatrixIndexCSX, indicesType, org_apache_arrow_flatbuf_Int_table_t, 1) +/** indicesBuffer stores the location and size of the array that + * contains the column indices of the corresponding non-zero values. + * The type of index value is long. + * + * For example, the indices of the above X is: + * ```text + * indices(X) = [1, 2, 2, 1, 3, 0, 2, 3, 1]. + * ``` + * Note that the indices are sorted in lexicographical order for each row. */ +__flatbuffers_define_struct_field(4, org_apache_arrow_flatbuf_SparseMatrixIndexCSX, indicesBuffer, org_apache_arrow_flatbuf_Buffer_struct_t, 1) + +/** Compressed Sparse Fiber (CSF) sparse tensor index. */ +struct org_apache_arrow_flatbuf_SparseTensorIndexCSF_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_SparseTensorIndexCSF_vec_len(org_apache_arrow_flatbuf_SparseTensorIndexCSF_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_SparseTensorIndexCSF_table_t org_apache_arrow_flatbuf_SparseTensorIndexCSF_vec_at(org_apache_arrow_flatbuf_SparseTensorIndexCSF_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_SparseTensorIndexCSF_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_SparseTensorIndexCSF) + +/** CSF is a generalization of compressed sparse row (CSR) index. + * See [smith2017knl](http://shaden.io/pub-files/smith2017knl.pdf) + * + * CSF index recursively compresses each dimension of a tensor into a set + * of prefix trees. Each path from a root to leaf forms one tensor + * non-zero index. CSF is implemented with two arrays of buffers and one + * arrays of integers. + * + * For example, let X be a 2x3x4x5 tensor and let it have the following + * 8 non-zero values: + * ```text + * X[0, 0, 0, 1] := 1 + * X[0, 0, 0, 2] := 2 + * X[0, 1, 0, 0] := 3 + * X[0, 1, 0, 2] := 4 + * X[0, 1, 1, 0] := 5 + * X[1, 1, 1, 0] := 6 + * X[1, 1, 1, 1] := 7 + * X[1, 1, 1, 2] := 8 + * ``` + * As a prefix tree this would be represented as: + * ```text + * 0 1 + * / \ | + * 0 1 1 + * / / \ | + * 0 0 1 1 + * /| /| | /| | + * 1 2 0 2 0 0 1 2 + * ``` + * The type of values in indptrBuffers */ +__flatbuffers_define_table_field(0, org_apache_arrow_flatbuf_SparseTensorIndexCSF, indptrType, org_apache_arrow_flatbuf_Int_table_t, 1) +/** indptrBuffers stores the sparsity structure. + * Each two consecutive dimensions in a tensor correspond to a buffer in + * indptrBuffers. A pair of consecutive values at `indptrBuffers[dim][i]` + * and `indptrBuffers[dim][i + 1]` signify a range of nodes in + * `indicesBuffers[dim + 1]` who are children of `indicesBuffers[dim][i]` node. + * + * For example, the indptrBuffers for the above X is: + * ```text + * indptrBuffer(X) = [ + * [0, 2, 3], + * [0, 1, 3, 4], + * [0, 2, 4, 5, 8] + * ]. + * ``` */ +__flatbuffers_define_vector_field(1, org_apache_arrow_flatbuf_SparseTensorIndexCSF, indptrBuffers, org_apache_arrow_flatbuf_Buffer_vec_t, 1) +/** The type of values in indicesBuffers */ +__flatbuffers_define_table_field(2, org_apache_arrow_flatbuf_SparseTensorIndexCSF, indicesType, org_apache_arrow_flatbuf_Int_table_t, 1) +/** indicesBuffers stores values of nodes. + * Each tensor dimension corresponds to a buffer in indicesBuffers. + * For example, the indicesBuffers for the above X is: + * ```text + * indicesBuffer(X) = [ + * [0, 1], + * [0, 1, 1], + * [0, 0, 1, 1], + * [1, 2, 0, 2, 0, 0, 1, 2] + * ]. + * ``` */ +__flatbuffers_define_vector_field(3, org_apache_arrow_flatbuf_SparseTensorIndexCSF, indicesBuffers, org_apache_arrow_flatbuf_Buffer_vec_t, 1) +/** axisOrder stores the sequence in which dimensions were traversed to + * produce the prefix tree. + * For example, the axisOrder for the above X is: + * ```text + * axisOrder(X) = [0, 1, 2, 3]. + * ``` */ +__flatbuffers_define_vector_field(4, org_apache_arrow_flatbuf_SparseTensorIndexCSF, axisOrder, flatbuffers_int32_vec_t, 1) +typedef uint8_t org_apache_arrow_flatbuf_SparseTensorIndex_union_type_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_SparseTensorIndex, org_apache_arrow_flatbuf_SparseTensorIndex_union_type_t, 8) +__flatbuffers_define_union(flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndex) +#define org_apache_arrow_flatbuf_SparseTensorIndex_NONE ((org_apache_arrow_flatbuf_SparseTensorIndex_union_type_t)UINT8_C(0)) +#define org_apache_arrow_flatbuf_SparseTensorIndex_SparseTensorIndexCOO ((org_apache_arrow_flatbuf_SparseTensorIndex_union_type_t)UINT8_C(1)) +#define org_apache_arrow_flatbuf_SparseTensorIndex_SparseMatrixIndexCSX ((org_apache_arrow_flatbuf_SparseTensorIndex_union_type_t)UINT8_C(2)) +#define org_apache_arrow_flatbuf_SparseTensorIndex_SparseTensorIndexCSF ((org_apache_arrow_flatbuf_SparseTensorIndex_union_type_t)UINT8_C(3)) + +static inline const char *org_apache_arrow_flatbuf_SparseTensorIndex_type_name(org_apache_arrow_flatbuf_SparseTensorIndex_union_type_t type) +{ + switch (type) { + case org_apache_arrow_flatbuf_SparseTensorIndex_NONE: return "NONE"; + case org_apache_arrow_flatbuf_SparseTensorIndex_SparseTensorIndexCOO: return "SparseTensorIndexCOO"; + case org_apache_arrow_flatbuf_SparseTensorIndex_SparseMatrixIndexCSX: return "SparseMatrixIndexCSX"; + case org_apache_arrow_flatbuf_SparseTensorIndex_SparseTensorIndexCSF: return "SparseTensorIndexCSF"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndex_is_known_type(org_apache_arrow_flatbuf_SparseTensorIndex_union_type_t type) +{ + switch (type) { + case org_apache_arrow_flatbuf_SparseTensorIndex_NONE: return 1; + case org_apache_arrow_flatbuf_SparseTensorIndex_SparseTensorIndexCOO: return 1; + case org_apache_arrow_flatbuf_SparseTensorIndex_SparseMatrixIndexCSX: return 1; + case org_apache_arrow_flatbuf_SparseTensorIndex_SparseTensorIndexCSF: return 1; + default: return 0; + } +} + + +struct org_apache_arrow_flatbuf_SparseTensor_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_SparseTensor_vec_len(org_apache_arrow_flatbuf_SparseTensor_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_SparseTensor_table_t org_apache_arrow_flatbuf_SparseTensor_vec_at(org_apache_arrow_flatbuf_SparseTensor_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_SparseTensor_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_SparseTensor) + +/** The type of data contained in a value cell. + * Currently only fixed-width value types are supported, + * no strings or nested types. */ +__flatbuffers_define_union_field(flatbuffers_, 1, org_apache_arrow_flatbuf_SparseTensor, type, org_apache_arrow_flatbuf_Type, 1) +/** The dimensions of the tensor, optionally named. */ +__flatbuffers_define_vector_field(2, org_apache_arrow_flatbuf_SparseTensor, shape, org_apache_arrow_flatbuf_TensorDim_vec_t, 1) +/** The number of non-zero values in a sparse tensor. */ +__flatbuffers_define_scalar_field(3, org_apache_arrow_flatbuf_SparseTensor, non_zero_length, flatbuffers_int64, int64_t, INT64_C(0)) +/** Sparse tensor index */ +__flatbuffers_define_union_field(flatbuffers_, 5, org_apache_arrow_flatbuf_SparseTensor, sparseIndex, org_apache_arrow_flatbuf_SparseTensorIndex, 1) +/** The location and size of the tensor's data */ +__flatbuffers_define_struct_field(6, org_apache_arrow_flatbuf_SparseTensor, data, org_apache_arrow_flatbuf_Buffer_struct_t, 1) + + +#include "flatcc/flatcc_epilogue.h" +#endif /* SPARSETENSOR_READER_H */ +#ifndef SPARSETENSOR_BUILDER_H +#define SPARSETENSOR_BUILDER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef SPARSETENSOR_READER_H +#include "SparseTensor_reader.h" +#endif +#ifndef FLATBUFFERS_COMMON_BUILDER_H +#include "flatbuffers_common_builder.h" +#endif +#ifndef TENSOR_BUILDER_H +#include "Tensor_builder.h" +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + +#define __org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_formal_args , org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t v0 +#define __org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_SparseMatrixCompressedAxis, org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t) + +typedef flatbuffers_union_ref_t org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t; +typedef flatbuffers_union_vec_ref_t org_apache_arrow_flatbuf_SparseTensorIndex_union_vec_ref_t; +static org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t org_apache_arrow_flatbuf_SparseTensorIndex_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseTensorIndex_union_t t); + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_SparseTensorIndexCOO_required[] = { 0, 2, 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCOO_ref_t; +static org_apache_arrow_flatbuf_SparseTensorIndexCOO_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCOO_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseTensorIndexCOO_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCOO, 4) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_SparseMatrixIndexCSX_required[] = { 1, 2, 3, 4, 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_SparseMatrixIndexCSX_ref_t; +static org_apache_arrow_flatbuf_SparseMatrixIndexCSX_ref_t org_apache_arrow_flatbuf_SparseMatrixIndexCSX_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_SparseMatrixIndexCSX, 5) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_SparseTensorIndexCSF_required[] = { 0, 1, 2, 3, 4, 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCSF_ref_t; +static org_apache_arrow_flatbuf_SparseTensorIndexCSF_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCSF_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseTensorIndexCSF_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCSF, 5) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_SparseTensor_required[] = { 1, 2, 5, 6, 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_SparseTensor_ref_t; +static org_apache_arrow_flatbuf_SparseTensor_ref_t org_apache_arrow_flatbuf_SparseTensor_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseTensor_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor, 7) + +#define __org_apache_arrow_flatbuf_SparseTensorIndexCOO_formal_args , org_apache_arrow_flatbuf_Int_ref_t v0, flatbuffers_int64_vec_ref_t v1, org_apache_arrow_flatbuf_Buffer_t *v2, flatbuffers_bool_t v3 +#define __org_apache_arrow_flatbuf_SparseTensorIndexCOO_call_args , v0, v1, v2, v3 +static inline org_apache_arrow_flatbuf_SparseTensorIndexCOO_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCOO_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_SparseTensorIndexCOO_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCOO, org_apache_arrow_flatbuf_SparseTensorIndexCOO_file_identifier, org_apache_arrow_flatbuf_SparseTensorIndexCOO_type_identifier) + +#define __org_apache_arrow_flatbuf_SparseMatrixIndexCSX_formal_args ,\ + org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t v0, org_apache_arrow_flatbuf_Int_ref_t v1, org_apache_arrow_flatbuf_Buffer_t *v2, org_apache_arrow_flatbuf_Int_ref_t v3, org_apache_arrow_flatbuf_Buffer_t *v4 +#define __org_apache_arrow_flatbuf_SparseMatrixIndexCSX_call_args ,\ + v0, v1, v2, v3, v4 +static inline org_apache_arrow_flatbuf_SparseMatrixIndexCSX_ref_t org_apache_arrow_flatbuf_SparseMatrixIndexCSX_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_SparseMatrixIndexCSX_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_SparseMatrixIndexCSX, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_file_identifier, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_type_identifier) + +#define __org_apache_arrow_flatbuf_SparseTensorIndexCSF_formal_args ,\ + org_apache_arrow_flatbuf_Int_ref_t v0, org_apache_arrow_flatbuf_Buffer_vec_ref_t v1, org_apache_arrow_flatbuf_Int_ref_t v2, org_apache_arrow_flatbuf_Buffer_vec_ref_t v3, flatbuffers_int32_vec_ref_t v4 +#define __org_apache_arrow_flatbuf_SparseTensorIndexCSF_call_args ,\ + v0, v1, v2, v3, v4 +static inline org_apache_arrow_flatbuf_SparseTensorIndexCSF_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCSF_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_SparseTensorIndexCSF_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCSF, org_apache_arrow_flatbuf_SparseTensorIndexCSF_file_identifier, org_apache_arrow_flatbuf_SparseTensorIndexCSF_type_identifier) + +#define __org_apache_arrow_flatbuf_SparseTensor_formal_args ,\ + org_apache_arrow_flatbuf_Type_union_ref_t v1, org_apache_arrow_flatbuf_TensorDim_vec_ref_t v2, int64_t v3, org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t v5, org_apache_arrow_flatbuf_Buffer_t *v6 +#define __org_apache_arrow_flatbuf_SparseTensor_call_args ,\ + v1, v2, v3, v5, v6 +static inline org_apache_arrow_flatbuf_SparseTensor_ref_t org_apache_arrow_flatbuf_SparseTensor_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_SparseTensor_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor, org_apache_arrow_flatbuf_SparseTensor_file_identifier, org_apache_arrow_flatbuf_SparseTensor_type_identifier) + +static inline org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t org_apache_arrow_flatbuf_SparseTensorIndex_as_NONE(void) +{ org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_SparseTensorIndex_NONE; uref.value = 0; return uref; } +static inline org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t org_apache_arrow_flatbuf_SparseTensorIndex_as_SparseTensorIndexCOO(org_apache_arrow_flatbuf_SparseTensorIndexCOO_ref_t ref) +{ org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_SparseTensorIndex_SparseTensorIndexCOO; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t org_apache_arrow_flatbuf_SparseTensorIndex_as_SparseMatrixIndexCSX(org_apache_arrow_flatbuf_SparseMatrixIndexCSX_ref_t ref) +{ org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_SparseTensorIndex_SparseMatrixIndexCSX; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t org_apache_arrow_flatbuf_SparseTensorIndex_as_SparseTensorIndexCSF(org_apache_arrow_flatbuf_SparseTensorIndexCSF_ref_t ref) +{ org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_SparseTensorIndex_SparseTensorIndexCSF; uref.value = ref; return uref; } +__flatbuffers_build_union_vector(flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndex) + +static org_apache_arrow_flatbuf_SparseTensorIndex_union_ref_t org_apache_arrow_flatbuf_SparseTensorIndex_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseTensorIndex_union_t u) +{ + switch (u.type) { + case 1: return org_apache_arrow_flatbuf_SparseTensorIndex_as_SparseTensorIndexCOO(org_apache_arrow_flatbuf_SparseTensorIndexCOO_clone(B, (org_apache_arrow_flatbuf_SparseTensorIndexCOO_table_t)u.value)); + case 2: return org_apache_arrow_flatbuf_SparseTensorIndex_as_SparseMatrixIndexCSX(org_apache_arrow_flatbuf_SparseMatrixIndexCSX_clone(B, (org_apache_arrow_flatbuf_SparseMatrixIndexCSX_table_t)u.value)); + case 3: return org_apache_arrow_flatbuf_SparseTensorIndex_as_SparseTensorIndexCSF(org_apache_arrow_flatbuf_SparseTensorIndexCSF_clone(B, (org_apache_arrow_flatbuf_SparseTensorIndexCSF_table_t)u.value)); + default: return org_apache_arrow_flatbuf_SparseTensorIndex_as_NONE(); + } +} + +__flatbuffers_build_table_field(0, flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCOO_indicesType, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_SparseTensorIndexCOO) +__flatbuffers_build_vector_field(1, flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCOO_indicesStrides, flatbuffers_int64, int64_t, org_apache_arrow_flatbuf_SparseTensorIndexCOO) +__flatbuffers_build_struct_field(2, flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCOO_indicesBuffer, org_apache_arrow_flatbuf_Buffer, 16, 8, org_apache_arrow_flatbuf_SparseTensorIndexCOO) +__flatbuffers_build_scalar_field(3, flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCOO_isCanonical, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_SparseTensorIndexCOO) + +static inline org_apache_arrow_flatbuf_SparseTensorIndexCOO_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCOO_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_SparseTensorIndexCOO_formal_args) +{ + if (org_apache_arrow_flatbuf_SparseTensorIndexCOO_start(B) + || org_apache_arrow_flatbuf_SparseTensorIndexCOO_indicesBuffer_add(B, v2) + || org_apache_arrow_flatbuf_SparseTensorIndexCOO_indicesType_add(B, v0) + || org_apache_arrow_flatbuf_SparseTensorIndexCOO_indicesStrides_add(B, v1) + || org_apache_arrow_flatbuf_SparseTensorIndexCOO_isCanonical_add(B, v3)) { + return 0; + } + return org_apache_arrow_flatbuf_SparseTensorIndexCOO_end(B); +} + +static org_apache_arrow_flatbuf_SparseTensorIndexCOO_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCOO_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseTensorIndexCOO_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_SparseTensorIndexCOO_start(B) + || org_apache_arrow_flatbuf_SparseTensorIndexCOO_indicesBuffer_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensorIndexCOO_indicesType_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensorIndexCOO_indicesStrides_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensorIndexCOO_isCanonical_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_SparseTensorIndexCOO_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_compressedAxis, org_apache_arrow_flatbuf_SparseMatrixCompressedAxis, org_apache_arrow_flatbuf_SparseMatrixCompressedAxis_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_SparseMatrixIndexCSX) +__flatbuffers_build_table_field(1, flatbuffers_, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indptrType, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_SparseMatrixIndexCSX) +__flatbuffers_build_struct_field(2, flatbuffers_, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indptrBuffer, org_apache_arrow_flatbuf_Buffer, 16, 8, org_apache_arrow_flatbuf_SparseMatrixIndexCSX) +__flatbuffers_build_table_field(3, flatbuffers_, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indicesType, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_SparseMatrixIndexCSX) +__flatbuffers_build_struct_field(4, flatbuffers_, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indicesBuffer, org_apache_arrow_flatbuf_Buffer, 16, 8, org_apache_arrow_flatbuf_SparseMatrixIndexCSX) + +static inline org_apache_arrow_flatbuf_SparseMatrixIndexCSX_ref_t org_apache_arrow_flatbuf_SparseMatrixIndexCSX_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_SparseMatrixIndexCSX_formal_args) +{ + if (org_apache_arrow_flatbuf_SparseMatrixIndexCSX_start(B) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indptrBuffer_add(B, v2) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indicesBuffer_add(B, v4) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indptrType_add(B, v1) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indicesType_add(B, v3) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_compressedAxis_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_SparseMatrixIndexCSX_end(B); +} + +static org_apache_arrow_flatbuf_SparseMatrixIndexCSX_ref_t org_apache_arrow_flatbuf_SparseMatrixIndexCSX_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_SparseMatrixIndexCSX_start(B) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indptrBuffer_pick(B, t) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indicesBuffer_pick(B, t) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indptrType_pick(B, t) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_indicesType_pick(B, t) + || org_apache_arrow_flatbuf_SparseMatrixIndexCSX_compressedAxis_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_end(B)); +} + +__flatbuffers_build_table_field(0, flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCSF_indptrType, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_SparseTensorIndexCSF) +__flatbuffers_build_vector_field(1, flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCSF_indptrBuffers, org_apache_arrow_flatbuf_Buffer, org_apache_arrow_flatbuf_Buffer_t, org_apache_arrow_flatbuf_SparseTensorIndexCSF) +__flatbuffers_build_table_field(2, flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCSF_indicesType, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_SparseTensorIndexCSF) +__flatbuffers_build_vector_field(3, flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCSF_indicesBuffers, org_apache_arrow_flatbuf_Buffer, org_apache_arrow_flatbuf_Buffer_t, org_apache_arrow_flatbuf_SparseTensorIndexCSF) +__flatbuffers_build_vector_field(4, flatbuffers_, org_apache_arrow_flatbuf_SparseTensorIndexCSF_axisOrder, flatbuffers_int32, int32_t, org_apache_arrow_flatbuf_SparseTensorIndexCSF) + +static inline org_apache_arrow_flatbuf_SparseTensorIndexCSF_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCSF_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_SparseTensorIndexCSF_formal_args) +{ + if (org_apache_arrow_flatbuf_SparseTensorIndexCSF_start(B) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_indptrType_add(B, v0) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_indptrBuffers_add(B, v1) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_indicesType_add(B, v2) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_indicesBuffers_add(B, v3) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_axisOrder_add(B, v4)) { + return 0; + } + return org_apache_arrow_flatbuf_SparseTensorIndexCSF_end(B); +} + +static org_apache_arrow_flatbuf_SparseTensorIndexCSF_ref_t org_apache_arrow_flatbuf_SparseTensorIndexCSF_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseTensorIndexCSF_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_SparseTensorIndexCSF_start(B) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_indptrType_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_indptrBuffers_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_indicesType_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_indicesBuffers_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensorIndexCSF_axisOrder_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_SparseTensorIndexCSF_end(B)); +} + +__flatbuffers_build_union_field(1, flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, org_apache_arrow_flatbuf_SparseTensor) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Null, org_apache_arrow_flatbuf_Null) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Int, org_apache_arrow_flatbuf_Int) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, FloatingPoint, org_apache_arrow_flatbuf_FloatingPoint) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Binary, org_apache_arrow_flatbuf_Binary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Utf8, org_apache_arrow_flatbuf_Utf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Bool, org_apache_arrow_flatbuf_Bool) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Decimal, org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Date, org_apache_arrow_flatbuf_Date) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Time, org_apache_arrow_flatbuf_Time) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Timestamp, org_apache_arrow_flatbuf_Timestamp) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Interval, org_apache_arrow_flatbuf_Interval) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, List, org_apache_arrow_flatbuf_List) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Struct_, org_apache_arrow_flatbuf_Struct_) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Union, org_apache_arrow_flatbuf_Union) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, FixedSizeBinary, org_apache_arrow_flatbuf_FixedSizeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, FixedSizeList, org_apache_arrow_flatbuf_FixedSizeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Map, org_apache_arrow_flatbuf_Map) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Duration, org_apache_arrow_flatbuf_Duration) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, LargeBinary, org_apache_arrow_flatbuf_LargeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, LargeUtf8, org_apache_arrow_flatbuf_LargeUtf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, LargeList, org_apache_arrow_flatbuf_LargeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, RunEndEncoded, org_apache_arrow_flatbuf_RunEndEncoded) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, BinaryView, org_apache_arrow_flatbuf_BinaryView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, Utf8View, org_apache_arrow_flatbuf_Utf8View) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, ListView, org_apache_arrow_flatbuf_ListView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_type, org_apache_arrow_flatbuf_Type, LargeListView, org_apache_arrow_flatbuf_LargeListView) +__flatbuffers_build_table_vector_field(2, flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_shape, org_apache_arrow_flatbuf_TensorDim, org_apache_arrow_flatbuf_SparseTensor) +__flatbuffers_build_scalar_field(3, flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_non_zero_length, flatbuffers_int64, int64_t, 8, 8, INT64_C(0), org_apache_arrow_flatbuf_SparseTensor) +__flatbuffers_build_union_field(5, flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_sparseIndex, org_apache_arrow_flatbuf_SparseTensorIndex, org_apache_arrow_flatbuf_SparseTensor) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_sparseIndex, org_apache_arrow_flatbuf_SparseTensorIndex, SparseTensorIndexCOO, org_apache_arrow_flatbuf_SparseTensorIndexCOO) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_sparseIndex, org_apache_arrow_flatbuf_SparseTensorIndex, SparseMatrixIndexCSX, org_apache_arrow_flatbuf_SparseMatrixIndexCSX) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_sparseIndex, org_apache_arrow_flatbuf_SparseTensorIndex, SparseTensorIndexCSF, org_apache_arrow_flatbuf_SparseTensorIndexCSF) +__flatbuffers_build_struct_field(6, flatbuffers_, org_apache_arrow_flatbuf_SparseTensor_data, org_apache_arrow_flatbuf_Buffer, 16, 8, org_apache_arrow_flatbuf_SparseTensor) + +static inline org_apache_arrow_flatbuf_SparseTensor_ref_t org_apache_arrow_flatbuf_SparseTensor_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_SparseTensor_formal_args) +{ + if (org_apache_arrow_flatbuf_SparseTensor_start(B) + || org_apache_arrow_flatbuf_SparseTensor_non_zero_length_add(B, v3) + || org_apache_arrow_flatbuf_SparseTensor_data_add(B, v6) + || org_apache_arrow_flatbuf_SparseTensor_type_add_value(B, v1) + || org_apache_arrow_flatbuf_SparseTensor_shape_add(B, v2) + || org_apache_arrow_flatbuf_SparseTensor_sparseIndex_add_value(B, v5) + || org_apache_arrow_flatbuf_SparseTensor_type_add_type(B, v1.type) + || org_apache_arrow_flatbuf_SparseTensor_sparseIndex_add_type(B, v5.type)) { + return 0; + } + return org_apache_arrow_flatbuf_SparseTensor_end(B); +} + +static org_apache_arrow_flatbuf_SparseTensor_ref_t org_apache_arrow_flatbuf_SparseTensor_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_SparseTensor_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_SparseTensor_start(B) + || org_apache_arrow_flatbuf_SparseTensor_non_zero_length_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensor_data_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensor_type_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensor_shape_pick(B, t) + || org_apache_arrow_flatbuf_SparseTensor_sparseIndex_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_SparseTensor_end(B)); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* SPARSETENSOR_BUILDER_H */ +#ifndef SPARSETENSOR_VERIFIER_H +#define SPARSETENSOR_VERIFIER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef SPARSETENSOR_READER_H +#include "SparseTensor_reader.h" +#endif +#include "flatcc/flatcc_verifier.h" +#ifndef TENSOR_VERIFIER_H +#include "Tensor_verifier.h" +#endif +#include "flatcc/flatcc_prologue.h" + +static int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_SparseTensor_verify_table(flatcc_table_verifier_descriptor_t *td); + +static int org_apache_arrow_flatbuf_SparseTensorIndex_union_verifier(flatcc_union_verifier_descriptor_t *ud) +{ + switch (ud->type) { + case 1: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table); /* SparseTensorIndexCOO */ + case 2: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table); /* SparseMatrixIndexCSX */ + case 3: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table); /* SparseTensorIndexCSF */ + default: return flatcc_verify_ok; + } +} + +static int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_table_field(td, 0, 1, &org_apache_arrow_flatbuf_Int_verify_table) /* indicesType */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 1, 0, 8, 8, INT64_C(536870911)) /* indicesStrides */)) return ret; + if ((ret = flatcc_verify_field(td, 2, 16, 8) /* indicesBuffer */)) return ret; + if ((ret = flatcc_verify_field(td, 3, 1, 1) /* isCanonical */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensorIndexCOO_identifier, &org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensorIndexCOO_identifier, &org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensorIndexCOO_type_identifier, &org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensorIndexCOO_type_identifier, &org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_SparseTensorIndexCOO_verify_table); +} + +static int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* compressedAxis */)) return ret; + if ((ret = flatcc_verify_table_field(td, 1, 1, &org_apache_arrow_flatbuf_Int_verify_table) /* indptrType */)) return ret; + if ((ret = flatcc_verify_field(td, 2, 16, 8) /* indptrBuffer */)) return ret; + if ((ret = flatcc_verify_table_field(td, 3, 1, &org_apache_arrow_flatbuf_Int_verify_table) /* indicesType */)) return ret; + if ((ret = flatcc_verify_field(td, 4, 16, 8) /* indicesBuffer */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_identifier, &org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_identifier, &org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_type_identifier, &org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_SparseMatrixIndexCSX_type_identifier, &org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_SparseMatrixIndexCSX_verify_table); +} + +static int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_table_field(td, 0, 1, &org_apache_arrow_flatbuf_Int_verify_table) /* indptrType */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 1, 1, 16, 8, INT64_C(268435455)) /* indptrBuffers */)) return ret; + if ((ret = flatcc_verify_table_field(td, 2, 1, &org_apache_arrow_flatbuf_Int_verify_table) /* indicesType */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 3, 1, 16, 8, INT64_C(268435455)) /* indicesBuffers */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 4, 1, 4, 4, INT64_C(1073741823)) /* axisOrder */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensorIndexCSF_identifier, &org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensorIndexCSF_identifier, &org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensorIndexCSF_type_identifier, &org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensorIndexCSF_type_identifier, &org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_SparseTensorIndexCSF_verify_table); +} + +static int org_apache_arrow_flatbuf_SparseTensor_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_union_field(td, 1, 1, &org_apache_arrow_flatbuf_Type_union_verifier) /* type */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 2, 1, &org_apache_arrow_flatbuf_TensorDim_verify_table) /* shape */)) return ret; + if ((ret = flatcc_verify_field(td, 3, 8, 8) /* non_zero_length */)) return ret; + if ((ret = flatcc_verify_union_field(td, 5, 1, &org_apache_arrow_flatbuf_SparseTensorIndex_union_verifier) /* sparseIndex */)) return ret; + if ((ret = flatcc_verify_field(td, 6, 16, 8) /* data */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_SparseTensor_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensor_identifier, &org_apache_arrow_flatbuf_SparseTensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensor_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensor_identifier, &org_apache_arrow_flatbuf_SparseTensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensor_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensor_type_identifier, &org_apache_arrow_flatbuf_SparseTensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensor_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_SparseTensor_type_identifier, &org_apache_arrow_flatbuf_SparseTensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensor_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_SparseTensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensor_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_SparseTensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensor_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_SparseTensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_SparseTensor_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_SparseTensor_verify_table); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* SPARSETENSOR_VERIFIER_H */ +#ifndef SCHEMA_READER_H +#define SCHEMA_READER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef FLATBUFFERS_COMMON_READER_H +#include "flatbuffers_common_reader.h" +#endif +#include "flatcc/flatcc_flatbuffers.h" +#ifndef __alignas_is_defined +#include +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + +typedef struct org_apache_arrow_flatbuf_Buffer org_apache_arrow_flatbuf_Buffer_t; +typedef const org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_struct_t; +typedef org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_mutable_struct_t; +typedef const org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_vec_t; +typedef org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_mutable_vec_t; + +typedef const struct org_apache_arrow_flatbuf_Null_table *org_apache_arrow_flatbuf_Null_table_t; +typedef struct org_apache_arrow_flatbuf_Null_table *org_apache_arrow_flatbuf_Null_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Null_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Null_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Struct__table *org_apache_arrow_flatbuf_Struct__table_t; +typedef struct org_apache_arrow_flatbuf_Struct__table *org_apache_arrow_flatbuf_Struct__mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Struct__vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Struct__mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_List_table *org_apache_arrow_flatbuf_List_table_t; +typedef struct org_apache_arrow_flatbuf_List_table *org_apache_arrow_flatbuf_List_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_List_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_List_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeList_table *org_apache_arrow_flatbuf_LargeList_table_t; +typedef struct org_apache_arrow_flatbuf_LargeList_table *org_apache_arrow_flatbuf_LargeList_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeList_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeList_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_ListView_table *org_apache_arrow_flatbuf_ListView_table_t; +typedef struct org_apache_arrow_flatbuf_ListView_table *org_apache_arrow_flatbuf_ListView_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_ListView_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_ListView_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeListView_table *org_apache_arrow_flatbuf_LargeListView_table_t; +typedef struct org_apache_arrow_flatbuf_LargeListView_table *org_apache_arrow_flatbuf_LargeListView_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeListView_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeListView_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_FixedSizeList_table *org_apache_arrow_flatbuf_FixedSizeList_table_t; +typedef struct org_apache_arrow_flatbuf_FixedSizeList_table *org_apache_arrow_flatbuf_FixedSizeList_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeList_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeList_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Map_table *org_apache_arrow_flatbuf_Map_table_t; +typedef struct org_apache_arrow_flatbuf_Map_table *org_apache_arrow_flatbuf_Map_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Map_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Map_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Union_table *org_apache_arrow_flatbuf_Union_table_t; +typedef struct org_apache_arrow_flatbuf_Union_table *org_apache_arrow_flatbuf_Union_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Union_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Union_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Int_table *org_apache_arrow_flatbuf_Int_table_t; +typedef struct org_apache_arrow_flatbuf_Int_table *org_apache_arrow_flatbuf_Int_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Int_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Int_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_FloatingPoint_table *org_apache_arrow_flatbuf_FloatingPoint_table_t; +typedef struct org_apache_arrow_flatbuf_FloatingPoint_table *org_apache_arrow_flatbuf_FloatingPoint_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FloatingPoint_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FloatingPoint_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Utf8_table *org_apache_arrow_flatbuf_Utf8_table_t; +typedef struct org_apache_arrow_flatbuf_Utf8_table *org_apache_arrow_flatbuf_Utf8_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Binary_table *org_apache_arrow_flatbuf_Binary_table_t; +typedef struct org_apache_arrow_flatbuf_Binary_table *org_apache_arrow_flatbuf_Binary_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Binary_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Binary_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeUtf8_table *org_apache_arrow_flatbuf_LargeUtf8_table_t; +typedef struct org_apache_arrow_flatbuf_LargeUtf8_table *org_apache_arrow_flatbuf_LargeUtf8_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeUtf8_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeUtf8_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_LargeBinary_table *org_apache_arrow_flatbuf_LargeBinary_table_t; +typedef struct org_apache_arrow_flatbuf_LargeBinary_table *org_apache_arrow_flatbuf_LargeBinary_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeBinary_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_LargeBinary_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Utf8View_table *org_apache_arrow_flatbuf_Utf8View_table_t; +typedef struct org_apache_arrow_flatbuf_Utf8View_table *org_apache_arrow_flatbuf_Utf8View_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8View_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Utf8View_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_BinaryView_table *org_apache_arrow_flatbuf_BinaryView_table_t; +typedef struct org_apache_arrow_flatbuf_BinaryView_table *org_apache_arrow_flatbuf_BinaryView_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_BinaryView_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_BinaryView_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_FixedSizeBinary_table *org_apache_arrow_flatbuf_FixedSizeBinary_table_t; +typedef struct org_apache_arrow_flatbuf_FixedSizeBinary_table *org_apache_arrow_flatbuf_FixedSizeBinary_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeBinary_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_FixedSizeBinary_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Bool_table *org_apache_arrow_flatbuf_Bool_table_t; +typedef struct org_apache_arrow_flatbuf_Bool_table *org_apache_arrow_flatbuf_Bool_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Bool_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Bool_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_RunEndEncoded_table *org_apache_arrow_flatbuf_RunEndEncoded_table_t; +typedef struct org_apache_arrow_flatbuf_RunEndEncoded_table *org_apache_arrow_flatbuf_RunEndEncoded_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_RunEndEncoded_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_RunEndEncoded_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Decimal_table *org_apache_arrow_flatbuf_Decimal_table_t; +typedef struct org_apache_arrow_flatbuf_Decimal_table *org_apache_arrow_flatbuf_Decimal_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Decimal_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Decimal_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Date_table *org_apache_arrow_flatbuf_Date_table_t; +typedef struct org_apache_arrow_flatbuf_Date_table *org_apache_arrow_flatbuf_Date_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Date_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Date_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Time_table *org_apache_arrow_flatbuf_Time_table_t; +typedef struct org_apache_arrow_flatbuf_Time_table *org_apache_arrow_flatbuf_Time_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Time_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Time_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Timestamp_table *org_apache_arrow_flatbuf_Timestamp_table_t; +typedef struct org_apache_arrow_flatbuf_Timestamp_table *org_apache_arrow_flatbuf_Timestamp_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Timestamp_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Timestamp_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Interval_table *org_apache_arrow_flatbuf_Interval_table_t; +typedef struct org_apache_arrow_flatbuf_Interval_table *org_apache_arrow_flatbuf_Interval_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Interval_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Interval_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Duration_table *org_apache_arrow_flatbuf_Duration_table_t; +typedef struct org_apache_arrow_flatbuf_Duration_table *org_apache_arrow_flatbuf_Duration_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Duration_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Duration_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_KeyValue_table *org_apache_arrow_flatbuf_KeyValue_table_t; +typedef struct org_apache_arrow_flatbuf_KeyValue_table *org_apache_arrow_flatbuf_KeyValue_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_KeyValue_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_KeyValue_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_DictionaryEncoding_table *org_apache_arrow_flatbuf_DictionaryEncoding_table_t; +typedef struct org_apache_arrow_flatbuf_DictionaryEncoding_table *org_apache_arrow_flatbuf_DictionaryEncoding_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_DictionaryEncoding_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_DictionaryEncoding_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Field_table *org_apache_arrow_flatbuf_Field_table_t; +typedef struct org_apache_arrow_flatbuf_Field_table *org_apache_arrow_flatbuf_Field_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Field_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Field_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Schema_table *org_apache_arrow_flatbuf_Schema_table_t; +typedef struct org_apache_arrow_flatbuf_Schema_table *org_apache_arrow_flatbuf_Schema_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Schema_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Schema_mutable_vec_t; +#ifndef org_apache_arrow_flatbuf_Null_file_identifier +#define org_apache_arrow_flatbuf_Null_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Null_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Null_identifier +#define org_apache_arrow_flatbuf_Null_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Null_type_hash ((flatbuffers_thash_t)0x7b36a4dd) +#define org_apache_arrow_flatbuf_Null_type_identifier "\xdd\xa4\x36\x7b" +#ifndef org_apache_arrow_flatbuf_Null_file_extension +#define org_apache_arrow_flatbuf_Null_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Struct__file_identifier +#define org_apache_arrow_flatbuf_Struct__file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Struct__file_identifier */ +#ifndef org_apache_arrow_flatbuf_Struct__identifier +#define org_apache_arrow_flatbuf_Struct__identifier 0 +#endif +#define org_apache_arrow_flatbuf_Struct__type_hash ((flatbuffers_thash_t)0x6310f362) +#define org_apache_arrow_flatbuf_Struct__type_identifier "\x62\xf3\x10\x63" +#ifndef org_apache_arrow_flatbuf_Struct__file_extension +#define org_apache_arrow_flatbuf_Struct__file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_List_file_identifier +#define org_apache_arrow_flatbuf_List_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_List_file_identifier */ +#ifndef org_apache_arrow_flatbuf_List_identifier +#define org_apache_arrow_flatbuf_List_identifier 0 +#endif +#define org_apache_arrow_flatbuf_List_type_hash ((flatbuffers_thash_t)0xd4ce5878) +#define org_apache_arrow_flatbuf_List_type_identifier "\x78\x58\xce\xd4" +#ifndef org_apache_arrow_flatbuf_List_file_extension +#define org_apache_arrow_flatbuf_List_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeList_file_identifier +#define org_apache_arrow_flatbuf_LargeList_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeList_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeList_identifier +#define org_apache_arrow_flatbuf_LargeList_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeList_type_hash ((flatbuffers_thash_t)0x38aa7e27) +#define org_apache_arrow_flatbuf_LargeList_type_identifier "\x27\x7e\xaa\x38" +#ifndef org_apache_arrow_flatbuf_LargeList_file_extension +#define org_apache_arrow_flatbuf_LargeList_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_ListView_file_identifier +#define org_apache_arrow_flatbuf_ListView_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_ListView_file_identifier */ +#ifndef org_apache_arrow_flatbuf_ListView_identifier +#define org_apache_arrow_flatbuf_ListView_identifier 0 +#endif +#define org_apache_arrow_flatbuf_ListView_type_hash ((flatbuffers_thash_t)0x23d37919) +#define org_apache_arrow_flatbuf_ListView_type_identifier "\x19\x79\xd3\x23" +#ifndef org_apache_arrow_flatbuf_ListView_file_extension +#define org_apache_arrow_flatbuf_ListView_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeListView_file_identifier +#define org_apache_arrow_flatbuf_LargeListView_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeListView_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeListView_identifier +#define org_apache_arrow_flatbuf_LargeListView_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeListView_type_hash ((flatbuffers_thash_t)0x28efac02) +#define org_apache_arrow_flatbuf_LargeListView_type_identifier "\x02\xac\xef\x28" +#ifndef org_apache_arrow_flatbuf_LargeListView_file_extension +#define org_apache_arrow_flatbuf_LargeListView_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_FixedSizeList_file_identifier +#define org_apache_arrow_flatbuf_FixedSizeList_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_FixedSizeList_file_identifier */ +#ifndef org_apache_arrow_flatbuf_FixedSizeList_identifier +#define org_apache_arrow_flatbuf_FixedSizeList_identifier 0 +#endif +#define org_apache_arrow_flatbuf_FixedSizeList_type_hash ((flatbuffers_thash_t)0xcef245bb) +#define org_apache_arrow_flatbuf_FixedSizeList_type_identifier "\xbb\x45\xf2\xce" +#ifndef org_apache_arrow_flatbuf_FixedSizeList_file_extension +#define org_apache_arrow_flatbuf_FixedSizeList_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Map_file_identifier +#define org_apache_arrow_flatbuf_Map_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Map_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Map_identifier +#define org_apache_arrow_flatbuf_Map_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Map_type_hash ((flatbuffers_thash_t)0xcebef8e6) +#define org_apache_arrow_flatbuf_Map_type_identifier "\xe6\xf8\xbe\xce" +#ifndef org_apache_arrow_flatbuf_Map_file_extension +#define org_apache_arrow_flatbuf_Map_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Union_file_identifier +#define org_apache_arrow_flatbuf_Union_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Union_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Union_identifier +#define org_apache_arrow_flatbuf_Union_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Union_type_hash ((flatbuffers_thash_t)0x896bda57) +#define org_apache_arrow_flatbuf_Union_type_identifier "\x57\xda\x6b\x89" +#ifndef org_apache_arrow_flatbuf_Union_file_extension +#define org_apache_arrow_flatbuf_Union_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Int_file_identifier +#define org_apache_arrow_flatbuf_Int_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Int_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Int_identifier +#define org_apache_arrow_flatbuf_Int_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Int_type_hash ((flatbuffers_thash_t)0x30789001) +#define org_apache_arrow_flatbuf_Int_type_identifier "\x01\x90\x78\x30" +#ifndef org_apache_arrow_flatbuf_Int_file_extension +#define org_apache_arrow_flatbuf_Int_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_FloatingPoint_file_identifier +#define org_apache_arrow_flatbuf_FloatingPoint_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_FloatingPoint_file_identifier */ +#ifndef org_apache_arrow_flatbuf_FloatingPoint_identifier +#define org_apache_arrow_flatbuf_FloatingPoint_identifier 0 +#endif +#define org_apache_arrow_flatbuf_FloatingPoint_type_hash ((flatbuffers_thash_t)0xf7d06268) +#define org_apache_arrow_flatbuf_FloatingPoint_type_identifier "\x68\x62\xd0\xf7" +#ifndef org_apache_arrow_flatbuf_FloatingPoint_file_extension +#define org_apache_arrow_flatbuf_FloatingPoint_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Utf8_file_identifier +#define org_apache_arrow_flatbuf_Utf8_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Utf8_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Utf8_identifier +#define org_apache_arrow_flatbuf_Utf8_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Utf8_type_hash ((flatbuffers_thash_t)0x8fe60d37) +#define org_apache_arrow_flatbuf_Utf8_type_identifier "\x37\x0d\xe6\x8f" +#ifndef org_apache_arrow_flatbuf_Utf8_file_extension +#define org_apache_arrow_flatbuf_Utf8_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Binary_file_identifier +#define org_apache_arrow_flatbuf_Binary_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Binary_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Binary_identifier +#define org_apache_arrow_flatbuf_Binary_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Binary_type_hash ((flatbuffers_thash_t)0x8e21a795) +#define org_apache_arrow_flatbuf_Binary_type_identifier "\x95\xa7\x21\x8e" +#ifndef org_apache_arrow_flatbuf_Binary_file_extension +#define org_apache_arrow_flatbuf_Binary_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeUtf8_file_identifier +#define org_apache_arrow_flatbuf_LargeUtf8_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeUtf8_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeUtf8_identifier +#define org_apache_arrow_flatbuf_LargeUtf8_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeUtf8_type_hash ((flatbuffers_thash_t)0x24ed2fb0) +#define org_apache_arrow_flatbuf_LargeUtf8_type_identifier "\xb0\x2f\xed\x24" +#ifndef org_apache_arrow_flatbuf_LargeUtf8_file_extension +#define org_apache_arrow_flatbuf_LargeUtf8_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_LargeBinary_file_identifier +#define org_apache_arrow_flatbuf_LargeBinary_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_LargeBinary_file_identifier */ +#ifndef org_apache_arrow_flatbuf_LargeBinary_identifier +#define org_apache_arrow_flatbuf_LargeBinary_identifier 0 +#endif +#define org_apache_arrow_flatbuf_LargeBinary_type_hash ((flatbuffers_thash_t)0xbd437872) +#define org_apache_arrow_flatbuf_LargeBinary_type_identifier "\x72\x78\x43\xbd" +#ifndef org_apache_arrow_flatbuf_LargeBinary_file_extension +#define org_apache_arrow_flatbuf_LargeBinary_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Utf8View_file_identifier +#define org_apache_arrow_flatbuf_Utf8View_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Utf8View_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Utf8View_identifier +#define org_apache_arrow_flatbuf_Utf8View_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Utf8View_type_hash ((flatbuffers_thash_t)0xab7692) +#define org_apache_arrow_flatbuf_Utf8View_type_identifier "\x92\x76\xab\x00" +#ifndef org_apache_arrow_flatbuf_Utf8View_file_extension +#define org_apache_arrow_flatbuf_Utf8View_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_BinaryView_file_identifier +#define org_apache_arrow_flatbuf_BinaryView_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_BinaryView_file_identifier */ +#ifndef org_apache_arrow_flatbuf_BinaryView_identifier +#define org_apache_arrow_flatbuf_BinaryView_identifier 0 +#endif +#define org_apache_arrow_flatbuf_BinaryView_type_hash ((flatbuffers_thash_t)0x18c52428) +#define org_apache_arrow_flatbuf_BinaryView_type_identifier "\x28\x24\xc5\x18" +#ifndef org_apache_arrow_flatbuf_BinaryView_file_extension +#define org_apache_arrow_flatbuf_BinaryView_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier +#define org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier */ +#ifndef org_apache_arrow_flatbuf_FixedSizeBinary_identifier +#define org_apache_arrow_flatbuf_FixedSizeBinary_identifier 0 +#endif +#define org_apache_arrow_flatbuf_FixedSizeBinary_type_hash ((flatbuffers_thash_t)0x80d0f4ce) +#define org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier "\xce\xf4\xd0\x80" +#ifndef org_apache_arrow_flatbuf_FixedSizeBinary_file_extension +#define org_apache_arrow_flatbuf_FixedSizeBinary_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Bool_file_identifier +#define org_apache_arrow_flatbuf_Bool_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Bool_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Bool_identifier +#define org_apache_arrow_flatbuf_Bool_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Bool_type_hash ((flatbuffers_thash_t)0x96bf83f0) +#define org_apache_arrow_flatbuf_Bool_type_identifier "\xf0\x83\xbf\x96" +#ifndef org_apache_arrow_flatbuf_Bool_file_extension +#define org_apache_arrow_flatbuf_Bool_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_RunEndEncoded_file_identifier +#define org_apache_arrow_flatbuf_RunEndEncoded_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_RunEndEncoded_file_identifier */ +#ifndef org_apache_arrow_flatbuf_RunEndEncoded_identifier +#define org_apache_arrow_flatbuf_RunEndEncoded_identifier 0 +#endif +#define org_apache_arrow_flatbuf_RunEndEncoded_type_hash ((flatbuffers_thash_t)0x5a98bcc) +#define org_apache_arrow_flatbuf_RunEndEncoded_type_identifier "\xcc\x8b\xa9\x05" +#ifndef org_apache_arrow_flatbuf_RunEndEncoded_file_extension +#define org_apache_arrow_flatbuf_RunEndEncoded_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Decimal_file_identifier +#define org_apache_arrow_flatbuf_Decimal_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Decimal_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Decimal_identifier +#define org_apache_arrow_flatbuf_Decimal_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Decimal_type_hash ((flatbuffers_thash_t)0x91d1beb7) +#define org_apache_arrow_flatbuf_Decimal_type_identifier "\xb7\xbe\xd1\x91" +#ifndef org_apache_arrow_flatbuf_Decimal_file_extension +#define org_apache_arrow_flatbuf_Decimal_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Date_file_identifier +#define org_apache_arrow_flatbuf_Date_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Date_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Date_identifier +#define org_apache_arrow_flatbuf_Date_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Date_type_hash ((flatbuffers_thash_t)0xe0ccf624) +#define org_apache_arrow_flatbuf_Date_type_identifier "\x24\xf6\xcc\xe0" +#ifndef org_apache_arrow_flatbuf_Date_file_extension +#define org_apache_arrow_flatbuf_Date_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Time_file_identifier +#define org_apache_arrow_flatbuf_Time_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Time_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Time_identifier +#define org_apache_arrow_flatbuf_Time_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Time_type_hash ((flatbuffers_thash_t)0x2442a489) +#define org_apache_arrow_flatbuf_Time_type_identifier "\x89\xa4\x42\x24" +#ifndef org_apache_arrow_flatbuf_Time_file_extension +#define org_apache_arrow_flatbuf_Time_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Timestamp_file_identifier +#define org_apache_arrow_flatbuf_Timestamp_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Timestamp_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Timestamp_identifier +#define org_apache_arrow_flatbuf_Timestamp_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Timestamp_type_hash ((flatbuffers_thash_t)0x1fddf080) +#define org_apache_arrow_flatbuf_Timestamp_type_identifier "\x80\xf0\xdd\x1f" +#ifndef org_apache_arrow_flatbuf_Timestamp_file_extension +#define org_apache_arrow_flatbuf_Timestamp_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Interval_file_identifier +#define org_apache_arrow_flatbuf_Interval_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Interval_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Interval_identifier +#define org_apache_arrow_flatbuf_Interval_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Interval_type_hash ((flatbuffers_thash_t)0x1e2d6809) +#define org_apache_arrow_flatbuf_Interval_type_identifier "\x09\x68\x2d\x1e" +#ifndef org_apache_arrow_flatbuf_Interval_file_extension +#define org_apache_arrow_flatbuf_Interval_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Duration_file_identifier +#define org_apache_arrow_flatbuf_Duration_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Duration_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Duration_identifier +#define org_apache_arrow_flatbuf_Duration_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Duration_type_hash ((flatbuffers_thash_t)0x1ecea6b0) +#define org_apache_arrow_flatbuf_Duration_type_identifier "\xb0\xa6\xce\x1e" +#ifndef org_apache_arrow_flatbuf_Duration_file_extension +#define org_apache_arrow_flatbuf_Duration_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_KeyValue_file_identifier +#define org_apache_arrow_flatbuf_KeyValue_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_KeyValue_file_identifier */ +#ifndef org_apache_arrow_flatbuf_KeyValue_identifier +#define org_apache_arrow_flatbuf_KeyValue_identifier 0 +#endif +#define org_apache_arrow_flatbuf_KeyValue_type_hash ((flatbuffers_thash_t)0x3b264744) +#define org_apache_arrow_flatbuf_KeyValue_type_identifier "\x44\x47\x26\x3b" +#ifndef org_apache_arrow_flatbuf_KeyValue_file_extension +#define org_apache_arrow_flatbuf_KeyValue_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier +#define org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier */ +#ifndef org_apache_arrow_flatbuf_DictionaryEncoding_identifier +#define org_apache_arrow_flatbuf_DictionaryEncoding_identifier 0 +#endif +#define org_apache_arrow_flatbuf_DictionaryEncoding_type_hash ((flatbuffers_thash_t)0x8c703261) +#define org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier "\x61\x32\x70\x8c" +#ifndef org_apache_arrow_flatbuf_DictionaryEncoding_file_extension +#define org_apache_arrow_flatbuf_DictionaryEncoding_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Field_file_identifier +#define org_apache_arrow_flatbuf_Field_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Field_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Field_identifier +#define org_apache_arrow_flatbuf_Field_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Field_type_hash ((flatbuffers_thash_t)0xd981525c) +#define org_apache_arrow_flatbuf_Field_type_identifier "\x5c\x52\x81\xd9" +#ifndef org_apache_arrow_flatbuf_Field_file_extension +#define org_apache_arrow_flatbuf_Field_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Buffer_file_identifier +#define org_apache_arrow_flatbuf_Buffer_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Buffer_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Buffer_identifier +#define org_apache_arrow_flatbuf_Buffer_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Buffer_type_hash ((flatbuffers_thash_t)0x519d7fea) +#define org_apache_arrow_flatbuf_Buffer_type_identifier "\xea\x7f\x9d\x51" +#ifndef org_apache_arrow_flatbuf_Buffer_file_extension +#define org_apache_arrow_flatbuf_Buffer_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Schema_file_identifier +#define org_apache_arrow_flatbuf_Schema_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Schema_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Schema_identifier +#define org_apache_arrow_flatbuf_Schema_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Schema_type_hash ((flatbuffers_thash_t)0x406570b) +#define org_apache_arrow_flatbuf_Schema_type_identifier "\x0b\x57\x06\x04" +#ifndef org_apache_arrow_flatbuf_Schema_file_extension +#define org_apache_arrow_flatbuf_Schema_file_extension "bin" +#endif + +typedef int16_t org_apache_arrow_flatbuf_MetadataVersion_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_MetadataVersion, org_apache_arrow_flatbuf_MetadataVersion_enum_t, 16) +/** 0.1.0 (October 2016). */ +#define org_apache_arrow_flatbuf_MetadataVersion_V1 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_MetadataVersion_V2 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_MetadataVersion_V3 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(2)) +#define org_apache_arrow_flatbuf_MetadataVersion_V4 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(3)) +#define org_apache_arrow_flatbuf_MetadataVersion_V5 ((org_apache_arrow_flatbuf_MetadataVersion_enum_t)INT16_C(4)) + +static inline const char *org_apache_arrow_flatbuf_MetadataVersion_name(org_apache_arrow_flatbuf_MetadataVersion_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_MetadataVersion_V1: return "V1"; + case org_apache_arrow_flatbuf_MetadataVersion_V2: return "V2"; + case org_apache_arrow_flatbuf_MetadataVersion_V3: return "V3"; + case org_apache_arrow_flatbuf_MetadataVersion_V4: return "V4"; + case org_apache_arrow_flatbuf_MetadataVersion_V5: return "V5"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_MetadataVersion_is_known_value(org_apache_arrow_flatbuf_MetadataVersion_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_MetadataVersion_V1: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V2: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V3: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V4: return 1; + case org_apache_arrow_flatbuf_MetadataVersion_V5: return 1; + default: return 0; + } +} + +/** Represents Arrow Features that might not have full support + * within implementations. This is intended to be used in + * two scenarios: + * 1. A mechanism for readers of Arrow Streams + * and files to understand that the stream or file makes + * use of a feature that isn't supported or unknown to + * the implementation (and therefore can meet the Arrow + * forward compatibility guarantees). + * 2. A means of negotiating between a client and server + * what features a stream is allowed to use. The enums + * values here are intented to represent higher level + * features, additional details maybe negotiated + * with key-value pairs specific to the protocol. + * + * Enums added to this list should be assigned power-of-two values + * to facilitate exchanging and comparing bitmaps for supported + * features. */ +typedef int64_t org_apache_arrow_flatbuf_Feature_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Feature, org_apache_arrow_flatbuf_Feature_enum_t, 64) +/** Needed to make flatbuffers happy. */ +#define org_apache_arrow_flatbuf_Feature_UNUSED ((org_apache_arrow_flatbuf_Feature_enum_t)INT64_C(0)) +#define org_apache_arrow_flatbuf_Feature_DICTIONARY_REPLACEMENT ((org_apache_arrow_flatbuf_Feature_enum_t)INT64_C(1)) +#define org_apache_arrow_flatbuf_Feature_COMPRESSED_BODY ((org_apache_arrow_flatbuf_Feature_enum_t)INT64_C(2)) + +static inline const char *org_apache_arrow_flatbuf_Feature_name(org_apache_arrow_flatbuf_Feature_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Feature_UNUSED: return "UNUSED"; + case org_apache_arrow_flatbuf_Feature_DICTIONARY_REPLACEMENT: return "DICTIONARY_REPLACEMENT"; + case org_apache_arrow_flatbuf_Feature_COMPRESSED_BODY: return "COMPRESSED_BODY"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Feature_is_known_value(org_apache_arrow_flatbuf_Feature_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Feature_UNUSED: return 1; + case org_apache_arrow_flatbuf_Feature_DICTIONARY_REPLACEMENT: return 1; + case org_apache_arrow_flatbuf_Feature_COMPRESSED_BODY: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_UnionMode_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t, 16) +#define org_apache_arrow_flatbuf_UnionMode_Sparse ((org_apache_arrow_flatbuf_UnionMode_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_UnionMode_Dense ((org_apache_arrow_flatbuf_UnionMode_enum_t)INT16_C(1)) + +static inline const char *org_apache_arrow_flatbuf_UnionMode_name(org_apache_arrow_flatbuf_UnionMode_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_UnionMode_Sparse: return "Sparse"; + case org_apache_arrow_flatbuf_UnionMode_Dense: return "Dense"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_UnionMode_is_known_value(org_apache_arrow_flatbuf_UnionMode_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_UnionMode_Sparse: return 1; + case org_apache_arrow_flatbuf_UnionMode_Dense: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_Precision_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t, 16) +#define org_apache_arrow_flatbuf_Precision_HALF ((org_apache_arrow_flatbuf_Precision_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_Precision_SINGLE ((org_apache_arrow_flatbuf_Precision_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_Precision_DOUBLE ((org_apache_arrow_flatbuf_Precision_enum_t)INT16_C(2)) + +static inline const char *org_apache_arrow_flatbuf_Precision_name(org_apache_arrow_flatbuf_Precision_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Precision_HALF: return "HALF"; + case org_apache_arrow_flatbuf_Precision_SINGLE: return "SINGLE"; + case org_apache_arrow_flatbuf_Precision_DOUBLE: return "DOUBLE"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Precision_is_known_value(org_apache_arrow_flatbuf_Precision_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Precision_HALF: return 1; + case org_apache_arrow_flatbuf_Precision_SINGLE: return 1; + case org_apache_arrow_flatbuf_Precision_DOUBLE: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_DateUnit_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t, 16) +#define org_apache_arrow_flatbuf_DateUnit_DAY ((org_apache_arrow_flatbuf_DateUnit_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_DateUnit_MILLISECOND ((org_apache_arrow_flatbuf_DateUnit_enum_t)INT16_C(1)) + +static inline const char *org_apache_arrow_flatbuf_DateUnit_name(org_apache_arrow_flatbuf_DateUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DateUnit_DAY: return "DAY"; + case org_apache_arrow_flatbuf_DateUnit_MILLISECOND: return "MILLISECOND"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_DateUnit_is_known_value(org_apache_arrow_flatbuf_DateUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DateUnit_DAY: return 1; + case org_apache_arrow_flatbuf_DateUnit_MILLISECOND: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_TimeUnit_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 16) +#define org_apache_arrow_flatbuf_TimeUnit_SECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_TimeUnit_MILLISECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_TimeUnit_MICROSECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(2)) +#define org_apache_arrow_flatbuf_TimeUnit_NANOSECOND ((org_apache_arrow_flatbuf_TimeUnit_enum_t)INT16_C(3)) + +static inline const char *org_apache_arrow_flatbuf_TimeUnit_name(org_apache_arrow_flatbuf_TimeUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_TimeUnit_SECOND: return "SECOND"; + case org_apache_arrow_flatbuf_TimeUnit_MILLISECOND: return "MILLISECOND"; + case org_apache_arrow_flatbuf_TimeUnit_MICROSECOND: return "MICROSECOND"; + case org_apache_arrow_flatbuf_TimeUnit_NANOSECOND: return "NANOSECOND"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_TimeUnit_is_known_value(org_apache_arrow_flatbuf_TimeUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_TimeUnit_SECOND: return 1; + case org_apache_arrow_flatbuf_TimeUnit_MILLISECOND: return 1; + case org_apache_arrow_flatbuf_TimeUnit_MICROSECOND: return 1; + case org_apache_arrow_flatbuf_TimeUnit_NANOSECOND: return 1; + default: return 0; + } +} + +typedef int16_t org_apache_arrow_flatbuf_IntervalUnit_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t, 16) +#define org_apache_arrow_flatbuf_IntervalUnit_YEAR_MONTH ((org_apache_arrow_flatbuf_IntervalUnit_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_IntervalUnit_DAY_TIME ((org_apache_arrow_flatbuf_IntervalUnit_enum_t)INT16_C(1)) +#define org_apache_arrow_flatbuf_IntervalUnit_MONTH_DAY_NANO ((org_apache_arrow_flatbuf_IntervalUnit_enum_t)INT16_C(2)) + +static inline const char *org_apache_arrow_flatbuf_IntervalUnit_name(org_apache_arrow_flatbuf_IntervalUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_IntervalUnit_YEAR_MONTH: return "YEAR_MONTH"; + case org_apache_arrow_flatbuf_IntervalUnit_DAY_TIME: return "DAY_TIME"; + case org_apache_arrow_flatbuf_IntervalUnit_MONTH_DAY_NANO: return "MONTH_DAY_NANO"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_IntervalUnit_is_known_value(org_apache_arrow_flatbuf_IntervalUnit_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_IntervalUnit_YEAR_MONTH: return 1; + case org_apache_arrow_flatbuf_IntervalUnit_DAY_TIME: return 1; + case org_apache_arrow_flatbuf_IntervalUnit_MONTH_DAY_NANO: return 1; + default: return 0; + } +} + +/** ---------------------------------------------------------------------- + * Dictionary encoding metadata + * Maintained for forwards compatibility, in the future + * Dictionaries might be explicit maps between integers and values + * allowing for non-contiguous index values */ +typedef int16_t org_apache_arrow_flatbuf_DictionaryKind_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t, 16) +#define org_apache_arrow_flatbuf_DictionaryKind_DenseArray ((org_apache_arrow_flatbuf_DictionaryKind_enum_t)INT16_C(0)) + +static inline const char *org_apache_arrow_flatbuf_DictionaryKind_name(org_apache_arrow_flatbuf_DictionaryKind_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DictionaryKind_DenseArray: return "DenseArray"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_DictionaryKind_is_known_value(org_apache_arrow_flatbuf_DictionaryKind_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_DictionaryKind_DenseArray: return 1; + default: return 0; + } +} + +/** ---------------------------------------------------------------------- + * Endianness of the platform producing the data */ +typedef int16_t org_apache_arrow_flatbuf_Endianness_enum_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t, 16) +#define org_apache_arrow_flatbuf_Endianness_Little ((org_apache_arrow_flatbuf_Endianness_enum_t)INT16_C(0)) +#define org_apache_arrow_flatbuf_Endianness_Big ((org_apache_arrow_flatbuf_Endianness_enum_t)INT16_C(1)) + +static inline const char *org_apache_arrow_flatbuf_Endianness_name(org_apache_arrow_flatbuf_Endianness_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Endianness_Little: return "Little"; + case org_apache_arrow_flatbuf_Endianness_Big: return "Big"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Endianness_is_known_value(org_apache_arrow_flatbuf_Endianness_enum_t value) +{ + switch (value) { + case org_apache_arrow_flatbuf_Endianness_Little: return 1; + case org_apache_arrow_flatbuf_Endianness_Big: return 1; + default: return 0; + } +} + + +/** ---------------------------------------------------------------------- + * A Buffer represents a single contiguous memory segment */ +struct org_apache_arrow_flatbuf_Buffer { + /** The relative offset into the shared memory page where the bytes for this + * buffer starts */ + alignas(8) int64_t offset; + /** The absolute length (in bytes) of the memory buffer. The memory is found + * from offset (inclusive) to offset + length (non-inclusive). When building + * messages using the encapsulated IPC message, padding bytes may be written + * after a buffer, but such padding bytes do not need to be accounted for in + * the size here. */ + alignas(8) int64_t length; +}; +static_assert(sizeof(org_apache_arrow_flatbuf_Buffer_t) == 16, "struct size mismatch"); + +static inline const org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer__const_ptr_add(const org_apache_arrow_flatbuf_Buffer_t *p, size_t i) { return p + i; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer__ptr_add(org_apache_arrow_flatbuf_Buffer_t *p, size_t i) { return p + i; } +static inline org_apache_arrow_flatbuf_Buffer_struct_t org_apache_arrow_flatbuf_Buffer_vec_at(org_apache_arrow_flatbuf_Buffer_vec_t vec, size_t i) +__flatbuffers_struct_vec_at(vec, i) +static inline size_t org_apache_arrow_flatbuf_Buffer__size(void) { return 16; } +static inline size_t org_apache_arrow_flatbuf_Buffer_vec_len(org_apache_arrow_flatbuf_Buffer_vec_t vec) +__flatbuffers_vec_len(vec) +__flatbuffers_struct_as_root(org_apache_arrow_flatbuf_Buffer) + +__flatbuffers_define_struct_scalar_field(org_apache_arrow_flatbuf_Buffer, offset, flatbuffers_int64, int64_t) +__flatbuffers_define_struct_scalar_field(org_apache_arrow_flatbuf_Buffer, length, flatbuffers_int64, int64_t) + + +/** These are stored in the flatbuffer in the Type union below */ +struct org_apache_arrow_flatbuf_Null_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Null_vec_len(org_apache_arrow_flatbuf_Null_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Null_table_t org_apache_arrow_flatbuf_Null_vec_at(org_apache_arrow_flatbuf_Null_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Null_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Null) + + +/** A Struct_ in the flatbuffer metadata is the same as an Arrow Struct + * (according to the physical memory layout). We used Struct_ here as + * Struct is a reserved word in Flatbuffers */ +struct org_apache_arrow_flatbuf_Struct__table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Struct__vec_len(org_apache_arrow_flatbuf_Struct__vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Struct__table_t org_apache_arrow_flatbuf_Struct__vec_at(org_apache_arrow_flatbuf_Struct__vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Struct__table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Struct_) + + +struct org_apache_arrow_flatbuf_List_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_List_vec_len(org_apache_arrow_flatbuf_List_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_List_table_t org_apache_arrow_flatbuf_List_vec_at(org_apache_arrow_flatbuf_List_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_List_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_List) + + +/** Same as List, but with 64-bit offsets, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeList_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeList_vec_len(org_apache_arrow_flatbuf_LargeList_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeList_table_t org_apache_arrow_flatbuf_LargeList_vec_at(org_apache_arrow_flatbuf_LargeList_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeList_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeList) + + +/** Represents the same logical types that List can, but contains offsets and + * sizes allowing for writes in any order and sharing of child values among + * list values. */ +struct org_apache_arrow_flatbuf_ListView_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_ListView_vec_len(org_apache_arrow_flatbuf_ListView_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_ListView_table_t org_apache_arrow_flatbuf_ListView_vec_at(org_apache_arrow_flatbuf_ListView_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_ListView_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_ListView) + + +/** Same as ListView, but with 64-bit offsets and sizes, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeListView_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeListView_vec_len(org_apache_arrow_flatbuf_LargeListView_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeListView_table_t org_apache_arrow_flatbuf_LargeListView_vec_at(org_apache_arrow_flatbuf_LargeListView_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeListView_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeListView) + + +struct org_apache_arrow_flatbuf_FixedSizeList_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_FixedSizeList_vec_len(org_apache_arrow_flatbuf_FixedSizeList_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_FixedSizeList_table_t org_apache_arrow_flatbuf_FixedSizeList_vec_at(org_apache_arrow_flatbuf_FixedSizeList_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_FixedSizeList_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_FixedSizeList) + +/** Number of list items per value */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_FixedSizeList, listSize, flatbuffers_int32, int32_t, INT32_C(0)) + +/** A Map is a logical nested type that is represented as + * + * List> + * + * In this layout, the keys and values are each respectively contiguous. We do + * not constrain the key and value types, so the application is responsible + * for ensuring that the keys are hashable and unique. Whether the keys are sorted + * may be set in the metadata for this field. + * + * In a field with Map type, the field has a child Struct field, which then + * has two children: key type and the second the value type. The names of the + * child fields may be respectively "entries", "key", and "value", but this is + * not enforced. + * + * Map + * ```text + * - child[0] entries: Struct + * - child[0] key: K + * - child[1] value: V + * ``` + * Neither the "entries" field nor the "key" field may be nullable. + * + * The metadata is structured so that Arrow systems without special handling + * for Map can make Map an alias for List. The "layout" attribute for the Map + * field must have the same contents as a List. */ +struct org_apache_arrow_flatbuf_Map_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Map_vec_len(org_apache_arrow_flatbuf_Map_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Map_table_t org_apache_arrow_flatbuf_Map_vec_at(org_apache_arrow_flatbuf_Map_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Map_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Map) + +/** Set to true if the keys within each value are sorted */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Map, keysSorted, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) + +/** A union is a complex type with children in Field + * By default ids in the type vector refer to the offsets in the children + * optionally typeIds provides an indirection between the child offset and the type id + * for each child `typeIds[offset]` is the id used in the type vector */ +struct org_apache_arrow_flatbuf_Union_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Union_vec_len(org_apache_arrow_flatbuf_Union_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Union_table_t org_apache_arrow_flatbuf_Union_vec_at(org_apache_arrow_flatbuf_Union_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Union_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Union) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Union, mode, org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t, INT16_C(0)) +__flatbuffers_define_vector_field(1, org_apache_arrow_flatbuf_Union, typeIds, flatbuffers_int32_vec_t, 0) + +struct org_apache_arrow_flatbuf_Int_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Int_vec_len(org_apache_arrow_flatbuf_Int_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Int_table_t org_apache_arrow_flatbuf_Int_vec_at(org_apache_arrow_flatbuf_Int_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Int_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Int) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Int, bitWidth, flatbuffers_int32, int32_t, INT32_C(0)) +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Int, is_signed, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) + +struct org_apache_arrow_flatbuf_FloatingPoint_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_FloatingPoint_vec_len(org_apache_arrow_flatbuf_FloatingPoint_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_FloatingPoint_table_t org_apache_arrow_flatbuf_FloatingPoint_vec_at(org_apache_arrow_flatbuf_FloatingPoint_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_FloatingPoint_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_FloatingPoint) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_FloatingPoint, precision, org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t, INT16_C(0)) + +/** Unicode with UTF-8 encoding */ +struct org_apache_arrow_flatbuf_Utf8_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Utf8_vec_len(org_apache_arrow_flatbuf_Utf8_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Utf8_table_t org_apache_arrow_flatbuf_Utf8_vec_at(org_apache_arrow_flatbuf_Utf8_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Utf8_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Utf8) + + +/** Opaque binary data */ +struct org_apache_arrow_flatbuf_Binary_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Binary_vec_len(org_apache_arrow_flatbuf_Binary_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Binary_table_t org_apache_arrow_flatbuf_Binary_vec_at(org_apache_arrow_flatbuf_Binary_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Binary_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Binary) + + +/** Same as Utf8, but with 64-bit offsets, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeUtf8_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeUtf8_vec_len(org_apache_arrow_flatbuf_LargeUtf8_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeUtf8_table_t org_apache_arrow_flatbuf_LargeUtf8_vec_at(org_apache_arrow_flatbuf_LargeUtf8_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeUtf8_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeUtf8) + + +/** Same as Binary, but with 64-bit offsets, allowing to represent + * extremely large data values. */ +struct org_apache_arrow_flatbuf_LargeBinary_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_LargeBinary_vec_len(org_apache_arrow_flatbuf_LargeBinary_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_LargeBinary_table_t org_apache_arrow_flatbuf_LargeBinary_vec_at(org_apache_arrow_flatbuf_LargeBinary_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_LargeBinary_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_LargeBinary) + + +/** Logically the same as Utf8, but the internal representation uses a view + * struct that contains the string length and either the string's entire data + * inline (for small strings) or an inlined prefix, an index of another buffer, + * and an offset pointing to a slice in that buffer (for non-small strings). + * + * Since it uses a variable number of data buffers, each Field with this type + * must have a corresponding entry in `variadicBufferCounts`. */ +struct org_apache_arrow_flatbuf_Utf8View_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Utf8View_vec_len(org_apache_arrow_flatbuf_Utf8View_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Utf8View_table_t org_apache_arrow_flatbuf_Utf8View_vec_at(org_apache_arrow_flatbuf_Utf8View_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Utf8View_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Utf8View) + + +/** Logically the same as Binary, but the internal representation uses a view + * struct that contains the string length and either the string's entire data + * inline (for small strings) or an inlined prefix, an index of another buffer, + * and an offset pointing to a slice in that buffer (for non-small strings). + * + * Since it uses a variable number of data buffers, each Field with this type + * must have a corresponding entry in `variadicBufferCounts`. */ +struct org_apache_arrow_flatbuf_BinaryView_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_BinaryView_vec_len(org_apache_arrow_flatbuf_BinaryView_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_BinaryView_table_t org_apache_arrow_flatbuf_BinaryView_vec_at(org_apache_arrow_flatbuf_BinaryView_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_BinaryView_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_BinaryView) + + +struct org_apache_arrow_flatbuf_FixedSizeBinary_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_FixedSizeBinary_vec_len(org_apache_arrow_flatbuf_FixedSizeBinary_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_FixedSizeBinary_table_t org_apache_arrow_flatbuf_FixedSizeBinary_vec_at(org_apache_arrow_flatbuf_FixedSizeBinary_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_FixedSizeBinary_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_FixedSizeBinary) + +/** Number of bytes per value */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_FixedSizeBinary, byteWidth, flatbuffers_int32, int32_t, INT32_C(0)) + +struct org_apache_arrow_flatbuf_Bool_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Bool_vec_len(org_apache_arrow_flatbuf_Bool_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Bool_table_t org_apache_arrow_flatbuf_Bool_vec_at(org_apache_arrow_flatbuf_Bool_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Bool_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Bool) + + +/** Contains two child arrays, run_ends and values. + * The run_ends child array must be a 16/32/64-bit integer array + * which encodes the indices at which the run with the value in + * each corresponding index in the values child array ends. + * Like list/struct types, the value array can be of any type. */ +struct org_apache_arrow_flatbuf_RunEndEncoded_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_RunEndEncoded_vec_len(org_apache_arrow_flatbuf_RunEndEncoded_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_RunEndEncoded_table_t org_apache_arrow_flatbuf_RunEndEncoded_vec_at(org_apache_arrow_flatbuf_RunEndEncoded_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_RunEndEncoded_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_RunEndEncoded) + + +/** Exact decimal value represented as an integer value in two's + * complement. Currently only 128-bit (16-byte) and 256-bit (32-byte) integers + * are used. The representation uses the endianness indicated + * in the Schema. */ +struct org_apache_arrow_flatbuf_Decimal_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Decimal_vec_len(org_apache_arrow_flatbuf_Decimal_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Decimal_table_t org_apache_arrow_flatbuf_Decimal_vec_at(org_apache_arrow_flatbuf_Decimal_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Decimal_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Decimal) + +/** Total number of decimal digits */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Decimal, precision, flatbuffers_int32, int32_t, INT32_C(0)) +/** Number of digits after the decimal point "." */ +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Decimal, scale, flatbuffers_int32, int32_t, INT32_C(0)) +/** Number of bits per value. The only accepted widths are 128 and 256. + * We use bitWidth for consistency with Int::bitWidth. */ +__flatbuffers_define_scalar_field(2, org_apache_arrow_flatbuf_Decimal, bitWidth, flatbuffers_int32, int32_t, INT32_C(128)) + +/** Date is either a 32-bit or 64-bit signed integer type representing an + * elapsed time since UNIX epoch (1970-01-01), stored in either of two units: + * + * * Milliseconds (64 bits) indicating UNIX time elapsed since the epoch (no + * leap seconds), where the values are evenly divisible by 86400000 + * * Days (32 bits) since the UNIX epoch */ +struct org_apache_arrow_flatbuf_Date_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Date_vec_len(org_apache_arrow_flatbuf_Date_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Date_table_t org_apache_arrow_flatbuf_Date_vec_at(org_apache_arrow_flatbuf_Date_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Date_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Date) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Date, unit, org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t, INT16_C(1)) + +/** Time is either a 32-bit or 64-bit signed integer type representing an + * elapsed time since midnight, stored in either of four units: seconds, + * milliseconds, microseconds or nanoseconds. + * + * The integer `bitWidth` depends on the `unit` and must be one of the following: + * * SECOND and MILLISECOND: 32 bits + * * MICROSECOND and NANOSECOND: 64 bits + * + * The allowed values are between 0 (inclusive) and 86400 (=24*60*60) seconds + * (exclusive), adjusted for the time unit (for example, up to 86400000 + * exclusive for the MILLISECOND unit). + * This definition doesn't allow for leap seconds. Time values from + * measurements with leap seconds will need to be corrected when ingesting + * into Arrow (for example by replacing the value 86400 with 86399). */ +struct org_apache_arrow_flatbuf_Time_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Time_vec_len(org_apache_arrow_flatbuf_Time_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Time_table_t org_apache_arrow_flatbuf_Time_vec_at(org_apache_arrow_flatbuf_Time_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Time_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Time) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Time, unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, INT16_C(1)) +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Time, bitWidth, flatbuffers_int32, int32_t, INT32_C(32)) + +/** Timestamp is a 64-bit signed integer representing an elapsed time since a + * fixed epoch, stored in either of four units: seconds, milliseconds, + * microseconds or nanoseconds, and is optionally annotated with a timezone. + * + * Timestamp values do not include any leap seconds (in other words, all + * days are considered 86400 seconds long). + * + * Timestamps with a non-empty timezone + * ------------------------------------ + * + * If a Timestamp column has a non-empty timezone value, its epoch is + * 1970-01-01 00:00:00 (January 1st 1970, midnight) in the *UTC* timezone + * (the Unix epoch), regardless of the Timestamp's own timezone. + * + * Therefore, timestamp values with a non-empty timezone correspond to + * physical points in time together with some additional information about + * how the data was obtained and/or how to display it (the timezone). + * + * For example, the timestamp value 0 with the timezone string "Europe/Paris" + * corresponds to "January 1st 1970, 00h00" in the UTC timezone, but the + * application may prefer to display it as "January 1st 1970, 01h00" in + * the Europe/Paris timezone (which is the same physical point in time). + * + * One consequence is that timestamp values with a non-empty timezone + * can be compared and ordered directly, since they all share the same + * well-known point of reference (the Unix epoch). + * + * Timestamps with an unset / empty timezone + * ----------------------------------------- + * + * If a Timestamp column has no timezone value, its epoch is + * 1970-01-01 00:00:00 (January 1st 1970, midnight) in an *unknown* timezone. + * + * Therefore, timestamp values without a timezone cannot be meaningfully + * interpreted as physical points in time, but only as calendar / clock + * indications ("wall clock time") in an unspecified timezone. + * + * For example, the timestamp value 0 with an empty timezone string + * corresponds to "January 1st 1970, 00h00" in an unknown timezone: there + * is not enough information to interpret it as a well-defined physical + * point in time. + * + * One consequence is that timestamp values without a timezone cannot + * be reliably compared or ordered, since they may have different points of + * reference. In particular, it is *not* possible to interpret an unset + * or empty timezone as the same as "UTC". + * + * Conversion between timezones + * ---------------------------- + * + * If a Timestamp column has a non-empty timezone, changing the timezone + * to a different non-empty value is a metadata-only operation: + * the timestamp values need not change as their point of reference remains + * the same (the Unix epoch). + * + * However, if a Timestamp column has no timezone value, changing it to a + * non-empty value requires to think about the desired semantics. + * One possibility is to assume that the original timestamp values are + * relative to the epoch of the timezone being set; timestamp values should + * then adjusted to the Unix epoch (for example, changing the timezone from + * empty to "Europe/Paris" would require converting the timestamp values + * from "Europe/Paris" to "UTC", which seems counter-intuitive but is + * nevertheless correct). + * + * Guidelines for encoding data from external libraries + * ---------------------------------------------------- + * + * Date & time libraries often have multiple different data types for temporal + * data. In order to ease interoperability between different implementations the + * Arrow project has some recommendations for encoding these types into a Timestamp + * column. + * + * An "instant" represents a physical point in time that has no relevant timezone + * (for example, astronomical data). To encode an instant, use a Timestamp with + * the timezone string set to "UTC", and make sure the Timestamp values + * are relative to the UTC epoch (January 1st 1970, midnight). + * + * A "zoned date-time" represents a physical point in time annotated with an + * informative timezone (for example, the timezone in which the data was + * recorded). To encode a zoned date-time, use a Timestamp with the timezone + * string set to the name of the timezone, and make sure the Timestamp values + * are relative to the UTC epoch (January 1st 1970, midnight). + * + * (There is some ambiguity between an instant and a zoned date-time with the + * UTC timezone. Both of these are stored the same in Arrow. Typically, + * this distinction does not matter. If it does, then an application should + * use custom metadata or an extension type to distinguish between the two cases.) + * + * An "offset date-time" represents a physical point in time combined with an + * explicit offset from UTC. To encode an offset date-time, use a Timestamp + * with the timezone string set to the numeric timezone offset string + * (e.g. "+03:00"), and make sure the Timestamp values are relative to + * the UTC epoch (January 1st 1970, midnight). + * + * A "naive date-time" (also called "local date-time" in some libraries) + * represents a wall clock time combined with a calendar date, but with + * no indication of how to map this information to a physical point in time. + * Naive date-times must be handled with care because of this missing + * information, and also because daylight saving time (DST) may make + * some values ambiguous or nonexistent. A naive date-time may be + * stored as a struct with Date and Time fields. However, it may also be + * encoded into a Timestamp column with an empty timezone. The timestamp + * values should be computed "as if" the timezone of the date-time values + * was UTC; for example, the naive date-time "January 1st 1970, 00h00" would + * be encoded as timestamp value 0. */ +struct org_apache_arrow_flatbuf_Timestamp_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Timestamp_vec_len(org_apache_arrow_flatbuf_Timestamp_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Timestamp_table_t org_apache_arrow_flatbuf_Timestamp_vec_at(org_apache_arrow_flatbuf_Timestamp_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Timestamp_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Timestamp) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Timestamp, unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, INT16_C(0)) +/** The timezone is an optional string indicating the name of a timezone, + * one of: + * + * * As used in the Olson timezone database (the "tz database" or + * "tzdata"), such as "America/New_York". + * * An absolute timezone offset of the form "+XX:XX" or "-XX:XX", + * such as "+07:30". + * + * Whether a timezone string is present indicates different semantics about + * the data (see above). */ +__flatbuffers_define_string_field(1, org_apache_arrow_flatbuf_Timestamp, timezone, 0) + +struct org_apache_arrow_flatbuf_Interval_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Interval_vec_len(org_apache_arrow_flatbuf_Interval_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Interval_table_t org_apache_arrow_flatbuf_Interval_vec_at(org_apache_arrow_flatbuf_Interval_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Interval_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Interval) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Interval, unit, org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t, INT16_C(0)) + +struct org_apache_arrow_flatbuf_Duration_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Duration_vec_len(org_apache_arrow_flatbuf_Duration_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Duration_table_t org_apache_arrow_flatbuf_Duration_vec_at(org_apache_arrow_flatbuf_Duration_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Duration_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Duration) + +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Duration, unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, INT16_C(1)) +/** ---------------------------------------------------------------------- + * Top-level Type value, enabling extensible type-specific metadata. We can + * add new logical types to Type without breaking backwards compatibility */ +typedef uint8_t org_apache_arrow_flatbuf_Type_union_type_t; +__flatbuffers_define_integer_type(org_apache_arrow_flatbuf_Type, org_apache_arrow_flatbuf_Type_union_type_t, 8) +__flatbuffers_define_union(flatbuffers_, org_apache_arrow_flatbuf_Type) +/** ---------------------------------------------------------------------- + * user defined key value pairs to add custom metadata to arrow + * key namespacing is the responsibility of the user */ +#define org_apache_arrow_flatbuf_Type_NONE ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(0)) +#define org_apache_arrow_flatbuf_Type_Null ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(1)) +#define org_apache_arrow_flatbuf_Type_Int ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(2)) +#define org_apache_arrow_flatbuf_Type_FloatingPoint ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(3)) +#define org_apache_arrow_flatbuf_Type_Binary ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(4)) +#define org_apache_arrow_flatbuf_Type_Utf8 ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(5)) +#define org_apache_arrow_flatbuf_Type_Bool ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(6)) +#define org_apache_arrow_flatbuf_Type_Decimal ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(7)) +#define org_apache_arrow_flatbuf_Type_Date ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(8)) +#define org_apache_arrow_flatbuf_Type_Time ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(9)) +#define org_apache_arrow_flatbuf_Type_Timestamp ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(10)) +#define org_apache_arrow_flatbuf_Type_Interval ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(11)) +#define org_apache_arrow_flatbuf_Type_List ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(12)) +#define org_apache_arrow_flatbuf_Type_Struct_ ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(13)) +#define org_apache_arrow_flatbuf_Type_Union ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(14)) +#define org_apache_arrow_flatbuf_Type_FixedSizeBinary ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(15)) +#define org_apache_arrow_flatbuf_Type_FixedSizeList ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(16)) +#define org_apache_arrow_flatbuf_Type_Map ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(17)) +#define org_apache_arrow_flatbuf_Type_Duration ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(18)) +#define org_apache_arrow_flatbuf_Type_LargeBinary ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(19)) +#define org_apache_arrow_flatbuf_Type_LargeUtf8 ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(20)) +#define org_apache_arrow_flatbuf_Type_LargeList ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(21)) +#define org_apache_arrow_flatbuf_Type_RunEndEncoded ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(22)) +#define org_apache_arrow_flatbuf_Type_BinaryView ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(23)) +#define org_apache_arrow_flatbuf_Type_Utf8View ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(24)) +#define org_apache_arrow_flatbuf_Type_ListView ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(25)) +#define org_apache_arrow_flatbuf_Type_LargeListView ((org_apache_arrow_flatbuf_Type_union_type_t)UINT8_C(26)) + +static inline const char *org_apache_arrow_flatbuf_Type_type_name(org_apache_arrow_flatbuf_Type_union_type_t type) +{ + switch (type) { + case org_apache_arrow_flatbuf_Type_NONE: return "NONE"; + case org_apache_arrow_flatbuf_Type_Null: return "Null"; + case org_apache_arrow_flatbuf_Type_Int: return "Int"; + case org_apache_arrow_flatbuf_Type_FloatingPoint: return "FloatingPoint"; + case org_apache_arrow_flatbuf_Type_Binary: return "Binary"; + case org_apache_arrow_flatbuf_Type_Utf8: return "Utf8"; + case org_apache_arrow_flatbuf_Type_Bool: return "Bool"; + case org_apache_arrow_flatbuf_Type_Decimal: return "Decimal"; + case org_apache_arrow_flatbuf_Type_Date: return "Date"; + case org_apache_arrow_flatbuf_Type_Time: return "Time"; + case org_apache_arrow_flatbuf_Type_Timestamp: return "Timestamp"; + case org_apache_arrow_flatbuf_Type_Interval: return "Interval"; + case org_apache_arrow_flatbuf_Type_List: return "List"; + case org_apache_arrow_flatbuf_Type_Struct_: return "Struct_"; + case org_apache_arrow_flatbuf_Type_Union: return "Union"; + case org_apache_arrow_flatbuf_Type_FixedSizeBinary: return "FixedSizeBinary"; + case org_apache_arrow_flatbuf_Type_FixedSizeList: return "FixedSizeList"; + case org_apache_arrow_flatbuf_Type_Map: return "Map"; + case org_apache_arrow_flatbuf_Type_Duration: return "Duration"; + case org_apache_arrow_flatbuf_Type_LargeBinary: return "LargeBinary"; + case org_apache_arrow_flatbuf_Type_LargeUtf8: return "LargeUtf8"; + case org_apache_arrow_flatbuf_Type_LargeList: return "LargeList"; + case org_apache_arrow_flatbuf_Type_RunEndEncoded: return "RunEndEncoded"; + case org_apache_arrow_flatbuf_Type_BinaryView: return "BinaryView"; + case org_apache_arrow_flatbuf_Type_Utf8View: return "Utf8View"; + case org_apache_arrow_flatbuf_Type_ListView: return "ListView"; + case org_apache_arrow_flatbuf_Type_LargeListView: return "LargeListView"; + default: return ""; + } +} + +static inline int org_apache_arrow_flatbuf_Type_is_known_type(org_apache_arrow_flatbuf_Type_union_type_t type) +{ + switch (type) { + case org_apache_arrow_flatbuf_Type_NONE: return 1; + case org_apache_arrow_flatbuf_Type_Null: return 1; + case org_apache_arrow_flatbuf_Type_Int: return 1; + case org_apache_arrow_flatbuf_Type_FloatingPoint: return 1; + case org_apache_arrow_flatbuf_Type_Binary: return 1; + case org_apache_arrow_flatbuf_Type_Utf8: return 1; + case org_apache_arrow_flatbuf_Type_Bool: return 1; + case org_apache_arrow_flatbuf_Type_Decimal: return 1; + case org_apache_arrow_flatbuf_Type_Date: return 1; + case org_apache_arrow_flatbuf_Type_Time: return 1; + case org_apache_arrow_flatbuf_Type_Timestamp: return 1; + case org_apache_arrow_flatbuf_Type_Interval: return 1; + case org_apache_arrow_flatbuf_Type_List: return 1; + case org_apache_arrow_flatbuf_Type_Struct_: return 1; + case org_apache_arrow_flatbuf_Type_Union: return 1; + case org_apache_arrow_flatbuf_Type_FixedSizeBinary: return 1; + case org_apache_arrow_flatbuf_Type_FixedSizeList: return 1; + case org_apache_arrow_flatbuf_Type_Map: return 1; + case org_apache_arrow_flatbuf_Type_Duration: return 1; + case org_apache_arrow_flatbuf_Type_LargeBinary: return 1; + case org_apache_arrow_flatbuf_Type_LargeUtf8: return 1; + case org_apache_arrow_flatbuf_Type_LargeList: return 1; + case org_apache_arrow_flatbuf_Type_RunEndEncoded: return 1; + case org_apache_arrow_flatbuf_Type_BinaryView: return 1; + case org_apache_arrow_flatbuf_Type_Utf8View: return 1; + case org_apache_arrow_flatbuf_Type_ListView: return 1; + case org_apache_arrow_flatbuf_Type_LargeListView: return 1; + default: return 0; + } +} + + +struct org_apache_arrow_flatbuf_KeyValue_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_KeyValue_vec_len(org_apache_arrow_flatbuf_KeyValue_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_KeyValue_table_t org_apache_arrow_flatbuf_KeyValue_vec_at(org_apache_arrow_flatbuf_KeyValue_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_KeyValue_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_KeyValue) + +__flatbuffers_define_string_field(0, org_apache_arrow_flatbuf_KeyValue, key, 0) +__flatbuffers_define_string_field(1, org_apache_arrow_flatbuf_KeyValue, value, 0) + +struct org_apache_arrow_flatbuf_DictionaryEncoding_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_DictionaryEncoding_vec_len(org_apache_arrow_flatbuf_DictionaryEncoding_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_DictionaryEncoding_table_t org_apache_arrow_flatbuf_DictionaryEncoding_vec_at(org_apache_arrow_flatbuf_DictionaryEncoding_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_DictionaryEncoding_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_DictionaryEncoding) + +/** The known dictionary id in the application where this data is used. In + * the file or streaming formats, the dictionary ids are found in the + * DictionaryBatch messages */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_DictionaryEncoding, id, flatbuffers_int64, int64_t, INT64_C(0)) +/** The dictionary indices are constrained to be non-negative integers. If + * this field is null, the indices must be signed int32. To maximize + * cross-language compatibility and performance, implementations are + * recommended to prefer signed integer types over unsigned integer types + * and to avoid uint64 indices unless they are required by an application. */ +__flatbuffers_define_table_field(1, org_apache_arrow_flatbuf_DictionaryEncoding, indexType, org_apache_arrow_flatbuf_Int_table_t, 0) +/** By default, dictionaries are not ordered, or the order does not have + * semantic meaning. In some statistical, applications, dictionary-encoding + * is used to represent ordered categorical data, and we provide a way to + * preserve that metadata here */ +__flatbuffers_define_scalar_field(2, org_apache_arrow_flatbuf_DictionaryEncoding, isOrdered, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) +__flatbuffers_define_scalar_field(3, org_apache_arrow_flatbuf_DictionaryEncoding, dictionaryKind, org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t, INT16_C(0)) + +/** ---------------------------------------------------------------------- + * A field represents a named column in a record / row batch or child of a + * nested type. */ +struct org_apache_arrow_flatbuf_Field_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Field_vec_len(org_apache_arrow_flatbuf_Field_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Field_table_t org_apache_arrow_flatbuf_Field_vec_at(org_apache_arrow_flatbuf_Field_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Field_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Field) + +/** Name is not required, in i.e. a List */ +__flatbuffers_define_string_field(0, org_apache_arrow_flatbuf_Field, name, 0) +/** Whether or not this field can contain nulls. Should be true in general. */ +__flatbuffers_define_scalar_field(1, org_apache_arrow_flatbuf_Field, nullable, flatbuffers_bool, flatbuffers_bool_t, UINT8_C(0)) +/** This is the type of the decoded value if the field is dictionary encoded. */ +__flatbuffers_define_union_field(flatbuffers_, 3, org_apache_arrow_flatbuf_Field, type, org_apache_arrow_flatbuf_Type, 0) +/** Present only if the field is dictionary encoded. */ +__flatbuffers_define_table_field(4, org_apache_arrow_flatbuf_Field, dictionary, org_apache_arrow_flatbuf_DictionaryEncoding_table_t, 0) +/** children apply only to nested data types like Struct, List and Union. For + * primitive types children will have length 0. */ +__flatbuffers_define_vector_field(5, org_apache_arrow_flatbuf_Field, children, org_apache_arrow_flatbuf_Field_vec_t, 0) +/** User-defined metadata */ +__flatbuffers_define_vector_field(6, org_apache_arrow_flatbuf_Field, custom_metadata, org_apache_arrow_flatbuf_KeyValue_vec_t, 0) + +/** ---------------------------------------------------------------------- + * A Schema describes the columns in a row batch */ +struct org_apache_arrow_flatbuf_Schema_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Schema_vec_len(org_apache_arrow_flatbuf_Schema_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Schema_table_t org_apache_arrow_flatbuf_Schema_vec_at(org_apache_arrow_flatbuf_Schema_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Schema_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Schema) + +/** endianness of the buffer + * it is Little Endian by default + * if endianness doesn't match the underlying system then the vectors need to be converted */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_Schema, endianness, org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t, INT16_C(0)) +__flatbuffers_define_vector_field(1, org_apache_arrow_flatbuf_Schema, fields, org_apache_arrow_flatbuf_Field_vec_t, 0) +__flatbuffers_define_vector_field(2, org_apache_arrow_flatbuf_Schema, custom_metadata, org_apache_arrow_flatbuf_KeyValue_vec_t, 0) +/** Features used in the stream/file. */ +__flatbuffers_define_vector_field(3, org_apache_arrow_flatbuf_Schema, features, org_apache_arrow_flatbuf_Feature_vec_t, 0) + + +#include "flatcc/flatcc_epilogue.h" +#endif /* SCHEMA_READER_H */ +#ifndef SCHEMA_BUILDER_H +#define SCHEMA_BUILDER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef SCHEMA_READER_H +#include "Schema_reader.h" +#endif +#ifndef FLATBUFFERS_COMMON_BUILDER_H +#include "flatbuffers_common_builder.h" +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + +#define __org_apache_arrow_flatbuf_MetadataVersion_formal_args , org_apache_arrow_flatbuf_MetadataVersion_enum_t v0 +#define __org_apache_arrow_flatbuf_MetadataVersion_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_MetadataVersion, org_apache_arrow_flatbuf_MetadataVersion_enum_t) +#define __org_apache_arrow_flatbuf_Feature_formal_args , org_apache_arrow_flatbuf_Feature_enum_t v0 +#define __org_apache_arrow_flatbuf_Feature_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_Feature, org_apache_arrow_flatbuf_Feature_enum_t) +#define __org_apache_arrow_flatbuf_UnionMode_formal_args , org_apache_arrow_flatbuf_UnionMode_enum_t v0 +#define __org_apache_arrow_flatbuf_UnionMode_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t) +#define __org_apache_arrow_flatbuf_Precision_formal_args , org_apache_arrow_flatbuf_Precision_enum_t v0 +#define __org_apache_arrow_flatbuf_Precision_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t) +#define __org_apache_arrow_flatbuf_DateUnit_formal_args , org_apache_arrow_flatbuf_DateUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_DateUnit_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t) +#define __org_apache_arrow_flatbuf_TimeUnit_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_TimeUnit_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t) +#define __org_apache_arrow_flatbuf_IntervalUnit_formal_args , org_apache_arrow_flatbuf_IntervalUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_IntervalUnit_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t) +#define __org_apache_arrow_flatbuf_DictionaryKind_formal_args , org_apache_arrow_flatbuf_DictionaryKind_enum_t v0 +#define __org_apache_arrow_flatbuf_DictionaryKind_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t) +#define __org_apache_arrow_flatbuf_Endianness_formal_args , org_apache_arrow_flatbuf_Endianness_enum_t v0 +#define __org_apache_arrow_flatbuf_Endianness_call_args , v0 +__flatbuffers_build_scalar(flatbuffers_, org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t) + +#define __org_apache_arrow_flatbuf_Buffer_formal_args , int64_t v0, int64_t v1 +#define __org_apache_arrow_flatbuf_Buffer_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_assign(org_apache_arrow_flatbuf_Buffer_t *p, int64_t v0, int64_t v1) +{ p->offset = v0; p->length = v1; + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_copy(org_apache_arrow_flatbuf_Buffer_t *p, const org_apache_arrow_flatbuf_Buffer_t *p2) +{ p->offset = p2->offset; p->length = p2->length; + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_assign_to_pe(org_apache_arrow_flatbuf_Buffer_t *p, int64_t v0, int64_t v1) +{ flatbuffers_int64_assign_to_pe(&p->offset, v0); flatbuffers_int64_assign_to_pe(&p->length, v1); + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_copy_to_pe(org_apache_arrow_flatbuf_Buffer_t *p, const org_apache_arrow_flatbuf_Buffer_t *p2) +{ flatbuffers_int64_copy_to_pe(&p->offset, &p2->offset); flatbuffers_int64_copy_to_pe(&p->length, &p2->length); + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_assign_from_pe(org_apache_arrow_flatbuf_Buffer_t *p, int64_t v0, int64_t v1) +{ flatbuffers_int64_assign_from_pe(&p->offset, v0); flatbuffers_int64_assign_from_pe(&p->length, v1); + return p; } +static inline org_apache_arrow_flatbuf_Buffer_t *org_apache_arrow_flatbuf_Buffer_copy_from_pe(org_apache_arrow_flatbuf_Buffer_t *p, const org_apache_arrow_flatbuf_Buffer_t *p2) +{ flatbuffers_int64_copy_from_pe(&p->offset, &p2->offset); flatbuffers_int64_copy_from_pe(&p->length, &p2->length); + return p; } +__flatbuffers_build_struct(flatbuffers_, org_apache_arrow_flatbuf_Buffer, 16, 8, org_apache_arrow_flatbuf_Buffer_file_identifier, org_apache_arrow_flatbuf_Buffer_type_identifier) +__flatbuffers_define_fixed_array_primitives(flatbuffers_, org_apache_arrow_flatbuf_Buffer, org_apache_arrow_flatbuf_Buffer_t) + +typedef flatbuffers_union_ref_t org_apache_arrow_flatbuf_Type_union_ref_t; +typedef flatbuffers_union_vec_ref_t org_apache_arrow_flatbuf_Type_union_vec_ref_t; +static org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Type_union_t t); + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Null_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Null_ref_t; +static org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Null_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Null, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Struct__required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Struct__ref_t; +static org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Struct__table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Struct_, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_List_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_List_ref_t; +static org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_List_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_List, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeList_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeList_ref_t; +static org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeList_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeList, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_ListView_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_ListView_ref_t; +static org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_ListView_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_ListView, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeListView_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeListView_ref_t; +static org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeListView_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeListView, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_FixedSizeList_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_FixedSizeList_ref_t; +static org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeList_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeList, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Map_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Map_ref_t; +static org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Map_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Map, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Union_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Union_ref_t; +static org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Union_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Union, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Int_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Int_ref_t; +static org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Int_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Int, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_FloatingPoint_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_FloatingPoint_ref_t; +static org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FloatingPoint_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_FloatingPoint, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Utf8_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Utf8_ref_t; +static org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Utf8, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Binary_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Binary_ref_t; +static org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Binary_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Binary, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeUtf8_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeUtf8_ref_t; +static org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeUtf8_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeUtf8, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_LargeBinary_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_LargeBinary_ref_t; +static org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeBinary_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_LargeBinary, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Utf8View_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Utf8View_ref_t; +static org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8View_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Utf8View, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_BinaryView_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_BinaryView_ref_t; +static org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_BinaryView_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_BinaryView, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_FixedSizeBinary_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_ref_t; +static org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeBinary_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeBinary, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Bool_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Bool_ref_t; +static org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Bool_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Bool, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_RunEndEncoded_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_RunEndEncoded_ref_t; +static org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_RunEndEncoded_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_RunEndEncoded, 0) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Decimal_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Decimal_ref_t; +static org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Decimal_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Decimal, 3) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Date_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Date_ref_t; +static org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Date_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Date, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Time_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Time_ref_t; +static org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Time_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Time, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Timestamp_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Timestamp_ref_t; +static org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Timestamp_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Timestamp, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Interval_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Interval_ref_t; +static org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Interval_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Interval, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Duration_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Duration_ref_t; +static org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Duration_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Duration, 1) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_KeyValue_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_KeyValue_ref_t; +static org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_KeyValue_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_KeyValue, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_DictionaryEncoding_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_ref_t; +static org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_DictionaryEncoding_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding, 4) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Field_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Field_ref_t; +static org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Field_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Field, 7) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Schema_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Schema_ref_t; +static org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Schema_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Schema, 4) + +#define __org_apache_arrow_flatbuf_Null_formal_args +#define __org_apache_arrow_flatbuf_Null_call_args +static inline org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Null_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Null, org_apache_arrow_flatbuf_Null_file_identifier, org_apache_arrow_flatbuf_Null_type_identifier) + +#define __org_apache_arrow_flatbuf_Struct__formal_args +#define __org_apache_arrow_flatbuf_Struct__call_args +static inline org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Struct__formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Struct_, org_apache_arrow_flatbuf_Struct__file_identifier, org_apache_arrow_flatbuf_Struct__type_identifier) + +#define __org_apache_arrow_flatbuf_List_formal_args +#define __org_apache_arrow_flatbuf_List_call_args +static inline org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_List_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_List, org_apache_arrow_flatbuf_List_file_identifier, org_apache_arrow_flatbuf_List_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeList_formal_args +#define __org_apache_arrow_flatbuf_LargeList_call_args +static inline org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeList_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeList, org_apache_arrow_flatbuf_LargeList_file_identifier, org_apache_arrow_flatbuf_LargeList_type_identifier) + +#define __org_apache_arrow_flatbuf_ListView_formal_args +#define __org_apache_arrow_flatbuf_ListView_call_args +static inline org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_ListView_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_ListView, org_apache_arrow_flatbuf_ListView_file_identifier, org_apache_arrow_flatbuf_ListView_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeListView_formal_args +#define __org_apache_arrow_flatbuf_LargeListView_call_args +static inline org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeListView_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeListView, org_apache_arrow_flatbuf_LargeListView_file_identifier, org_apache_arrow_flatbuf_LargeListView_type_identifier) + +#define __org_apache_arrow_flatbuf_FixedSizeList_formal_args , int32_t v0 +#define __org_apache_arrow_flatbuf_FixedSizeList_call_args , v0 +static inline org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeList_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeList, org_apache_arrow_flatbuf_FixedSizeList_file_identifier, org_apache_arrow_flatbuf_FixedSizeList_type_identifier) + +#define __org_apache_arrow_flatbuf_Map_formal_args , flatbuffers_bool_t v0 +#define __org_apache_arrow_flatbuf_Map_call_args , v0 +static inline org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Map_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Map, org_apache_arrow_flatbuf_Map_file_identifier, org_apache_arrow_flatbuf_Map_type_identifier) + +#define __org_apache_arrow_flatbuf_Union_formal_args , org_apache_arrow_flatbuf_UnionMode_enum_t v0, flatbuffers_int32_vec_ref_t v1 +#define __org_apache_arrow_flatbuf_Union_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Union_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Union, org_apache_arrow_flatbuf_Union_file_identifier, org_apache_arrow_flatbuf_Union_type_identifier) + +#define __org_apache_arrow_flatbuf_Int_formal_args , int32_t v0, flatbuffers_bool_t v1 +#define __org_apache_arrow_flatbuf_Int_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Int_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_Int_file_identifier, org_apache_arrow_flatbuf_Int_type_identifier) + +#define __org_apache_arrow_flatbuf_FloatingPoint_formal_args , org_apache_arrow_flatbuf_Precision_enum_t v0 +#define __org_apache_arrow_flatbuf_FloatingPoint_call_args , v0 +static inline org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FloatingPoint_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_FloatingPoint, org_apache_arrow_flatbuf_FloatingPoint_file_identifier, org_apache_arrow_flatbuf_FloatingPoint_type_identifier) + +#define __org_apache_arrow_flatbuf_Utf8_formal_args +#define __org_apache_arrow_flatbuf_Utf8_call_args +static inline org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Utf8, org_apache_arrow_flatbuf_Utf8_file_identifier, org_apache_arrow_flatbuf_Utf8_type_identifier) + +#define __org_apache_arrow_flatbuf_Binary_formal_args +#define __org_apache_arrow_flatbuf_Binary_call_args +static inline org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Binary_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Binary, org_apache_arrow_flatbuf_Binary_file_identifier, org_apache_arrow_flatbuf_Binary_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeUtf8_formal_args +#define __org_apache_arrow_flatbuf_LargeUtf8_call_args +static inline org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeUtf8_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeUtf8, org_apache_arrow_flatbuf_LargeUtf8_file_identifier, org_apache_arrow_flatbuf_LargeUtf8_type_identifier) + +#define __org_apache_arrow_flatbuf_LargeBinary_formal_args +#define __org_apache_arrow_flatbuf_LargeBinary_call_args +static inline org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeBinary_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_LargeBinary, org_apache_arrow_flatbuf_LargeBinary_file_identifier, org_apache_arrow_flatbuf_LargeBinary_type_identifier) + +#define __org_apache_arrow_flatbuf_Utf8View_formal_args +#define __org_apache_arrow_flatbuf_Utf8View_call_args +static inline org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8View_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Utf8View, org_apache_arrow_flatbuf_Utf8View_file_identifier, org_apache_arrow_flatbuf_Utf8View_type_identifier) + +#define __org_apache_arrow_flatbuf_BinaryView_formal_args +#define __org_apache_arrow_flatbuf_BinaryView_call_args +static inline org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_BinaryView_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_BinaryView, org_apache_arrow_flatbuf_BinaryView_file_identifier, org_apache_arrow_flatbuf_BinaryView_type_identifier) + +#define __org_apache_arrow_flatbuf_FixedSizeBinary_formal_args , int32_t v0 +#define __org_apache_arrow_flatbuf_FixedSizeBinary_call_args , v0 +static inline org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeBinary_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_FixedSizeBinary, org_apache_arrow_flatbuf_FixedSizeBinary_file_identifier, org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier) + +#define __org_apache_arrow_flatbuf_Bool_formal_args +#define __org_apache_arrow_flatbuf_Bool_call_args +static inline org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Bool_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Bool, org_apache_arrow_flatbuf_Bool_file_identifier, org_apache_arrow_flatbuf_Bool_type_identifier) + +#define __org_apache_arrow_flatbuf_RunEndEncoded_formal_args +#define __org_apache_arrow_flatbuf_RunEndEncoded_call_args +static inline org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_RunEndEncoded_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_RunEndEncoded, org_apache_arrow_flatbuf_RunEndEncoded_file_identifier, org_apache_arrow_flatbuf_RunEndEncoded_type_identifier) + +#define __org_apache_arrow_flatbuf_Decimal_formal_args , int32_t v0, int32_t v1, int32_t v2 +#define __org_apache_arrow_flatbuf_Decimal_call_args , v0, v1, v2 +static inline org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Decimal_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Decimal, org_apache_arrow_flatbuf_Decimal_file_identifier, org_apache_arrow_flatbuf_Decimal_type_identifier) + +#define __org_apache_arrow_flatbuf_Date_formal_args , org_apache_arrow_flatbuf_DateUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_Date_call_args , v0 +static inline org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Date_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Date, org_apache_arrow_flatbuf_Date_file_identifier, org_apache_arrow_flatbuf_Date_type_identifier) + +#define __org_apache_arrow_flatbuf_Time_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0, int32_t v1 +#define __org_apache_arrow_flatbuf_Time_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Time_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Time, org_apache_arrow_flatbuf_Time_file_identifier, org_apache_arrow_flatbuf_Time_type_identifier) + +#define __org_apache_arrow_flatbuf_Timestamp_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0, flatbuffers_string_ref_t v1 +#define __org_apache_arrow_flatbuf_Timestamp_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Timestamp_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Timestamp, org_apache_arrow_flatbuf_Timestamp_file_identifier, org_apache_arrow_flatbuf_Timestamp_type_identifier) + +#define __org_apache_arrow_flatbuf_Interval_formal_args , org_apache_arrow_flatbuf_IntervalUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_Interval_call_args , v0 +static inline org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Interval_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Interval, org_apache_arrow_flatbuf_Interval_file_identifier, org_apache_arrow_flatbuf_Interval_type_identifier) + +#define __org_apache_arrow_flatbuf_Duration_formal_args , org_apache_arrow_flatbuf_TimeUnit_enum_t v0 +#define __org_apache_arrow_flatbuf_Duration_call_args , v0 +static inline org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Duration_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Duration, org_apache_arrow_flatbuf_Duration_file_identifier, org_apache_arrow_flatbuf_Duration_type_identifier) + +#define __org_apache_arrow_flatbuf_KeyValue_formal_args , flatbuffers_string_ref_t v0, flatbuffers_string_ref_t v1 +#define __org_apache_arrow_flatbuf_KeyValue_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_KeyValue_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_KeyValue, org_apache_arrow_flatbuf_KeyValue_file_identifier, org_apache_arrow_flatbuf_KeyValue_type_identifier) + +#define __org_apache_arrow_flatbuf_DictionaryEncoding_formal_args , int64_t v0, org_apache_arrow_flatbuf_Int_ref_t v1, flatbuffers_bool_t v2, org_apache_arrow_flatbuf_DictionaryKind_enum_t v3 +#define __org_apache_arrow_flatbuf_DictionaryEncoding_call_args , v0, v1, v2, v3 +static inline org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_DictionaryEncoding_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding, org_apache_arrow_flatbuf_DictionaryEncoding_file_identifier, org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier) + +#define __org_apache_arrow_flatbuf_Field_formal_args ,\ + flatbuffers_string_ref_t v0, flatbuffers_bool_t v1, org_apache_arrow_flatbuf_Type_union_ref_t v3, org_apache_arrow_flatbuf_DictionaryEncoding_ref_t v4, org_apache_arrow_flatbuf_Field_vec_ref_t v5, org_apache_arrow_flatbuf_KeyValue_vec_ref_t v6 +#define __org_apache_arrow_flatbuf_Field_call_args ,\ + v0, v1, v3, v4, v5, v6 +static inline org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Field_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Field, org_apache_arrow_flatbuf_Field_file_identifier, org_apache_arrow_flatbuf_Field_type_identifier) + +#define __org_apache_arrow_flatbuf_Schema_formal_args , org_apache_arrow_flatbuf_Endianness_enum_t v0, org_apache_arrow_flatbuf_Field_vec_ref_t v1, org_apache_arrow_flatbuf_KeyValue_vec_ref_t v2, org_apache_arrow_flatbuf_Feature_vec_ref_t v3 +#define __org_apache_arrow_flatbuf_Schema_call_args , v0, v1, v2, v3 +static inline org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Schema_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Schema, org_apache_arrow_flatbuf_Schema_file_identifier, org_apache_arrow_flatbuf_Schema_type_identifier) + +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_NONE(void) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_NONE; uref.value = 0; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Null(org_apache_arrow_flatbuf_Null_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Null; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Int(org_apache_arrow_flatbuf_Int_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Int; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_FloatingPoint(org_apache_arrow_flatbuf_FloatingPoint_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_FloatingPoint; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Binary(org_apache_arrow_flatbuf_Binary_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Binary; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Utf8(org_apache_arrow_flatbuf_Utf8_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Utf8; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Bool(org_apache_arrow_flatbuf_Bool_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Bool; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Decimal(org_apache_arrow_flatbuf_Decimal_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Decimal; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Date(org_apache_arrow_flatbuf_Date_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Date; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Time(org_apache_arrow_flatbuf_Time_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Time; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Timestamp(org_apache_arrow_flatbuf_Timestamp_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Timestamp; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Interval(org_apache_arrow_flatbuf_Interval_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Interval; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_List(org_apache_arrow_flatbuf_List_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_List; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Struct_(org_apache_arrow_flatbuf_Struct__ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Struct_; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Union(org_apache_arrow_flatbuf_Union_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Union; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_FixedSizeBinary(org_apache_arrow_flatbuf_FixedSizeBinary_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_FixedSizeBinary; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_FixedSizeList(org_apache_arrow_flatbuf_FixedSizeList_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_FixedSizeList; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Map(org_apache_arrow_flatbuf_Map_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Map; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Duration(org_apache_arrow_flatbuf_Duration_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Duration; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeBinary(org_apache_arrow_flatbuf_LargeBinary_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeBinary; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeUtf8(org_apache_arrow_flatbuf_LargeUtf8_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeUtf8; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeList(org_apache_arrow_flatbuf_LargeList_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeList; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_RunEndEncoded(org_apache_arrow_flatbuf_RunEndEncoded_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_RunEndEncoded; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_BinaryView(org_apache_arrow_flatbuf_BinaryView_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_BinaryView; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_Utf8View(org_apache_arrow_flatbuf_Utf8View_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_Utf8View; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_ListView(org_apache_arrow_flatbuf_ListView_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_ListView; uref.value = ref; return uref; } +static inline org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_as_LargeListView(org_apache_arrow_flatbuf_LargeListView_ref_t ref) +{ org_apache_arrow_flatbuf_Type_union_ref_t uref; uref.type = org_apache_arrow_flatbuf_Type_LargeListView; uref.value = ref; return uref; } +__flatbuffers_build_union_vector(flatbuffers_, org_apache_arrow_flatbuf_Type) + +static org_apache_arrow_flatbuf_Type_union_ref_t org_apache_arrow_flatbuf_Type_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Type_union_t u) +{ + switch (u.type) { + case 1: return org_apache_arrow_flatbuf_Type_as_Null(org_apache_arrow_flatbuf_Null_clone(B, (org_apache_arrow_flatbuf_Null_table_t)u.value)); + case 2: return org_apache_arrow_flatbuf_Type_as_Int(org_apache_arrow_flatbuf_Int_clone(B, (org_apache_arrow_flatbuf_Int_table_t)u.value)); + case 3: return org_apache_arrow_flatbuf_Type_as_FloatingPoint(org_apache_arrow_flatbuf_FloatingPoint_clone(B, (org_apache_arrow_flatbuf_FloatingPoint_table_t)u.value)); + case 4: return org_apache_arrow_flatbuf_Type_as_Binary(org_apache_arrow_flatbuf_Binary_clone(B, (org_apache_arrow_flatbuf_Binary_table_t)u.value)); + case 5: return org_apache_arrow_flatbuf_Type_as_Utf8(org_apache_arrow_flatbuf_Utf8_clone(B, (org_apache_arrow_flatbuf_Utf8_table_t)u.value)); + case 6: return org_apache_arrow_flatbuf_Type_as_Bool(org_apache_arrow_flatbuf_Bool_clone(B, (org_apache_arrow_flatbuf_Bool_table_t)u.value)); + case 7: return org_apache_arrow_flatbuf_Type_as_Decimal(org_apache_arrow_flatbuf_Decimal_clone(B, (org_apache_arrow_flatbuf_Decimal_table_t)u.value)); + case 8: return org_apache_arrow_flatbuf_Type_as_Date(org_apache_arrow_flatbuf_Date_clone(B, (org_apache_arrow_flatbuf_Date_table_t)u.value)); + case 9: return org_apache_arrow_flatbuf_Type_as_Time(org_apache_arrow_flatbuf_Time_clone(B, (org_apache_arrow_flatbuf_Time_table_t)u.value)); + case 10: return org_apache_arrow_flatbuf_Type_as_Timestamp(org_apache_arrow_flatbuf_Timestamp_clone(B, (org_apache_arrow_flatbuf_Timestamp_table_t)u.value)); + case 11: return org_apache_arrow_flatbuf_Type_as_Interval(org_apache_arrow_flatbuf_Interval_clone(B, (org_apache_arrow_flatbuf_Interval_table_t)u.value)); + case 12: return org_apache_arrow_flatbuf_Type_as_List(org_apache_arrow_flatbuf_List_clone(B, (org_apache_arrow_flatbuf_List_table_t)u.value)); + case 13: return org_apache_arrow_flatbuf_Type_as_Struct_(org_apache_arrow_flatbuf_Struct__clone(B, (org_apache_arrow_flatbuf_Struct__table_t)u.value)); + case 14: return org_apache_arrow_flatbuf_Type_as_Union(org_apache_arrow_flatbuf_Union_clone(B, (org_apache_arrow_flatbuf_Union_table_t)u.value)); + case 15: return org_apache_arrow_flatbuf_Type_as_FixedSizeBinary(org_apache_arrow_flatbuf_FixedSizeBinary_clone(B, (org_apache_arrow_flatbuf_FixedSizeBinary_table_t)u.value)); + case 16: return org_apache_arrow_flatbuf_Type_as_FixedSizeList(org_apache_arrow_flatbuf_FixedSizeList_clone(B, (org_apache_arrow_flatbuf_FixedSizeList_table_t)u.value)); + case 17: return org_apache_arrow_flatbuf_Type_as_Map(org_apache_arrow_flatbuf_Map_clone(B, (org_apache_arrow_flatbuf_Map_table_t)u.value)); + case 18: return org_apache_arrow_flatbuf_Type_as_Duration(org_apache_arrow_flatbuf_Duration_clone(B, (org_apache_arrow_flatbuf_Duration_table_t)u.value)); + case 19: return org_apache_arrow_flatbuf_Type_as_LargeBinary(org_apache_arrow_flatbuf_LargeBinary_clone(B, (org_apache_arrow_flatbuf_LargeBinary_table_t)u.value)); + case 20: return org_apache_arrow_flatbuf_Type_as_LargeUtf8(org_apache_arrow_flatbuf_LargeUtf8_clone(B, (org_apache_arrow_flatbuf_LargeUtf8_table_t)u.value)); + case 21: return org_apache_arrow_flatbuf_Type_as_LargeList(org_apache_arrow_flatbuf_LargeList_clone(B, (org_apache_arrow_flatbuf_LargeList_table_t)u.value)); + case 22: return org_apache_arrow_flatbuf_Type_as_RunEndEncoded(org_apache_arrow_flatbuf_RunEndEncoded_clone(B, (org_apache_arrow_flatbuf_RunEndEncoded_table_t)u.value)); + case 23: return org_apache_arrow_flatbuf_Type_as_BinaryView(org_apache_arrow_flatbuf_BinaryView_clone(B, (org_apache_arrow_flatbuf_BinaryView_table_t)u.value)); + case 24: return org_apache_arrow_flatbuf_Type_as_Utf8View(org_apache_arrow_flatbuf_Utf8View_clone(B, (org_apache_arrow_flatbuf_Utf8View_table_t)u.value)); + case 25: return org_apache_arrow_flatbuf_Type_as_ListView(org_apache_arrow_flatbuf_ListView_clone(B, (org_apache_arrow_flatbuf_ListView_table_t)u.value)); + case 26: return org_apache_arrow_flatbuf_Type_as_LargeListView(org_apache_arrow_flatbuf_LargeListView_clone(B, (org_apache_arrow_flatbuf_LargeListView_table_t)u.value)); + default: return org_apache_arrow_flatbuf_Type_as_NONE(); + } +} + + +static inline org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Null_formal_args) +{ + if (org_apache_arrow_flatbuf_Null_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Null_end(B); +} + +static org_apache_arrow_flatbuf_Null_ref_t org_apache_arrow_flatbuf_Null_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Null_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Null_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Null_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Struct__formal_args) +{ + if (org_apache_arrow_flatbuf_Struct__start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Struct__end(B); +} + +static org_apache_arrow_flatbuf_Struct__ref_t org_apache_arrow_flatbuf_Struct__clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Struct__table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Struct__start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Struct__end(B)); +} + + +static inline org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_List_formal_args) +{ + if (org_apache_arrow_flatbuf_List_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_List_end(B); +} + +static org_apache_arrow_flatbuf_List_ref_t org_apache_arrow_flatbuf_List_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_List_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_List_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_List_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeList_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeList_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeList_end(B); +} + +static org_apache_arrow_flatbuf_LargeList_ref_t org_apache_arrow_flatbuf_LargeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeList_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeList_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeList_end(B)); +} + + +static inline org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_ListView_formal_args) +{ + if (org_apache_arrow_flatbuf_ListView_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_ListView_end(B); +} + +static org_apache_arrow_flatbuf_ListView_ref_t org_apache_arrow_flatbuf_ListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_ListView_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_ListView_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_ListView_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeListView_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeListView_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeListView_end(B); +} + +static org_apache_arrow_flatbuf_LargeListView_ref_t org_apache_arrow_flatbuf_LargeListView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeListView_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeListView_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeListView_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_FixedSizeList_listSize, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_FixedSizeList) + +static inline org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeList_formal_args) +{ + if (org_apache_arrow_flatbuf_FixedSizeList_start(B) + || org_apache_arrow_flatbuf_FixedSizeList_listSize_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_FixedSizeList_end(B); +} + +static org_apache_arrow_flatbuf_FixedSizeList_ref_t org_apache_arrow_flatbuf_FixedSizeList_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeList_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_FixedSizeList_start(B) + || org_apache_arrow_flatbuf_FixedSizeList_listSize_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_FixedSizeList_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Map_keysSorted, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_Map) + +static inline org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Map_formal_args) +{ + if (org_apache_arrow_flatbuf_Map_start(B) + || org_apache_arrow_flatbuf_Map_keysSorted_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Map_end(B); +} + +static org_apache_arrow_flatbuf_Map_ref_t org_apache_arrow_flatbuf_Map_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Map_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Map_start(B) + || org_apache_arrow_flatbuf_Map_keysSorted_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Map_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Union_mode, org_apache_arrow_flatbuf_UnionMode, org_apache_arrow_flatbuf_UnionMode_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Union) +__flatbuffers_build_vector_field(1, flatbuffers_, org_apache_arrow_flatbuf_Union_typeIds, flatbuffers_int32, int32_t, org_apache_arrow_flatbuf_Union) + +static inline org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Union_formal_args) +{ + if (org_apache_arrow_flatbuf_Union_start(B) + || org_apache_arrow_flatbuf_Union_typeIds_add(B, v1) + || org_apache_arrow_flatbuf_Union_mode_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Union_end(B); +} + +static org_apache_arrow_flatbuf_Union_ref_t org_apache_arrow_flatbuf_Union_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Union_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Union_start(B) + || org_apache_arrow_flatbuf_Union_typeIds_pick(B, t) + || org_apache_arrow_flatbuf_Union_mode_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Union_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Int_bitWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_Int) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Int_is_signed, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_Int) + +static inline org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Int_formal_args) +{ + if (org_apache_arrow_flatbuf_Int_start(B) + || org_apache_arrow_flatbuf_Int_bitWidth_add(B, v0) + || org_apache_arrow_flatbuf_Int_is_signed_add(B, v1)) { + return 0; + } + return org_apache_arrow_flatbuf_Int_end(B); +} + +static org_apache_arrow_flatbuf_Int_ref_t org_apache_arrow_flatbuf_Int_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Int_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Int_start(B) + || org_apache_arrow_flatbuf_Int_bitWidth_pick(B, t) + || org_apache_arrow_flatbuf_Int_is_signed_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Int_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_FloatingPoint_precision, org_apache_arrow_flatbuf_Precision, org_apache_arrow_flatbuf_Precision_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_FloatingPoint) + +static inline org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FloatingPoint_formal_args) +{ + if (org_apache_arrow_flatbuf_FloatingPoint_start(B) + || org_apache_arrow_flatbuf_FloatingPoint_precision_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_FloatingPoint_end(B); +} + +static org_apache_arrow_flatbuf_FloatingPoint_ref_t org_apache_arrow_flatbuf_FloatingPoint_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FloatingPoint_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_FloatingPoint_start(B) + || org_apache_arrow_flatbuf_FloatingPoint_precision_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_FloatingPoint_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8_formal_args) +{ + if (org_apache_arrow_flatbuf_Utf8_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Utf8_end(B); +} + +static org_apache_arrow_flatbuf_Utf8_ref_t org_apache_arrow_flatbuf_Utf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Utf8_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Utf8_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Binary_formal_args) +{ + if (org_apache_arrow_flatbuf_Binary_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Binary_end(B); +} + +static org_apache_arrow_flatbuf_Binary_ref_t org_apache_arrow_flatbuf_Binary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Binary_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Binary_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Binary_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeUtf8_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeUtf8_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeUtf8_end(B); +} + +static org_apache_arrow_flatbuf_LargeUtf8_ref_t org_apache_arrow_flatbuf_LargeUtf8_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeUtf8_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeUtf8_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeUtf8_end(B)); +} + + +static inline org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_LargeBinary_formal_args) +{ + if (org_apache_arrow_flatbuf_LargeBinary_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_LargeBinary_end(B); +} + +static org_apache_arrow_flatbuf_LargeBinary_ref_t org_apache_arrow_flatbuf_LargeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_LargeBinary_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_LargeBinary_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_LargeBinary_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Utf8View_formal_args) +{ + if (org_apache_arrow_flatbuf_Utf8View_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Utf8View_end(B); +} + +static org_apache_arrow_flatbuf_Utf8View_ref_t org_apache_arrow_flatbuf_Utf8View_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Utf8View_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Utf8View_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Utf8View_end(B)); +} + + +static inline org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_BinaryView_formal_args) +{ + if (org_apache_arrow_flatbuf_BinaryView_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_BinaryView_end(B); +} + +static org_apache_arrow_flatbuf_BinaryView_ref_t org_apache_arrow_flatbuf_BinaryView_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_BinaryView_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_BinaryView_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_BinaryView_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_FixedSizeBinary_byteWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_FixedSizeBinary) + +static inline org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_FixedSizeBinary_formal_args) +{ + if (org_apache_arrow_flatbuf_FixedSizeBinary_start(B) + || org_apache_arrow_flatbuf_FixedSizeBinary_byteWidth_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_FixedSizeBinary_end(B); +} + +static org_apache_arrow_flatbuf_FixedSizeBinary_ref_t org_apache_arrow_flatbuf_FixedSizeBinary_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_FixedSizeBinary_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_FixedSizeBinary_start(B) + || org_apache_arrow_flatbuf_FixedSizeBinary_byteWidth_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_FixedSizeBinary_end(B)); +} + + +static inline org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Bool_formal_args) +{ + if (org_apache_arrow_flatbuf_Bool_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_Bool_end(B); +} + +static org_apache_arrow_flatbuf_Bool_ref_t org_apache_arrow_flatbuf_Bool_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Bool_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Bool_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Bool_end(B)); +} + + +static inline org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_RunEndEncoded_formal_args) +{ + if (org_apache_arrow_flatbuf_RunEndEncoded_start(B)) { + return 0; + } + return org_apache_arrow_flatbuf_RunEndEncoded_end(B); +} + +static org_apache_arrow_flatbuf_RunEndEncoded_ref_t org_apache_arrow_flatbuf_RunEndEncoded_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_RunEndEncoded_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_RunEndEncoded_start(B)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_RunEndEncoded_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Decimal_precision, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Decimal_scale, flatbuffers_int32, int32_t, 4, 4, INT32_C(0), org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_scalar_field(2, flatbuffers_, org_apache_arrow_flatbuf_Decimal_bitWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(128), org_apache_arrow_flatbuf_Decimal) + +static inline org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Decimal_formal_args) +{ + if (org_apache_arrow_flatbuf_Decimal_start(B) + || org_apache_arrow_flatbuf_Decimal_precision_add(B, v0) + || org_apache_arrow_flatbuf_Decimal_scale_add(B, v1) + || org_apache_arrow_flatbuf_Decimal_bitWidth_add(B, v2)) { + return 0; + } + return org_apache_arrow_flatbuf_Decimal_end(B); +} + +static org_apache_arrow_flatbuf_Decimal_ref_t org_apache_arrow_flatbuf_Decimal_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Decimal_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Decimal_start(B) + || org_apache_arrow_flatbuf_Decimal_precision_pick(B, t) + || org_apache_arrow_flatbuf_Decimal_scale_pick(B, t) + || org_apache_arrow_flatbuf_Decimal_bitWidth_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Decimal_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Date_unit, org_apache_arrow_flatbuf_DateUnit, org_apache_arrow_flatbuf_DateUnit_enum_t, 2, 2, INT16_C(1), org_apache_arrow_flatbuf_Date) + +static inline org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Date_formal_args) +{ + if (org_apache_arrow_flatbuf_Date_start(B) + || org_apache_arrow_flatbuf_Date_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Date_end(B); +} + +static org_apache_arrow_flatbuf_Date_ref_t org_apache_arrow_flatbuf_Date_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Date_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Date_start(B) + || org_apache_arrow_flatbuf_Date_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Date_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Time_unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 2, 2, INT16_C(1), org_apache_arrow_flatbuf_Time) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Time_bitWidth, flatbuffers_int32, int32_t, 4, 4, INT32_C(32), org_apache_arrow_flatbuf_Time) + +static inline org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Time_formal_args) +{ + if (org_apache_arrow_flatbuf_Time_start(B) + || org_apache_arrow_flatbuf_Time_bitWidth_add(B, v1) + || org_apache_arrow_flatbuf_Time_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Time_end(B); +} + +static org_apache_arrow_flatbuf_Time_ref_t org_apache_arrow_flatbuf_Time_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Time_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Time_start(B) + || org_apache_arrow_flatbuf_Time_bitWidth_pick(B, t) + || org_apache_arrow_flatbuf_Time_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Time_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Timestamp_unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Timestamp) +__flatbuffers_build_string_field(1, flatbuffers_, org_apache_arrow_flatbuf_Timestamp_timezone, org_apache_arrow_flatbuf_Timestamp) + +static inline org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Timestamp_formal_args) +{ + if (org_apache_arrow_flatbuf_Timestamp_start(B) + || org_apache_arrow_flatbuf_Timestamp_timezone_add(B, v1) + || org_apache_arrow_flatbuf_Timestamp_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Timestamp_end(B); +} + +static org_apache_arrow_flatbuf_Timestamp_ref_t org_apache_arrow_flatbuf_Timestamp_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Timestamp_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Timestamp_start(B) + || org_apache_arrow_flatbuf_Timestamp_timezone_pick(B, t) + || org_apache_arrow_flatbuf_Timestamp_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Timestamp_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Interval_unit, org_apache_arrow_flatbuf_IntervalUnit, org_apache_arrow_flatbuf_IntervalUnit_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Interval) + +static inline org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Interval_formal_args) +{ + if (org_apache_arrow_flatbuf_Interval_start(B) + || org_apache_arrow_flatbuf_Interval_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Interval_end(B); +} + +static org_apache_arrow_flatbuf_Interval_ref_t org_apache_arrow_flatbuf_Interval_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Interval_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Interval_start(B) + || org_apache_arrow_flatbuf_Interval_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Interval_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Duration_unit, org_apache_arrow_flatbuf_TimeUnit, org_apache_arrow_flatbuf_TimeUnit_enum_t, 2, 2, INT16_C(1), org_apache_arrow_flatbuf_Duration) + +static inline org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Duration_formal_args) +{ + if (org_apache_arrow_flatbuf_Duration_start(B) + || org_apache_arrow_flatbuf_Duration_unit_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Duration_end(B); +} + +static org_apache_arrow_flatbuf_Duration_ref_t org_apache_arrow_flatbuf_Duration_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Duration_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Duration_start(B) + || org_apache_arrow_flatbuf_Duration_unit_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Duration_end(B)); +} + +__flatbuffers_build_string_field(0, flatbuffers_, org_apache_arrow_flatbuf_KeyValue_key, org_apache_arrow_flatbuf_KeyValue) +__flatbuffers_build_string_field(1, flatbuffers_, org_apache_arrow_flatbuf_KeyValue_value, org_apache_arrow_flatbuf_KeyValue) + +static inline org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_KeyValue_formal_args) +{ + if (org_apache_arrow_flatbuf_KeyValue_start(B) + || org_apache_arrow_flatbuf_KeyValue_key_add(B, v0) + || org_apache_arrow_flatbuf_KeyValue_value_add(B, v1)) { + return 0; + } + return org_apache_arrow_flatbuf_KeyValue_end(B); +} + +static org_apache_arrow_flatbuf_KeyValue_ref_t org_apache_arrow_flatbuf_KeyValue_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_KeyValue_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_KeyValue_start(B) + || org_apache_arrow_flatbuf_KeyValue_key_pick(B, t) + || org_apache_arrow_flatbuf_KeyValue_value_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_KeyValue_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_id, flatbuffers_int64, int64_t, 8, 8, INT64_C(0), org_apache_arrow_flatbuf_DictionaryEncoding) +__flatbuffers_build_table_field(1, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_indexType, org_apache_arrow_flatbuf_Int, org_apache_arrow_flatbuf_DictionaryEncoding) +__flatbuffers_build_scalar_field(2, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_isOrdered, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_DictionaryEncoding) +__flatbuffers_build_scalar_field(3, flatbuffers_, org_apache_arrow_flatbuf_DictionaryEncoding_dictionaryKind, org_apache_arrow_flatbuf_DictionaryKind, org_apache_arrow_flatbuf_DictionaryKind_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_DictionaryEncoding) + +static inline org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_DictionaryEncoding_formal_args) +{ + if (org_apache_arrow_flatbuf_DictionaryEncoding_start(B) + || org_apache_arrow_flatbuf_DictionaryEncoding_id_add(B, v0) + || org_apache_arrow_flatbuf_DictionaryEncoding_indexType_add(B, v1) + || org_apache_arrow_flatbuf_DictionaryEncoding_dictionaryKind_add(B, v3) + || org_apache_arrow_flatbuf_DictionaryEncoding_isOrdered_add(B, v2)) { + return 0; + } + return org_apache_arrow_flatbuf_DictionaryEncoding_end(B); +} + +static org_apache_arrow_flatbuf_DictionaryEncoding_ref_t org_apache_arrow_flatbuf_DictionaryEncoding_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_DictionaryEncoding_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_DictionaryEncoding_start(B) + || org_apache_arrow_flatbuf_DictionaryEncoding_id_pick(B, t) + || org_apache_arrow_flatbuf_DictionaryEncoding_indexType_pick(B, t) + || org_apache_arrow_flatbuf_DictionaryEncoding_dictionaryKind_pick(B, t) + || org_apache_arrow_flatbuf_DictionaryEncoding_isOrdered_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_DictionaryEncoding_end(B)); +} + +__flatbuffers_build_string_field(0, flatbuffers_, org_apache_arrow_flatbuf_Field_name, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_scalar_field(1, flatbuffers_, org_apache_arrow_flatbuf_Field_nullable, flatbuffers_bool, flatbuffers_bool_t, 1, 1, UINT8_C(0), org_apache_arrow_flatbuf_Field) +__flatbuffers_build_union_field(3, flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Null, org_apache_arrow_flatbuf_Null) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Int, org_apache_arrow_flatbuf_Int) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, FloatingPoint, org_apache_arrow_flatbuf_FloatingPoint) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Binary, org_apache_arrow_flatbuf_Binary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Utf8, org_apache_arrow_flatbuf_Utf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Bool, org_apache_arrow_flatbuf_Bool) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Decimal, org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Date, org_apache_arrow_flatbuf_Date) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Time, org_apache_arrow_flatbuf_Time) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Timestamp, org_apache_arrow_flatbuf_Timestamp) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Interval, org_apache_arrow_flatbuf_Interval) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, List, org_apache_arrow_flatbuf_List) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Struct_, org_apache_arrow_flatbuf_Struct_) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Union, org_apache_arrow_flatbuf_Union) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, FixedSizeBinary, org_apache_arrow_flatbuf_FixedSizeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, FixedSizeList, org_apache_arrow_flatbuf_FixedSizeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Map, org_apache_arrow_flatbuf_Map) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Duration, org_apache_arrow_flatbuf_Duration) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeBinary, org_apache_arrow_flatbuf_LargeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeUtf8, org_apache_arrow_flatbuf_LargeUtf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeList, org_apache_arrow_flatbuf_LargeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, RunEndEncoded, org_apache_arrow_flatbuf_RunEndEncoded) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, BinaryView, org_apache_arrow_flatbuf_BinaryView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, Utf8View, org_apache_arrow_flatbuf_Utf8View) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, ListView, org_apache_arrow_flatbuf_ListView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Field_type, org_apache_arrow_flatbuf_Type, LargeListView, org_apache_arrow_flatbuf_LargeListView) +__flatbuffers_build_table_field(4, flatbuffers_, org_apache_arrow_flatbuf_Field_dictionary, org_apache_arrow_flatbuf_DictionaryEncoding, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_table_vector_field(5, flatbuffers_, org_apache_arrow_flatbuf_Field_children, org_apache_arrow_flatbuf_Field, org_apache_arrow_flatbuf_Field) +__flatbuffers_build_table_vector_field(6, flatbuffers_, org_apache_arrow_flatbuf_Field_custom_metadata, org_apache_arrow_flatbuf_KeyValue, org_apache_arrow_flatbuf_Field) + +static inline org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Field_formal_args) +{ + if (org_apache_arrow_flatbuf_Field_start(B) + || org_apache_arrow_flatbuf_Field_name_add(B, v0) + || org_apache_arrow_flatbuf_Field_type_add_value(B, v3) + || org_apache_arrow_flatbuf_Field_dictionary_add(B, v4) + || org_apache_arrow_flatbuf_Field_children_add(B, v5) + || org_apache_arrow_flatbuf_Field_custom_metadata_add(B, v6) + || org_apache_arrow_flatbuf_Field_nullable_add(B, v1) + || org_apache_arrow_flatbuf_Field_type_add_type(B, v3.type)) { + return 0; + } + return org_apache_arrow_flatbuf_Field_end(B); +} + +static org_apache_arrow_flatbuf_Field_ref_t org_apache_arrow_flatbuf_Field_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Field_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Field_start(B) + || org_apache_arrow_flatbuf_Field_name_pick(B, t) + || org_apache_arrow_flatbuf_Field_type_pick(B, t) + || org_apache_arrow_flatbuf_Field_dictionary_pick(B, t) + || org_apache_arrow_flatbuf_Field_children_pick(B, t) + || org_apache_arrow_flatbuf_Field_custom_metadata_pick(B, t) + || org_apache_arrow_flatbuf_Field_nullable_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Field_end(B)); +} + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_Schema_endianness, org_apache_arrow_flatbuf_Endianness, org_apache_arrow_flatbuf_Endianness_enum_t, 2, 2, INT16_C(0), org_apache_arrow_flatbuf_Schema) +__flatbuffers_build_table_vector_field(1, flatbuffers_, org_apache_arrow_flatbuf_Schema_fields, org_apache_arrow_flatbuf_Field, org_apache_arrow_flatbuf_Schema) +__flatbuffers_build_table_vector_field(2, flatbuffers_, org_apache_arrow_flatbuf_Schema_custom_metadata, org_apache_arrow_flatbuf_KeyValue, org_apache_arrow_flatbuf_Schema) +__flatbuffers_build_vector_field(3, flatbuffers_, org_apache_arrow_flatbuf_Schema_features, org_apache_arrow_flatbuf_Feature, org_apache_arrow_flatbuf_Feature_enum_t, org_apache_arrow_flatbuf_Schema) + +static inline org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Schema_formal_args) +{ + if (org_apache_arrow_flatbuf_Schema_start(B) + || org_apache_arrow_flatbuf_Schema_fields_add(B, v1) + || org_apache_arrow_flatbuf_Schema_custom_metadata_add(B, v2) + || org_apache_arrow_flatbuf_Schema_features_add(B, v3) + || org_apache_arrow_flatbuf_Schema_endianness_add(B, v0)) { + return 0; + } + return org_apache_arrow_flatbuf_Schema_end(B); +} + +static org_apache_arrow_flatbuf_Schema_ref_t org_apache_arrow_flatbuf_Schema_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Schema_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Schema_start(B) + || org_apache_arrow_flatbuf_Schema_fields_pick(B, t) + || org_apache_arrow_flatbuf_Schema_custom_metadata_pick(B, t) + || org_apache_arrow_flatbuf_Schema_features_pick(B, t) + || org_apache_arrow_flatbuf_Schema_endianness_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Schema_end(B)); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* SCHEMA_BUILDER_H */ +#ifndef SCHEMA_VERIFIER_H +#define SCHEMA_VERIFIER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef SCHEMA_READER_H +#include "Schema_reader.h" +#endif +#include "flatcc/flatcc_verifier.h" +#include "flatcc/flatcc_prologue.h" + +static int org_apache_arrow_flatbuf_Null_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Struct__verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_List_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeList_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_ListView_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeListView_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_FixedSizeList_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Map_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Union_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Int_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_FloatingPoint_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Utf8_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Binary_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeUtf8_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_LargeBinary_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Utf8View_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_BinaryView_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_FixedSizeBinary_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Bool_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_RunEndEncoded_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Decimal_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Date_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Time_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Timestamp_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Interval_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Duration_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_KeyValue_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_DictionaryEncoding_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Field_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Schema_verify_table(flatcc_table_verifier_descriptor_t *td); + +static int org_apache_arrow_flatbuf_Type_union_verifier(flatcc_union_verifier_descriptor_t *ud) +{ + switch (ud->type) { + case 1: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Null_verify_table); /* Null */ + case 2: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Int_verify_table); /* Int */ + case 3: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_FloatingPoint_verify_table); /* FloatingPoint */ + case 4: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Binary_verify_table); /* Binary */ + case 5: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Utf8_verify_table); /* Utf8 */ + case 6: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Bool_verify_table); /* Bool */ + case 7: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Decimal_verify_table); /* Decimal */ + case 8: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Date_verify_table); /* Date */ + case 9: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Time_verify_table); /* Time */ + case 10: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Timestamp_verify_table); /* Timestamp */ + case 11: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Interval_verify_table); /* Interval */ + case 12: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_List_verify_table); /* List */ + case 13: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Struct__verify_table); /* Struct_ */ + case 14: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Union_verify_table); /* Union */ + case 15: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); /* FixedSizeBinary */ + case 16: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_FixedSizeList_verify_table); /* FixedSizeList */ + case 17: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Map_verify_table); /* Map */ + case 18: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Duration_verify_table); /* Duration */ + case 19: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeBinary_verify_table); /* LargeBinary */ + case 20: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeUtf8_verify_table); /* LargeUtf8 */ + case 21: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeList_verify_table); /* LargeList */ + case 22: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_RunEndEncoded_verify_table); /* RunEndEncoded */ + case 23: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_BinaryView_verify_table); /* BinaryView */ + case 24: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_Utf8View_verify_table); /* Utf8View */ + case 25: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_ListView_verify_table); /* ListView */ + case 26: return flatcc_verify_union_table(ud, org_apache_arrow_flatbuf_LargeListView_verify_table); /* LargeListView */ + default: return flatcc_verify_ok; + } +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_identifier, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_identifier, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_typed_root(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_type_hash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_typed_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Buffer_type_hash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_struct_as_typed_root(buf, bufsiz, thash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_struct_as_typed_root_with_size(buf, bufsiz, thash, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_struct_as_root(buf, bufsiz, fid, 16, 8); +} + +static inline int org_apache_arrow_flatbuf_Buffer_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_struct_as_root_with_size(buf, bufsiz, fid, 16, 8); +} + +static int org_apache_arrow_flatbuf_Null_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Null_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Null_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Null_type_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Null_type_identifier, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Null_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Null_verify_table); +} + +static int org_apache_arrow_flatbuf_Struct__verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Struct__identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Struct__identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Struct__type_identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Struct__type_identifier, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static inline int org_apache_arrow_flatbuf_Struct__verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Struct__verify_table); +} + +static int org_apache_arrow_flatbuf_List_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_List_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_List_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_List_type_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_List_type_identifier, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_List_verify_table); +} + +static inline int org_apache_arrow_flatbuf_List_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_List_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeList_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_type_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeList_type_identifier, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeList_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeList_verify_table); +} + +static int org_apache_arrow_flatbuf_ListView_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_ListView_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_ListView_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_ListView_type_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_ListView_type_identifier, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_ListView_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_ListView_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeListView_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_type_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeListView_type_identifier, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeListView_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeListView_verify_table); +} + +static int org_apache_arrow_flatbuf_FixedSizeList_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* listSize */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_type_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeList_type_identifier, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeList_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeList_verify_table); +} + +static int org_apache_arrow_flatbuf_Map_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 1, 1) /* keysSorted */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Map_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Map_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Map_type_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Map_type_identifier, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Map_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Map_verify_table); +} + +static int org_apache_arrow_flatbuf_Union_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* mode */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 1, 0, 4, 4, INT64_C(1073741823)) /* typeIds */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Union_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Union_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Union_type_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Union_type_identifier, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Union_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Union_verify_table); +} + +static int org_apache_arrow_flatbuf_Int_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* bitWidth */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 1, 1) /* is_signed */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Int_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Int_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Int_type_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Int_type_identifier, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Int_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Int_verify_table); +} + +static int org_apache_arrow_flatbuf_FloatingPoint_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* precision */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_type_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FloatingPoint_type_identifier, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FloatingPoint_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FloatingPoint_verify_table); +} + +static int org_apache_arrow_flatbuf_Utf8_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_type_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8_type_identifier, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8_verify_table); +} + +static int org_apache_arrow_flatbuf_Binary_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Binary_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Binary_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Binary_type_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Binary_type_identifier, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Binary_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Binary_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeUtf8_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_type_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeUtf8_type_identifier, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeUtf8_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeUtf8_verify_table); +} + +static int org_apache_arrow_flatbuf_LargeBinary_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_type_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_LargeBinary_type_identifier, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_LargeBinary_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_LargeBinary_verify_table); +} + +static int org_apache_arrow_flatbuf_Utf8View_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_type_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Utf8View_type_identifier, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Utf8View_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Utf8View_verify_table); +} + +static int org_apache_arrow_flatbuf_BinaryView_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_type_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_BinaryView_type_identifier, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static inline int org_apache_arrow_flatbuf_BinaryView_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_BinaryView_verify_table); +} + +static int org_apache_arrow_flatbuf_FixedSizeBinary_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* byteWidth */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_FixedSizeBinary_type_identifier, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static inline int org_apache_arrow_flatbuf_FixedSizeBinary_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_FixedSizeBinary_verify_table); +} + +static int org_apache_arrow_flatbuf_Bool_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Bool_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Bool_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Bool_type_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Bool_type_identifier, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Bool_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Bool_verify_table); +} + +static int org_apache_arrow_flatbuf_RunEndEncoded_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_type_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_RunEndEncoded_type_identifier, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static inline int org_apache_arrow_flatbuf_RunEndEncoded_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_RunEndEncoded_verify_table); +} + +static int org_apache_arrow_flatbuf_Decimal_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 4, 4) /* precision */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 4, 4) /* scale */)) return ret; + if ((ret = flatcc_verify_field(td, 2, 4, 4) /* bitWidth */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_type_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Decimal_type_identifier, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Decimal_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Decimal_verify_table); +} + +static int org_apache_arrow_flatbuf_Date_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Date_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Date_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Date_type_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Date_type_identifier, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Date_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Date_verify_table); +} + +static int org_apache_arrow_flatbuf_Time_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 4, 4) /* bitWidth */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Time_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Time_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Time_type_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Time_type_identifier, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Time_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Time_verify_table); +} + +static int org_apache_arrow_flatbuf_Timestamp_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + if ((ret = flatcc_verify_string_field(td, 1, 0) /* timezone */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_type_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Timestamp_type_identifier, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Timestamp_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Timestamp_verify_table); +} + +static int org_apache_arrow_flatbuf_Interval_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Interval_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Interval_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Interval_type_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Interval_type_identifier, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Interval_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Interval_verify_table); +} + +static int org_apache_arrow_flatbuf_Duration_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* unit */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Duration_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Duration_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Duration_type_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Duration_type_identifier, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Duration_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Duration_verify_table); +} + +static int org_apache_arrow_flatbuf_KeyValue_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_string_field(td, 0, 0) /* key */)) return ret; + if ((ret = flatcc_verify_string_field(td, 1, 0) /* value */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_type_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_KeyValue_type_identifier, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static inline int org_apache_arrow_flatbuf_KeyValue_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_KeyValue_verify_table); +} + +static int org_apache_arrow_flatbuf_DictionaryEncoding_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 8, 8) /* id */)) return ret; + if ((ret = flatcc_verify_table_field(td, 1, 0, &org_apache_arrow_flatbuf_Int_verify_table) /* indexType */)) return ret; + if ((ret = flatcc_verify_field(td, 2, 1, 1) /* isOrdered */)) return ret; + if ((ret = flatcc_verify_field(td, 3, 2, 2) /* dictionaryKind */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_DictionaryEncoding_type_identifier, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static inline int org_apache_arrow_flatbuf_DictionaryEncoding_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table); +} + +static int org_apache_arrow_flatbuf_Field_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_string_field(td, 0, 0) /* name */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 1, 1) /* nullable */)) return ret; + if ((ret = flatcc_verify_union_field(td, 3, 0, &org_apache_arrow_flatbuf_Type_union_verifier) /* type */)) return ret; + if ((ret = flatcc_verify_table_field(td, 4, 0, &org_apache_arrow_flatbuf_DictionaryEncoding_verify_table) /* dictionary */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 5, 0, &org_apache_arrow_flatbuf_Field_verify_table) /* children */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 6, 0, &org_apache_arrow_flatbuf_KeyValue_verify_table) /* custom_metadata */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Field_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Field_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Field_type_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Field_type_identifier, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Field_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Field_verify_table); +} + +static int org_apache_arrow_flatbuf_Schema_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 2, 2) /* endianness */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 1, 0, &org_apache_arrow_flatbuf_Field_verify_table) /* fields */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 2, 0, &org_apache_arrow_flatbuf_KeyValue_verify_table) /* custom_metadata */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 3, 0, 8, 8, INT64_C(536870911)) /* features */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Schema_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Schema_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Schema_type_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Schema_type_identifier, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Schema_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Schema_verify_table); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* SCHEMA_VERIFIER_H */ +#ifndef TENSOR_READER_H +#define TENSOR_READER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef FLATBUFFERS_COMMON_READER_H +#include "flatbuffers_common_reader.h" +#endif +#ifndef SCHEMA_READER_H +#include "Schema_reader.h" +#endif +#include "flatcc/flatcc_flatbuffers.h" +#ifndef __alignas_is_defined +#include +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + + +typedef const struct org_apache_arrow_flatbuf_TensorDim_table *org_apache_arrow_flatbuf_TensorDim_table_t; +typedef struct org_apache_arrow_flatbuf_TensorDim_table *org_apache_arrow_flatbuf_TensorDim_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_TensorDim_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_TensorDim_mutable_vec_t; +typedef const struct org_apache_arrow_flatbuf_Tensor_table *org_apache_arrow_flatbuf_Tensor_table_t; +typedef struct org_apache_arrow_flatbuf_Tensor_table *org_apache_arrow_flatbuf_Tensor_mutable_table_t; +typedef const flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Tensor_vec_t; +typedef flatbuffers_uoffset_t *org_apache_arrow_flatbuf_Tensor_mutable_vec_t; +#ifndef org_apache_arrow_flatbuf_TensorDim_file_identifier +#define org_apache_arrow_flatbuf_TensorDim_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_TensorDim_file_identifier */ +#ifndef org_apache_arrow_flatbuf_TensorDim_identifier +#define org_apache_arrow_flatbuf_TensorDim_identifier 0 +#endif +#define org_apache_arrow_flatbuf_TensorDim_type_hash ((flatbuffers_thash_t)0xbc6d7b25) +#define org_apache_arrow_flatbuf_TensorDim_type_identifier "\x25\x7b\x6d\xbc" +#ifndef org_apache_arrow_flatbuf_TensorDim_file_extension +#define org_apache_arrow_flatbuf_TensorDim_file_extension "bin" +#endif +#ifndef org_apache_arrow_flatbuf_Tensor_file_identifier +#define org_apache_arrow_flatbuf_Tensor_file_identifier 0 +#endif +/* deprecated, use org_apache_arrow_flatbuf_Tensor_file_identifier */ +#ifndef org_apache_arrow_flatbuf_Tensor_identifier +#define org_apache_arrow_flatbuf_Tensor_identifier 0 +#endif +#define org_apache_arrow_flatbuf_Tensor_type_hash ((flatbuffers_thash_t)0x1764df19) +#define org_apache_arrow_flatbuf_Tensor_type_identifier "\x19\xdf\x64\x17" +#ifndef org_apache_arrow_flatbuf_Tensor_file_extension +#define org_apache_arrow_flatbuf_Tensor_file_extension "bin" +#endif + + + +/** ---------------------------------------------------------------------- + * Data structures for dense tensors + * Shape data for a single axis in a tensor */ +struct org_apache_arrow_flatbuf_TensorDim_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_TensorDim_vec_len(org_apache_arrow_flatbuf_TensorDim_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_TensorDim_table_t org_apache_arrow_flatbuf_TensorDim_vec_at(org_apache_arrow_flatbuf_TensorDim_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_TensorDim_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_TensorDim) + +/** Length of dimension */ +__flatbuffers_define_scalar_field(0, org_apache_arrow_flatbuf_TensorDim, size, flatbuffers_int64, int64_t, INT64_C(0)) +/** Name of the dimension, optional */ +__flatbuffers_define_string_field(1, org_apache_arrow_flatbuf_TensorDim, name, 0) + +struct org_apache_arrow_flatbuf_Tensor_table { uint8_t unused__; }; + +static inline size_t org_apache_arrow_flatbuf_Tensor_vec_len(org_apache_arrow_flatbuf_Tensor_vec_t vec) +__flatbuffers_vec_len(vec) +static inline org_apache_arrow_flatbuf_Tensor_table_t org_apache_arrow_flatbuf_Tensor_vec_at(org_apache_arrow_flatbuf_Tensor_vec_t vec, size_t i) +__flatbuffers_offset_vec_at(org_apache_arrow_flatbuf_Tensor_table_t, vec, i, 0) +__flatbuffers_table_as_root(org_apache_arrow_flatbuf_Tensor) + +/** The type of data contained in a value cell. Currently only fixed-width + * value types are supported, no strings or nested types */ +__flatbuffers_define_union_field(flatbuffers_, 1, org_apache_arrow_flatbuf_Tensor, type, org_apache_arrow_flatbuf_Type, 1) +/** The dimensions of the tensor, optionally named */ +__flatbuffers_define_vector_field(2, org_apache_arrow_flatbuf_Tensor, shape, org_apache_arrow_flatbuf_TensorDim_vec_t, 1) +/** Non-negative byte offsets to advance one value cell along each dimension + * If omitted, default to row-major order (C-like). */ +__flatbuffers_define_vector_field(3, org_apache_arrow_flatbuf_Tensor, strides, flatbuffers_int64_vec_t, 0) +/** The location and size of the tensor's data */ +__flatbuffers_define_struct_field(4, org_apache_arrow_flatbuf_Tensor, data, org_apache_arrow_flatbuf_Buffer_struct_t, 1) + + +#include "flatcc/flatcc_epilogue.h" +#endif /* TENSOR_READER_H */ +#ifndef TENSOR_BUILDER_H +#define TENSOR_BUILDER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef TENSOR_READER_H +#include "Tensor_reader.h" +#endif +#ifndef FLATBUFFERS_COMMON_BUILDER_H +#include "flatbuffers_common_builder.h" +#endif +#ifndef SCHEMA_BUILDER_H +#include "Schema_builder.h" +#endif +#include "flatcc/flatcc_prologue.h" +#ifndef flatbuffers_identifier +#define flatbuffers_identifier 0 +#endif +#ifndef flatbuffers_extension +#define flatbuffers_extension "bin" +#endif + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_TensorDim_required[] = { 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_TensorDim_ref_t; +static org_apache_arrow_flatbuf_TensorDim_ref_t org_apache_arrow_flatbuf_TensorDim_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_TensorDim_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_TensorDim, 2) + +static const flatbuffers_voffset_t __org_apache_arrow_flatbuf_Tensor_required[] = { 1, 2, 4, 0 }; +typedef flatbuffers_ref_t org_apache_arrow_flatbuf_Tensor_ref_t; +static org_apache_arrow_flatbuf_Tensor_ref_t org_apache_arrow_flatbuf_Tensor_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Tensor_table_t t); +__flatbuffers_build_table(flatbuffers_, org_apache_arrow_flatbuf_Tensor, 5) + +#define __org_apache_arrow_flatbuf_TensorDim_formal_args , int64_t v0, flatbuffers_string_ref_t v1 +#define __org_apache_arrow_flatbuf_TensorDim_call_args , v0, v1 +static inline org_apache_arrow_flatbuf_TensorDim_ref_t org_apache_arrow_flatbuf_TensorDim_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_TensorDim_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_TensorDim, org_apache_arrow_flatbuf_TensorDim_file_identifier, org_apache_arrow_flatbuf_TensorDim_type_identifier) + +#define __org_apache_arrow_flatbuf_Tensor_formal_args , org_apache_arrow_flatbuf_Type_union_ref_t v1, org_apache_arrow_flatbuf_TensorDim_vec_ref_t v2, flatbuffers_int64_vec_ref_t v3, org_apache_arrow_flatbuf_Buffer_t *v4 +#define __org_apache_arrow_flatbuf_Tensor_call_args , v1, v2, v3, v4 +static inline org_apache_arrow_flatbuf_Tensor_ref_t org_apache_arrow_flatbuf_Tensor_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Tensor_formal_args); +__flatbuffers_build_table_prolog(flatbuffers_, org_apache_arrow_flatbuf_Tensor, org_apache_arrow_flatbuf_Tensor_file_identifier, org_apache_arrow_flatbuf_Tensor_type_identifier) + +__flatbuffers_build_scalar_field(0, flatbuffers_, org_apache_arrow_flatbuf_TensorDim_size, flatbuffers_int64, int64_t, 8, 8, INT64_C(0), org_apache_arrow_flatbuf_TensorDim) +__flatbuffers_build_string_field(1, flatbuffers_, org_apache_arrow_flatbuf_TensorDim_name, org_apache_arrow_flatbuf_TensorDim) + +static inline org_apache_arrow_flatbuf_TensorDim_ref_t org_apache_arrow_flatbuf_TensorDim_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_TensorDim_formal_args) +{ + if (org_apache_arrow_flatbuf_TensorDim_start(B) + || org_apache_arrow_flatbuf_TensorDim_size_add(B, v0) + || org_apache_arrow_flatbuf_TensorDim_name_add(B, v1)) { + return 0; + } + return org_apache_arrow_flatbuf_TensorDim_end(B); +} + +static org_apache_arrow_flatbuf_TensorDim_ref_t org_apache_arrow_flatbuf_TensorDim_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_TensorDim_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_TensorDim_start(B) + || org_apache_arrow_flatbuf_TensorDim_size_pick(B, t) + || org_apache_arrow_flatbuf_TensorDim_name_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_TensorDim_end(B)); +} + +__flatbuffers_build_union_field(1, flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, org_apache_arrow_flatbuf_Tensor) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Null, org_apache_arrow_flatbuf_Null) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Int, org_apache_arrow_flatbuf_Int) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, FloatingPoint, org_apache_arrow_flatbuf_FloatingPoint) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Binary, org_apache_arrow_flatbuf_Binary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Utf8, org_apache_arrow_flatbuf_Utf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Bool, org_apache_arrow_flatbuf_Bool) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Decimal, org_apache_arrow_flatbuf_Decimal) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Date, org_apache_arrow_flatbuf_Date) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Time, org_apache_arrow_flatbuf_Time) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Timestamp, org_apache_arrow_flatbuf_Timestamp) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Interval, org_apache_arrow_flatbuf_Interval) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, List, org_apache_arrow_flatbuf_List) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Struct_, org_apache_arrow_flatbuf_Struct_) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Union, org_apache_arrow_flatbuf_Union) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, FixedSizeBinary, org_apache_arrow_flatbuf_FixedSizeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, FixedSizeList, org_apache_arrow_flatbuf_FixedSizeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Map, org_apache_arrow_flatbuf_Map) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Duration, org_apache_arrow_flatbuf_Duration) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, LargeBinary, org_apache_arrow_flatbuf_LargeBinary) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, LargeUtf8, org_apache_arrow_flatbuf_LargeUtf8) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, LargeList, org_apache_arrow_flatbuf_LargeList) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, RunEndEncoded, org_apache_arrow_flatbuf_RunEndEncoded) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, BinaryView, org_apache_arrow_flatbuf_BinaryView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, Utf8View, org_apache_arrow_flatbuf_Utf8View) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, ListView, org_apache_arrow_flatbuf_ListView) +__flatbuffers_build_union_table_value_field(flatbuffers_, org_apache_arrow_flatbuf_Tensor_type, org_apache_arrow_flatbuf_Type, LargeListView, org_apache_arrow_flatbuf_LargeListView) +__flatbuffers_build_table_vector_field(2, flatbuffers_, org_apache_arrow_flatbuf_Tensor_shape, org_apache_arrow_flatbuf_TensorDim, org_apache_arrow_flatbuf_Tensor) +__flatbuffers_build_vector_field(3, flatbuffers_, org_apache_arrow_flatbuf_Tensor_strides, flatbuffers_int64, int64_t, org_apache_arrow_flatbuf_Tensor) +__flatbuffers_build_struct_field(4, flatbuffers_, org_apache_arrow_flatbuf_Tensor_data, org_apache_arrow_flatbuf_Buffer, 16, 8, org_apache_arrow_flatbuf_Tensor) + +static inline org_apache_arrow_flatbuf_Tensor_ref_t org_apache_arrow_flatbuf_Tensor_create(flatbuffers_builder_t *B __org_apache_arrow_flatbuf_Tensor_formal_args) +{ + if (org_apache_arrow_flatbuf_Tensor_start(B) + || org_apache_arrow_flatbuf_Tensor_data_add(B, v4) + || org_apache_arrow_flatbuf_Tensor_type_add_value(B, v1) + || org_apache_arrow_flatbuf_Tensor_shape_add(B, v2) + || org_apache_arrow_flatbuf_Tensor_strides_add(B, v3) + || org_apache_arrow_flatbuf_Tensor_type_add_type(B, v1.type)) { + return 0; + } + return org_apache_arrow_flatbuf_Tensor_end(B); +} + +static org_apache_arrow_flatbuf_Tensor_ref_t org_apache_arrow_flatbuf_Tensor_clone(flatbuffers_builder_t *B, org_apache_arrow_flatbuf_Tensor_table_t t) +{ + __flatbuffers_memoize_begin(B, t); + if (org_apache_arrow_flatbuf_Tensor_start(B) + || org_apache_arrow_flatbuf_Tensor_data_pick(B, t) + || org_apache_arrow_flatbuf_Tensor_type_pick(B, t) + || org_apache_arrow_flatbuf_Tensor_shape_pick(B, t) + || org_apache_arrow_flatbuf_Tensor_strides_pick(B, t)) { + return 0; + } + __flatbuffers_memoize_end(B, t, org_apache_arrow_flatbuf_Tensor_end(B)); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* TENSOR_BUILDER_H */ +#ifndef TENSOR_VERIFIER_H +#define TENSOR_VERIFIER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef TENSOR_READER_H +#include "Tensor_reader.h" +#endif +#include "flatcc/flatcc_verifier.h" +#ifndef SCHEMA_VERIFIER_H +#include "Schema_verifier.h" +#endif +#include "flatcc/flatcc_prologue.h" + +static int org_apache_arrow_flatbuf_TensorDim_verify_table(flatcc_table_verifier_descriptor_t *td); +static int org_apache_arrow_flatbuf_Tensor_verify_table(flatcc_table_verifier_descriptor_t *td); + +static int org_apache_arrow_flatbuf_TensorDim_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 8, 8) /* size */)) return ret; + if ((ret = flatcc_verify_string_field(td, 1, 0) /* name */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_TensorDim_identifier, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_TensorDim_identifier, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_TensorDim_type_identifier, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_TensorDim_type_identifier, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static inline int org_apache_arrow_flatbuf_TensorDim_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_TensorDim_verify_table); +} + +static int org_apache_arrow_flatbuf_Tensor_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_union_field(td, 1, 1, &org_apache_arrow_flatbuf_Type_union_verifier) /* type */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 2, 1, &org_apache_arrow_flatbuf_TensorDim_verify_table) /* shape */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 3, 0, 8, 8, INT64_C(536870911)) /* strides */)) return ret; + if ((ret = flatcc_verify_field(td, 4, 16, 8) /* data */)) return ret; + return flatcc_verify_ok; +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Tensor_identifier, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Tensor_identifier, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, org_apache_arrow_flatbuf_Tensor_type_identifier, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_typed_root_with_size(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, org_apache_arrow_flatbuf_Tensor_type_identifier, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_root_with_identifier_and_size(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root_with_size(buf, bufsiz, fid, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +static inline int org_apache_arrow_flatbuf_Tensor_verify_as_root_with_type_hash_and_size(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root_with_size(buf, bufsiz, thash, &org_apache_arrow_flatbuf_Tensor_verify_table); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* TENSOR_VERIFIER_H */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include +#include +#include +#include + +// For thread safe shared buffers we need C11 + stdatomic.h +// Can compile with -DNANOARROW_IPC_USE_STDATOMIC=0 or 1 to override +// automatic detection +#if !defined(NANOARROW_IPC_USE_STDATOMIC) +#define NANOARROW_IPC_USE_STDATOMIC 0 + +// Check for C11 +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L + +// Check for GCC 4.8, which doesn't include stdatomic.h but does +// not define __STDC_NO_ATOMICS__ +#if defined(__clang__) || !defined(__GNUC__) || __GNUC__ >= 5 + +#if !defined(__STDC_NO_ATOMICS__) +#include +#undef NANOARROW_IPC_USE_STDATOMIC +#define NANOARROW_IPC_USE_STDATOMIC 1 +#endif +#endif +#endif + +#endif + + +#include "nanoarrow/nanoarrow.h" +#include "nanoarrow/nanoarrow_ipc.h" + +// R 3.6 / Windows builds on a very old toolchain that does not define ENODATA +#if defined(_WIN32) && !defined(_MSC_VER) && !defined(ENODATA) +#define ENODATA 120 +#endif + +#define NANOARROW_IPC_MAGIC "ARROW1" + +// Internal representation of a parsed "Field" from flatbuffers. This +// represents a field in a depth-first walk of column arrays and their +// children. +struct ArrowIpcField { + // Pointer to the ArrowIpcDecoderPrivate::array_view or child for this node + struct ArrowArrayView* array_view; + // Pointer to the ArrowIpcDecoderPrivate::array or child for this node. This + // array is scratch space for any intermediary allocations (i.e., it is never moved + // to the user). + struct ArrowArray* array; + // The cumulative number of buffers preceding this node. + int64_t buffer_offset; +}; + +// Internal data specific to the read/decode process +struct ArrowIpcDecoderPrivate { + // The endianness that will be assumed for decoding future RecordBatch messages + enum ArrowIpcEndianness endianness; + // A cached system endianness value + enum ArrowIpcEndianness system_endianness; + // An ArrowArrayView whose length/null_count/buffers are set directly from the + // deserialized flatbuffer message (i.e., no fully underlying ArrowArray exists, + // although some buffers may be temporarily owned by ArrowIpcDecoderPrivate::array). + struct ArrowArrayView array_view; + // An ArrowArray with the same structure as the ArrowArrayView whose ArrowArrayBuffer() + // values are used to allocate or store memory when this is required. This ArrowArray + // is never moved to the caller; however, its buffers may be moved to the final output + // ArrowArray if the caller requests one. + struct ArrowArray array; + // The number of fields in the flattened depth-first walk of columns and their children + int64_t n_fields; + // Array of cached information such that given a field index it is possible to locate + // the ArrowArrayView/ArrowArray where the depth-first buffer/field walk should start. + struct ArrowIpcField* fields; + // The number of buffers that future RecordBatch messages must have to match the schema + // that has been set. + int64_t n_buffers; + // The number of union fields in the Schema. + int64_t n_union_fields; + // A pointer to the last flatbuffers message. + const void* last_message; + // Storage for a Footer + struct ArrowIpcFooter footer; +}; + +ArrowErrorCode ArrowIpcCheckRuntime(struct ArrowError* error) { + // Avoids an unused warning when bundling the header into nanoarrow_ipc.c + NANOARROW_UNUSED(flatbuffers_end); + + const char* nanoarrow_runtime_version = ArrowNanoarrowVersion(); + const char* nanoarrow_ipc_build_time_version = NANOARROW_VERSION; + + if (strcmp(nanoarrow_runtime_version, nanoarrow_ipc_build_time_version) != 0) { + ArrowErrorSet(error, "Expected nanoarrow runtime version '%s' but found version '%s'", + nanoarrow_ipc_build_time_version, nanoarrow_runtime_version); + return EINVAL; + } + + return NANOARROW_OK; +} + +#if NANOARROW_IPC_USE_STDATOMIC +struct ArrowIpcSharedBufferPrivate { + struct ArrowBuffer src; + atomic_long reference_count; +}; + +static int64_t ArrowIpcSharedBufferUpdate( + struct ArrowIpcSharedBufferPrivate* private_data, int delta) { + int64_t old_count = atomic_fetch_add(&private_data->reference_count, delta); + return old_count + delta; +} + +static void ArrowIpcSharedBufferSet(struct ArrowIpcSharedBufferPrivate* private_data, + int64_t count) { + atomic_store(&private_data->reference_count, count); +} + +int ArrowIpcSharedBufferIsThreadSafe(void) { return 1; } +#else +struct ArrowIpcSharedBufferPrivate { + struct ArrowBuffer src; + int64_t reference_count; +}; + +static int64_t ArrowIpcSharedBufferUpdate( + struct ArrowIpcSharedBufferPrivate* private_data, int delta) { + private_data->reference_count += delta; + return private_data->reference_count; +} + +static void ArrowIpcSharedBufferSet(struct ArrowIpcSharedBufferPrivate* private_data, + int64_t count) { + private_data->reference_count = count; +} + +int ArrowIpcSharedBufferIsThreadSafe(void) { return 0; } +#endif + +static void ArrowIpcSharedBufferFree(struct ArrowBufferAllocator* allocator, uint8_t* ptr, + int64_t size) { + NANOARROW_UNUSED(allocator); + NANOARROW_UNUSED(ptr); + NANOARROW_UNUSED(size); + + struct ArrowIpcSharedBufferPrivate* private_data = + (struct ArrowIpcSharedBufferPrivate*)allocator->private_data; + + if (ArrowIpcSharedBufferUpdate(private_data, -1) == 0) { + ArrowBufferReset(&private_data->src); + ArrowFree(private_data); + } +} + +ArrowErrorCode ArrowIpcSharedBufferInit(struct ArrowIpcSharedBuffer* shared, + struct ArrowBuffer* src) { + if (src->data == NULL) { + ArrowBufferMove(src, &shared->private_src); + return NANOARROW_OK; + } + + struct ArrowIpcSharedBufferPrivate* private_data = + (struct ArrowIpcSharedBufferPrivate*)ArrowMalloc( + sizeof(struct ArrowIpcSharedBufferPrivate)); + if (private_data == NULL) { + return ENOMEM; + } + + ArrowBufferMove(src, &private_data->src); + ArrowIpcSharedBufferSet(private_data, 1); + + ArrowBufferInit(&shared->private_src); + shared->private_src.data = private_data->src.data; + shared->private_src.size_bytes = private_data->src.size_bytes; + // Don't expose any extra capcity from src so that any calls to ArrowBufferAppend + // on this buffer will fail. + shared->private_src.capacity_bytes = private_data->src.size_bytes; + shared->private_src.allocator = + ArrowBufferDeallocator(&ArrowIpcSharedBufferFree, private_data); + return NANOARROW_OK; +} + +static void ArrowIpcSharedBufferClone(struct ArrowIpcSharedBuffer* shared, + struct ArrowBuffer* shared_out) { + if (shared->private_src.data == NULL) { + ArrowBufferInit(shared_out); + shared_out->size_bytes = shared_out->size_bytes; + shared_out->capacity_bytes = shared_out->capacity_bytes; + return; + } + + struct ArrowIpcSharedBufferPrivate* private_data = + (struct ArrowIpcSharedBufferPrivate*)shared->private_src.allocator.private_data; + ArrowIpcSharedBufferUpdate(private_data, 1); + memcpy(shared_out, shared, sizeof(struct ArrowBuffer)); +} + +void ArrowIpcSharedBufferReset(struct ArrowIpcSharedBuffer* shared) { + ArrowBufferReset(&shared->private_src); +} + +static int ArrowIpcDecoderNeedsSwapEndian(struct ArrowIpcDecoder* decoder) { + struct ArrowIpcDecoderPrivate* private_data = + (struct ArrowIpcDecoderPrivate*)decoder->private_data; + switch (private_data->endianness) { + case NANOARROW_IPC_ENDIANNESS_LITTLE: + case NANOARROW_IPC_ENDIANNESS_BIG: + return private_data->endianness != NANOARROW_IPC_ENDIANNESS_UNINITIALIZED && + private_data->endianness != private_data->system_endianness; + default: + return 0; + } +} + +ArrowErrorCode ArrowIpcDecoderInit(struct ArrowIpcDecoder* decoder) { + memset(decoder, 0, sizeof(struct ArrowIpcDecoder)); + struct ArrowIpcDecoderPrivate* private_data = + (struct ArrowIpcDecoderPrivate*)ArrowMalloc(sizeof(struct ArrowIpcDecoderPrivate)); + if (private_data == NULL) { + return ENOMEM; + } + + memset(private_data, 0, sizeof(struct ArrowIpcDecoderPrivate)); + private_data->system_endianness = ArrowIpcSystemEndianness(); + ArrowIpcFooterInit(&private_data->footer); + decoder->private_data = private_data; + return NANOARROW_OK; +} + +void ArrowIpcDecoderReset(struct ArrowIpcDecoder* decoder) { + struct ArrowIpcDecoderPrivate* private_data = + (struct ArrowIpcDecoderPrivate*)decoder->private_data; + + if (private_data != NULL) { + ArrowArrayViewReset(&private_data->array_view); + + if (private_data->array.release != NULL) { + ArrowArrayRelease(&private_data->array); + } + + if (private_data->fields != NULL) { + ArrowFree(private_data->fields); + private_data->n_fields = 0; + } + + private_data->n_union_fields = 0; + + ArrowIpcFooterReset(&private_data->footer); + + ArrowFree(private_data); + memset(decoder, 0, sizeof(struct ArrowIpcDecoder)); + } +} + +static inline int32_t ArrowIpcReadInt32LE(struct ArrowBufferView* data, int swap_endian) { + int32_t value; + memcpy(&value, data->data.as_uint8, sizeof(int32_t)); + if (swap_endian) { + value = bswap32(value); + } + + data->data.as_uint8 += sizeof(int32_t); + data->size_bytes -= sizeof(int32_t); + return value; +} + +#define ns(x) FLATBUFFERS_WRAP_NAMESPACE(org_apache_arrow_flatbuf, x) + +static int ArrowIpcDecoderSetMetadata(struct ArrowSchema* schema, + ns(KeyValue_vec_t) kv_vec, + struct ArrowError* error) { + int64_t n_pairs = ns(KeyValue_vec_len(kv_vec)); + if (n_pairs == 0) { + return NANOARROW_OK; + } + + if (n_pairs > 2147483647) { + ArrowErrorSet(error, + "Expected between 0 and 2147483647 key/value pairs but found %" PRId64, + n_pairs); + return EINVAL; + } + + struct ArrowBuffer buf; + struct ArrowStringView key; + struct ArrowStringView value; + ns(KeyValue_table_t) kv; + + int result = ArrowMetadataBuilderInit(&buf, NULL); + if (result != NANOARROW_OK) { + ArrowBufferReset(&buf); + ArrowErrorSet(error, "ArrowMetadataBuilderInit() failed"); + return result; + } + + for (int64_t i = 0; i < n_pairs; i++) { + kv = ns(KeyValue_vec_at(kv_vec, i)); + + key.data = ns(KeyValue_key(kv)); + key.size_bytes = strlen(key.data); + value.data = ns(KeyValue_value(kv)); + value.size_bytes = strlen(value.data); + + result = ArrowMetadataBuilderAppend(&buf, key, value); + if (result != NANOARROW_OK) { + ArrowBufferReset(&buf); + ArrowErrorSet(error, "ArrowMetadataBuilderAppend() failed"); + return result; + } + } + + result = ArrowSchemaSetMetadata(schema, (const char*)buf.data); + ArrowBufferReset(&buf); + if (result != NANOARROW_OK) { + ArrowErrorSet(error, "ArrowSchemaSetMetadata() failed"); + return result; + } + + return NANOARROW_OK; +} + +static int ArrowIpcDecoderSetTypeSimple(struct ArrowSchema* schema, int nanoarrow_type, + struct ArrowError* error) { + int result = ArrowSchemaSetType(schema, nanoarrow_type); + if (result != NANOARROW_OK) { + ArrowErrorSet(error, "ArrowSchemaSetType() failed for type %s", + ArrowTypeString(nanoarrow_type)); + return result; + } + + return NANOARROW_OK; +} + +static int ArrowIpcDecoderSetTypeInt(struct ArrowSchema* schema, + flatbuffers_generic_t type_generic, + struct ArrowError* error) { + ns(Int_table_t) type = (ns(Int_table_t))type_generic; + + int is_signed = ns(Int_is_signed_get(type)); + int bitwidth = ns(Int_bitWidth_get(type)); + int nanoarrow_type = NANOARROW_TYPE_UNINITIALIZED; + + if (is_signed) { + switch (bitwidth) { + case 8: + nanoarrow_type = NANOARROW_TYPE_INT8; + break; + case 16: + nanoarrow_type = NANOARROW_TYPE_INT16; + break; + case 32: + nanoarrow_type = NANOARROW_TYPE_INT32; + break; + case 64: + nanoarrow_type = NANOARROW_TYPE_INT64; + break; + default: + ArrowErrorSet(error, + "Expected signed int bitwidth of 8, 16, 32, or 64 but got %d", + bitwidth); + return EINVAL; + } + } else { + switch (bitwidth) { + case 8: + nanoarrow_type = NANOARROW_TYPE_UINT8; + break; + case 16: + nanoarrow_type = NANOARROW_TYPE_UINT16; + break; + case 32: + nanoarrow_type = NANOARROW_TYPE_UINT32; + break; + case 64: + nanoarrow_type = NANOARROW_TYPE_UINT64; + break; + default: + ArrowErrorSet(error, + "Expected unsigned int bitwidth of 8, 16, 32, or 64 but got %d", + bitwidth); + return EINVAL; + } + } + + return ArrowIpcDecoderSetTypeSimple(schema, nanoarrow_type, error); +} + +static int ArrowIpcDecoderSetTypeFloatingPoint(struct ArrowSchema* schema, + flatbuffers_generic_t type_generic, + struct ArrowError* error) { + ns(FloatingPoint_table_t) type = (ns(FloatingPoint_table_t))type_generic; + int precision = ns(FloatingPoint_precision(type)); + switch (precision) { + case ns(Precision_HALF): + return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_HALF_FLOAT, error); + case ns(Precision_SINGLE): + return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_FLOAT, error); + case ns(Precision_DOUBLE): + return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_DOUBLE, error); + default: + ArrowErrorSet(error, "Unexpected FloatingPoint Precision value: %d", precision); + return EINVAL; + } +} + +static int ArrowIpcDecoderSetTypeDecimal(struct ArrowSchema* schema, + flatbuffers_generic_t type_generic, + struct ArrowError* error) { + ns(Decimal_table_t) type = (ns(Decimal_table_t))type_generic; + int scale = ns(Decimal_scale(type)); + int precision = ns(Decimal_precision(type)); + int bitwidth = ns(Decimal_bitWidth(type)); + + int result; + switch (bitwidth) { + case 128: + result = + ArrowSchemaSetTypeDecimal(schema, NANOARROW_TYPE_DECIMAL128, precision, scale); + break; + case 256: + result = + ArrowSchemaSetTypeDecimal(schema, NANOARROW_TYPE_DECIMAL256, precision, scale); + break; + default: + ArrowErrorSet(error, "Unexpected Decimal bitwidth value: %d", bitwidth); + return EINVAL; + } + + if (result != NANOARROW_OK) { + ArrowErrorSet(error, "ArrowSchemaSetTypeDecimal() failed"); + return result; + } + + return NANOARROW_OK; +} + +static int ArrowIpcDecoderSetTypeFixedSizeBinary(struct ArrowSchema* schema, + flatbuffers_generic_t type_generic, + struct ArrowError* error) { + ns(FixedSizeBinary_table_t) type = (ns(FixedSizeBinary_table_t))type_generic; + int fixed_size = ns(FixedSizeBinary_byteWidth(type)); + NANOARROW_RETURN_NOT_OK_WITH_ERROR( + ArrowSchemaSetTypeFixedSize(schema, NANOARROW_TYPE_FIXED_SIZE_BINARY, fixed_size), + error); + return NANOARROW_OK; +} + +static int ArrowIpcDecoderSetTypeDate(struct ArrowSchema* schema, + flatbuffers_generic_t type_generic, + struct ArrowError* error) { + ns(Date_table_t) type = (ns(Date_table_t))type_generic; + int date_unit = ns(Date_unit(type)); + switch (date_unit) { + case ns(DateUnit_DAY): + return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_DATE32, error); + case ns(DateUnit_MILLISECOND): + return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_DATE64, error); + default: + ArrowErrorSet(error, "Unexpected Date DateUnit value: %d", (int)date_unit); + return EINVAL; + } +} + +static int ArrowIpcDecoderSetTypeTime(struct ArrowSchema* schema, + flatbuffers_generic_t type_generic, + struct ArrowError* error) { + ns(Time_table_t) type = (ns(Time_table_t))type_generic; + int time_unit = ns(Time_unit(type)); + int bitwidth = ns(Time_bitWidth(type)); + int nanoarrow_type; + + switch (time_unit) { + case ns(TimeUnit_SECOND): + case ns(TimeUnit_MILLISECOND): + if (bitwidth != 32) { + ArrowErrorSet(error, "Expected bitwidth of 32 for Time TimeUnit %s but found %d", + ns(TimeUnit_name(ns(Time_unit(type)))), bitwidth); + return EINVAL; + } + + nanoarrow_type = NANOARROW_TYPE_TIME32; + break; + + case ns(TimeUnit_MICROSECOND): + case ns(TimeUnit_NANOSECOND): + if (bitwidth != 64) { + ArrowErrorSet(error, "Expected bitwidth of 64 for Time TimeUnit %s but found %d", + ns(TimeUnit_name(ns(Time_unit(type)))), bitwidth); + return EINVAL; + } + + nanoarrow_type = NANOARROW_TYPE_TIME64; + break; + + default: + ArrowErrorSet(error, "Unexpected Time TimeUnit value: %d", time_unit); + return EINVAL; + } + + int result = ArrowSchemaSetTypeDateTime(schema, nanoarrow_type, time_unit, NULL); + if (result != NANOARROW_OK) { + ArrowErrorSet(error, "ArrowSchemaSetTypeDateTime() failed"); + return result; + } + + return NANOARROW_OK; +} + +static int ArrowIpcDecoderSetTypeTimestamp(struct ArrowSchema* schema, + flatbuffers_generic_t type_generic, + struct ArrowError* error) { + ns(Timestamp_table_t) type = (ns(Timestamp_table_t))type_generic; + int time_unit = ns(Timestamp_unit(type)); + + const char* timezone = ""; + if (ns(Timestamp_timezone_is_present(type))) { + timezone = ns(Timestamp_timezone_get(type)); + } + + int result = + ArrowSchemaSetTypeDateTime(schema, NANOARROW_TYPE_TIMESTAMP, time_unit, timezone); + if (result != NANOARROW_OK) { + ArrowErrorSet(error, "ArrowSchemaSetTypeDateTime() failed"); + return result; + } + + return NANOARROW_OK; +} + +static int ArrowIpcDecoderSetTypeDuration(struct ArrowSchema* schema, + flatbuffers_generic_t type_generic, + struct ArrowError* error) { + ns(Duration_table_t) type = (ns(Duration_table_t))type_generic; + int time_unit = ns(Duration_unit(type)); + + int result = + ArrowSchemaSetTypeDateTime(schema, NANOARROW_TYPE_DURATION, time_unit, NULL); + if (result != NANOARROW_OK) { + ArrowErrorSet(error, "ArrowSchemaSetTypeDateTime() failed"); + return result; + } + + return NANOARROW_OK; +} + +static int ArrowIpcDecoderSetTypeInterval(struct ArrowSchema* schema, + flatbuffers_generic_t type_generic, + struct ArrowError* error) { + ns(Interval_table_t) type = (ns(Interval_table_t))type_generic; + int interval_unit = ns(Interval_unit(type)); + + switch (interval_unit) { + case ns(IntervalUnit_YEAR_MONTH): + return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_INTERVAL_MONTHS, error); + case ns(IntervalUnit_DAY_TIME): + return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_INTERVAL_DAY_TIME, + error); + case ns(IntervalUnit_MONTH_DAY_NANO): + return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO, + error); + default: + ArrowErrorSet(error, "Unexpected Interval unit value: %d", interval_unit); + return EINVAL; + } +} + +// We can't quite use nanoarrow's built-in SchemaSet functions for nested types +// because the IPC format allows modifying some of the defaults those functions assume. +// In particular, the allocate + initialize children step is handled outside these +// setters. +static int ArrowIpcDecoderSetTypeSimpleNested(struct ArrowSchema* schema, + const char* format, + struct ArrowError* error) { + int result = ArrowSchemaSetFormat(schema, format); + if (result != NANOARROW_OK) { + ArrowErrorSet(error, "ArrowSchemaSetFormat('%s') failed", format); + return result; + } + + return NANOARROW_OK; +} + +static int ArrowIpcDecoderSetTypeFixedSizeList(struct ArrowSchema* schema, + flatbuffers_generic_t type_generic, + struct ArrowError* error) { + ns(FixedSizeList_table_t) type = (ns(FixedSizeList_table_t))type_generic; + int32_t fixed_size = ns(FixedSizeList_listSize(type)); + + char fixed_size_str[128]; + int n_chars = snprintf(fixed_size_str, 128, "+w:%d", fixed_size); + if (n_chars < 0) { + ArrowErrorSet(error, "snprintf() encoding error"); + return ERANGE; + } + + fixed_size_str[n_chars] = '\0'; + return ArrowIpcDecoderSetTypeSimpleNested(schema, fixed_size_str, error); +} + +static int ArrowIpcDecoderSetTypeMap(struct ArrowSchema* schema, + flatbuffers_generic_t type_generic, + struct ArrowError* error) { + ns(Map_table_t) type = (ns(Map_table_t))type_generic; + NANOARROW_RETURN_NOT_OK(ArrowIpcDecoderSetTypeSimpleNested(schema, "+m", error)); + + if (ns(Map_keysSorted(type))) { + schema->flags |= ARROW_FLAG_MAP_KEYS_SORTED; + } else { + schema->flags &= ~ARROW_FLAG_MAP_KEYS_SORTED; + } + + return NANOARROW_OK; +} + +static int ArrowIpcDecoderSetTypeUnion(struct ArrowSchema* schema, + flatbuffers_generic_t type_generic, + int64_t n_children, struct ArrowError* error) { + ns(Union_table_t) type = (ns(Union_table_t))type_generic; + int union_mode = ns(Union_mode(type)); + + if (n_children < 0 || n_children > 127) { + ArrowErrorSet(error, + "Expected between 0 and 127 children for Union type but found %" PRId64, + n_children); + return EINVAL; + } + + // Max valid typeIds size is 127; the longest single ID that could be present here + // is -INT_MIN (11 chars). With commas and the prefix the max size would be + // 1527 characters. (Any ids outside the range 0...127 are unlikely to be valid + // elsewhere but they could in theory be present here). + char union_types_str[2048]; + memset(union_types_str, 0, sizeof(union_types_str)); + char* format_cursor = union_types_str; + int format_out_size = sizeof(union_types_str); + int n_chars = 0; + + switch (union_mode) { + case ns(UnionMode_Sparse): + n_chars = snprintf(format_cursor, format_out_size, "+us:"); + format_cursor += n_chars; + format_out_size -= n_chars; + break; + case ns(UnionMode_Dense): + n_chars = snprintf(format_cursor, format_out_size, "+ud:"); + format_cursor += n_chars; + format_out_size -= n_chars; + break; + default: + ArrowErrorSet(error, "Unexpected Union UnionMode value: %d", union_mode); + return EINVAL; + } + + if (n_chars < 0) { + ArrowErrorSet(error, "snprintf() encoding error"); + return ERANGE; + } + + if (ns(Union_typeIds_is_present(type))) { + flatbuffers_int32_vec_t type_ids = ns(Union_typeIds(type)); + int64_t n_type_ids = flatbuffers_int32_vec_len(type_ids); + + if (n_type_ids != n_children) { + ArrowErrorSet(error, + "Expected between %" PRId64 " children for Union type with %" PRId64 + " typeIds but found %" PRId64, + n_type_ids, n_type_ids, n_children); + return EINVAL; + } + + if (n_type_ids > 0) { + n_chars = snprintf(format_cursor, format_out_size, "%d", + flatbuffers_int32_vec_at(type_ids, 0)); + format_cursor += n_chars; + format_out_size -= n_chars; + + if (n_chars < 0) { + ArrowErrorSet(error, "snprintf() encoding error"); + return ERANGE; + } + + for (int64_t i = 1; i < n_type_ids; i++) { + n_chars = snprintf(format_cursor, format_out_size, ",%" PRId32, + flatbuffers_int32_vec_at(type_ids, i)); + format_cursor += n_chars; + format_out_size -= n_chars; + + if (n_chars < 0) { + ArrowErrorSet(error, "snprintf() encoding error"); + return ERANGE; + } + } + } + } else if (n_children > 0) { + n_chars = snprintf(format_cursor, format_out_size, "0"); + format_cursor += n_chars; + format_out_size -= n_chars; + + if (n_chars < 0) { + ArrowErrorSet(error, "snprintf() encoding error"); + return ERANGE; + } + + for (int64_t i = 1; i < n_children; i++) { + n_chars = snprintf(format_cursor, format_out_size, ",%" PRId64, i); + format_cursor += n_chars; + format_out_size -= n_chars; + + if (n_chars < 0) { + ArrowErrorSet(error, "snprintf() encoding error"); + return ERANGE; + } + } + } + + return ArrowIpcDecoderSetTypeSimpleNested(schema, union_types_str, error); +} + +static int ArrowIpcDecoderSetType(struct ArrowSchema* schema, ns(Field_table_t) field, + int64_t n_children, struct ArrowError* error) { + int type_type = ns(Field_type_type(field)); + switch (type_type) { + case ns(Type_Null): + return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_NA, error); + case ns(Type_Bool): + return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_BOOL, error); + case ns(Type_Int): + return ArrowIpcDecoderSetTypeInt(schema, ns(Field_type_get(field)), error); + case ns(Type_FloatingPoint): + return ArrowIpcDecoderSetTypeFloatingPoint(schema, ns(Field_type_get(field)), + error); + case ns(Type_Decimal): + return ArrowIpcDecoderSetTypeDecimal(schema, ns(Field_type_get(field)), error); + case ns(Type_Binary): + return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_BINARY, error); + case ns(Type_LargeBinary): + return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_LARGE_BINARY, error); + case ns(Type_FixedSizeBinary): + return ArrowIpcDecoderSetTypeFixedSizeBinary(schema, ns(Field_type_get(field)), + error); + case ns(Type_Utf8): + return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_STRING, error); + case ns(Type_LargeUtf8): + return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_LARGE_STRING, error); + case ns(Type_Date): + return ArrowIpcDecoderSetTypeDate(schema, ns(Field_type_get(field)), error); + case ns(Type_Time): + return ArrowIpcDecoderSetTypeTime(schema, ns(Field_type_get(field)), error); + case ns(Type_Timestamp): + return ArrowIpcDecoderSetTypeTimestamp(schema, ns(Field_type_get(field)), error); + case ns(Type_Duration): + return ArrowIpcDecoderSetTypeDuration(schema, ns(Field_type_get(field)), error); + case ns(Type_Interval): + return ArrowIpcDecoderSetTypeInterval(schema, ns(Field_type_get(field)), error); + case ns(Type_Struct_): + return ArrowIpcDecoderSetTypeSimpleNested(schema, "+s", error); + case ns(Type_List): + return ArrowIpcDecoderSetTypeSimpleNested(schema, "+l", error); + case ns(Type_LargeList): + return ArrowIpcDecoderSetTypeSimpleNested(schema, "+L", error); + case ns(Type_FixedSizeList): + return ArrowIpcDecoderSetTypeFixedSizeList(schema, ns(Field_type_get(field)), + error); + case ns(Type_Map): + return ArrowIpcDecoderSetTypeMap(schema, ns(Field_type_get(field)), error); + case ns(Type_Union): + return ArrowIpcDecoderSetTypeUnion(schema, ns(Field_type_get(field)), n_children, + error); + default: + ArrowErrorSet(error, "Unrecognized Field type with value %d", type_type); + return EINVAL; + } +} + +static int ArrowIpcDecoderSetChildren(struct ArrowSchema* schema, ns(Field_vec_t) fields, + struct ArrowError* error); + +static int ArrowIpcDecoderSetField(struct ArrowSchema* schema, ns(Field_table_t) field, + struct ArrowError* error) { + // No dictionary support yet + if (ns(Field_dictionary_is_present(field))) { + ArrowErrorSet(error, "Schema message field with DictionaryEncoding not supported"); + return ENOTSUP; + } + + int result; + if (ns(Field_name_is_present(field))) { + result = ArrowSchemaSetName(schema, ns(Field_name_get(field))); + } else { + result = ArrowSchemaSetName(schema, ""); + } + + if (result != NANOARROW_OK) { + ArrowErrorSet(error, "ArrowSchemaSetName() failed"); + return result; + } + + // Sets the schema->format and validates type-related inconsistencies + // that might exist in the flatbuffer + ns(Field_vec_t) children = ns(Field_children(field)); + int64_t n_children = ns(Field_vec_len(children)); + + NANOARROW_RETURN_NOT_OK(ArrowIpcDecoderSetType(schema, field, n_children, error)); + + // nanoarrow's type setters set the nullable flag by default, so we might + // have to unset it here. + if (ns(Field_nullable_get(field))) { + schema->flags |= ARROW_FLAG_NULLABLE; + } else { + schema->flags &= ~ARROW_FLAG_NULLABLE; + } + + // Children are defined separately in the flatbuffer, so we allocate, initialize + // and set them separately as well. + result = ArrowSchemaAllocateChildren(schema, n_children); + if (result != NANOARROW_OK) { + ArrowErrorSet(error, "ArrowSchemaAllocateChildren() failed"); + return result; + } + + for (int64_t i = 0; i < n_children; i++) { + ArrowSchemaInit(schema->children[i]); + } + + NANOARROW_RETURN_NOT_OK(ArrowIpcDecoderSetChildren(schema, children, error)); + return ArrowIpcDecoderSetMetadata(schema, ns(Field_custom_metadata(field)), error); +} + +static int ArrowIpcDecoderSetChildren(struct ArrowSchema* schema, ns(Field_vec_t) fields, + struct ArrowError* error) { + int64_t n_fields = ns(Schema_vec_len(fields)); + + for (int64_t i = 0; i < n_fields; i++) { + ns(Field_table_t) field = ns(Field_vec_at(fields, i)); + NANOARROW_RETURN_NOT_OK(ArrowIpcDecoderSetField(schema->children[i], field, error)); + } + + return NANOARROW_OK; +} + +static int ArrowIpcDecoderDecodeSchemaHeader(struct ArrowIpcDecoder* decoder, + flatbuffers_generic_t message_header, + struct ArrowError* error) { + ns(Schema_table_t) schema = (ns(Schema_table_t))message_header; + int endianness = ns(Schema_endianness(schema)); + switch (endianness) { + case ns(Endianness_Little): + decoder->endianness = NANOARROW_IPC_ENDIANNESS_LITTLE; + break; + case ns(Endianness_Big): + decoder->endianness = NANOARROW_IPC_ENDIANNESS_BIG; + break; + default: + ArrowErrorSet(error, + "Expected Schema endianness of 0 (little) or 1 (big) but got %d", + endianness); + return EINVAL; + } + + ns(Feature_vec_t) features = ns(Schema_features(schema)); + int64_t n_features = ns(Feature_vec_len(features)); + decoder->feature_flags = 0; + + for (int64_t i = 0; i < n_features; i++) { + ns(Feature_enum_t) feature = ns(Feature_vec_at(features, i)); + switch (feature) { + case ns(Feature_COMPRESSED_BODY): + decoder->feature_flags |= NANOARROW_IPC_FEATURE_COMPRESSED_BODY; + break; + case ns(Feature_DICTIONARY_REPLACEMENT): + decoder->feature_flags |= NANOARROW_IPC_FEATURE_DICTIONARY_REPLACEMENT; + break; + default: + ArrowErrorSet(error, "Unrecognized Schema feature with value %d", (int)feature); + return EINVAL; + } + } + + return NANOARROW_OK; +} + +static int ArrowIpcDecoderDecodeRecordBatchHeader(struct ArrowIpcDecoder* decoder, + flatbuffers_generic_t message_header, + struct ArrowError* error) { + struct ArrowIpcDecoderPrivate* private_data = + (struct ArrowIpcDecoderPrivate*)decoder->private_data; + + ns(RecordBatch_table_t) batch = (ns(RecordBatch_table_t))message_header; + + ns(FieldNode_vec_t) fields = ns(RecordBatch_nodes(batch)); + ns(Buffer_vec_t) buffers = ns(RecordBatch_buffers(batch)); + int64_t n_fields = ns(FieldNode_vec_len(fields)); + int64_t n_buffers = ns(Buffer_vec_len(buffers)); + + // Check field node and buffer count. We have one more field and buffer + // because we count the root struct and the flatbuffer message does not. + if ((n_fields + 1) != private_data->n_fields) { + ArrowErrorSet(error, "Expected %" PRId64 " field nodes in message but found %" PRId64, + private_data->n_fields - 1, n_fields); + return EINVAL; + } + + int64_t n_expected_buffers = private_data->n_buffers; + if (decoder->metadata_version < NANOARROW_IPC_METADATA_VERSION_V5) { + // Unions had null buffers before arrow 1.0, so expect one extra buffer per union + // field + n_expected_buffers += private_data->n_union_fields; + } + + if ((n_buffers + 1) != n_expected_buffers) { + ArrowErrorSet(error, "Expected %" PRId64 " buffers in message but found %" PRId64, + n_expected_buffers - 1, n_buffers); + return EINVAL; + } + + if (ns(RecordBatch_compression_is_present(batch))) { + ns(BodyCompression_table_t) compression = ns(RecordBatch_compression(batch)); + ns(CompressionType_enum_t) codec = ns(BodyCompression_codec(compression)); + switch (codec) { + case ns(CompressionType_LZ4_FRAME): + decoder->codec = NANOARROW_IPC_COMPRESSION_TYPE_LZ4_FRAME; + break; + case ns(CompressionType_ZSTD): + decoder->codec = NANOARROW_IPC_COMPRESSION_TYPE_ZSTD; + break; + default: + ArrowErrorSet(error, "Unrecognized RecordBatch BodyCompression codec value: %d", + (int)codec); + return EINVAL; + } + } else { + decoder->codec = NANOARROW_IPC_COMPRESSION_TYPE_NONE; + } + + // Copying field node and buffer information is separate so as only to pay for the + // nodes that are actually accessed. + return NANOARROW_OK; +} + +// Wipes any "current message" fields before moving on to a new message +static inline void ArrowIpcDecoderResetHeaderInfo(struct ArrowIpcDecoder* decoder) { + struct ArrowIpcDecoderPrivate* private_data = + (struct ArrowIpcDecoderPrivate*)decoder->private_data; + + decoder->message_type = 0; + decoder->metadata_version = 0; + decoder->endianness = 0; + decoder->feature_flags = 0; + decoder->codec = 0; + decoder->header_size_bytes = 0; + decoder->body_size_bytes = 0; + decoder->footer = NULL; + ArrowIpcFooterReset(&private_data->footer); + private_data->last_message = NULL; +} + +// Returns NANOARROW_OK if data is large enough to read the first 8 bytes +// of the message header, ESPIPE if reading more data might help, or EINVAL if the content +// is not valid. Advances the input ArrowBufferView by prefix_size (8 bytes or 4 bytes if +// the message is pre-0.15 and has no continuation). Sets decoder->header_size_bytes +// to the flatbuffers length plus the prefix_size. +static inline int ArrowIpcDecoderReadHeaderPrefix(struct ArrowIpcDecoder* decoder, + struct ArrowBufferView* data_mut, + int32_t* prefix_size_bytes, + struct ArrowError* error) { + struct ArrowIpcDecoderPrivate* private_data = + (struct ArrowIpcDecoderPrivate*)decoder->private_data; + + if (data_mut->size_bytes < 8) { + ArrowErrorSet(error, + "Expected data of at least 8 bytes but only %" PRId64 " bytes remain", + data_mut->size_bytes); + return ESPIPE; + } + + int swap_endian = private_data->system_endianness == NANOARROW_IPC_ENDIANNESS_BIG; + int32_t continuation = ArrowIpcReadInt32LE(data_mut, swap_endian); + int32_t length; + if ((uint32_t)continuation != 0xFFFFFFFF) { + if (continuation < 0) { + ArrowErrorSet(error, "Expected 0xFFFFFFFF at start of message but found 0x%08X", + (unsigned int)continuation); + return EINVAL; + } + // Tolerate pre-0.15 encapsulated messages which only had the length prefix + length = continuation; + *prefix_size_bytes = sizeof(length); + } else { + length = ArrowIpcReadInt32LE(data_mut, swap_endian); + *prefix_size_bytes = sizeof(continuation) + sizeof(length); + } + decoder->header_size_bytes = *prefix_size_bytes + length; + + if (length < 0) { + ArrowErrorSet(error, + "Expected message size > 0 but found message size of %" PRId32 " bytes", + length); + return EINVAL; + } + + if (length == 0) { + ArrowErrorSet(error, "End of Arrow stream"); + return ENODATA; + } + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowIpcDecoderPeekHeader(struct ArrowIpcDecoder* decoder, + struct ArrowBufferView data, + int32_t* prefix_size_bytes, + struct ArrowError* error) { + ArrowIpcDecoderResetHeaderInfo(decoder); + NANOARROW_RETURN_NOT_OK( + ArrowIpcDecoderReadHeaderPrefix(decoder, &data, prefix_size_bytes, error)); + return NANOARROW_OK; +} + +ArrowErrorCode ArrowIpcDecoderVerifyHeader(struct ArrowIpcDecoder* decoder, + struct ArrowBufferView data, + struct ArrowError* error) { + struct ArrowIpcDecoderPrivate* private_data = + (struct ArrowIpcDecoderPrivate*)decoder->private_data; + + ArrowIpcDecoderResetHeaderInfo(decoder); + int32_t prefix_size_bytes; + NANOARROW_RETURN_NOT_OK( + ArrowIpcDecoderReadHeaderPrefix(decoder, &data, &prefix_size_bytes, error)); + + // Check that data contains at least the entire header (return ESPIPE to signal + // that reading more data may help). + if (data.size_bytes < decoder->header_size_bytes - prefix_size_bytes) { + ArrowErrorSet(error, + "Expected >= %d bytes of remaining data but found %" PRId64 + " bytes in buffer", + decoder->header_size_bytes, data.size_bytes + prefix_size_bytes); + return ESPIPE; + } + + // Run flatbuffers verification + enum flatcc_verify_error_no verify_error = + ns(Message_verify_as_root(data.data.as_uint8, + decoder->header_size_bytes - prefix_size_bytes); + if (verify_error != flatcc_verify_ok)) { + ArrowErrorSet(error, "Message flatbuffer verification failed (%d) %s", + (int)verify_error, flatcc_verify_error_string(verify_error)); + return EINVAL; + } + + // Read some basic information from the message + ns(Message_table_t) message = ns(Message_as_root(data.data.as_uint8)); + decoder->metadata_version = ns(Message_version(message)); + decoder->message_type = ns(Message_header_type(message)); + decoder->body_size_bytes = ns(Message_bodyLength(message)); + + private_data->last_message = ns(Message_header_get(message)); + return NANOARROW_OK; +} + +ArrowErrorCode ArrowIpcDecoderPeekFooter(struct ArrowIpcDecoder* decoder, + struct ArrowBufferView data, + struct ArrowError* error) { + struct ArrowIpcDecoderPrivate* private_data = + (struct ArrowIpcDecoderPrivate*)decoder->private_data; + + ArrowIpcDecoderResetHeaderInfo(decoder); + if (data.size_bytes < (int)strlen(NANOARROW_IPC_MAGIC) + (int)sizeof(int32_t)) { + ArrowErrorSet(error, + "Expected data of at least 10 bytes but only %" PRId64 + " bytes are available", + data.size_bytes); + return ESPIPE; + } + + const char* data_end = data.data.as_char + data.size_bytes; + const char* magic = data_end - strlen(NANOARROW_IPC_MAGIC); + const char* footer_size_data = magic - sizeof(int32_t); + + if (memcmp(magic, NANOARROW_IPC_MAGIC, strlen(NANOARROW_IPC_MAGIC)) != 0) { + ArrowErrorSet(error, "Expected file to end with ARROW1 but got %s", data_end); + return EINVAL; + } + + int32_t footer_size; + memcpy(&footer_size, footer_size_data, sizeof(footer_size)); + if (private_data->system_endianness == NANOARROW_IPC_ENDIANNESS_BIG) { + footer_size = bswap32(footer_size); + } + + if (footer_size < 0) { + ArrowErrorSet(error, "Expected footer size > 0 but found footer size of %d bytes", + footer_size); + return EINVAL; + } + + decoder->header_size_bytes = footer_size; + return NANOARROW_OK; +} + +ArrowErrorCode ArrowIpcDecoderVerifyFooter(struct ArrowIpcDecoder* decoder, + struct ArrowBufferView data, + struct ArrowError* error) { + NANOARROW_RETURN_NOT_OK(ArrowIpcDecoderPeekFooter(decoder, data, error)); + + // Check that data contains at least the entire footer (return ESPIPE to signal + // that reading more data may help). + int32_t footer_and_size_and_magic_size = + decoder->header_size_bytes + sizeof(int32_t) + strlen(NANOARROW_IPC_MAGIC); + if (data.size_bytes < footer_and_size_and_magic_size) { + ArrowErrorSet(error, + "Expected >= %d bytes of data but only %" PRId64 + " bytes are in the buffer", + footer_and_size_and_magic_size, data.size_bytes); + return ESPIPE; + } + + const uint8_t* footer_data = + data.data.as_uint8 + data.size_bytes - footer_and_size_and_magic_size; + + // Run flatbuffers verification + enum flatcc_verify_error_no verify_error = + ns(Footer_verify_as_root(footer_data, decoder->header_size_bytes)); + if (verify_error != flatcc_verify_ok) { + ArrowErrorSet(error, "Footer flatbuffer verification failed (%d) %s", + (int)verify_error, flatcc_verify_error_string(verify_error)); + return EINVAL; + } + + // Read some basic information from the message + ns(Footer_table_t) footer = ns(Footer_as_root(footer_data)); + if (ns(Footer_schema(footer)) == NULL) { + ArrowErrorSet(error, "Footer has no schema"); + return EINVAL; + } + + decoder->metadata_version = ns(Footer_version(footer)); + decoder->body_size_bytes = 0; + return NANOARROW_OK; +} + +ArrowErrorCode ArrowIpcDecoderDecodeHeader(struct ArrowIpcDecoder* decoder, + struct ArrowBufferView data, + struct ArrowError* error) { + struct ArrowIpcDecoderPrivate* private_data = + (struct ArrowIpcDecoderPrivate*)decoder->private_data; + + ArrowIpcDecoderResetHeaderInfo(decoder); + int32_t prefix_size_bytes; + NANOARROW_RETURN_NOT_OK( + ArrowIpcDecoderReadHeaderPrefix(decoder, &data, &prefix_size_bytes, error)); + + // Check that data contains at least the entire header (return ESPIPE to signal + // that reading more data may help). + if (data.size_bytes < decoder->header_size_bytes - prefix_size_bytes) { + ArrowErrorSet(error, + "Expected >= %d bytes of remaining data but found %" PRId64 + " bytes in buffer", + decoder->header_size_bytes, data.size_bytes + prefix_size_bytes); + return ESPIPE; + } + + ns(Message_table_t) message = ns(Message_as_root(data.data.as_uint8)); + if (!message) { + return EINVAL; + } + + // Read some basic information from the message + decoder->metadata_version = ns(Message_version(message)); + decoder->message_type = ns(Message_header_type(message)); + decoder->body_size_bytes = ns(Message_bodyLength(message)); + + switch (decoder->metadata_version) { + case ns(MetadataVersion_V4): + case ns(MetadataVersion_V5): + break; + ArrowErrorSet(error, "Expected metadata version V4 or V5 but found %s", + ns(MetadataVersion_name(ns(Message_version(message))))); + return EINVAL; + case ns(MetadataVersion_V1): + case ns(MetadataVersion_V2): + case ns(MetadataVersion_V3): + default: + ArrowErrorSet(error, "Unexpected value for Message metadata version (%d)", + decoder->metadata_version); + return EINVAL; + } + + flatbuffers_generic_t message_header = ns(Message_header_get(message)); + switch (decoder->message_type) { + case ns(MessageHeader_Schema): + NANOARROW_RETURN_NOT_OK( + ArrowIpcDecoderDecodeSchemaHeader(decoder, message_header, error)); + break; + case ns(MessageHeader_RecordBatch): + NANOARROW_RETURN_NOT_OK( + ArrowIpcDecoderDecodeRecordBatchHeader(decoder, message_header, error)); + break; + case ns(MessageHeader_DictionaryBatch): + case ns(MessageHeader_Tensor): + case ns(MessageHeader_SparseTensor): + ArrowErrorSet(error, "Unsupported message type: '%s'", + ns(MessageHeader_type_name(ns(Message_header_type(message))))); + return ENOTSUP; + default: + ArrowErrorSet(error, "Unknown message type: %d", (int)(decoder->message_type)); + return EINVAL; + } + + private_data->last_message = message_header; + return NANOARROW_OK; +} + +static ArrowErrorCode ArrowIpcDecoderDecodeSchemaImpl(ns(Schema_table_t) schema, + struct ArrowSchema* out, + struct ArrowError* error) { + ArrowSchemaInit(out); + // Top-level batch schema is typically non-nullable + out->flags = 0; + + ns(Field_vec_t) fields = ns(Schema_fields(schema)); + int64_t n_fields = ns(Schema_vec_len(fields)); + + ArrowErrorCode result = ArrowSchemaSetTypeStruct(out, n_fields); + if (result != NANOARROW_OK) { + ArrowErrorSet(error, "Failed to allocate struct schema with %" PRId64 " children", + n_fields); + return result; + } + + NANOARROW_RETURN_NOT_OK(ArrowIpcDecoderSetChildren(out, fields, error)); + NANOARROW_RETURN_NOT_OK( + ArrowIpcDecoderSetMetadata(out, ns(Schema_custom_metadata(schema)), error)); + return NANOARROW_OK; +} + +ArrowErrorCode ArrowIpcDecoderDecodeSchema(struct ArrowIpcDecoder* decoder, + struct ArrowSchema* out, + struct ArrowError* error) { + struct ArrowIpcDecoderPrivate* private_data = + (struct ArrowIpcDecoderPrivate*)decoder->private_data; + + if (private_data->last_message == NULL || + decoder->message_type != NANOARROW_IPC_MESSAGE_TYPE_SCHEMA) { + ArrowErrorSet(error, "decoder did not just decode a Schema message"); + return EINVAL; + } + + struct ArrowSchema tmp; + ArrowErrorCode result = ArrowIpcDecoderDecodeSchemaImpl( + (ns(Schema_table_t))private_data->last_message, &tmp, error); + + if (result != NANOARROW_OK) { + ArrowSchemaRelease(&tmp); + return result; + } + ArrowSchemaMove(&tmp, out); + return NANOARROW_OK; +} + +ArrowErrorCode ArrowIpcDecoderDecodeFooter(struct ArrowIpcDecoder* decoder, + struct ArrowBufferView data, + struct ArrowError* error) { + struct ArrowIpcDecoderPrivate* private_data = + (struct ArrowIpcDecoderPrivate*)decoder->private_data; + + int32_t footer_and_size_and_magic_size = + decoder->header_size_bytes + sizeof(int32_t) + strlen(NANOARROW_IPC_MAGIC); + const uint8_t* footer_data = + data.data.as_uint8 + data.size_bytes - footer_and_size_and_magic_size; + ns(Footer_table_t) footer = ns(Footer_as_root(footer_data)); + + NANOARROW_RETURN_NOT_OK( + ArrowIpcDecoderDecodeSchemaHeader(decoder, ns(Footer_schema(footer)), error)); + + NANOARROW_RETURN_NOT_OK(ArrowIpcDecoderDecodeSchemaImpl( + ns(Footer_schema(footer)), &private_data->footer.schema, error)); + + ns(Block_vec_t) blocks = ns(Footer_recordBatches(footer)); + int64_t n = ns(Block_vec_len(blocks)); + NANOARROW_RETURN_NOT_OK(ArrowBufferResize(&private_data->footer.record_batch_blocks, + sizeof(struct ArrowIpcFileBlock) * n, + /*shrink_to_fit=*/0)); + struct ArrowIpcFileBlock* record_batches = + (struct ArrowIpcFileBlock*)private_data->footer.record_batch_blocks.data; + for (int64_t i = 0; i < n; i++) { + record_batches[i].offset = ns(Block_offset(blocks + i)); + record_batches[i].metadata_length = ns(Block_metaDataLength(blocks + i)); + record_batches[i].body_length = ns(Block_bodyLength(blocks + i)); + } + + decoder->footer = &private_data->footer; + return NANOARROW_OK; +} + +static void ArrowIpcDecoderCountFields(struct ArrowSchema* schema, int64_t* n_fields) { + *n_fields += 1; + for (int64_t i = 0; i < schema->n_children; i++) { + ArrowIpcDecoderCountFields(schema->children[i], n_fields); + } +} + +static void ArrowIpcDecoderInitFields(struct ArrowIpcField* fields, + struct ArrowArrayView* array_view, + struct ArrowArray* array, int64_t* n_fields, + int64_t* n_buffers, int64_t* n_union_fields) { + struct ArrowIpcField* field = fields + (*n_fields); + field->array_view = array_view; + field->array = array; + field->buffer_offset = *n_buffers; + + for (int i = 0; i < NANOARROW_MAX_FIXED_BUFFERS; i++) { + *n_buffers += array_view->layout.buffer_type[i] != NANOARROW_BUFFER_TYPE_NONE; + } + *n_union_fields += array_view->storage_type == NANOARROW_TYPE_SPARSE_UNION || + array_view->storage_type == NANOARROW_TYPE_DENSE_UNION; + + *n_fields += 1; + + for (int64_t i = 0; i < array_view->n_children; i++) { + ArrowIpcDecoderInitFields(fields, array_view->children[i], array->children[i], + n_fields, n_buffers, n_union_fields); + } +} + +ArrowErrorCode ArrowIpcDecoderSetSchema(struct ArrowIpcDecoder* decoder, + struct ArrowSchema* schema, + struct ArrowError* error) { + struct ArrowIpcDecoderPrivate* private_data = + (struct ArrowIpcDecoderPrivate*)decoder->private_data; + + // Reset previously allocated schema-specific resources + private_data->n_buffers = 0; + private_data->n_fields = 0; + private_data->n_union_fields = 0; + ArrowArrayViewReset(&private_data->array_view); + if (private_data->array.release != NULL) { + ArrowArrayRelease(&private_data->array); + } + if (private_data->fields != NULL) { + ArrowFree(private_data->fields); + } + + // Allocate Array and ArrayView based on schema without moving the schema. + // This will fail if the schema is not valid. + NANOARROW_RETURN_NOT_OK( + ArrowArrayViewInitFromSchema(&private_data->array_view, schema, error)); + NANOARROW_RETURN_NOT_OK(ArrowArrayInitFromArrayView(&private_data->array, + &private_data->array_view, error)); + + // Root must be a struct + if (private_data->array_view.storage_type != NANOARROW_TYPE_STRUCT) { + ArrowErrorSet(error, "schema must be a struct type"); + return EINVAL; + } + + // Walk tree and calculate how many fields we need to allocate + ArrowIpcDecoderCountFields(schema, &private_data->n_fields); + private_data->fields = (struct ArrowIpcField*)ArrowMalloc(private_data->n_fields * + sizeof(struct ArrowIpcField)); + if (private_data->fields == NULL) { + ArrowErrorSet(error, "Failed to allocate decoder->fields"); + return ENOMEM; + } + memset(private_data->fields, 0, private_data->n_fields * sizeof(struct ArrowIpcField)); + + // Init field information and calculate starting buffer offset for each + int64_t field_i = 0; + ArrowIpcDecoderInitFields(private_data->fields, &private_data->array_view, + &private_data->array, &field_i, &private_data->n_buffers, + &private_data->n_union_fields); + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowIpcDecoderSetEndianness(struct ArrowIpcDecoder* decoder, + enum ArrowIpcEndianness endianness) { + struct ArrowIpcDecoderPrivate* private_data = + (struct ArrowIpcDecoderPrivate*)decoder->private_data; + + switch (endianness) { + case NANOARROW_IPC_ENDIANNESS_UNINITIALIZED: + case NANOARROW_IPC_ENDIANNESS_LITTLE: + case NANOARROW_IPC_ENDIANNESS_BIG: + private_data->endianness = endianness; + return NANOARROW_OK; + default: + return EINVAL; + } +} + +/// \brief Information required to read and/or decompress a single buffer +/// +/// The RecordBatch message header contains a description of each buffer +/// in the message body. The ArrowIpcBufferSource is the parsed result of +/// a single buffer with compression and endian information such that the +/// original buffer can be reconstructed. +struct ArrowIpcBufferSource { + int64_t body_offset_bytes; + int64_t buffer_length_bytes; + enum ArrowIpcCompressionType codec; + enum ArrowType data_type; + int64_t element_size_bits; + int swap_endian; +}; + +/// \brief Materializing ArrowBuffer objects +/// +/// Given a description of where a buffer is located inside the message body, make +/// the ArrowBuffer that will be placed into the correct ArrowArray. The decoder +/// does not do any IO and does not make any assumptions about how or if the body +/// has been read into memory. This abstraction is currently internal and exists +/// to support the two obvious ways a user might go about this: (1) using a +/// non-owned view of memory that must be copied slice-wise or (2) adding a reference +/// to an ArrowIpcSharedBuffer and returning a slice of that memory. +struct ArrowIpcBufferFactory { + /// \brief User-defined callback to populate a buffer view + /// + /// At the time that this callback is called, the ArrowIpcBufferSource has been checked + /// to ensure that it is within the body size declared by the message header. A + /// possibly preallocated ArrowBuffer (dst) is provided, which implementations must use + /// if an allocation is required (in which case the view must be populated pointing to + /// the contents of the ArrowBuffer) If NANOARROW_OK is not returned, error must contain + /// a null-terminated message. + ArrowErrorCode (*make_buffer)(struct ArrowIpcBufferFactory* factory, + struct ArrowIpcBufferSource* src, + struct ArrowBufferView* dst_view, struct ArrowBuffer* dst, + struct ArrowError* error); + + /// \brief Caller-defined private data to be used in the callback. + /// + /// Usually this would be a description of where the body has been read into memory or + /// information required to do so. + void* private_data; +}; + +static ArrowErrorCode ArrowIpcMakeBufferFromView(struct ArrowIpcBufferFactory* factory, + struct ArrowIpcBufferSource* src, + struct ArrowBufferView* dst_view, + struct ArrowBuffer* dst, + struct ArrowError* error) { + NANOARROW_UNUSED(factory); + NANOARROW_UNUSED(dst); + NANOARROW_UNUSED(error); + + struct ArrowBufferView* body = (struct ArrowBufferView*)factory->private_data; + dst_view->data.as_uint8 = body->data.as_uint8 + src->body_offset_bytes; + dst_view->size_bytes = src->buffer_length_bytes; + return NANOARROW_OK; +} + +static struct ArrowIpcBufferFactory ArrowIpcBufferFactoryFromView( + struct ArrowBufferView* buffer_view) { + struct ArrowIpcBufferFactory out; + out.make_buffer = &ArrowIpcMakeBufferFromView; + out.private_data = buffer_view; + return out; +} + +static ArrowErrorCode ArrowIpcMakeBufferFromShared(struct ArrowIpcBufferFactory* factory, + struct ArrowIpcBufferSource* src, + struct ArrowBufferView* dst_view, + struct ArrowBuffer* dst, + struct ArrowError* error) { + NANOARROW_UNUSED(error); + + struct ArrowIpcSharedBuffer* shared = + (struct ArrowIpcSharedBuffer*)factory->private_data; + ArrowBufferReset(dst); + ArrowIpcSharedBufferClone(shared, dst); + dst->data += src->body_offset_bytes; + dst->size_bytes = src->buffer_length_bytes; + dst_view->data.data = dst->data; + dst_view->size_bytes = dst->size_bytes; + return NANOARROW_OK; +} + +static struct ArrowIpcBufferFactory ArrowIpcBufferFactoryFromShared( + struct ArrowIpcSharedBuffer* shared) { + struct ArrowIpcBufferFactory out; + out.make_buffer = &ArrowIpcMakeBufferFromShared; + out.private_data = shared; + return out; +} + +// Just for the purposes of endian-swapping +struct ArrowIpcIntervalMonthDayNano { + uint32_t months; + uint32_t days; + uint64_t ns; +}; + +static int ArrowIpcDecoderSwapEndian(struct ArrowIpcBufferSource* src, + struct ArrowBufferView* out_view, + struct ArrowBuffer* dst, struct ArrowError* error) { + NANOARROW_DCHECK(out_view->size_bytes > 0); + NANOARROW_DCHECK(out_view->data.data != NULL); + + // Some buffer data types don't need any endian swapping + switch (src->data_type) { + case NANOARROW_TYPE_BOOL: + case NANOARROW_TYPE_INT8: + case NANOARROW_TYPE_UINT8: + case NANOARROW_TYPE_STRING: + case NANOARROW_TYPE_BINARY: + return NANOARROW_OK; + default: + break; + } + + // Make sure dst is not a shared buffer that we can't modify + struct ArrowBuffer tmp; + ArrowBufferInit(&tmp); + + if (dst->allocator.private_data != NULL) { + ArrowBufferMove(dst, &tmp); + ArrowBufferInit(dst); + } + + if (dst->size_bytes == 0) { + NANOARROW_RETURN_NOT_OK(ArrowBufferReserve(dst, out_view->size_bytes)); + dst->size_bytes = out_view->size_bytes; + } + + switch (src->data_type) { + case NANOARROW_TYPE_DECIMAL128: + case NANOARROW_TYPE_DECIMAL256: { + const uint64_t* ptr_src = out_view->data.as_uint64; + uint64_t* ptr_dst = (uint64_t*)dst->data; + uint64_t words[4]; + int n_words = (int)(src->element_size_bits / 64); + NANOARROW_DCHECK(n_words == 2 || n_words == 4); + + for (int64_t i = 0; i < (dst->size_bytes / n_words / 8); i++) { + for (int j = 0; j < n_words; j++) { + words[j] = bswap64(ptr_src[i * n_words + j]); + } + + for (int j = 0; j < n_words; j++) { + ptr_dst[i * n_words + j] = words[n_words - j - 1]; + } + } + break; + } + case NANOARROW_TYPE_INTERVAL_DAY_TIME: { + uint32_t* ptr = (uint32_t*)dst->data; + for (int64_t i = 0; i < (dst->size_bytes / 4); i++) { + ptr[i] = bswap32(out_view->data.as_uint32[i]); + } + break; + } + case NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO: { + const uint8_t* ptr_src = out_view->data.as_uint8; + uint8_t* ptr_dst = dst->data; + int item_size_bytes = 16; + struct ArrowIpcIntervalMonthDayNano item; + for (int64_t i = 0; i < (dst->size_bytes / item_size_bytes); i++) { + memcpy(&item, ptr_src + i * item_size_bytes, item_size_bytes); + item.months = bswap32(item.months); + item.days = bswap32(item.days); + item.ns = bswap64(item.ns); + memcpy(ptr_dst + i * item_size_bytes, &item, item_size_bytes); + } + break; + } + default: + switch (src->element_size_bits) { + case 16: { + uint16_t* ptr = (uint16_t*)dst->data; + for (int64_t i = 0; i < (dst->size_bytes / 2); i++) { + ptr[i] = bswap16(out_view->data.as_uint16[i]); + } + break; + } + case 32: { + uint32_t* ptr = (uint32_t*)dst->data; + for (int64_t i = 0; i < (dst->size_bytes / 4); i++) { + ptr[i] = bswap32(out_view->data.as_uint32[i]); + } + break; + } + case 64: { + uint64_t* ptr = (uint64_t*)dst->data; + for (int64_t i = 0; i < (dst->size_bytes / 8); i++) { + ptr[i] = bswap64(out_view->data.as_uint64[i]); + } + break; + } + default: + ArrowErrorSet( + error, "Endian swapping for element bitwidth %" PRId64 " is not supported", + src->element_size_bits); + return ENOTSUP; + } + break; + } + + ArrowBufferReset(&tmp); + out_view->data.data = dst->data; + return NANOARROW_OK; +} + +struct ArrowIpcArraySetter { + ns(FieldNode_vec_t) fields; + int64_t field_i; + ns(Buffer_vec_t) buffers; + int64_t buffer_i; + int64_t body_size_bytes; + struct ArrowIpcBufferSource src; + struct ArrowIpcBufferFactory factory; + enum ArrowIpcMetadataVersion version; +}; + +static int ArrowIpcDecoderMakeBuffer(struct ArrowIpcArraySetter* setter, int64_t offset, + int64_t length, struct ArrowBufferView* out_view, + struct ArrowBuffer* out, struct ArrowError* error) { + out_view->data.data = NULL; + out_view->size_bytes = 0; + + if (length == 0) { + return NANOARROW_OK; + } + + // Check that this buffer fits within the body + int64_t buffer_start = offset; + int64_t buffer_end = buffer_start + length; + if (buffer_start < 0 || buffer_end > setter->body_size_bytes) { + ArrowErrorSet(error, + "Buffer requires body offsets [%" PRId64 "..%" PRId64 + ") but body has size %" PRId64, + buffer_start, buffer_end, setter->body_size_bytes); + return EINVAL; + } + + // If the ArrowIpcBufferFactory is made public, these should get moved (since then a + // user could inject support for either one). More likely, by the time that happens, + // this library will be able to support some of these features. + if (setter->src.codec != NANOARROW_IPC_COMPRESSION_TYPE_NONE) { + ArrowErrorSet(error, "The nanoarrow_ipc extension does not support compression"); + return ENOTSUP; + } + + setter->src.body_offset_bytes = offset; + setter->src.buffer_length_bytes = length; + NANOARROW_RETURN_NOT_OK( + setter->factory.make_buffer(&setter->factory, &setter->src, out_view, out, error)); + + if (setter->src.swap_endian) { + NANOARROW_RETURN_NOT_OK( + ArrowIpcDecoderSwapEndian(&setter->src, out_view, out, error)); + } + + return NANOARROW_OK; +} + +static int ArrowIpcDecoderWalkGetArray(struct ArrowArrayView* array_view, + struct ArrowArray* array, struct ArrowArray* out, + struct ArrowError* error) { + out->length = array_view->length; + out->null_count = array_view->null_count; + + for (int64_t i = 0; i < array->n_buffers; i++) { + struct ArrowBufferView view = array_view->buffer_views[i]; + struct ArrowBuffer* scratch_buffer = ArrowArrayBuffer(array, i); + struct ArrowBuffer* buffer_out = ArrowArrayBuffer(out, i); + + // If the scratch buffer was used, move it to the final array. Otherwise, + // copy the view. + if (scratch_buffer->size_bytes == 0) { + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendBufferView(buffer_out, view)); + } else if (scratch_buffer->data == view.data.as_uint8) { + ArrowBufferMove(scratch_buffer, buffer_out); + } else { + ArrowErrorSet( + error, + "Internal: scratch buffer was used but doesn't point to the same data as view"); + return EINVAL; + } + } + + for (int64_t i = 0; i < array->n_children; i++) { + NANOARROW_RETURN_NOT_OK(ArrowIpcDecoderWalkGetArray( + array_view->children[i], array->children[i], out->children[i], error)); + } + + return NANOARROW_OK; +} + +static int ArrowIpcDecoderWalkSetArrayView(struct ArrowIpcArraySetter* setter, + struct ArrowArrayView* array_view, + struct ArrowArray* array, + struct ArrowError* error) { + ns(FieldNode_struct_t) field = + ns(FieldNode_vec_at(setter->fields, (size_t)setter->field_i)); + array_view->length = ns(FieldNode_length(field)); + array_view->null_count = ns(FieldNode_null_count(field)); + setter->field_i += 1; + + if (array_view->storage_type == NANOARROW_TYPE_SPARSE_UNION || + array_view->storage_type == NANOARROW_TYPE_DENSE_UNION) { + if (setter->version < NANOARROW_IPC_METADATA_VERSION_V5) { + ns(Buffer_struct_t) buffer = + ns(Buffer_vec_at(setter->buffers, (size_t)setter->buffer_i)); + if (ns(Buffer_length(buffer)) != 0) { + ArrowErrorSet(error, + "Cannot read pre-1.0.0 Union array with top-level validity bitmap"); + return EINVAL; + } + // skip the empty validity bitmap + setter->buffer_i += 1; + } + } + + for (int i = 0; i < NANOARROW_MAX_FIXED_BUFFERS; i++) { + if (array_view->layout.buffer_type[i] == NANOARROW_BUFFER_TYPE_NONE) { + break; + } + + ns(Buffer_struct_t) buffer = + ns(Buffer_vec_at(setter->buffers, (size_t)setter->buffer_i)); + int64_t buffer_offset = ns(Buffer_offset(buffer)); + int64_t buffer_length = ns(Buffer_length(buffer)); + setter->buffer_i += 1; + + // Provide a buffer that will be used if any allocation has to occur + struct ArrowBuffer* buffer_dst = ArrowArrayBuffer(array, i); + + // Attempt to re-use any previous allocation unless this buffer is + // wrapping a custom allocator. + if (buffer_dst->allocator.private_data != NULL) { + ArrowBufferReset(buffer_dst); + } else { + buffer_dst->size_bytes = 0; + } + + setter->src.data_type = array_view->layout.buffer_data_type[i]; + setter->src.element_size_bits = array_view->layout.element_size_bits[i]; + + NANOARROW_RETURN_NOT_OK( + ArrowIpcDecoderMakeBuffer(setter, buffer_offset, buffer_length, + &array_view->buffer_views[i], buffer_dst, error)); + } + + for (int64_t i = 0; i < array_view->n_children; i++) { + NANOARROW_RETURN_NOT_OK(ArrowIpcDecoderWalkSetArrayView( + setter, array_view->children[i], array->children[i], error)); + } + + return NANOARROW_OK; +} + +static ArrowErrorCode ArrowIpcDecoderDecodeArrayInternal( + struct ArrowIpcDecoder* decoder, int64_t field_i, struct ArrowArray* out, + enum ArrowValidationLevel validation_level, struct ArrowError* error) { + struct ArrowIpcDecoderPrivate* private_data = + (struct ArrowIpcDecoderPrivate*)decoder->private_data; + + struct ArrowIpcField* root = private_data->fields + field_i + 1; + + if (field_i == -1) { + NANOARROW_RETURN_NOT_OK( + ArrowArrayInitFromArrayView(out, &private_data->array_view, error)); + out->length = private_data->array_view.length; + out->null_count = private_data->array_view.null_count; + + for (int64_t i = 0; i < private_data->array_view.n_children; i++) { + NANOARROW_RETURN_NOT_OK(ArrowIpcDecoderWalkGetArray( + private_data->array_view.children[i], private_data->array.children[i], + out->children[i], error)); + } + + } else { + NANOARROW_RETURN_NOT_OK(ArrowArrayInitFromArrayView(out, root->array_view, error)); + NANOARROW_RETURN_NOT_OK( + ArrowIpcDecoderWalkGetArray(root->array_view, root->array, out, error)); + } + + // If validation is going to happen it has already occurred; however, the part of + // ArrowArrayFinishBuilding() that allocates a data buffer if the data buffer is + // NULL (required for compatibility with Arrow <= 9.0.0) assumes CPU data access + // and thus needs a validation level >= default. + if (validation_level >= NANOARROW_VALIDATION_LEVEL_DEFAULT) { + NANOARROW_RETURN_NOT_OK( + ArrowArrayFinishBuilding(out, NANOARROW_VALIDATION_LEVEL_DEFAULT, error)); + } else { + NANOARROW_RETURN_NOT_OK( + ArrowArrayFinishBuilding(out, NANOARROW_VALIDATION_LEVEL_NONE, error)); + } + + return NANOARROW_OK; +} + +static ArrowErrorCode ArrowIpcDecoderDecodeArrayViewInternal( + struct ArrowIpcDecoder* decoder, struct ArrowIpcBufferFactory factory, + int64_t field_i, struct ArrowArrayView** out_view, struct ArrowError* error) { + struct ArrowIpcDecoderPrivate* private_data = + (struct ArrowIpcDecoderPrivate*)decoder->private_data; + + if (private_data->last_message == NULL || + decoder->message_type != NANOARROW_IPC_MESSAGE_TYPE_RECORD_BATCH) { + ArrowErrorSet(error, "decoder did not just decode a RecordBatch message"); + return EINVAL; + } + + // RecordBatch messages don't count the root node but decoder->fields does + // (decoder->fields[0] is the root field) + if (field_i + 1 >= private_data->n_fields) { + ArrowErrorSet(error, "cannot decode column %" PRId64 "; there are only %" PRId64, + field_i, private_data->n_fields - 1); + return EINVAL; + } + + ns(RecordBatch_table_t) batch = (ns(RecordBatch_table_t))private_data->last_message; + + struct ArrowIpcField* root = private_data->fields + field_i + 1; + + struct ArrowIpcArraySetter setter; + setter.fields = ns(RecordBatch_nodes(batch)); + setter.field_i = field_i; + setter.buffers = ns(RecordBatch_buffers(batch)); + setter.buffer_i = root->buffer_offset - 1; + setter.body_size_bytes = decoder->body_size_bytes; + setter.factory = factory; + setter.src.codec = decoder->codec; + setter.src.swap_endian = ArrowIpcDecoderNeedsSwapEndian(decoder); + setter.version = decoder->metadata_version; + + // The flatbuffers FieldNode doesn't count the root struct so we have to loop over the + // children ourselves + if (field_i == -1) { + root->array_view->length = ns(RecordBatch_length(batch)); + root->array_view->null_count = 0; + setter.field_i++; + setter.buffer_i++; + + for (int64_t i = 0; i < root->array_view->n_children; i++) { + NANOARROW_RETURN_NOT_OK(ArrowIpcDecoderWalkSetArrayView( + &setter, root->array_view->children[i], root->array->children[i], error)); + } + } else { + NANOARROW_RETURN_NOT_OK( + ArrowIpcDecoderWalkSetArrayView(&setter, root->array_view, root->array, error)); + } + + *out_view = root->array_view; + return NANOARROW_OK; +} + +ArrowErrorCode ArrowIpcDecoderDecodeArrayView(struct ArrowIpcDecoder* decoder, + struct ArrowBufferView body, int64_t i, + struct ArrowArrayView** out, + struct ArrowError* error) { + return ArrowIpcDecoderDecodeArrayViewInternal( + decoder, ArrowIpcBufferFactoryFromView(&body), i, out, error); +} + +ArrowErrorCode ArrowIpcDecoderDecodeArray(struct ArrowIpcDecoder* decoder, + struct ArrowBufferView body, int64_t i, + struct ArrowArray* out, + enum ArrowValidationLevel validation_level, + struct ArrowError* error) { + struct ArrowArrayView* array_view; + NANOARROW_RETURN_NOT_OK(ArrowIpcDecoderDecodeArrayViewInternal( + decoder, ArrowIpcBufferFactoryFromView(&body), i, &array_view, error)); + + NANOARROW_RETURN_NOT_OK(ArrowArrayViewValidate(array_view, validation_level, error)); + + struct ArrowArray temp; + temp.release = NULL; + int result = + ArrowIpcDecoderDecodeArrayInternal(decoder, i, &temp, validation_level, error); + if (result != NANOARROW_OK && temp.release != NULL) { + ArrowArrayRelease(&temp); + } else if (result != NANOARROW_OK) { + return result; + } + + ArrowArrayMove(&temp, out); + return NANOARROW_OK; +} + +ArrowErrorCode ArrowIpcDecoderDecodeArrayFromShared( + struct ArrowIpcDecoder* decoder, struct ArrowIpcSharedBuffer* body, int64_t i, + struct ArrowArray* out, enum ArrowValidationLevel validation_level, + struct ArrowError* error) { + struct ArrowArrayView* array_view; + NANOARROW_RETURN_NOT_OK(ArrowIpcDecoderDecodeArrayViewInternal( + decoder, ArrowIpcBufferFactoryFromShared(body), i, &array_view, error)); + + NANOARROW_RETURN_NOT_OK(ArrowArrayViewValidate(array_view, validation_level, error)); + + struct ArrowArray temp; + temp.release = NULL; + int result = + ArrowIpcDecoderDecodeArrayInternal(decoder, i, &temp, validation_level, error); + if (result != NANOARROW_OK && temp.release != NULL) { + ArrowArrayRelease(&temp); + } else if (result != NANOARROW_OK) { + return result; + } + + ArrowArrayMove(&temp, out); + return NANOARROW_OK; +} +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include +#include +#include + +#include "flatcc/flatcc_builder.h" + +#include "nanoarrow/nanoarrow.h" +#include "nanoarrow/nanoarrow_ipc.h" + +#define ns(x) FLATBUFFERS_WRAP_NAMESPACE(org_apache_arrow_flatbuf, x) + +#define FLATCC_RETURN_UNLESS_0_NO_NS(x, error) \ + if ((x) != 0) { \ + ArrowErrorSet(error, "%s:%d: %s failed", __FILE__, __LINE__, #x); \ + return ENOMEM; \ + } + +#define FLATCC_RETURN_UNLESS_0(x, error) FLATCC_RETURN_UNLESS_0_NO_NS(ns(x), error) + +#define FLATCC_RETURN_IF_NULL(x, error) \ + if (!(x)) { \ + ArrowErrorSet(error, "%s:%d: %s was null", __FILE__, __LINE__, #x); \ + return ENOMEM; \ + } + +struct ArrowIpcEncoderPrivate { + flatcc_builder_t builder; + struct ArrowBuffer buffers; + struct ArrowBuffer nodes; + int encoding_footer; +}; + +ArrowErrorCode ArrowIpcEncoderInit(struct ArrowIpcEncoder* encoder) { + NANOARROW_DCHECK(encoder != NULL); + memset(encoder, 0, sizeof(struct ArrowIpcEncoder)); + encoder->private_data = ArrowMalloc(sizeof(struct ArrowIpcEncoderPrivate)); + struct ArrowIpcEncoderPrivate* private = + (struct ArrowIpcEncoderPrivate*)encoder->private_data; + if (private == NULL) { + return ENOMEM; + } + if (flatcc_builder_init(&private->builder) == -1) { + ArrowFree(private); + return ESPIPE; + } + private->encoding_footer = 0; + ArrowBufferInit(&private->buffers); + ArrowBufferInit(&private->nodes); + return NANOARROW_OK; +} + +void ArrowIpcEncoderReset(struct ArrowIpcEncoder* encoder) { + NANOARROW_DCHECK(encoder != NULL); + struct ArrowIpcEncoderPrivate* private = + (struct ArrowIpcEncoderPrivate*)encoder->private_data; + if (private != NULL) { + flatcc_builder_clear(&private->builder); + ArrowBufferReset(&private->nodes); + ArrowBufferReset(&private->buffers); + ArrowFree(private); + } + memset(encoder, 0, sizeof(struct ArrowIpcEncoder)); +} + +static ArrowErrorCode ArrowIpcEncoderWriteContinuationAndSize(struct ArrowBuffer* out, + size_t size) { + _NANOARROW_CHECK_UPPER_LIMIT(size, INT32_MAX); + NANOARROW_RETURN_NOT_OK(ArrowBufferAppendInt32(out, -1)); + + if (ArrowIpcSystemEndianness() == NANOARROW_IPC_ENDIANNESS_BIG) { + return ArrowBufferAppendInt32(out, (int32_t)bswap32((uint32_t)size)); + } else { + return ArrowBufferAppendInt32(out, (int32_t)size); + } +} + +ArrowErrorCode ArrowIpcEncoderFinalizeBuffer(struct ArrowIpcEncoder* encoder, + char encapsulate, struct ArrowBuffer* out) { + NANOARROW_DCHECK(encoder != NULL && encoder->private_data != NULL && out != NULL); + struct ArrowIpcEncoderPrivate* private = + (struct ArrowIpcEncoderPrivate*)encoder->private_data; + + size_t size = flatcc_builder_get_buffer_size(&private->builder); + + if (encapsulate) { + int64_t padded_size = _ArrowRoundUpToMultipleOf8(size); + NANOARROW_RETURN_NOT_OK( + ArrowBufferReserve(out, sizeof(int32_t) + sizeof(int32_t) + padded_size)); + NANOARROW_ASSERT_OK(ArrowIpcEncoderWriteContinuationAndSize(out, padded_size)); + } else { + NANOARROW_RETURN_NOT_OK(ArrowBufferReserve(out, size)); + } + + if (size == 0) { + // Finalizing an empty flatcc_builder_t triggers an assertion + return NANOARROW_OK; + } + + void* data = + flatcc_builder_copy_buffer(&private->builder, out->data + out->size_bytes, size); + NANOARROW_DCHECK(data != NULL); + NANOARROW_UNUSED(data); + out->size_bytes += size; + + while (encapsulate && out->size_bytes % 8 != 0) { + // zero padding bytes, if any + out->data[out->size_bytes++] = 0; + } + + // don't deallocate yet, just wipe the builder's current Message + flatcc_builder_reset(&private->builder); + return NANOARROW_OK; +} + +static ArrowErrorCode ArrowIpcEncodeFieldType(flatcc_builder_t* builder, + const struct ArrowSchemaView* schema_view, + struct ArrowError* error) { + switch (schema_view->type) { + case NANOARROW_TYPE_NA: + FLATCC_RETURN_UNLESS_0(Field_type_Null_create(builder), error); + return NANOARROW_OK; + + case NANOARROW_TYPE_BOOL: + FLATCC_RETURN_UNLESS_0(Field_type_Bool_create(builder), error); + return NANOARROW_OK; + + case NANOARROW_TYPE_UINT8: + case NANOARROW_TYPE_INT8: + FLATCC_RETURN_UNLESS_0( + Field_type_Int_create(builder, 8, schema_view->type == NANOARROW_TYPE_INT8), + error); + return NANOARROW_OK; + + case NANOARROW_TYPE_UINT16: + case NANOARROW_TYPE_INT16: + FLATCC_RETURN_UNLESS_0( + Field_type_Int_create(builder, 16, schema_view->type == NANOARROW_TYPE_INT16), + error); + return NANOARROW_OK; + + case NANOARROW_TYPE_UINT32: + case NANOARROW_TYPE_INT32: + FLATCC_RETURN_UNLESS_0( + Field_type_Int_create(builder, 32, schema_view->type == NANOARROW_TYPE_INT32), + error); + return NANOARROW_OK; + + case NANOARROW_TYPE_UINT64: + case NANOARROW_TYPE_INT64: + FLATCC_RETURN_UNLESS_0( + Field_type_Int_create(builder, 64, schema_view->type == NANOARROW_TYPE_INT64), + error); + return NANOARROW_OK; + + case NANOARROW_TYPE_HALF_FLOAT: + FLATCC_RETURN_UNLESS_0(Field_type_FloatingPoint_create(builder, ns(Precision_HALF)), + error); + return NANOARROW_OK; + + case NANOARROW_TYPE_FLOAT: + FLATCC_RETURN_UNLESS_0( + Field_type_FloatingPoint_create(builder, ns(Precision_SINGLE)), error); + return NANOARROW_OK; + + case NANOARROW_TYPE_DOUBLE: + FLATCC_RETURN_UNLESS_0( + Field_type_FloatingPoint_create(builder, ns(Precision_DOUBLE)), error); + return NANOARROW_OK; + + case NANOARROW_TYPE_DECIMAL128: + case NANOARROW_TYPE_DECIMAL256: + FLATCC_RETURN_UNLESS_0( + Field_type_Decimal_create(builder, schema_view->decimal_precision, + schema_view->decimal_scale, + schema_view->decimal_bitwidth), + error); + return NANOARROW_OK; + + case NANOARROW_TYPE_STRING: + FLATCC_RETURN_UNLESS_0(Field_type_Utf8_create(builder), error); + return NANOARROW_OK; + + case NANOARROW_TYPE_LARGE_STRING: + FLATCC_RETURN_UNLESS_0(Field_type_LargeUtf8_create(builder), error); + return NANOARROW_OK; + + case NANOARROW_TYPE_BINARY: + FLATCC_RETURN_UNLESS_0(Field_type_Binary_create(builder), error); + return NANOARROW_OK; + + case NANOARROW_TYPE_LARGE_BINARY: + FLATCC_RETURN_UNLESS_0(Field_type_LargeBinary_create(builder), error); + return NANOARROW_OK; + + case NANOARROW_TYPE_DATE32: + FLATCC_RETURN_UNLESS_0(Field_type_Date_create(builder, ns(DateUnit_DAY)), error); + return NANOARROW_OK; + + case NANOARROW_TYPE_DATE64: + FLATCC_RETURN_UNLESS_0(Field_type_Date_create(builder, ns(DateUnit_MILLISECOND)), + error); + return NANOARROW_OK; + + case NANOARROW_TYPE_INTERVAL_MONTHS: + FLATCC_RETURN_UNLESS_0( + Field_type_Interval_create(builder, ns(IntervalUnit_YEAR_MONTH)), error); + return NANOARROW_OK; + + case NANOARROW_TYPE_INTERVAL_DAY_TIME: + FLATCC_RETURN_UNLESS_0( + Field_type_Interval_create(builder, ns(IntervalUnit_DAY_TIME)), error); + return NANOARROW_OK; + + case NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO: + FLATCC_RETURN_UNLESS_0( + Field_type_Interval_create(builder, ns(IntervalUnit_MONTH_DAY_NANO)), error); + return NANOARROW_OK; + + case NANOARROW_TYPE_TIMESTAMP: + FLATCC_RETURN_UNLESS_0(Field_type_Timestamp_start(builder), error); + FLATCC_RETURN_UNLESS_0( + Timestamp_unit_add(builder, (ns(TimeUnit_enum_t))schema_view->time_unit), + error); + if (schema_view->timezone && schema_view->timezone[0] != 0) { + FLATCC_RETURN_UNLESS_0( + Timestamp_timezone_create_str(builder, schema_view->timezone), error); + } + FLATCC_RETURN_UNLESS_0(Field_type_Timestamp_end(builder), error); + return NANOARROW_OK; + + case NANOARROW_TYPE_TIME32: + FLATCC_RETURN_UNLESS_0( + Field_type_Time_create(builder, (ns(TimeUnit_enum_t))schema_view->time_unit, + 32), + error); + return NANOARROW_OK; + + case NANOARROW_TYPE_TIME64: + FLATCC_RETURN_UNLESS_0( + Field_type_Time_create(builder, (ns(TimeUnit_enum_t))schema_view->time_unit, + 64), + error); + return NANOARROW_OK; + + case NANOARROW_TYPE_DURATION: + FLATCC_RETURN_UNLESS_0(Field_type_Duration_create( + builder, (ns(TimeUnit_enum_t))schema_view->time_unit), + error); + return NANOARROW_OK; + + case NANOARROW_TYPE_FIXED_SIZE_BINARY: + FLATCC_RETURN_UNLESS_0( + Field_type_FixedSizeBinary_create(builder, schema_view->fixed_size), error); + return NANOARROW_OK; + + case NANOARROW_TYPE_LIST: + FLATCC_RETURN_UNLESS_0(Field_type_List_create(builder), error); + return NANOARROW_OK; + + case NANOARROW_TYPE_LARGE_LIST: + FLATCC_RETURN_UNLESS_0(Field_type_LargeList_create(builder), error); + return NANOARROW_OK; + + case NANOARROW_TYPE_FIXED_SIZE_LIST: + FLATCC_RETURN_UNLESS_0( + Field_type_FixedSizeList_create(builder, schema_view->fixed_size), error); + return NANOARROW_OK; + + case NANOARROW_TYPE_RUN_END_ENCODED: + FLATCC_RETURN_UNLESS_0(Field_type_RunEndEncoded_create(builder), error); + return NANOARROW_OK; + + case NANOARROW_TYPE_STRUCT: + FLATCC_RETURN_UNLESS_0(Field_type_Struct__create(builder), error); + return NANOARROW_OK; + + case NANOARROW_TYPE_SPARSE_UNION: + case NANOARROW_TYPE_DENSE_UNION: { + FLATCC_RETURN_UNLESS_0(Field_type_Union_start(builder), error); + + FLATCC_RETURN_UNLESS_0( + Union_mode_add(builder, schema_view->type == NANOARROW_TYPE_DENSE_UNION), + error); + if (schema_view->union_type_ids) { + int8_t type_ids[128]; + int n = _ArrowParseUnionTypeIds(schema_view->union_type_ids, type_ids); + if (n != 0) { + FLATCC_RETURN_UNLESS_0(Union_typeIds_start(builder), error); + int32_t* type_ids_32 = (int32_t*)ns(Union_typeIds_extend(builder, n)); + FLATCC_RETURN_IF_NULL(type_ids_32, error); + + for (int i = 0; i < n; i++) { + type_ids_32[i] = type_ids[i]; + } + FLATCC_RETURN_UNLESS_0(Union_typeIds_end(builder), error); + } + } + + FLATCC_RETURN_UNLESS_0(Field_type_Union_end(builder), error); + return NANOARROW_OK; + } + + case NANOARROW_TYPE_MAP: + FLATCC_RETURN_UNLESS_0( + Field_type_Map_create(builder, + schema_view->schema->flags & ARROW_FLAG_MAP_KEYS_SORTED), + error); + return NANOARROW_OK; + + case NANOARROW_TYPE_DICTIONARY: + ArrowErrorSet(error, "IPC encoding of dictionary types unsupported"); + return ENOTSUP; + + default: + ArrowErrorSet(error, "Expected a valid enum ArrowType value but found %d", + schema_view->type); + return EINVAL; + } +} + +static ArrowErrorCode ArrowIpcEncodeField(flatcc_builder_t* builder, + const struct ArrowSchema* schema, + struct ArrowError* error); + +static ArrowErrorCode ArrowIpcEncodeMetadata(flatcc_builder_t* builder, + const struct ArrowSchema* schema, + int (*push_start)(flatcc_builder_t*), + ns(KeyValue_ref_t) * + (*push_end)(flatcc_builder_t*), + struct ArrowError* error) { + struct ArrowMetadataReader metadata; + NANOARROW_RETURN_NOT_OK_WITH_ERROR(ArrowMetadataReaderInit(&metadata, schema->metadata), + error); + while (metadata.remaining_keys > 0) { + struct ArrowStringView key, value; + NANOARROW_RETURN_NOT_OK_WITH_ERROR(ArrowMetadataReaderRead(&metadata, &key, &value), + error); + FLATCC_RETURN_UNLESS_0_NO_NS(push_start(builder), error); + FLATCC_RETURN_UNLESS_0(KeyValue_key_create_strn(builder, key.data, key.size_bytes), + error); + FLATCC_RETURN_UNLESS_0( + KeyValue_value_create_strn(builder, value.data, value.size_bytes), error); + FLATCC_RETURN_IF_NULL(push_end(builder), error); + } + return NANOARROW_OK; +} + +static ArrowErrorCode ArrowIpcEncodeFields(flatcc_builder_t* builder, + const struct ArrowSchema* schema, + int (*push_start)(flatcc_builder_t*), + ns(Field_ref_t) * + (*push_end)(flatcc_builder_t*), + struct ArrowError* error) { + for (int i = 0; i < schema->n_children; i++) { + FLATCC_RETURN_UNLESS_0_NO_NS(push_start(builder), error); + NANOARROW_RETURN_NOT_OK(ArrowIpcEncodeField(builder, schema->children[i], error)); + FLATCC_RETURN_IF_NULL(push_end(builder), error); + } + return NANOARROW_OK; +} + +static ArrowErrorCode ArrowIpcEncodeField(flatcc_builder_t* builder, + const struct ArrowSchema* schema, + struct ArrowError* error) { + FLATCC_RETURN_UNLESS_0(Field_name_create_str(builder, schema->name), error); + FLATCC_RETURN_UNLESS_0( + Field_nullable_add(builder, (schema->flags & ARROW_FLAG_NULLABLE) != 0), error); + + struct ArrowSchemaView schema_view; + NANOARROW_RETURN_NOT_OK(ArrowSchemaViewInit(&schema_view, schema, error)); + NANOARROW_RETURN_NOT_OK(ArrowIpcEncodeFieldType(builder, &schema_view, error)); + + if (schema->n_children != 0) { + FLATCC_RETURN_UNLESS_0(Field_children_start(builder), error); + NANOARROW_RETURN_NOT_OK(ArrowIpcEncodeFields(builder, schema, + &ns(Field_children_push_start), + &ns(Field_children_push_end), error)); + FLATCC_RETURN_UNLESS_0(Field_children_end(builder), error); + } + + if (schema->metadata) { + FLATCC_RETURN_UNLESS_0(Field_custom_metadata_start(builder), error); + NANOARROW_RETURN_NOT_OK( + ArrowIpcEncodeMetadata(builder, schema, &ns(Field_custom_metadata_push_start), + &ns(Field_custom_metadata_push_end), error)); + FLATCC_RETURN_UNLESS_0(Field_custom_metadata_end(builder), error); + } + return NANOARROW_OK; +} + +static ArrowErrorCode ArrowIpcEncodeSchema(flatcc_builder_t* builder, + const struct ArrowSchema* schema, + struct ArrowError* error) { + NANOARROW_DCHECK(schema->release != NULL); + + if (strcmp(schema->format, "+s") != 0) { + ArrowErrorSet( + error, + "Cannot encode schema with format '%s'; top level schema must have struct type", + schema->format); + return EINVAL; + } + + if (ArrowIpcSystemEndianness() == NANOARROW_IPC_ENDIANNESS_LITTLE) { + FLATCC_RETURN_UNLESS_0(Schema_endianness_add(builder, ns(Endianness_Little)), error); + } else { + FLATCC_RETURN_UNLESS_0(Schema_endianness_add(builder, ns(Endianness_Big)), error); + } + + FLATCC_RETURN_UNLESS_0(Schema_fields_start(builder), error); + NANOARROW_RETURN_NOT_OK(ArrowIpcEncodeFields(builder, schema, + &ns(Schema_fields_push_start), + &ns(Schema_fields_push_end), error)); + FLATCC_RETURN_UNLESS_0(Schema_fields_end(builder), error); + + FLATCC_RETURN_UNLESS_0(Schema_custom_metadata_start(builder), error); + if (schema->metadata) { + NANOARROW_RETURN_NOT_OK( + ArrowIpcEncodeMetadata(builder, schema, &ns(Schema_custom_metadata_push_start), + &ns(Schema_custom_metadata_push_end), error)); + } + FLATCC_RETURN_UNLESS_0(Schema_custom_metadata_end(builder), error); + + FLATCC_RETURN_UNLESS_0(Schema_features_start(builder), error); + FLATCC_RETURN_UNLESS_0(Schema_features_end(builder), error); + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowIpcEncoderEncodeSchema(struct ArrowIpcEncoder* encoder, + const struct ArrowSchema* schema, + struct ArrowError* error) { + NANOARROW_DCHECK(encoder != NULL && encoder->private_data != NULL && schema != NULL); + + struct ArrowIpcEncoderPrivate* private = + (struct ArrowIpcEncoderPrivate*)encoder->private_data; + + flatcc_builder_t* builder = &private->builder; + + FLATCC_RETURN_UNLESS_0(Message_start_as_root(builder), error); + + FLATCC_RETURN_UNLESS_0(Message_version_add(builder, ns(MetadataVersion_V5)), error); + + FLATCC_RETURN_UNLESS_0(Message_header_Schema_start(builder), error); + NANOARROW_RETURN_NOT_OK(ArrowIpcEncodeSchema(builder, schema, error)); + FLATCC_RETURN_UNLESS_0(Message_header_Schema_end(builder), error); + + FLATCC_RETURN_UNLESS_0(Message_bodyLength_add(builder, 0), error); + + FLATCC_RETURN_IF_NULL(ns(Message_end_as_root(builder)), error); + return NANOARROW_OK; +} + +struct ArrowIpcBufferEncoder { + /// \brief Callback invoked against each buffer to be encoded + /// + /// Encoding of buffers is left as a callback to accommodate dissociated data storage. + /// One implementation of this callback might copy all buffers into a contiguous body + /// for use in an arrow IPC stream, another implementation might store offsets and + /// lengths relative to a known arena. + ArrowErrorCode (*encode_buffer)(struct ArrowBufferView buffer_view, + struct ArrowIpcEncoder* encoder, + struct ArrowIpcBufferEncoder* buffer_encoder, + int64_t* offset, int64_t* length, + struct ArrowError* error); + + /// \brief Pointer to arbitrary data used by encode_buffer() + void* encode_buffer_state; + + /// \brief Finalized body length of the most recently encoded RecordBatch message + /// + /// encode_buffer() is expected to update this while encoding each buffer. After all + /// buffers are encoded, this will be written to the RecordBatch's .bodyLength + int64_t body_length; +}; + +static ArrowErrorCode ArrowIpcEncoderBuildContiguousBodyBufferCallback( + struct ArrowBufferView buffer_view, struct ArrowIpcEncoder* encoder, + struct ArrowIpcBufferEncoder* buffer_encoder, int64_t* offset, int64_t* length, + struct ArrowError* error) { + NANOARROW_UNUSED(encoder); + + struct ArrowBuffer* body_buffer = + (struct ArrowBuffer*)buffer_encoder->encode_buffer_state; + + int64_t old_size = body_buffer->size_bytes; + int64_t buffer_begin = _ArrowRoundUpToMultipleOf8(old_size); + int64_t buffer_end = buffer_begin + buffer_view.size_bytes; + int64_t new_size = _ArrowRoundUpToMultipleOf8(buffer_end); + + // reserve all the memory we'll need now + NANOARROW_RETURN_NOT_OK_WITH_ERROR(ArrowBufferReserve(body_buffer, new_size - old_size), + error); + + // zero padding up to the start of the buffer + NANOARROW_ASSERT_OK(ArrowBufferAppendFill(body_buffer, 0, buffer_begin - old_size)); + + // store offset and length of the buffer + *offset = buffer_begin; + *length = buffer_view.size_bytes; + + NANOARROW_ASSERT_OK( + ArrowBufferAppend(body_buffer, buffer_view.data.data, buffer_view.size_bytes)); + + // zero padding after writing the buffer + NANOARROW_DCHECK(body_buffer->size_bytes == buffer_end); + NANOARROW_ASSERT_OK(ArrowBufferAppendFill(body_buffer, 0, new_size - buffer_end)); + + buffer_encoder->body_length = body_buffer->size_bytes; + return NANOARROW_OK; +} + +static ArrowErrorCode ArrowIpcEncoderEncodeRecordBatchImpl( + struct ArrowIpcEncoder* encoder, struct ArrowIpcBufferEncoder* buffer_encoder, + const struct ArrowArrayView* array_view, struct ArrowBuffer* buffers, + struct ArrowBuffer* nodes, struct ArrowError* error) { + if (array_view->offset != 0) { + ArrowErrorSet(error, "Cannot encode arrays with nonzero offset"); + return ENOTSUP; + } + + for (int64_t c = 0; c < array_view->n_children; ++c) { + const struct ArrowArrayView* child = array_view->children[c]; + + struct ns(FieldNode) node = {child->length, child->null_count}; + NANOARROW_RETURN_NOT_OK_WITH_ERROR(ArrowBufferAppend(nodes, &node, sizeof(node)), + error); + + for (int64_t b = 0; b < child->array->n_buffers; ++b) { + struct ns(Buffer) buffer; + NANOARROW_RETURN_NOT_OK( + buffer_encoder->encode_buffer(child->buffer_views[b], encoder, buffer_encoder, + &buffer.offset, &buffer.length, error)); + NANOARROW_RETURN_NOT_OK_WITH_ERROR( + ArrowBufferAppend(buffers, &buffer, sizeof(buffer)), error); + } + + NANOARROW_RETURN_NOT_OK(ArrowIpcEncoderEncodeRecordBatchImpl( + encoder, buffer_encoder, child, buffers, nodes, error)); + } + return NANOARROW_OK; +} + +static ArrowErrorCode ArrowIpcEncoderEncodeRecordBatch( + struct ArrowIpcEncoder* encoder, struct ArrowIpcBufferEncoder* buffer_encoder, + const struct ArrowArrayView* array_view, struct ArrowError* error) { + NANOARROW_DCHECK(encoder != NULL && encoder->private_data != NULL && + buffer_encoder != NULL && buffer_encoder->encode_buffer != NULL); + if (array_view->null_count != 0 && ArrowArrayViewComputeNullCount(array_view) != 0) { + ArrowErrorSet(error, + "RecordBatches cannot be constructed from arrays with top level nulls"); + return EINVAL; + } + + if (array_view->storage_type != NANOARROW_TYPE_STRUCT) { + ArrowErrorSet( + error, + "RecordBatches cannot be constructed from arrays of type other than struct"); + return EINVAL; + } + + struct ArrowIpcEncoderPrivate* private = + (struct ArrowIpcEncoderPrivate*)encoder->private_data; + + flatcc_builder_t* builder = &private->builder; + + FLATCC_RETURN_UNLESS_0(Message_start_as_root(builder), error); + FLATCC_RETURN_UNLESS_0(Message_version_add(builder, ns(MetadataVersion_V5)), error); + + FLATCC_RETURN_UNLESS_0(Message_header_RecordBatch_start(builder), error); + FLATCC_RETURN_UNLESS_0(RecordBatch_length_add(builder, array_view->length), error); + + NANOARROW_ASSERT_OK(ArrowBufferResize(&private->buffers, 0, 0)); + NANOARROW_ASSERT_OK(ArrowBufferResize(&private->nodes, 0, 0)); + NANOARROW_RETURN_NOT_OK(ArrowIpcEncoderEncodeRecordBatchImpl( + encoder, buffer_encoder, array_view, &private->buffers, &private->nodes, error)); + + FLATCC_RETURN_UNLESS_0(RecordBatch_nodes_create( // + builder, (struct ns(FieldNode)*)private->nodes.data, + private->nodes.size_bytes / sizeof(struct ns(FieldNode))), + error); + FLATCC_RETURN_UNLESS_0(RecordBatch_buffers_create( // + builder, (struct ns(Buffer)*)private->buffers.data, + private->buffers.size_bytes / sizeof(struct ns(Buffer))), + error); + + FLATCC_RETURN_UNLESS_0(Message_header_RecordBatch_end(builder), error); + + FLATCC_RETURN_UNLESS_0(Message_bodyLength_add(builder, buffer_encoder->body_length), + error); + FLATCC_RETURN_IF_NULL(ns(Message_end_as_root(builder)), error); + return NANOARROW_OK; +} + +ArrowErrorCode ArrowIpcEncoderEncodeSimpleRecordBatch( + struct ArrowIpcEncoder* encoder, const struct ArrowArrayView* array_view, + struct ArrowBuffer* body_buffer, struct ArrowError* error) { + NANOARROW_DCHECK(encoder != NULL && encoder->private_data != NULL && + body_buffer != NULL); + + struct ArrowIpcBufferEncoder buffer_encoder = { + .encode_buffer = &ArrowIpcEncoderBuildContiguousBodyBufferCallback, + .encode_buffer_state = body_buffer, + .body_length = 0, + }; + + return ArrowIpcEncoderEncodeRecordBatch(encoder, &buffer_encoder, array_view, error); +} + +void ArrowIpcFooterInit(struct ArrowIpcFooter* footer) { + footer->schema.release = NULL; + ArrowBufferInit(&footer->record_batch_blocks); +} + +void ArrowIpcFooterReset(struct ArrowIpcFooter* footer) { + if (footer->schema.release != NULL) { + ArrowSchemaRelease(&footer->schema); + } + ArrowBufferReset(&footer->record_batch_blocks); +} + +ArrowErrorCode ArrowIpcEncoderEncodeFooter(struct ArrowIpcEncoder* encoder, + const struct ArrowIpcFooter* footer, + struct ArrowError* error) { + NANOARROW_DCHECK(encoder != NULL && encoder->private_data != NULL && footer != NULL); + + struct ArrowIpcEncoderPrivate* private = + (struct ArrowIpcEncoderPrivate*)encoder->private_data; + + flatcc_builder_t* builder = &private->builder; + + FLATCC_RETURN_UNLESS_0(Footer_start_as_root(builder), error); + + FLATCC_RETURN_UNLESS_0(Footer_version_add(builder, ns(MetadataVersion_V5)), error); + + FLATCC_RETURN_UNLESS_0(Footer_schema_start(builder), error); + NANOARROW_RETURN_NOT_OK(ArrowIpcEncodeSchema(builder, &footer->schema, error)); + FLATCC_RETURN_UNLESS_0(Footer_schema_end(builder), error); + + const struct ArrowIpcFileBlock* blocks = + (struct ArrowIpcFileBlock*)footer->record_batch_blocks.data; + int64_t n_blocks = + footer->record_batch_blocks.size_bytes / sizeof(struct ArrowIpcFileBlock); + + FLATCC_RETURN_UNLESS_0(Footer_recordBatches_start(builder), error); + struct ns(Block)* flatcc_RecordBatch_blocks = + ns(Footer_recordBatches_extend(builder, n_blocks)); + FLATCC_RETURN_IF_NULL(flatcc_RecordBatch_blocks, error); + for (int64_t i = 0; i < n_blocks; i++) { + struct ns(Block) block = { + blocks[i].offset, + blocks[i].metadata_length, + blocks[i].body_length, + }; + flatcc_RecordBatch_blocks[i] = block; + } + FLATCC_RETURN_UNLESS_0(Footer_recordBatches_end(builder), error); + + FLATCC_RETURN_IF_NULL(ns(Footer_end_as_root(builder)), error); + return NANOARROW_OK; +} +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include +#include +#include +#include + +#include "nanoarrow/nanoarrow.h" +#include "nanoarrow/nanoarrow_ipc.h" + +// R 3.6 / Windows builds on a very old toolchain that does not define ENODATA +#if defined(_WIN32) && !defined(_MSC_VER) && !defined(ENODATA) +#define ENODATA 120 +#endif + +// Sentinel value to indicate that we haven't read a message yet +// and don't know the number of header prefix bytes to expect. +static const int32_t kExpectedHeaderPrefixSizeNotSet = -1; + +void ArrowIpcInputStreamMove(struct ArrowIpcInputStream* src, + struct ArrowIpcInputStream* dst) { + memcpy(dst, src, sizeof(struct ArrowIpcInputStream)); + src->release = NULL; +} + +struct ArrowIpcInputStreamBufferPrivate { + struct ArrowBuffer input; + int64_t cursor_bytes; +}; + +static ArrowErrorCode ArrowIpcInputStreamBufferRead(struct ArrowIpcInputStream* stream, + uint8_t* buf, int64_t buf_size_bytes, + int64_t* size_read_out, + struct ArrowError* error) { + NANOARROW_UNUSED(error); + + if (buf_size_bytes == 0) { + *size_read_out = 0; + return NANOARROW_OK; + } + + struct ArrowIpcInputStreamBufferPrivate* private_data = + (struct ArrowIpcInputStreamBufferPrivate*)stream->private_data; + int64_t bytes_remaining = private_data->input.size_bytes - private_data->cursor_bytes; + int64_t bytes_to_read; + if (bytes_remaining > buf_size_bytes) { + bytes_to_read = buf_size_bytes; + } else { + bytes_to_read = bytes_remaining; + } + + if (bytes_to_read > 0) { + memcpy(buf, private_data->input.data + private_data->cursor_bytes, bytes_to_read); + } + + *size_read_out = bytes_to_read; + private_data->cursor_bytes += bytes_to_read; + return NANOARROW_OK; +} + +static void ArrowIpcInputStreamBufferRelease(struct ArrowIpcInputStream* stream) { + struct ArrowIpcInputStreamBufferPrivate* private_data = + (struct ArrowIpcInputStreamBufferPrivate*)stream->private_data; + ArrowBufferReset(&private_data->input); + ArrowFree(private_data); + stream->release = NULL; +} + +ArrowErrorCode ArrowIpcInputStreamInitBuffer(struct ArrowIpcInputStream* stream, + struct ArrowBuffer* input) { + NANOARROW_DCHECK(stream != NULL); + + struct ArrowIpcInputStreamBufferPrivate* private_data = + (struct ArrowIpcInputStreamBufferPrivate*)ArrowMalloc( + sizeof(struct ArrowIpcInputStreamBufferPrivate)); + if (private_data == NULL) { + return ENOMEM; + } + + ArrowBufferMove(input, &private_data->input); + private_data->cursor_bytes = 0; + stream->read = &ArrowIpcInputStreamBufferRead; + stream->release = &ArrowIpcInputStreamBufferRelease; + stream->private_data = private_data; + + return NANOARROW_OK; +} + +struct ArrowIpcInputStreamFilePrivate { + FILE* file_ptr; + int stream_finished; + int close_on_release; +}; + +static void ArrowIpcInputStreamFileRelease(struct ArrowIpcInputStream* stream) { + struct ArrowIpcInputStreamFilePrivate* private_data = + (struct ArrowIpcInputStreamFilePrivate*)stream->private_data; + + if (private_data->file_ptr != NULL && private_data->close_on_release) { + fclose(private_data->file_ptr); + } + + ArrowFree(private_data); + stream->release = NULL; +} + +static ArrowErrorCode ArrowIpcInputStreamFileRead(struct ArrowIpcInputStream* stream, + uint8_t* buf, int64_t buf_size_bytes, + int64_t* size_read_out, + struct ArrowError* error) { + struct ArrowIpcInputStreamFilePrivate* private_data = + (struct ArrowIpcInputStreamFilePrivate*)stream->private_data; + + if (private_data->stream_finished) { + *size_read_out = 0; + return NANOARROW_OK; + } + + // Do the read + int64_t bytes_read = (int64_t)fread(buf, 1, buf_size_bytes, private_data->file_ptr); + *size_read_out = bytes_read; + + if (bytes_read != buf_size_bytes) { + private_data->stream_finished = 1; + + // Inspect error + int has_error = !feof(private_data->file_ptr) && ferror(private_data->file_ptr); + + // Try to close the file now + if (private_data->close_on_release) { + if (fclose(private_data->file_ptr) == 0) { + private_data->file_ptr = NULL; + } + } + + // Maybe return error + if (has_error) { + ArrowErrorSet(error, "ArrowIpcInputStreamFile IO error"); + return EIO; + } + } + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowIpcInputStreamInitFile(struct ArrowIpcInputStream* stream, + void* file_ptr, int close_on_release) { + NANOARROW_DCHECK(stream != NULL); + if (file_ptr == NULL) { + return errno ? errno : EINVAL; + } + + struct ArrowIpcInputStreamFilePrivate* private_data = + (struct ArrowIpcInputStreamFilePrivate*)ArrowMalloc( + sizeof(struct ArrowIpcInputStreamFilePrivate)); + if (private_data == NULL) { + return ENOMEM; + } + + private_data->file_ptr = (FILE*)file_ptr; + private_data->close_on_release = close_on_release; + private_data->stream_finished = 0; + + stream->read = &ArrowIpcInputStreamFileRead; + stream->release = &ArrowIpcInputStreamFileRelease; + stream->private_data = private_data; + return NANOARROW_OK; +} + +struct ArrowIpcArrayStreamReaderPrivate { + struct ArrowIpcInputStream input; + struct ArrowIpcDecoder decoder; + int use_shared_buffers; + struct ArrowSchema out_schema; + int64_t field_index; + struct ArrowBuffer header; + struct ArrowBuffer body; + int32_t expected_header_prefix_size; + struct ArrowError error; +}; + +static void ArrowIpcArrayStreamReaderRelease(struct ArrowArrayStream* stream) { + struct ArrowIpcArrayStreamReaderPrivate* private_data = + (struct ArrowIpcArrayStreamReaderPrivate*)stream->private_data; + + if (private_data->input.release != NULL) { + private_data->input.release(&private_data->input); + } + + ArrowIpcDecoderReset(&private_data->decoder); + + if (private_data->out_schema.release != NULL) { + ArrowSchemaRelease(&private_data->out_schema); + } + + ArrowBufferReset(&private_data->header); + ArrowBufferReset(&private_data->body); + + ArrowFree(private_data); + stream->release = NULL; +} + +static int ArrowIpcArrayStreamReaderNextHeader( + struct ArrowIpcArrayStreamReaderPrivate* private_data, + enum ArrowIpcMessageType message_type) { + private_data->header.size_bytes = 0; + int64_t bytes_read = 0; + + // Read 8 bytes (continuation + header size in bytes) + NANOARROW_RETURN_NOT_OK_WITH_ERROR(ArrowBufferReserve(&private_data->header, 8), + &private_data->error); + NANOARROW_RETURN_NOT_OK(private_data->input.read(&private_data->input, + private_data->header.data, 8, + &bytes_read, &private_data->error)); + private_data->header.size_bytes += bytes_read; + + if (bytes_read == 0) { + // The caller might not use this error message (e.g., if the end of the stream + // is one of the valid outcomes) but we set the error anyway in case it gets + // propagated higher (e.g., if the stream is empty and there's no schema message) + ArrowErrorSet(&private_data->error, "No data available on stream"); + return ENODATA; + } else if (bytes_read == 4 && private_data->expected_header_prefix_size == 4) { + // Special case very, very old IPC streams that used 0x00000000 as the + // end-of-stream indicator. We may want to remove this case at some point: + // https://github.com/apache/arrow-nanoarrow/issues/648 + uint32_t last_four_bytes = 0; + memcpy(&last_four_bytes, private_data->header.data, sizeof(uint32_t)); + if (last_four_bytes == 0) { + ArrowErrorSet(&private_data->error, "No data available on stream"); + return ENODATA; + } else { + ArrowErrorSet(&private_data->error, + "Expected 0x00000000 if exactly four bytes are available at the end " + "of a stream"); + return EINVAL; + } + } else if (bytes_read != 8) { + ArrowErrorSet(&private_data->error, + "Expected at least 8 bytes in remainder of stream"); + return EINVAL; + } + + struct ArrowBufferView input_view; + input_view.data.data = private_data->header.data; + input_view.size_bytes = private_data->header.size_bytes; + + // Use PeekHeader to fill in decoder.header_size_bytes + int32_t prefix_size_bytes = 0; + NANOARROW_RETURN_NOT_OK(ArrowIpcDecoderPeekHeader( + &private_data->decoder, input_view, &prefix_size_bytes, &private_data->error)); + + // Check for a consistent header prefix size + if (private_data->expected_header_prefix_size != kExpectedHeaderPrefixSizeNotSet && + prefix_size_bytes != private_data->expected_header_prefix_size) { + ArrowErrorSet(&private_data->error, + "Expected prefix %d prefix header bytes but found %d", + (int)private_data->expected_header_prefix_size, (int)prefix_size_bytes); + return EINVAL; + } else { + private_data->expected_header_prefix_size = prefix_size_bytes; + } + + // Legacy streams are missing the 0xFFFFFFFF at the start of the message. The + // decoder can handle this; however, verification will fail because flatbuffers + // must be 8-byte aligned. To handle this case, we prepend the continuation + // token to the start of the stream and ensure that we read four fewer bytes + // the next time we issue a read. We may be able to remove this case in the future: + // https://github.com/apache/arrow-nanoarrow/issues/648 + int64_t extra_bytes_already_read = 0; + if (prefix_size_bytes == 4) { + NANOARROW_RETURN_NOT_OK_WITH_ERROR(ArrowBufferReserve(&private_data->header, 4), + &private_data->error); + memmove(private_data->header.data + 4, private_data->header.data, + private_data->header.size_bytes); + uint32_t continuation = 0xFFFFFFFFU; + memcpy(private_data->header.data, &continuation, sizeof(uint32_t)); + private_data->header.size_bytes += 4; + extra_bytes_already_read = 4; + + input_view.data.data = private_data->header.data; + input_view.size_bytes = private_data->header.size_bytes; + + int32_t new_prefix_size_bytes; + NANOARROW_RETURN_NOT_OK(ArrowIpcDecoderPeekHeader(&private_data->decoder, input_view, + &new_prefix_size_bytes, + &private_data->error)); + NANOARROW_DCHECK(new_prefix_size_bytes == 8); + } + + // Read the header bytes + int64_t expected_header_bytes = private_data->decoder.header_size_bytes - 8; + NANOARROW_RETURN_NOT_OK_WITH_ERROR( + ArrowBufferReserve(&private_data->header, + expected_header_bytes - extra_bytes_already_read), + &private_data->error); + NANOARROW_RETURN_NOT_OK(private_data->input.read( + &private_data->input, private_data->header.data + private_data->header.size_bytes, + expected_header_bytes - extra_bytes_already_read, &bytes_read, + &private_data->error)); + private_data->header.size_bytes += bytes_read; + + // Verify + decode the header + input_view.data.data = private_data->header.data; + input_view.size_bytes = private_data->header.size_bytes; + NANOARROW_RETURN_NOT_OK(ArrowIpcDecoderVerifyHeader(&private_data->decoder, input_view, + &private_data->error)); + + // If we have a 4-byte header prefix, make sure the metadata version is V4 + // (Note that some V4 IPC files have an 8 byte header prefix). + if (prefix_size_bytes == 4 && + private_data->decoder.metadata_version != NANOARROW_IPC_METADATA_VERSION_V4) { + ArrowErrorSet(&private_data->error, + "Header prefix size of four bytes is only allowed for V4 metadata"); + return EINVAL; + } + + // Don't decode the message if it's of the wrong type (because the error message + // is better communicated by the caller) + if (private_data->decoder.message_type != message_type) { + return NANOARROW_OK; + } + + NANOARROW_RETURN_NOT_OK(ArrowIpcDecoderDecodeHeader(&private_data->decoder, input_view, + &private_data->error)); + return NANOARROW_OK; +} + +static int ArrowIpcArrayStreamReaderNextBody( + struct ArrowIpcArrayStreamReaderPrivate* private_data) { + int64_t bytes_read; + int64_t bytes_to_read = private_data->decoder.body_size_bytes; + + // Read the body bytes + private_data->body.size_bytes = 0; + NANOARROW_RETURN_NOT_OK_WITH_ERROR( + ArrowBufferReserve(&private_data->body, bytes_to_read), &private_data->error); + NANOARROW_RETURN_NOT_OK(private_data->input.read(&private_data->input, + private_data->body.data, bytes_to_read, + &bytes_read, &private_data->error)); + private_data->body.size_bytes += bytes_read; + + if (bytes_read != bytes_to_read) { + ArrowErrorSet(&private_data->error, + "Expected to be able to read %" PRId64 + " bytes for message body but got %" PRId64, + bytes_to_read, bytes_read); + return ESPIPE; + } else { + return NANOARROW_OK; + } +} + +static int ArrowIpcArrayStreamReaderReadSchemaIfNeeded( + struct ArrowIpcArrayStreamReaderPrivate* private_data) { + if (private_data->out_schema.release != NULL) { + return NANOARROW_OK; + } + + NANOARROW_RETURN_NOT_OK(ArrowIpcArrayStreamReaderNextHeader( + private_data, NANOARROW_IPC_MESSAGE_TYPE_SCHEMA)); + + // Error if this isn't a schema message + if (private_data->decoder.message_type != NANOARROW_IPC_MESSAGE_TYPE_SCHEMA) { + ArrowErrorSet(&private_data->error, + "Unexpected message type at start of input (expected Schema)"); + return EINVAL; + } + + // ...or if it uses features we don't support + if (private_data->decoder.feature_flags & NANOARROW_IPC_FEATURE_COMPRESSED_BODY) { + ArrowErrorSet(&private_data->error, + "This stream uses unsupported feature COMPRESSED_BODY"); + return EINVAL; + } + + if (private_data->decoder.feature_flags & + NANOARROW_IPC_FEATURE_DICTIONARY_REPLACEMENT) { + ArrowErrorSet(&private_data->error, + "This stream uses unsupported feature DICTIONARY_REPLACEMENT"); + return EINVAL; + } + + // Notify the decoder of buffer endianness + NANOARROW_RETURN_NOT_OK_WITH_ERROR( + ArrowIpcDecoderSetEndianness(&private_data->decoder, + private_data->decoder.endianness), + &private_data->error); + + struct ArrowSchema tmp; + NANOARROW_RETURN_NOT_OK( + ArrowIpcDecoderDecodeSchema(&private_data->decoder, &tmp, &private_data->error)); + + // Only support "read the whole thing" for now + if (private_data->field_index != -1) { + ArrowSchemaRelease(&tmp); + ArrowErrorSet(&private_data->error, "Field index != -1 is not yet supported"); + return ENOTSUP; + } + + // Notify the decoder of the schema for forthcoming messages + int result = + ArrowIpcDecoderSetSchema(&private_data->decoder, &tmp, &private_data->error); + if (result != NANOARROW_OK) { + ArrowSchemaRelease(&tmp); + return result; + } + + ArrowSchemaMove(&tmp, &private_data->out_schema); + return NANOARROW_OK; +} + +static int ArrowIpcArrayStreamReaderGetSchema(struct ArrowArrayStream* stream, + struct ArrowSchema* out) { + struct ArrowIpcArrayStreamReaderPrivate* private_data = + (struct ArrowIpcArrayStreamReaderPrivate*)stream->private_data; + private_data->error.message[0] = '\0'; + NANOARROW_RETURN_NOT_OK(ArrowIpcArrayStreamReaderReadSchemaIfNeeded(private_data)); + return ArrowSchemaDeepCopy(&private_data->out_schema, out); +} + +static int ArrowIpcArrayStreamReaderGetNext(struct ArrowArrayStream* stream, + struct ArrowArray* out) { + struct ArrowIpcArrayStreamReaderPrivate* private_data = + (struct ArrowIpcArrayStreamReaderPrivate*)stream->private_data; + ArrowErrorInit(&private_data->error); + NANOARROW_RETURN_NOT_OK(ArrowIpcArrayStreamReaderReadSchemaIfNeeded(private_data)); + + // Read + decode the next header + int result = ArrowIpcArrayStreamReaderNextHeader( + private_data, NANOARROW_IPC_MESSAGE_TYPE_RECORD_BATCH); + if (result == ENODATA) { + // Stream is finished either because there is no input or because + // end of stream bytes were read. + out->release = NULL; + return NANOARROW_OK; + } else if (result != NANOARROW_OK) { + // Other error + return result; + } + + // Make sure we have a RecordBatch message + if (private_data->decoder.message_type != NANOARROW_IPC_MESSAGE_TYPE_RECORD_BATCH) { + ArrowErrorSet(&private_data->error, "Unexpected message type (expected RecordBatch)"); + return EINVAL; + } + + // Read in the body + NANOARROW_RETURN_NOT_OK(ArrowIpcArrayStreamReaderNextBody(private_data)); + + struct ArrowArray tmp; + + if (private_data->use_shared_buffers) { + struct ArrowIpcSharedBuffer shared; + NANOARROW_RETURN_NOT_OK_WITH_ERROR( + ArrowIpcSharedBufferInit(&shared, &private_data->body), &private_data->error); + result = ArrowIpcDecoderDecodeArrayFromShared( + &private_data->decoder, &shared, private_data->field_index, &tmp, + NANOARROW_VALIDATION_LEVEL_FULL, &private_data->error); + ArrowIpcSharedBufferReset(&shared); + NANOARROW_RETURN_NOT_OK(result); + } else { + struct ArrowBufferView body_view; + body_view.data.data = private_data->body.data; + body_view.size_bytes = private_data->body.size_bytes; + + NANOARROW_RETURN_NOT_OK(ArrowIpcDecoderDecodeArray( + &private_data->decoder, body_view, private_data->field_index, &tmp, + NANOARROW_VALIDATION_LEVEL_FULL, &private_data->error)); + } + + ArrowArrayMove(&tmp, out); + return NANOARROW_OK; +} + +static const char* ArrowIpcArrayStreamReaderGetLastError( + struct ArrowArrayStream* stream) { + struct ArrowIpcArrayStreamReaderPrivate* private_data = + (struct ArrowIpcArrayStreamReaderPrivate*)stream->private_data; + return private_data->error.message; +} + +ArrowErrorCode ArrowIpcArrayStreamReaderInit( + struct ArrowArrayStream* out, struct ArrowIpcInputStream* input_stream, + struct ArrowIpcArrayStreamReaderOptions* options) { + struct ArrowIpcArrayStreamReaderPrivate* private_data = + (struct ArrowIpcArrayStreamReaderPrivate*)ArrowMalloc( + sizeof(struct ArrowIpcArrayStreamReaderPrivate)); + if (private_data == NULL) { + return ENOMEM; + } + + int result = ArrowIpcDecoderInit(&private_data->decoder); + if (result != NANOARROW_OK) { + ArrowFree(private_data); + return result; + } + + ArrowBufferInit(&private_data->header); + ArrowBufferInit(&private_data->body); + private_data->out_schema.release = NULL; + ArrowIpcInputStreamMove(input_stream, &private_data->input); + private_data->expected_header_prefix_size = kExpectedHeaderPrefixSizeNotSet; + + if (options != NULL) { + private_data->field_index = options->field_index; + private_data->use_shared_buffers = options->use_shared_buffers; + } else { + private_data->field_index = -1; + private_data->use_shared_buffers = ArrowIpcSharedBufferIsThreadSafe(); + } + + out->private_data = private_data; + out->get_schema = &ArrowIpcArrayStreamReaderGetSchema; + out->get_next = &ArrowIpcArrayStreamReaderGetNext; + out->get_last_error = &ArrowIpcArrayStreamReaderGetLastError; + out->release = &ArrowIpcArrayStreamReaderRelease; + + return NANOARROW_OK; +} +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include +#include +#include + +#include "flatcc/flatcc_builder.h" + +#include "nanoarrow/nanoarrow.h" +#include "nanoarrow/nanoarrow_ipc.h" + +#define ns(x) FLATBUFFERS_WRAP_NAMESPACE(org_apache_arrow_flatbuf, x) + +void ArrowIpcOutputStreamMove(struct ArrowIpcOutputStream* src, + struct ArrowIpcOutputStream* dst) { + NANOARROW_DCHECK(src != NULL && dst != NULL); + + memcpy(dst, src, sizeof(struct ArrowIpcOutputStream)); + src->release = NULL; +} + +ArrowErrorCode ArrowIpcOutputStreamWrite(struct ArrowIpcOutputStream* stream, + struct ArrowBufferView data, + struct ArrowError* error) { + while (data.size_bytes != 0) { + int64_t bytes_written = 0; + NANOARROW_RETURN_NOT_OK(stream->write(stream, data.data.as_uint8, data.size_bytes, + &bytes_written, error)); + data.size_bytes -= bytes_written; + data.data.as_uint8 += bytes_written; + } + return NANOARROW_OK; +} + +struct ArrowIpcOutputStreamBufferPrivate { + struct ArrowBuffer* output; +}; + +static ArrowErrorCode ArrowIpcOutputStreamBufferWrite(struct ArrowIpcOutputStream* stream, + const void* buf, + int64_t buf_size_bytes, + int64_t* size_written_out, + struct ArrowError* error) { + struct ArrowIpcOutputStreamBufferPrivate* private_data = + (struct ArrowIpcOutputStreamBufferPrivate*)stream->private_data; + NANOARROW_RETURN_NOT_OK_WITH_ERROR( + ArrowBufferAppend(private_data->output, buf, buf_size_bytes), error); + *size_written_out = buf_size_bytes; + return NANOARROW_OK; +} + +static void ArrowIpcOutputStreamBufferRelease(struct ArrowIpcOutputStream* stream) { + struct ArrowIpcOutputStreamBufferPrivate* private_data = + (struct ArrowIpcOutputStreamBufferPrivate*)stream->private_data; + ArrowFree(private_data); + stream->release = NULL; +} + +ArrowErrorCode ArrowIpcOutputStreamInitBuffer(struct ArrowIpcOutputStream* stream, + struct ArrowBuffer* output) { + NANOARROW_DCHECK(stream != NULL && output != NULL); + + struct ArrowIpcOutputStreamBufferPrivate* private_data = + (struct ArrowIpcOutputStreamBufferPrivate*)ArrowMalloc( + sizeof(struct ArrowIpcOutputStreamBufferPrivate)); + if (private_data == NULL) { + return ENOMEM; + } + + private_data->output = output; + stream->write = &ArrowIpcOutputStreamBufferWrite; + stream->release = &ArrowIpcOutputStreamBufferRelease; + stream->private_data = private_data; + + return NANOARROW_OK; +} + +struct ArrowIpcOutputStreamFilePrivate { + FILE* file_ptr; + int stream_finished; + int close_on_release; +}; + +static void ArrowIpcOutputStreamFileRelease(struct ArrowIpcOutputStream* stream) { + struct ArrowIpcOutputStreamFilePrivate* private_data = + (struct ArrowIpcOutputStreamFilePrivate*)stream->private_data; + + if (private_data->file_ptr != NULL && private_data->close_on_release) { + fclose(private_data->file_ptr); + } + + ArrowFree(private_data); + stream->release = NULL; +} + +static ArrowErrorCode ArrowIpcOutputStreamFileWrite(struct ArrowIpcOutputStream* stream, + const void* buf, + int64_t buf_size_bytes, + int64_t* size_written_out, + struct ArrowError* error) { + struct ArrowIpcOutputStreamFilePrivate* private_data = + (struct ArrowIpcOutputStreamFilePrivate*)stream->private_data; + + if (private_data->stream_finished) { + *size_written_out = 0; + return NANOARROW_OK; + } + + // Do the write + int64_t bytes_written = (int64_t)fwrite(buf, 1, buf_size_bytes, private_data->file_ptr); + *size_written_out = bytes_written; + + if (bytes_written != buf_size_bytes) { + private_data->stream_finished = 1; + + // Inspect error + int has_error = !feof(private_data->file_ptr) && ferror(private_data->file_ptr); + + // Try to close the file now + if (private_data->close_on_release) { + if (fclose(private_data->file_ptr) == 0) { + private_data->file_ptr = NULL; + } + } + + // Maybe return error + if (has_error) { + ArrowErrorSet(error, "ArrowIpcOutputStreamFile IO error"); + return EIO; + } + } + + return NANOARROW_OK; +} + +ArrowErrorCode ArrowIpcOutputStreamInitFile(struct ArrowIpcOutputStream* stream, + void* file_ptr, int close_on_release) { + NANOARROW_DCHECK(stream != NULL); + if (file_ptr == NULL) { + return errno ? errno : EINVAL; + } + + struct ArrowIpcOutputStreamFilePrivate* private_data = + (struct ArrowIpcOutputStreamFilePrivate*)ArrowMalloc( + sizeof(struct ArrowIpcOutputStreamFilePrivate)); + if (private_data == NULL) { + return ENOMEM; + } + + private_data->file_ptr = (FILE*)file_ptr; + private_data->close_on_release = close_on_release; + private_data->stream_finished = 0; + + stream->write = &ArrowIpcOutputStreamFileWrite; + stream->release = &ArrowIpcOutputStreamFileRelease; + stream->private_data = private_data; + return NANOARROW_OK; +} + +struct ArrowIpcWriterPrivate { + struct ArrowIpcEncoder encoder; + struct ArrowIpcOutputStream output_stream; + struct ArrowBuffer buffer; + struct ArrowBuffer body_buffer; + + int writing_file; + int64_t bytes_written; + struct ArrowIpcFooter footer; +}; + +ArrowErrorCode ArrowIpcWriterInit(struct ArrowIpcWriter* writer, + struct ArrowIpcOutputStream* output_stream) { + NANOARROW_DCHECK(writer != NULL && output_stream != NULL); + + struct ArrowIpcWriterPrivate* private = + (struct ArrowIpcWriterPrivate*)ArrowMalloc(sizeof(struct ArrowIpcWriterPrivate)); + + if (private == NULL) { + return ENOMEM; + } + NANOARROW_RETURN_NOT_OK(ArrowIpcEncoderInit(&private->encoder)); + ArrowIpcOutputStreamMove(output_stream, &private->output_stream); + + ArrowBufferInit(&private->buffer); + ArrowBufferInit(&private->body_buffer); + + private->writing_file = 0; + private->bytes_written = 0; + ArrowIpcFooterInit(&private->footer); + + writer->private_data = private; + return NANOARROW_OK; +} + +void ArrowIpcWriterReset(struct ArrowIpcWriter* writer) { + NANOARROW_DCHECK(writer != NULL); + + struct ArrowIpcWriterPrivate* private = + (struct ArrowIpcWriterPrivate*)writer->private_data; + + if (private != NULL) { + ArrowIpcEncoderReset(&private->encoder); + private->output_stream.release(&private->output_stream); + ArrowBufferReset(&private->buffer); + ArrowBufferReset(&private->body_buffer); + + ArrowIpcFooterReset(&private->footer); + + ArrowFree(private); + } + memset(writer, 0, sizeof(struct ArrowIpcWriter)); +} + +static struct ArrowBufferView ArrowBufferToBufferView(const struct ArrowBuffer* buffer) { + struct ArrowBufferView buffer_view = { + .data.as_uint8 = buffer->data, + .size_bytes = buffer->size_bytes, + }; + return buffer_view; +} + +// Eventually, it may be necessary to construct an ArrowIpcWriter which doesn't rely on +// blocking writes (ArrowIpcOutputStreamWrite). For example an ArrowIpcOutputStream +// might wrap a socket which is not always able to transmit all bytes of a Message. In +// that case users of ArrowIpcWriter might prefer to do other work until a socket is +// ready rather than blocking, or timeout, or otherwise respond to partial transmission. +// +// This could be handled by: +// - keeping partially sent buffers internal and signalling incomplete transmission by +// raising EAGAIN, returning "bytes actually written", ... +// - when the caller is ready to try again, call ArrowIpcWriterWriteSome() +// - exposing internal buffers which have not been completely sent, deferring +// follow-up transmission to the caller + +ArrowErrorCode ArrowIpcWriterWriteSchema(struct ArrowIpcWriter* writer, + const struct ArrowSchema* in, + struct ArrowError* error) { + NANOARROW_DCHECK(writer != NULL && writer->private_data != NULL && in != NULL); + struct ArrowIpcWriterPrivate* private = + (struct ArrowIpcWriterPrivate*)writer->private_data; + + NANOARROW_ASSERT_OK(ArrowBufferResize(&private->buffer, 0, 0)); + + NANOARROW_RETURN_NOT_OK(ArrowIpcEncoderEncodeSchema(&private->encoder, in, error)); + NANOARROW_RETURN_NOT_OK_WITH_ERROR( + ArrowIpcEncoderFinalizeBuffer(&private->encoder, /*encapsulate=*/1, + &private->buffer), + error); + + if (private->writing_file) { + NANOARROW_RETURN_NOT_OK_WITH_ERROR(ArrowSchemaDeepCopy(in, &private->footer.schema), + error); + } + private->bytes_written += private->buffer.size_bytes; + + return ArrowIpcOutputStreamWrite(&private->output_stream, + ArrowBufferToBufferView(&private->buffer), error); +} + +ArrowErrorCode ArrowIpcWriterWriteArrayView(struct ArrowIpcWriter* writer, + const struct ArrowArrayView* in, + struct ArrowError* error) { + NANOARROW_DCHECK(writer != NULL && writer->private_data != NULL); + struct ArrowIpcWriterPrivate* private = + (struct ArrowIpcWriterPrivate*)writer->private_data; + + if (in == NULL) { + int32_t eos[] = {-1, 0}; + private->bytes_written += sizeof(eos); + struct ArrowBufferView eos_view = {.data.as_int32 = eos, .size_bytes = sizeof(eos)}; + return ArrowIpcOutputStreamWrite(&private->output_stream, eos_view, error); + } + + NANOARROW_ASSERT_OK(ArrowBufferResize(&private->buffer, 0, 0)); + NANOARROW_ASSERT_OK(ArrowBufferResize(&private->body_buffer, 0, 0)); + + NANOARROW_RETURN_NOT_OK(ArrowIpcEncoderEncodeSimpleRecordBatch( + &private->encoder, in, &private->body_buffer, error)); + NANOARROW_RETURN_NOT_OK_WITH_ERROR( + ArrowIpcEncoderFinalizeBuffer(&private->encoder, /*encapsulate=*/1, + &private->buffer), + error); + + if (private->writing_file) { + _NANOARROW_CHECK_RANGE(private->buffer.size_bytes, 0, INT32_MAX); + struct ArrowIpcFileBlock block = { + .offset = private->bytes_written, + .metadata_length = (int32_t) private->buffer.size_bytes, + .body_length = private->body_buffer.size_bytes, + }; + NANOARROW_RETURN_NOT_OK_WITH_ERROR( + ArrowBufferAppend(&private->footer.record_batch_blocks, &block, sizeof(block)), + error); + } + private->bytes_written += private->buffer.size_bytes; + private->bytes_written += private->body_buffer.size_bytes; + + NANOARROW_RETURN_NOT_OK(ArrowIpcOutputStreamWrite( + &private->output_stream, ArrowBufferToBufferView(&private->buffer), error)); + NANOARROW_RETURN_NOT_OK(ArrowIpcOutputStreamWrite( + &private->output_stream, ArrowBufferToBufferView(&private->body_buffer), error)); + return NANOARROW_OK; +} + +static ArrowErrorCode ArrowIpcWriterWriteArrayStreamImpl( + struct ArrowIpcWriter* writer, struct ArrowArrayStream* in, + struct ArrowSchema* schema, struct ArrowArray* array, + struct ArrowArrayView* array_view, struct ArrowError* error) { + NANOARROW_RETURN_NOT_OK(ArrowArrayStreamGetSchema(in, schema, error)); + NANOARROW_RETURN_NOT_OK(ArrowIpcWriterWriteSchema(writer, schema, error)); + + NANOARROW_RETURN_NOT_OK(ArrowArrayViewInitFromSchema(array_view, schema, error)); + while (1) { + NANOARROW_RETURN_NOT_OK(ArrowArrayStreamGetNext(in, array, error)); + if (array->release == NULL) { + break; + } + + NANOARROW_RETURN_NOT_OK(ArrowArrayViewSetArray(array_view, array, error)); + NANOARROW_RETURN_NOT_OK(ArrowIpcWriterWriteArrayView(writer, array_view, error)); + ArrowArrayRelease(array); + } + + // The stream is complete, signal the end to the caller + return ArrowIpcWriterWriteArrayView(writer, NULL, error); +} + +ArrowErrorCode ArrowIpcWriterWriteArrayStream(struct ArrowIpcWriter* writer, + struct ArrowArrayStream* in, + struct ArrowError* error) { + NANOARROW_DCHECK(writer != NULL && writer->private_data != NULL && in != NULL); + + struct ArrowSchema schema = {.release = NULL}; + struct ArrowArray array = {.release = NULL}; + struct ArrowArrayView array_view; + ArrowArrayViewInitFromType(&array_view, NANOARROW_TYPE_UNINITIALIZED); + + ArrowErrorCode result = + ArrowIpcWriterWriteArrayStreamImpl(writer, in, &schema, &array, &array_view, error); + + if (schema.release != NULL) { + ArrowSchemaRelease(&schema); + } + + if (array.release != NULL) { + ArrowArrayRelease(&array); + } + + ArrowArrayViewReset(&array_view); + + return result; +} + +#define NANOARROW_IPC_FILE_PADDED_MAGIC "ARROW1\0" + +ArrowErrorCode ArrowIpcWriterStartFile(struct ArrowIpcWriter* writer, + struct ArrowError* error) { + NANOARROW_DCHECK(writer != NULL && writer->private_data != NULL); + + struct ArrowIpcWriterPrivate* private = + (struct ArrowIpcWriterPrivate*)writer->private_data; + + NANOARROW_DCHECK(!private->writing_file && private->bytes_written == 0); + + struct ArrowBufferView magic = { + .data.data = NANOARROW_IPC_FILE_PADDED_MAGIC, + .size_bytes = sizeof(NANOARROW_IPC_FILE_PADDED_MAGIC), + }; + NANOARROW_RETURN_NOT_OK( + ArrowIpcOutputStreamWrite(&private->output_stream, magic, error)); + + private->writing_file = 1; + private->bytes_written = magic.size_bytes; + return NANOARROW_OK; +} + +ArrowErrorCode ArrowIpcWriterFinalizeFile(struct ArrowIpcWriter* writer, + struct ArrowError* error) { + NANOARROW_DCHECK(writer != NULL && writer->private_data != NULL); + + struct ArrowIpcWriterPrivate* private = + (struct ArrowIpcWriterPrivate*)writer->private_data; + + NANOARROW_DCHECK(private->writing_file); + + NANOARROW_ASSERT_OK(ArrowBufferResize(&private->buffer, 0, 0)); + NANOARROW_RETURN_NOT_OK( + ArrowIpcEncoderEncodeFooter(&private->encoder, &private->footer, error)); + NANOARROW_RETURN_NOT_OK_WITH_ERROR( + ArrowIpcEncoderFinalizeBuffer(&private->encoder, /*encapsulate=*/0, + &private->buffer), + error); + + _NANOARROW_CHECK_RANGE(private->buffer.size_bytes, 0, INT32_MAX); + int32_t size = (int32_t) private->buffer.size_bytes; + // we don't pad the magic at the end of the file + struct ArrowStringView unpadded_magic = ArrowCharView(NANOARROW_IPC_FILE_PADDED_MAGIC); + NANOARROW_DCHECK(unpadded_magic.size_bytes == 6); + + // just append to private->buffer instead of queueing two more tiny writes + NANOARROW_RETURN_NOT_OK_WITH_ERROR( + ArrowBufferReserve(&private->buffer, sizeof(size) + unpadded_magic.size_bytes), + error); + + if (ArrowIpcSystemEndianness() == NANOARROW_IPC_ENDIANNESS_BIG) { + size = (int32_t)bswap32((uint32_t)size); + } + NANOARROW_ASSERT_OK(ArrowBufferAppendInt32(&private->buffer, size)); + NANOARROW_ASSERT_OK(ArrowBufferAppendStringView(&private->buffer, unpadded_magic)); + + NANOARROW_RETURN_NOT_OK(ArrowIpcOutputStreamWrite( + &private->output_stream, ArrowBufferToBufferView(&private->buffer), error)); + private->bytes_written += private->buffer.size_bytes; + return NANOARROW_OK; +} diff --git a/CMakeLists.txt b/CMakeLists.txt index a7c434b..28c78b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,15 +50,15 @@ set(SOURCE_FILES include_directories("${ERTS_INCLUDE_DIR}") include_directories("${ADBC_SRC}/c/include") - -add_subdirectory("${ADBC_SRC}/c/vendor/nanoarrow") -include_directories("${ADBC_SRC}/c/vendor") +include_directories("${NANOARROW_SRC}") add_library(adbc_nif SHARED + "${NANOARROW_SRC}/nanoarrow.c" + "${NANOARROW_SRC}/flatcc.c" + "${NANOARROW_SRC}/nanoarrow_ipc.c" ${SOURCE_FILES} ) target_link_libraries(adbc_nif PUBLIC AdbcDriverManager::adbc_driver_manager_shared) -target_link_libraries(adbc_nif PUBLIC nanoarrow) install( TARGETS adbc_nif RUNTIME DESTINATION "${PRIV_DIR}" diff --git a/Makefile b/Makefile index 50cfc66..a1a9806 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ NIF_SO = $(PRIV_DIR)/adbc_nif.so NIF_SO_REL = $(NIF_SO:$(shell pwd)/%=%) THIRD_PARTY_DIR = $(shell pwd)/3rd_party ADBC_SRC = $(THIRD_PARTY_DIR)/apache-arrow-adbc +NANOARROW_SRC = $(THIRD_PARTY_DIR)/nanoarrow ADBC_C_SRC = $(ADBC_SRC)/c UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Linux) @@ -92,6 +93,7 @@ $(NIF_SO_REL): priv_dir adbc $(C_SRC_REL)/adbc_nif_resource.hpp $(C_SRC_REL)/adb -D CMAKE_BUILD_TYPE="$(CMAKE_BUILD_TYPE)" \ -D C_SRC="$(C_SRC)" \ -D ADBC_SRC="$(ADBC_SRC)" \ + -D NANOARROW_SRC="$(NANOARROW_SRC)" \ -D MIX_APP_PATH="$(MIX_APP_PATH)" \ -D PRIV_DIR="$(PRIV_DIR)" \ -D ERTS_INCLUDE_DIR="$(ERTS_INCLUDE_DIR)" \ diff --git a/UPDATE.md b/UPDATE.md new file mode 100644 index 0000000..ac3fcd2 --- /dev/null +++ b/UPDATE.md @@ -0,0 +1,20 @@ +## Update + +### nanoarrow + +To update the bundled nanoarrow, run the following command: + +```bash +git clone https://github.com/apache/arrow-nanoarrow.git +cd arrow-nanoarrow +git checkout apache-arrow-nanoarrow-0.6.0 +cd .. + +rm -rf 3rd_party/nanoarrow +python3 arrow-nanoarrow/ci/scripts/bundle.py \ + --source-output-dir=3rd_party/nanoarrow \ + --include-output-dir=3rd_party/nanoarrow \ + --symbol-namespace=ElixirAdbc \ + --with-ipc \ + --with-flatcc +``` diff --git a/c_src/adbc_nif.cpp b/c_src/adbc_nif.cpp index 40a8e7c..931bec6 100644 --- a/c_src/adbc_nif.cpp +++ b/c_src/adbc_nif.cpp @@ -1,9 +1,11 @@ #include #include #include +#include +#include +#include #include #include -#include #include "adbc_nif_resource.hpp" #include "nif_utils.hpp" #include "adbc_consts.h" @@ -18,6 +20,15 @@ template<> ErlNifResourceType * NifRes::type = nullptr; template<> ErlNifResourceType * NifRes::type = nullptr; template<> ErlNifResourceType * NifRes::type = nullptr; +static ERL_NIF_TERM nif_error_from_arrow_error(ErlNifEnv *env, struct ArrowError * arrow_error) { + return erlang::nif::error(env, enif_make_tuple4(env, + kAtomAdbcError, + erlang::nif::make_binary(env, arrow_error->message), + kAtomNil, + kAtomNil + )); +} + static ERL_NIF_TERM nif_error_from_adbc_error(ErlNifEnv *env, struct AdbcError * adbc_error) { char const* message = (adbc_error->message == nullptr) ? "unknown error" : adbc_error->message; ERL_NIF_TERM nif_error = erlang::nif::error(env, enif_make_tuple4(env, @@ -810,6 +821,173 @@ static ERL_NIF_TERM adbc_statement_bind_stream(ErlNifEnv *env, int argc, const E return erlang::nif::ok(env); } +static ERL_NIF_TERM adbc_ipc_load_binary(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) { + struct ArrowIpcDecoder decoder{}; + struct ArrowError arrow_error{}; + struct ArrowBufferView data{}; + ERL_NIF_TERM error{}; + std::vector out_terms; + + ErlNifBinary binary{}; + if (!erlang::nif::get(env, argv[0], &binary)) { + return enif_make_badarg(env); + } + data.data.as_uint8 = binary.data; + data.size_bytes = binary.size; + + ArrowErrorCode code = ArrowIpcDecoderInit(&decoder); + if (code != NANOARROW_OK) { + return erlang::nif::error(env, "failed to initialize Arrow IPC decoder"); + } + + code = ArrowIpcDecoderVerifyHeader(&decoder, data, &arrow_error); + if (code != NANOARROW_OK) { + ArrowIpcDecoderReset(&decoder); + return nif_error_from_arrow_error(env, &arrow_error); + } + + code = ArrowIpcDecoderDecodeHeader(&decoder, data, &arrow_error); + if (code != NANOARROW_OK) { + ArrowIpcDecoderReset(&decoder); + return nif_error_from_arrow_error(env, &arrow_error); + } + + struct ArrowSchema schema{}; + code = ArrowIpcDecoderDecodeSchema(&decoder, &schema, &arrow_error); + if (code != NANOARROW_OK) { + ArrowIpcDecoderReset(&decoder); + return nif_error_from_arrow_error(env, &arrow_error); + } + + struct ArrowBufferView body{}; + body.data.as_uint8 = data.data.as_uint8 + decoder.header_size_bytes; + body.size_bytes = binary.size - decoder.header_size_bytes; + printf("body.size_bytes: %zu\n", body.size_bytes); + printf("decoder.header_size_bytes: %zu\n", decoder.header_size_bytes); + printf("decoder.body_size_bytes: %zu\n", decoder.body_size_bytes); + + struct ArrowArray array{}; + code = ArrowIpcDecoderDecodeArray(&decoder, data, 0, &array, NANOARROW_VALIDATION_LEVEL_MINIMAL, &arrow_error); + if (code != NANOARROW_OK) { + ArrowIpcDecoderReset(&decoder); + return nif_error_from_arrow_error(env, &arrow_error); + } + + code = arrow_schema_to_nif_term(env, &schema, &array, out_terms, error); + // the outter array should be released because we have moved the values + // for each column to the corresponding reference in `Adbc.Column.data` + if (array.release) { + array.release(&array); + } + + ArrowIpcDecoderReset(&decoder); + + if (code != 0) { + // error is already set in arrow_schema_to_nif_term + // we don't need to release the schema in private data here + // it will be released when the stream resource is GC'd + return error; + } else { + return erlang::nif::ok(env, out_terms[0]); + } +} + +static ERL_NIF_TERM adbc_ipc_dump_binary(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) { + if (!enif_is_list(env, argv[0])) { + return enif_make_badarg(env); + } + + AdbcStatusCode code{}; + // struct ArrowArray values{}; + struct ArrowSchema schema{}; + struct ArrowError arrow_error{}; + nanoarrow::UniqueBuffer output; + nanoarrow::ipc::UniqueOutputStream stream; + code = ArrowIpcOutputStreamInitBuffer(stream.get(), output.get()); + if (code != NANOARROW_OK) { + return erlang::nif::error(env, "Failed to initialize Arrow IPC output stream and buffer"); + } + + nanoarrow::ipc::UniqueWriter writer; + code = ArrowIpcWriterInit(writer.get(), stream.get()); + if (code != NANOARROW_OK) { + return erlang::nif::error(env, "Failed to initialize Arrow IPC writer"); + } + + // values.release = nullptr; + schema.release = nullptr; + nanoarrow::UniqueArray array; + nanoarrow::UniqueArrayView array_view; + + ERL_NIF_TERM ret{}; + if (adbc_column_to_arrow_type_struct(env, argv[0], array.get(), &schema, &arrow_error)) { + ret = erlang::nif::error(env, arrow_error.message); + goto cleanup; + } + + code = ArrowArrayViewInitFromSchema(array_view.get(), &schema, &arrow_error); + if (code != NANOARROW_OK) { + ret = nif_error_from_arrow_error(env, &arrow_error); + goto cleanup; + } + + code = ArrowArrayViewSetArray(array_view.get(), array.get(), &arrow_error); + if (code != NANOARROW_OK) { + ret = nif_error_from_arrow_error(env, &arrow_error); + goto cleanup; + } + + printf("before ArrowIpcWriterWriteSchema: %lld\n", output->size_bytes); + code = ArrowIpcWriterWriteSchema(writer.get(), &schema, &arrow_error); + if (code != NANOARROW_OK) { + ret = nif_error_from_arrow_error(env, &arrow_error); + goto cleanup; + } + printf("after ArrowIpcWriterWriteSchema: %lld\n", output->size_bytes); + + code = ArrowIpcWriterWriteArrayView(writer.get(), array_view.get(), &arrow_error); + if (code != NANOARROW_OK) { + ret = nif_error_from_arrow_error(env, &arrow_error); + goto cleanup; + } + printf("after ArrowIpcWriterWriteArrayView: %lld\n", output->size_bytes); + + // write `nullptr` to end the stream + code = ArrowIpcWriterWriteArrayView(writer.get(), nullptr, &arrow_error); + if (code != NANOARROW_OK) { + ret = nif_error_from_arrow_error(env, &arrow_error); + goto cleanup; + } + + // code = ArrowIpcEncoderEncodeSimpleRecordBatch(&encoder, array_view.get(), output.get(), &arrow_error); + // if (code != NANOARROW_OK) { + // ret = nif_error_from_arrow_error(env, &arrow_error); + // goto cleanup; + // } + + // code = ArrowIpcEncoderFinalizeBuffer(&encoder, true, output.get()); + // if (code != NANOARROW_OK) { + // ret = nif_error_from_arrow_error(env, &arrow_error); + // goto cleanup; + // } + + ErlNifBinary binary; + if (!enif_alloc_binary(output->size_bytes, &binary)) { + ret = erlang::nif::error(env, "out of memory"); + goto cleanup; + } + + memcpy(binary.data, output->data, output->size_bytes); + ArrowIpcWriterReset(writer.get()); + + ret = erlang::nif::ok(env, enif_make_binary(env, &binary)); + +cleanup: + // if (values.release) values.release(&values); + if (schema.release) schema.release(&schema); + return ret; +} + static int on_load(ErlNifEnv *env, void **, ERL_NIF_TERM) { ErlNifResourceType *rt; @@ -1017,6 +1195,9 @@ static ErlNifFunc nif_functions[] = { {"adbc_arrow_array_stream_release", 1, adbc_arrow_array_stream_release, ERL_NIF_DIRTY_JOB_IO_BOUND}, {"adbc_column_materialize", 1, adbc_column_materialize, ERL_NIF_DIRTY_JOB_CPU_BOUND}, + + {"adbc_ipc_load_binary", 1, adbc_ipc_load_binary, ERL_NIF_DIRTY_JOB_CPU_BOUND}, + {"adbc_ipc_dump_binary", 1, adbc_ipc_dump_binary, ERL_NIF_DIRTY_JOB_CPU_BOUND}, }; ERL_NIF_INIT(Elixir.Adbc.Nif, nif_functions, on_load, on_reload, on_upgrade, NULL); diff --git a/c_src/nif_utils.cpp b/c_src/nif_utils.cpp index 19d48c5..e9f600e 100644 --- a/c_src/nif_utils.cpp +++ b/c_src/nif_utils.cpp @@ -143,6 +143,12 @@ int get(ErlNifEnv *env, ERL_NIF_TERM term, std::string &var) { return ret; } +int get(ErlNifEnv *env, ERL_NIF_TERM term, ErlNifBinary *var) { + int code = enif_inspect_binary(env, term, var); + if (!code) return enif_inspect_iolist_as_binary(env, term, var); + return code; +} + ERL_NIF_TERM make(ErlNifEnv *env, bool var) { if (var) { return atom(env, "true"); diff --git a/c_src/nif_utils.hpp b/c_src/nif_utils.hpp index 30595a9..6bd6916 100644 --- a/c_src/nif_utils.hpp +++ b/c_src/nif_utils.hpp @@ -146,6 +146,7 @@ int get(ErlNifEnv *env, ERL_NIF_TERM term, double *var); // Standard types int get(ErlNifEnv *env, ERL_NIF_TERM term, std::string &var); +int get(ErlNifEnv *env, ERL_NIF_TERM term, ErlNifBinary *var); ERL_NIF_TERM make(ErlNifEnv *env, bool var); ERL_NIF_TERM make(ErlNifEnv *env, long var); diff --git a/lib/adbc_error.ex b/lib/adbc_error.ex index ffc9bba..807d8bc 100644 --- a/lib/adbc_error.ex +++ b/lib/adbc_error.ex @@ -4,7 +4,7 @@ defmodule Adbc.Error do @type t :: %Adbc.Error{ message: String.t(), - vendor_code: integer(), - state: <<_::40>> + vendor_code: integer() | nil, + state: <<_::40>> | nil } end diff --git a/lib/adbc_ipc.ex b/lib/adbc_ipc.ex new file mode 100644 index 0000000..9bd1e3d --- /dev/null +++ b/lib/adbc_ipc.ex @@ -0,0 +1,45 @@ +defmodule Adbc.IPC do + @moduledoc """ + Module for loading and saving Arrow IPC data. + """ + + import Adbc.Helper, only: [error_to_exception: 1] + + @doc """ + Load IPC from a file. + """ + @spec load_file(Path.t()) :: term() | {:error, File.posix()} + def load_file(filepath) do + with {:ok, data} <- File.read(filepath) do + load_ipc(data) + end + end + + @doc """ + Load from in-memory IPC data. + """ + @spec load_ipc(binary) :: term() | {:error, Adbc.Error.t()} + def load_ipc(data) do + case Adbc.Nif.adbc_ipc_load_binary(data) do + {:error, reason} -> + {:error, error_to_exception(reason)} + + data -> + data + end + end + + @doc """ + Dump Adbc.Result to in-memory IPC data. + """ + @spec dump_ipc(list()) :: binary | {:error, Adbc.Error.t()} + def dump_ipc(result) do + case Adbc.Nif.adbc_ipc_dump_binary(result) do + {:error, reason} -> + {:error, error_to_exception(reason)} + + data -> + data + end + end +end diff --git a/lib/adbc_nif.ex b/lib/adbc_nif.ex index 15195ea..129c34d 100644 --- a/lib/adbc_nif.ex +++ b/lib/adbc_nif.ex @@ -67,4 +67,8 @@ defmodule Adbc.Nif do def adbc_arrow_array_stream_release(_arrow_array_stream), do: :erlang.nif_error(:not_loaded) def adbc_column_materialize(_data_ref), do: :erlang.nif_error(:not_loaded) + + def adbc_ipc_load_binary(_binary), do: :erlang.nif_error(:not_loaded) + + def adbc_ipc_dump_binary(_data), do: :erlang.nif_error(:not_loaded) end diff --git a/mix.exs b/mix.exs index a39cde1..4098a26 100644 --- a/mix.exs +++ b/mix.exs @@ -5,7 +5,7 @@ defmodule Adbc.MixProject do use Mix.Project - @version "0.7.8" + @version "0.7.9-dev" @github_url "https://github.com/elixir-explorer/adbc" def project do @@ -31,7 +31,13 @@ defmodule Adbc.MixProject do make_precompiler_url: "#{@github_url}/releases/download/v#{@version}/@{artefact_filename}", make_precompiler_filename: "adbc_nif", - make_precompiler_priv_paths: ["adbc_nif.*", "adbc_dll_loader.dll", "bin", "lib", "include"], + make_precompiler_priv_paths: [ + "adbc_nif.*", + "adbc_dll_loader.dll", + "bin", + "lib", + "include" + ], make_precompiler_nif_versions: [versions: ["2.16"]], cc_precompiler: [ cleanup: "clean", diff --git a/test/adbc_ipc_test.exs b/test/adbc_ipc_test.exs new file mode 100644 index 0000000..e11d713 --- /dev/null +++ b/test/adbc_ipc_test.exs @@ -0,0 +1,34 @@ +defmodule Adbc.IPC.Test do + use ExUnit.Case + + alias Adbc.IPC + + @invalid_data File.read!(Path.join(__DIR__, "invalid.arrows")) + @valid_schema_only File.read!(Path.join(__DIR__, "schema-valid.arrows")) + @simple_data File.read!(Path.join(__DIR__, "simple.arrows")) + + describe "load" do + test "it can load ipc from in-memory data" do + assert :ok = IPC.load_ipc(@simple_data) + end + + test "it returns Adbc.Error when in-memory ipc data contains only schema" do + assert {:error, error} = IPC.load_ipc(@valid_schema_only) + assert Exception.message(error) == "decoder did not just decode a RecordBatch message" + end + + test "it returns Adbc.Error when loading invalid in-memory ipc data" do + assert {:error, error} = IPC.load_ipc(@invalid_data) + + assert Exception.message(error) == + "Expected 0xFFFFFFFF at start of message but found 0xFFFFFF00" + end + end + + describe "dump" do + test "it can dump columns as in-memory IPC format data" do + assert {:ok, data} = IPC.dump_ipc([Adbc.Column.s64([1, 2, 3]), Adbc.Column.f32([1.1, 2.2, 3.3])]) + File.write!(Path.join(__DIR__, "simple.arrows"), data) + end + end +end diff --git a/test/invalid.arrows b/test/invalid.arrows new file mode 100644 index 0000000000000000000000000000000000000000..68a1bd65f2813c265cbc63ecf962bb3cb9a2ec11 GIT binary patch literal 280 zcmYjM(F(#a5KE=bA|gfhu*ZIg|1v}?$T}v7g75x!O=@)p?s}KIge!8+-T)rL8e242 z!m%QZ{qY;Nw(|Q@b6npSJ-S*;cbmr8KMv_0K}GF{_+(i$+68v#IBl?kyggbnf?2f8 xSBA8o-9Mk>lt>pJ=^WL%OS^$#8T!k7Lw~-+bRxyS&9{76=^by7o-lz)cmwscAjALw literal 0 HcmV?d00001 diff --git a/test/schema-valid.arrows b/test/schema-valid.arrows new file mode 100644 index 0000000000000000000000000000000000000000..9ffe2b62fa04e8f4332d62f5231225771d66d6b8 GIT binary patch literal 280 zcmYjM(F(#a5KE=bA|hq%VUPO||7D0)5GxbL1mFGdn$*r2xa(c+60Rww704hp<3on*gqg|jz%V~uTk^D-&g*Sxs94o|*kpHBvg+npw7doIFpQ%sakm|qa4xZPPR`IR0 zhQEm`vNcc4j?U>@O+?(%Xp!FZP`@*Iv?9-`nH)EKM#?zx_8phIOeLALui!kYzi!-s obqC(x?WL}*opxw)rrGB`{0`Jh@bg1|KMZ}-?f1t{zV;RW0IBsdp8x;= literal 0 HcmV?d00001 From e9d55db691cbbe0994bea47a844e4d20c44d5b67 Mon Sep 17 00:00:00 2001 From: Cocoa Date: Wed, 12 Feb 2025 17:51:47 +0100 Subject: [PATCH 2/7] feat: added `Adbc.IPC.{load,dump}_binary/1` Signed-off-by: Cocoa --- c_src/adbc_nif.cpp | 88 ++++++++------------------------------- lib/adbc_array_stream.ex | 30 +++++++++++++ lib/adbc_column.ex | 12 +++--- lib/adbc_connection.ex | 32 +++----------- lib/adbc_ipc.ex | 13 +++--- test/adbc_ipc_test.exs | 55 ++++++++++++++++++++---- test/simple.arrows | Bin 432 -> 0 bytes 7 files changed, 115 insertions(+), 115 deletions(-) create mode 100644 lib/adbc_array_stream.ex delete mode 100644 test/simple.arrows diff --git a/c_src/adbc_nif.cpp b/c_src/adbc_nif.cpp index 931bec6..a63340e 100644 --- a/c_src/adbc_nif.cpp +++ b/c_src/adbc_nif.cpp @@ -621,6 +621,7 @@ static ERL_NIF_TERM adbc_arrow_array_stream_release(ErlNifEnv *env, int argc, co res_type * res = nullptr; if ((res = res_type::get_resource(env, argv[0], error)) == nullptr) { + printf("wrng?????\r\n"); return error; } @@ -822,74 +823,37 @@ static ERL_NIF_TERM adbc_statement_bind_stream(ErlNifEnv *env, int argc, const E } static ERL_NIF_TERM adbc_ipc_load_binary(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) { - struct ArrowIpcDecoder decoder{}; - struct ArrowError arrow_error{}; - struct ArrowBufferView data{}; + using array_stream_type = NifRes; + + nanoarrow::UniqueBuffer input_buffer; ERL_NIF_TERM error{}; std::vector out_terms; ErlNifBinary binary{}; - if (!erlang::nif::get(env, argv[0], &binary)) { - return enif_make_badarg(env); - } - data.data.as_uint8 = binary.data; - data.size_bytes = binary.size; + if (!erlang::nif::get(env, argv[0], &binary)) return enif_make_badarg(env); - ArrowErrorCode code = ArrowIpcDecoderInit(&decoder); + ArrowErrorCode code = ArrowBufferAppend(input_buffer.get(), binary.data, binary.size); if (code != NANOARROW_OK) { - return erlang::nif::error(env, "failed to initialize Arrow IPC decoder"); - } - - code = ArrowIpcDecoderVerifyHeader(&decoder, data, &arrow_error); - if (code != NANOARROW_OK) { - ArrowIpcDecoderReset(&decoder); - return nif_error_from_arrow_error(env, &arrow_error); - } - - code = ArrowIpcDecoderDecodeHeader(&decoder, data, &arrow_error); - if (code != NANOARROW_OK) { - ArrowIpcDecoderReset(&decoder); - return nif_error_from_arrow_error(env, &arrow_error); + return erlang::nif::error(env, "Failed to append binary data to Arrow IPC input buffer"); } - struct ArrowSchema schema{}; - code = ArrowIpcDecoderDecodeSchema(&decoder, &schema, &arrow_error); + struct ArrowIpcInputStream input; + code = ArrowIpcInputStreamInitBuffer(&input, input_buffer.get()); if (code != NANOARROW_OK) { - ArrowIpcDecoderReset(&decoder); - return nif_error_from_arrow_error(env, &arrow_error); + return erlang::nif::error(env, "Failed to initialize Arrow IPC array stream"); } - struct ArrowBufferView body{}; - body.data.as_uint8 = data.data.as_uint8 + decoder.header_size_bytes; - body.size_bytes = binary.size - decoder.header_size_bytes; - printf("body.size_bytes: %zu\n", body.size_bytes); - printf("decoder.header_size_bytes: %zu\n", decoder.header_size_bytes); - printf("decoder.body_size_bytes: %zu\n", decoder.body_size_bytes); - - struct ArrowArray array{}; - code = ArrowIpcDecoderDecodeArray(&decoder, data, 0, &array, NANOARROW_VALIDATION_LEVEL_MINIMAL, &arrow_error); - if (code != NANOARROW_OK) { - ArrowIpcDecoderReset(&decoder); - return nif_error_from_arrow_error(env, &arrow_error); + auto array_stream = array_stream_type::allocate_resource(env, error); + if (array_stream == nullptr) { + return error; } - code = arrow_schema_to_nif_term(env, &schema, &array, out_terms, error); - // the outter array should be released because we have moved the values - // for each column to the corresponding reference in `Adbc.Column.data` - if (array.release) { - array.release(&array); + code = ArrowIpcArrayStreamReaderInit(&array_stream->val, &input, nullptr); + if (code != NANOARROW_OK) { + return erlang::nif::error(env, "Failed to initialize Arrow IPC array stream reader"); } - - ArrowIpcDecoderReset(&decoder); - if (code != 0) { - // error is already set in arrow_schema_to_nif_term - // we don't need to release the schema in private data here - // it will be released when the stream resource is GC'd - return error; - } else { - return erlang::nif::ok(env, out_terms[0]); - } + return array_stream->make_resource(env); } static ERL_NIF_TERM adbc_ipc_dump_binary(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) { @@ -898,7 +862,6 @@ static ERL_NIF_TERM adbc_ipc_dump_binary(ErlNifEnv *env, int argc, const ERL_NIF } AdbcStatusCode code{}; - // struct ArrowArray values{}; struct ArrowSchema schema{}; struct ArrowError arrow_error{}; nanoarrow::UniqueBuffer output; @@ -914,7 +877,6 @@ static ERL_NIF_TERM adbc_ipc_dump_binary(ErlNifEnv *env, int argc, const ERL_NIF return erlang::nif::error(env, "Failed to initialize Arrow IPC writer"); } - // values.release = nullptr; schema.release = nullptr; nanoarrow::UniqueArray array; nanoarrow::UniqueArrayView array_view; @@ -937,20 +899,17 @@ static ERL_NIF_TERM adbc_ipc_dump_binary(ErlNifEnv *env, int argc, const ERL_NIF goto cleanup; } - printf("before ArrowIpcWriterWriteSchema: %lld\n", output->size_bytes); code = ArrowIpcWriterWriteSchema(writer.get(), &schema, &arrow_error); if (code != NANOARROW_OK) { ret = nif_error_from_arrow_error(env, &arrow_error); goto cleanup; } - printf("after ArrowIpcWriterWriteSchema: %lld\n", output->size_bytes); code = ArrowIpcWriterWriteArrayView(writer.get(), array_view.get(), &arrow_error); if (code != NANOARROW_OK) { ret = nif_error_from_arrow_error(env, &arrow_error); goto cleanup; } - printf("after ArrowIpcWriterWriteArrayView: %lld\n", output->size_bytes); // write `nullptr` to end the stream code = ArrowIpcWriterWriteArrayView(writer.get(), nullptr, &arrow_error); @@ -959,18 +918,6 @@ static ERL_NIF_TERM adbc_ipc_dump_binary(ErlNifEnv *env, int argc, const ERL_NIF goto cleanup; } - // code = ArrowIpcEncoderEncodeSimpleRecordBatch(&encoder, array_view.get(), output.get(), &arrow_error); - // if (code != NANOARROW_OK) { - // ret = nif_error_from_arrow_error(env, &arrow_error); - // goto cleanup; - // } - - // code = ArrowIpcEncoderFinalizeBuffer(&encoder, true, output.get()); - // if (code != NANOARROW_OK) { - // ret = nif_error_from_arrow_error(env, &arrow_error); - // goto cleanup; - // } - ErlNifBinary binary; if (!enif_alloc_binary(output->size_bytes, &binary)) { ret = erlang::nif::error(env, "out of memory"); @@ -983,7 +930,6 @@ static ERL_NIF_TERM adbc_ipc_dump_binary(ErlNifEnv *env, int argc, const ERL_NIF ret = erlang::nif::ok(env, enif_make_binary(env, &binary)); cleanup: - // if (values.release) values.release(&values); if (schema.release) schema.release(&schema); return ret; } diff --git a/lib/adbc_array_stream.ex b/lib/adbc_array_stream.ex new file mode 100644 index 0000000..11ac9cf --- /dev/null +++ b/lib/adbc_array_stream.ex @@ -0,0 +1,30 @@ +defmodule Adbc.ArrayStream do + @moduledoc """ + Internal module for AdbcArrayStream. Not intended for public use. + """ + + import Adbc.Helper, only: [error_to_exception: 1] + + def stream_results(reference, num_rows), do: stream_results(reference, [], num_rows) + + def stream_results(reference, acc, num_rows) do + case Adbc.Nif.adbc_arrow_array_stream_next(reference) do + {:ok, result} -> + stream_results(reference, [result | acc], num_rows) + + :end_of_series -> + {:ok, %Adbc.Result{data: merge_columns(Enum.reverse(acc)), num_rows: num_rows}} + + {:error, reason} -> + {:error, error_to_exception(reason)} + end + end + + defp merge_columns(chucked_results) do + Enum.zip_with(chucked_results, fn columns -> + Enum.reduce(columns, fn column, merged_column -> + %{merged_column | data: merged_column.data ++ column.data} + end) + end) + end +end diff --git a/lib/adbc_column.ex b/lib/adbc_column.ex index 5bbf945..68576d0 100644 --- a/lib/adbc_column.ex +++ b/lib/adbc_column.ex @@ -10,6 +10,8 @@ defmodule Adbc.Column do import Bitwise + @type t() :: %__MODULE__{} + @type s8 :: -128..127 @type u8 :: 0..255 @type s16 :: -32768..32767 @@ -79,12 +81,12 @@ defmodule Adbc.Column do validity: [boolean()], offsets: [non_neg_integer()], sizes: [non_neg_integer()], - values: %Adbc.Column{} + values: t() } @valid_run_end_types [:s16, :s32, :s64] @type dictionary_data_t :: %{ - key: %Adbc.Column{}, - value: %Adbc.Column{} + key: t(), + value: t() } @type data_type :: :boolean @@ -111,8 +113,8 @@ defmodule Adbc.Column do | interval_t | :run_end_encoded | :dictionary - @spec column(data_type(), list() | list_view_data_t() | dictionary_data_t(), Keyword.t()) :: - %Adbc.Column{} + @spec column(data_type(), list() | list_view_data_t() | dictionary_data_t(), Keyword.t()) :: t() + def column(type, data, opts \\ []) when (is_atom(type) or is_tuple(type)) and (is_list(data) or (type in @list_view_types and is_map(data)) or diff --git a/lib/adbc_connection.ex b/lib/adbc_connection.ex index 2cdf86c..daf107c 100644 --- a/lib/adbc_connection.ex +++ b/lib/adbc_connection.ex @@ -11,6 +11,7 @@ defmodule Adbc.Connection do use GenServer import Adbc.Helper, only: [error_to_exception: 1] + alias Adbc.ArrayStream @doc """ Starts a connection process. @@ -159,7 +160,7 @@ defmodule Adbc.Connection do def query(conn, query, params \\ [], statement_options \\ []) when (is_binary(query) or is_reference(query)) and is_list(params) and is_list(statement_options) do - stream(conn, {:query, query, params, statement_options}, &stream_results/2) + stream(conn, {:query, query, params, statement_options}, &ArrayStream.stream_results/2) end @doc """ @@ -229,7 +230,7 @@ defmodule Adbc.Connection do @spec get_info(t(), list(non_neg_integer())) :: {:ok, result_set} | {:error, Exception.t()} def get_info(conn, info_codes \\ []) when is_list(info_codes) do - stream(conn, {:adbc_connection_get_info, [info_codes]}, &stream_results/2) + stream(conn, {:adbc_connection_get_info, [info_codes]}, &ArrayStream.stream_results/2) end @doc """ @@ -332,7 +333,7 @@ defmodule Adbc.Connection do opts[:column_name] ] - stream(conn, {:adbc_connection_get_objects, args}, &stream_results/2) + stream(conn, {:adbc_connection_get_objects, args}, &ArrayStream.stream_results/2) end @doc """ @@ -365,7 +366,7 @@ defmodule Adbc.Connection do @spec get_table_types(t) :: {:ok, result_set} | {:error, Exception.t()} def get_table_types(conn) do - stream(conn, {:adbc_connection_get_table_types, []}, &stream_results/2) + stream(conn, {:adbc_connection_get_table_types, []}, &ArrayStream.stream_results/2) end defp command(conn, command) do @@ -392,29 +393,6 @@ defmodule Adbc.Connection do defp normalize_rows(-1), do: nil defp normalize_rows(rows) when is_integer(rows) and rows >= 0, do: rows - defp stream_results(reference, num_rows), do: stream_results(reference, [], num_rows) - - defp stream_results(reference, acc, num_rows) do - case Adbc.Nif.adbc_arrow_array_stream_next(reference) do - {:ok, result} -> - stream_results(reference, [result | acc], num_rows) - - :end_of_series -> - {:ok, %Adbc.Result{data: merge_columns(Enum.reverse(acc)), num_rows: num_rows}} - - {:error, reason} -> - {:error, error_to_exception(reason)} - end - end - - defp merge_columns(chucked_results) do - Enum.zip_with(chucked_results, fn columns -> - Enum.reduce(columns, fn column, merged_column -> - %{merged_column | data: merged_column.data ++ column.data} - end) - end) - end - ## Callbacks @impl true diff --git a/lib/adbc_ipc.ex b/lib/adbc_ipc.ex index 9bd1e3d..ef60b73 100644 --- a/lib/adbc_ipc.ex +++ b/lib/adbc_ipc.ex @@ -4,6 +4,7 @@ defmodule Adbc.IPC do """ import Adbc.Helper, only: [error_to_exception: 1] + alias Adbc.ArrayStream @doc """ Load IPC from a file. @@ -24,17 +25,19 @@ defmodule Adbc.IPC do {:error, reason} -> {:error, error_to_exception(reason)} - data -> - data + stream_ref when is_reference(stream_ref) -> + stream_ref + |> ArrayStream.stream_results(nil) + |> tap(fn _ -> Adbc.Nif.adbc_arrow_array_stream_release(stream_ref) end) end end @doc """ Dump Adbc.Result to in-memory IPC data. """ - @spec dump_ipc(list()) :: binary | {:error, Adbc.Error.t()} - def dump_ipc(result) do - case Adbc.Nif.adbc_ipc_dump_binary(result) do + @spec dump_ipc(list(Adbc.Column.t())) :: binary | {:error, Adbc.Error.t()} + def dump_ipc(columns) when is_list(columns) do + case Adbc.Nif.adbc_ipc_dump_binary(columns) do {:error, reason} -> {:error, error_to_exception(reason)} diff --git a/test/adbc_ipc_test.exs b/test/adbc_ipc_test.exs index e11d713..a1ca8c5 100644 --- a/test/adbc_ipc_test.exs +++ b/test/adbc_ipc_test.exs @@ -5,16 +5,57 @@ defmodule Adbc.IPC.Test do @invalid_data File.read!(Path.join(__DIR__, "invalid.arrows")) @valid_schema_only File.read!(Path.join(__DIR__, "schema-valid.arrows")) - @simple_data File.read!(Path.join(__DIR__, "simple.arrows")) describe "load" do test "it can load ipc from in-memory data" do - assert :ok = IPC.load_ipc(@simple_data) + f32_values = [1.1, 2.2, 3.3] + + assert {:ok, data} = + IPC.dump_ipc([Adbc.Column.s64([1, 2, 3]), Adbc.Column.f32(f32_values)]) + + assert {:ok, + results = %Adbc.Result{ + data: [ + %Adbc.Column{ + name: "", + type: :s64, + metadata: nil, + nullable: true + }, + %Adbc.Column{ + name: "", + type: :f32, + metadata: nil, + nullable: true + } + ], + num_rows: nil + }} = IPC.load_ipc(data) + + assert %Adbc.Result{ + data: [ + %Adbc.Column{ + name: "", + type: :s64, + nullable: true, + metadata: nil, + data: [1, 2, 3] + }, + %Adbc.Column{ + name: "", + type: :f32, + nullable: true, + metadata: nil, + data: f32 + } + ] + } = Adbc.Result.materialize(results) + + Enum.all?(Enum.zip(f32_values, f32), fn {a, b} -> abs(a - b) < 0.001 end) end - test "it returns Adbc.Error when in-memory ipc data contains only schema" do - assert {:error, error} = IPC.load_ipc(@valid_schema_only) - assert Exception.message(error) == "decoder did not just decode a RecordBatch message" + test "it returns empty Adbc.Result when im-memory IPC contains only schema" do + assert {:ok, %Adbc.Result{data: [], num_rows: nil}} = IPC.load_ipc(@valid_schema_only) end test "it returns Adbc.Error when loading invalid in-memory ipc data" do @@ -27,8 +68,8 @@ defmodule Adbc.IPC.Test do describe "dump" do test "it can dump columns as in-memory IPC format data" do - assert {:ok, data} = IPC.dump_ipc([Adbc.Column.s64([1, 2, 3]), Adbc.Column.f32([1.1, 2.2, 3.3])]) - File.write!(Path.join(__DIR__, "simple.arrows"), data) + assert {:ok, _data} = + IPC.dump_ipc([Adbc.Column.s64([1, 2, 3]), Adbc.Column.f32([1.1, 2.2, 3.3])]) end end end diff --git a/test/simple.arrows b/test/simple.arrows deleted file mode 100644 index f20feaeabbbb8f48889195c11b8c051abef37d73..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 432 zcmZ9Iu@Qnm5JmUo#sP-FfWQ*WEkJtE$j~wzORyLN149dd%rflZeE(oahR-a2|7UO6 zy_8aVm{~~(7j(2>k^D-&g*Sxs94o|*kpHBvg+npw7doIFpQ%sakm|qa4xZPPR`IR0 zhQEm`vNcc4j?U>@O+?(%Xp!FZP`@*Iv?9-`nH)EKM#?zx_8phIOeLALui!kYzi!-s obqC(x?WL}*opxw)rrGB`{0`Jh@bg1|KMZ}-?f1t{zV;RW0IBsdp8x;= From 7b8cb9dc32b5e359478806213aa6983a062e6c38 Mon Sep 17 00:00:00 2001 From: Cocoa Date: Wed, 12 Feb 2025 17:55:26 +0100 Subject: [PATCH 3/7] fix windows build Signed-off-by: Cocoa --- Makefile.win | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile.win b/Makefile.win index 44d0be7..45b735f 100644 --- a/Makefile.win +++ b/Makefile.win @@ -6,6 +6,7 @@ PRIV_DIR = $(MIX_APP_PATH)/priv NIF_SO = $(PRIV_DIR)/adbc_nif.dll THIRD_PARTY_DIR = $(MAKEDIR)\3rd_party ADBC_SRC = $(THIRD_PARTY_DIR)\apache-arrow-adbc +NANOARROW_SRC = $(THIRD_PARTY_DIR)\nanoarrow ADBC_C_SRC = $(ADBC_SRC)\c C_SRC = $(MAKEDIR)\c_src !IFDEF CMAKE_TOOLCHAIN_FILE @@ -80,6 +81,7 @@ $(NIF_SO): adbc priv_dir c_src\adbc_nif_resource.hpp c_src\adbc_nif.cpp c_src\ni --no-warn-unused-cli \ -D C_SRC="$(C_SRC)" \ -D ADBC_SRC="$(ADBC_SRC)" \ + -D NANOARROW_SRC="$(NANOARROW_SRC)" \ -D MIX_APP_PATH="$(MIX_APP_PATH)" \ -D PRIV_DIR="$(PRIV_DIR)" \ -D ERTS_INCLUDE_DIR="$(ERTS_INCLUDE_DIR)" \ From 1675fcdd576fe6af90fc2115852b57e5322bd052 Mon Sep 17 00:00:00 2001 From: Cocoa Date: Wed, 12 Feb 2025 17:57:20 +0100 Subject: [PATCH 4/7] update UPDATE.md Signed-off-by: Cocoa --- UPDATE.md | 1 - 1 file changed, 1 deletion(-) diff --git a/UPDATE.md b/UPDATE.md index ac3fcd2..da6a6f6 100644 --- a/UPDATE.md +++ b/UPDATE.md @@ -14,7 +14,6 @@ rm -rf 3rd_party/nanoarrow python3 arrow-nanoarrow/ci/scripts/bundle.py \ --source-output-dir=3rd_party/nanoarrow \ --include-output-dir=3rd_party/nanoarrow \ - --symbol-namespace=ElixirAdbc \ --with-ipc \ --with-flatcc ``` From a47d56cabe5148c69158b73f313db07fc7c0005a Mon Sep 17 00:00:00 2001 From: Cocoa Date: Wed, 12 Feb 2025 18:01:29 +0100 Subject: [PATCH 5/7] remove debug printf Signed-off-by: Cocoa --- c_src/adbc_nif.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/c_src/adbc_nif.cpp b/c_src/adbc_nif.cpp index a63340e..c319512 100644 --- a/c_src/adbc_nif.cpp +++ b/c_src/adbc_nif.cpp @@ -621,7 +621,6 @@ static ERL_NIF_TERM adbc_arrow_array_stream_release(ErlNifEnv *env, int argc, co res_type * res = nullptr; if ((res = res_type::get_resource(env, argv[0], error)) == nullptr) { - printf("wrng?????\r\n"); return error; } From 489e49b29e21160d940e931982eac6847dbac139 Mon Sep 17 00:00:00 2001 From: Cocoa Date: Wed, 12 Feb 2025 18:02:25 +0100 Subject: [PATCH 6/7] fix windows build Signed-off-by: Cocoa --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 28c78b9..d046f6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,7 @@ include_directories("${PRIV_DIR}/include") if(WIN32) string(REPLACE "\\" "/" C_SRC "${C_SRC}") + string(REPLACE "\\" "/" NANOARROW_SRC "${NANOARROW_SRC}") endif() set(SOURCE_FILES "${C_SRC}/nif_utils.cpp" From 99c5e29e146285bee3eb53ba56b2f915e28d7771 Mon Sep 17 00:00:00 2001 From: Cocoa Date: Wed, 12 Feb 2025 18:07:36 +0100 Subject: [PATCH 7/7] forgot to add assert Signed-off-by: Cocoa --- test/adbc_ipc_test.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/adbc_ipc_test.exs b/test/adbc_ipc_test.exs index a1ca8c5..a70127b 100644 --- a/test/adbc_ipc_test.exs +++ b/test/adbc_ipc_test.exs @@ -51,7 +51,7 @@ defmodule Adbc.IPC.Test do ] } = Adbc.Result.materialize(results) - Enum.all?(Enum.zip(f32_values, f32), fn {a, b} -> abs(a - b) < 0.001 end) + assert Enum.all?(Enum.zip(f32_values, f32), fn {a, b} -> abs(a - b) < 0.001 end) end test "it returns empty Adbc.Result when im-memory IPC contains only schema" do