[C++] Add Vector64 specialization for std::vector<bool> (#8757)

* add vector64 specialization for vector<bool>

* fix generated code

---------

Co-authored-by: Wouter van Oortmerssen <aardappel@gmail.com>
This commit is contained in:
Justin Davis
2025-11-17 16:44:28 -05:00
committed by GitHub
parent e3ee24830e
commit e68355cb22
9 changed files with 180 additions and 106 deletions

View File

@@ -834,6 +834,16 @@ class FlatBufferBuilderImpl {
return Offset<Vector<uint8_t>>(EndVector(v.size()));
}
Offset64<Vector64<uint8_t>> CreateVector64(const std::vector<bool>& v) {
StartVector<uint8_t, Offset64, Vector64<uint8_t>::size_type>(v.size());
for (auto i = v.size(); i > 0;) {
PushElement(static_cast<uint8_t>(v[--i]));
}
return Offset64<Vector64<uint8_t>>(
EndVector<Vector64<uint8_t>::size_type,
Offset64<Vector64<uint8_t>>::offset_type>(v.size()));
}
/// @brief Serialize values returned by a function into a FlatBuffer `vector`.
/// This is a convenience function that takes care of iteration for you.
/// @tparam T The data type of the `std::vector` elements.

View File

@@ -33,6 +33,9 @@ void Offset64Test() {
far_data[0] = 4;
far_data[far_vector_size - 1] = 2;
std::vector<bool> big_bool_data = {true, false, true, true,
false, false, true};
std::vector<uint8_t> big_data;
big_data.resize(big_vector_size);
big_data[0] = 8;
@@ -49,15 +52,18 @@ void Offset64Test() {
const Offset64<Vector64<uint8_t>> big_vector_offset =
builder.CreateVector64(big_data);
const Offset64<Vector64<uint8_t>> big_bool_vector_offset =
builder.CreateVector64(big_bool_data);
// Now that we are done with the 64-bit fields, we can create and add the
// normal fields.
const Offset<String> near_string_offset =
builder.CreateString("some near string");
// Finish by building the root table by passing in all the offsets.
const Offset<RootTable> root_table_offset =
CreateRootTable(builder, far_vector_offset, 0, far_string_offset,
big_vector_offset, near_string_offset);
const Offset<RootTable> root_table_offset = CreateRootTable(
builder, far_vector_offset, 0, far_string_offset,
big_bool_vector_offset, big_vector_offset, near_string_offset);
// Finish the buffer.
builder.Finish(root_table_offset);
@@ -118,7 +124,7 @@ void Offset64NestedFlatBuffer() {
// Finish by building the root table by passing in all the offsets.
const Offset<RootTable> root_table_offset =
CreateRootTable(fbb, 0, 0, 0, 0, near_string_offset, 0);
CreateRootTable(fbb, 0, 0, 0, 0, 0, near_string_offset, 0);
// Finish the buffer.
fbb.Finish(root_table_offset);
@@ -145,7 +151,7 @@ void Offset64NestedFlatBuffer() {
// Finish by building the root table by passing in all the offsets.
const Offset<RootTable> root_table_offset = CreateRootTable(
fbb, 0, 0, 0, 0, near_string_offset, nested_flatbuffer_offset);
fbb, 0, 0, 0, 0, 0, near_string_offset, nested_flatbuffer_offset);
// Finish the buffer.
fbb.Finish(root_table_offset);
@@ -184,7 +190,7 @@ void Offset64CreateDirect() {
// Call the "Direct" creation method to ensure that things are added to the
// buffer in the correct order, Offset64 first followed by any Offsets.
const Offset<RootTable> root_table_offset = CreateRootTableDirect(
fbb, &data, 0, "some far string", &data, "some near string");
fbb, &data, 0, "some far string", nullptr, &data, "some near string");
// Finish the buffer.
fbb.Finish(root_table_offset);
@@ -306,7 +312,7 @@ void Offset64VectorOfStructs() {
// Add the two vectors of leaf structs.
const Offset<RootTable> root_table_offset =
CreateRootTableDirect(builder, nullptr, 0, nullptr, nullptr, nullptr,
nullptr, &far_leaves, &big_leaves);
nullptr, nullptr, &far_leaves, &big_leaves);
// Finish the buffer.
builder.Finish(root_table_offset);
@@ -346,7 +352,7 @@ void Offset64SizePrefix() {
// Finish by building the root table by passing in all the offsets.
const Offset<RootTable> root_table_offset =
CreateRootTable(builder, 0, 0, 0, 0, near_string_offset, 0);
CreateRootTable(builder, 0, 0, 0, 0, 0, near_string_offset, 0);
// Finish the buffer.
FinishSizePrefixedRootTableBuffer(builder, root_table_offset);
@@ -448,7 +454,7 @@ void Offset64ForceAlign() {
// Use the CreateDirect which calls the ForceVectorAlign
const auto root_table_offset =
CreateRootTableDirect(builder, nullptr, 0, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, &data);
nullptr, nullptr, nullptr, nullptr, nullptr, &data);
// Finish the buffer.
FinishRootTableBuffer(builder, root_table_offset);

View File

@@ -1,74 +1,90 @@
// Annotated Flatbuffer Binary
//
// Schema file: tests/64bit/test_64bit.fbs
// Schema file: tests/64bit/test_64bit.bfbs
// Binary file: tests/64bit/test_64bit.bin
header:
+0x00 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: 0x1C | offset to root table `RootTable`
+0x0000 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: 0x001C | offset to root table `RootTable`
padding:
+0x04 | 00 00 00 00 | uint8_t[4] | .... | padding
+0x0004 | 00 00 | uint8_t[2] | .. | padding
vtable (RootTable):
+0x08 | 14 00 | uint16_t | 0x0014 (20) | size of this vtable
+0x0A | 34 00 | uint16_t | 0x0034 (52) | size of referring table
+0x0C | 04 00 | VOffset16 | 0x0004 (4) | offset to field `far_vector` (id: 0)
+0x0E | 10 00 | VOffset16 | 0x0010 (16) | offset to field `a` (id: 1)
+0x10 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `far_string` (id: 2)
+0x12 | 24 00 | VOffset16 | 0x0024 (36) | offset to field `big_vector` (id: 3)
+0x14 | 20 00 | VOffset16 | 0x0020 (32) | offset to field `near_string` (id: 4)
+0x16 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `nested_root` (id: 5) <null> (Vector64)
+0x18 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `far_struct_vector` (id: 6) <null> (Vector)
+0x1A | 2C 00 | VOffset16 | 0x002C (44) | offset to field `big_struct_vector` (id: 7)
+0x0006 | 16 00 | uint16_t | 0x0016 (22) | size of this vtable
+0x0008 | 3C 00 | uint16_t | 0x003C (60) | size of referring table
+0x000A | 04 00 | VOffset16 | 0x0004 (4) | offset to field `far_vector` (id: 0)
+0x000C | 10 00 | VOffset16 | 0x0010 (16) | offset to field `a` (id: 1)
+0x000E | 14 00 | VOffset16 | 0x0014 (20) | offset to field `far_string` (id: 2)
+0x0010 | 24 00 | VOffset16 | 0x0024 (36) | offset to field `big_bool_vector` (id: 3)
+0x0012 | 2C 00 | VOffset16 | 0x002C (44) | offset to field `big_vector` (id: 4)
+0x0014 | 20 00 | VOffset16 | 0x0020 (32) | offset to field `near_string` (id: 5)
+0x0016 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `nested_root` (id: 6) <null> (Vector64)
+0x0018 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `far_struct_vector` (id: 7) <null> (Vector)
+0x001A | 34 00 | VOffset16 | 0x0034 (52) | offset to field `big_struct_vector` (id: 8)
root_table (RootTable):
+0x1C | 14 00 00 00 | SOffset32 | 0x00000014 (20) Loc: 0x08 | offset to vtable
+0x20 | D0 00 00 00 00 00 00 00 | UOffset64 | 0x00000000000000D0 (208) Loc: 0xF0 | offset to field `far_vector` (vector)
+0x28 | 00 00 00 00 | uint8_t[4] | .... | padding
+0x2C | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `a` (Int)
+0x30 | 8C 00 00 00 00 00 00 00 | UOffset64 | 0x000000000000008C (140) Loc: 0xBC | offset to field `far_string` (string)
+0x38 | 00 00 00 00 | uint8_t[4] | .... | padding
+0x3C | 40 00 00 00 | UOffset32 | 0x00000040 (64) Loc: 0x7C | offset to field `near_string` (string)
+0x40 | 70 00 00 00 00 00 00 00 | UOffset64 | 0x0000000000000070 (112) Loc: 0xB0 | offset to field `big_vector` (vector64)
+0x48 | 08 00 00 00 00 00 00 00 | UOffset64 | 0x0000000000000008 (8) Loc: 0x50 | offset to field `big_struct_vector` (vector64)
+0x001C | 16 00 00 00 | SOffset32 | 0x00000016 (22) Loc: 0x0006 | offset to vtable
+0x0020 | E8 00 00 00 00 00 00 00 | UOffset64 | 0x00000000000000E8 (232) Loc: 0x0108 | offset to field `far_vector` (vector)
+0x0028 | 00 00 00 00 | uint8_t[4] | .... | padding
+0x002C | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `a` (Int)
+0x0030 | A4 00 00 00 00 00 00 00 | UOffset64 | 0x00000000000000A4 (164) Loc: 0x00D4 | offset to field `far_string` (string)
+0x0038 | 00 00 00 00 | uint8_t[4] | .... | padding
+0x003C | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: 0x0084 | offset to field `near_string` (string)
+0x0040 | 78 00 00 00 00 00 00 00 | UOffset64 | 0x0000000000000078 (120) Loc: 0x00B8 | offset to field `big_bool_vector` (vector64)
+0x0048 | 80 00 00 00 00 00 00 00 | UOffset64 | 0x0000000000000080 (128) Loc: 0x00C8 | offset to field `big_vector` (vector64)
+0x0050 | 08 00 00 00 00 00 00 00 | UOffset64 | 0x0000000000000008 (8) Loc: 0x0058 | offset to field `big_struct_vector` (vector64)
vector64 (RootTable.big_struct_vector):
+0x50 | 02 00 00 00 00 00 00 00 | uint64_t | 0x0000000000000002 (2) | length of vector (# items)
+0x58 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `[0].a` of 'LeafStruct' (Int)
<4 regions omitted>
+0x70 | 33 33 33 33 33 33 22 40 | double | 0x4022333333333333 (9.1) | struct field `[1].b` of 'LeafStruct' (Double)
+0x0058 | 02 00 00 00 00 00 00 00 | uint64_t | 0x0000000000000002 (2) | length of vector (# items)
+0x0060 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `[0].a` of 'LeafStruct' (Int)
+0x0064 | 00 00 00 00 | uint8_t[4] | .... | padding
+0x0068 | D9 CE F7 53 E3 A5 0B 40 | double | 0x400BA5E353F7CED9 (3.456) | struct field `[0].b` of 'LeafStruct' (Double)
+0x0070 | 4E 00 00 00 | uint32_t | 0x0000004E (78) | struct field `[1].a` of 'LeafStruct' (Int)
+0x0074 | 00 00 00 00 | uint8_t[4] | .... | padding
+0x0078 | 33 33 33 33 33 33 22 40 | double | 0x4022333333333333 (9.1) | struct field `[1].b` of 'LeafStruct' (Double)
padding:
+0x78 | 00 00 00 00 | uint8_t[4] | .... | padding
+0x0080 | 00 00 00 00 | uint8_t[4] | .... | padding
string (RootTable.near_string):
+0x7C | 2F 00 00 00 | uint32_t | 0x0000002F (47) | length of string
+0x80 | 74 68 69 73 20 69 73 20 | char[47] | this is | string literal
+0x88 | 61 20 6E 65 61 72 20 73 | | a near s
+0x90 | 74 72 69 6E 67 20 77 68 | | tring wh
+0x98 | 69 63 68 20 68 61 73 20 | | ich has
+0xA0 | 61 20 33 32 2D 62 69 74 | | a 32-bit
+0xA8 | 20 6F 66 66 73 65 74 | | offset
+0xAF | 00 | char | 0x00 (0) | string terminator
+0x0084 | 2F 00 00 00 | uint32_t | 0x0000002F (47) | length of string
+0x0088 | 74 68 69 73 20 69 73 20 | char[47] | this is | string literal
+0x0090 | 61 20 6E 65 61 72 20 73 | | a near s
+0x0098 | 74 72 69 6E 67 20 77 68 | | tring wh
+0x00A0 | 69 63 68 20 68 61 73 20 | | ich has
+0x00A8 | 61 20 33 32 2D 62 69 74 | | a 32-bit
+0x00B0 | 20 6F 66 66 73 65 74 | | offset
+0x00B7 | 00 | char | 0x00 (0) | string terminator
vector64 (RootTable.big_bool_vector):
+0x00B8 | 07 00 00 00 00 00 00 00 | uint64_t | 0x0000000000000007 (7) | length of vector (# items)
+0x00C0 | 01 | uint8_t | 0x01 (1) | value[0]
+0x00C1 | 00 | uint8_t | 0x00 (0) | value[1]
+0x00C2 | 01 | uint8_t | 0x01 (1) | value[2]
+0x00C3 | 01 | uint8_t | 0x01 (1) | value[3]
+0x00C4 | 00 | uint8_t | 0x00 (0) | value[4]
+0x00C5 | 00 | uint8_t | 0x00 (0) | value[5]
+0x00C6 | 01 | uint8_t | 0x01 (1) | value[6]
vector64 (RootTable.big_vector):
+0xB0 | 04 00 00 00 00 00 00 00 | uint64_t | 0x0000000000000004 (4) | length of vector (# items)
+0xB8 | 05 | uint8_t | 0x05 (5) | value[0]
<2 regions omitted>
+0xBB | 08 | uint8_t | 0x08 (8) | value[3]
+0x00C8 | 04 00 00 00 00 00 00 00 | uint64_t | 0x0000000000000004 (4) | length of vector (# items)
+0x00D0 | 05 | uint8_t | 0x05 (5) | value[0]
+0x00D1 | 06 | uint8_t | 0x06 (6) | value[1]
+0x00D2 | 07 | uint8_t | 0x07 (7) | value[2]
+0x00D3 | 08 | uint8_t | 0x08 (8) | value[3]
string (RootTable.far_string):
+0xBC | 2E 00 00 00 | uint32_t | 0x0000002E (46) | length of string
+0xC0 | 74 68 69 73 20 69 73 20 | char[46] | this is | string literal
+0xC8 | 61 20 66 61 72 20 73 74 | | a far st
+0xD0 | 72 69 6E 67 20 77 68 69 | | ring whi
+0xD8 | 63 68 20 68 61 73 20 61 | | ch has a
+0xE0 | 20 36 34 2D 62 69 74 20 | | 64-bit
+0xE8 | 6F 66 66 73 65 74 | | offset
+0xEE | 00 | char | 0x00 (0) | string terminator
+0x00D4 | 2E 00 00 00 | uint32_t | 0x0000002E (46) | length of string
+0x00D8 | 74 68 69 73 20 69 73 20 | char[46] | this is | string literal
+0x00E0 | 61 20 66 61 72 20 73 74 | | a far st
+0x00E8 | 72 69 6E 67 20 77 68 69 | | ring whi
+0x00F0 | 63 68 20 68 61 73 20 61 | | ch has a
+0x00F8 | 20 36 34 2D 62 69 74 20 | | 64-bit
+0x0100 | 6F 66 66 73 65 74 | | offset
+0x0106 | 00 | char | 0x00 (0) | string terminator
vector (RootTable.far_vector):
+0xF0 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+0xF4 | 01 | uint8_t | 0x01 (1) | value[0]
+0xF5 | 02 | uint8_t | 0x02 (2) | value[1]
+0xF6 | 03 | uint8_t | 0x03 (3) | value[2]
+0x0108 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+0x010C | 01 | uint8_t | 0x01 (1) | value[0]
+0x010D | 02 | uint8_t | 0x02 (2) | value[1]
+0x010E | 03 | uint8_t | 0x03 (3) | value[2]

Binary file not shown.

Binary file not shown.

View File

@@ -18,6 +18,10 @@ table RootTable {
// A normal 32-bit sized string, that could be very far away (64-bit address).
far_string:string (offset64);
// a big vector of bool, that could be very far away (64-bit address).
// tests vector<bool> specialization with 64-bit offsets.
big_bool_vector:[ubyte] (vector64);
// A big 64-bit sized vector, that could be very far away (64-bit address).
big_vector:[ubyte] (vector64);
@@ -27,19 +31,19 @@ table RootTable {
// A big 64-bit sized vector that is a nested flatbuffers (64-bit address).
nested_root:[ubyte] (vector64, nested_flatbuffer: "RootTable");
// A normal 32-bit size vector of structs, that could be very far away
// A normal 32-bit size vector of structs, that could be very far away
// (64-bit address)
far_struct_vector:[LeafStruct] (offset64);
// A big 64-bit size vector of structs that could be very far away
// A big 64-bit size vector of structs that could be very far away
// (64-bit address)
big_struct_vector:[LeafStruct] (vector64);
// A normal 32-bit size vector of tables. Currently 64-bit vectors don't
// A normal 32-bit size vector of tables. Currently 64-bit vectors don't
// support tables as it would require serializing a table (32-bit) before the
// vector (64-bit), which is not allowed.
//
// This demonstrates how you could have many vectors in the buffer, by
// This demonstrates how you could have many vectors in the buffer, by
// effectively having a vector of 64-bit vectors. The IDL doesn't support
// nested vecotrs (e.g.: [[type]] ), so going through a wrapper table allows
// this.
@@ -50,4 +54,4 @@ table RootTable {
forced_aligned_vector:[ubyte] (vector64, force_align:32);
}
root_type RootTable;
root_type RootTable;

View File

@@ -3,13 +3,22 @@
"a": 1234,
"far_string": "this is a far string which has a 64-bit offset",
"big_vector": [5, 6, 7, 8],
"big_bool_vector": [
1,
0,
1,
1,
0,
0,
1
],
"near_string": "this is a near string which has a 32-bit offset",
"big_struct_vector": [
{
"a": 12,
"b": 3.456
},
{
{
"a": 78,
"b": 9.10
}

View File

@@ -9,42 +9,45 @@
struct RootTableBinarySchema {
static const uint8_t *data() {
// Buffer containing the binary schema.
static const uint8_t bfbsData[1248] = {
static const uint8_t bfbsData[1308] = {
0x1C,0x00,0x00,0x00,0x42,0x46,0x42,0x53,0x14,0x00,0x20,0x00,0x04,0x00,0x08,0x00,0x0C,0x00,0x10,0x00,
0x14,0x00,0x18,0x00,0x00,0x00,0x1C,0x00,0x14,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x2C,0x00,0x00,0x00,
0x20,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x54,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x2C,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0xA4,0x03,0x00,0x00,0x28,0x00,0x00,0x00,0x00,0x03,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0xE0,0x03,0x00,0x00,0x28,0x00,0x00,0x00,0x3C,0x03,0x00,0x00,
0x01,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x08,0x00,0x0C,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x00,0x00,
0xA0,0x03,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0xFD,0xFF,0xFF,0x3C,0x00,0x00,0x00,
0x0C,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x84,0x03,0x00,0x00,0x0A,0x00,0x00,0x00,0x60,0x02,0x00,0x00,
0xAC,0x00,0x00,0x00,0xC4,0x01,0x00,0x00,0x24,0x02,0x00,0x00,0xF0,0x00,0x00,0x00,0x70,0x02,0x00,0x00,
0x20,0x00,0x00,0x00,0x5C,0x00,0x00,0x00,0x7C,0x01,0x00,0x00,0x28,0x01,0x00,0x00,0x09,0x00,0x00,0x00,
0x52,0x6F,0x6F,0x74,0x54,0x61,0x62,0x6C,0x65,0x00,0x00,0x00,0x28,0xFE,0xFF,0xFF,0x00,0x00,0x01,0x01,
0x09,0x00,0x16,0x00,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x6C,0xFE,0xFF,0xFF,0x00,0x00,0x12,0x04,
0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x66,0x6F,0x72,0x63,0x65,0x64,0x5F,0x61,
0x6C,0x69,0x67,0x6E,0x65,0x64,0x5F,0x76,0x65,0x63,0x74,0x6F,0x72,0x00,0x00,0x00,0xF8,0xFE,0xFF,0xFF,
0x00,0x00,0x00,0x01,0x08,0x00,0x14,0x00,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x78,0xFF,0xFF,0xFF,
0x00,0x00,0x0E,0x0F,0x02,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x6D,0x61,0x6E,0x79,
0x5F,0x76,0x65,0x63,0x74,0x6F,0x72,0x73,0x00,0x00,0x00,0x00,0xA0,0xFE,0xFF,0xFF,0x00,0x00,0x01,0x01,
0x07,0x00,0x12,0x00,0x2C,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x10,0x00,0x14,0x00,0x06,0x00,0x07,0x00,
0x08,0x00,0x00,0x00,0x0C,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x12,0x0F,0x00,0x00,0x00,0x00,
0x08,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x62,0x69,0x67,0x5F,0x73,0x74,0x72,0x75,
0x63,0x74,0x5F,0x76,0x65,0x63,0x74,0x6F,0x72,0x00,0x00,0x00,0xF0,0xFE,0xFF,0xFF,0x00,0x00,0x01,0x01,
0x06,0x00,0x10,0x00,0x28,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x06,0x00,0x07,0x00,
0x08,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x0E,0x0F,0x00,0x00,0x00,0x00,
0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x66,0x61,0x72,0x5F,0x73,0x74,0x72,0x75,0x63,0x74,0x5F,0x76,
0x65,0x63,0x74,0x6F,0x72,0x00,0x00,0x00,0x3C,0xFF,0xFF,0xFF,0x00,0x00,0x01,0x01,0x05,0x00,0x0E,0x00,
0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x80,0xFF,0xFF,0xFF,0x00,0x00,0x12,0x04,0x08,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,0x6E,0x65,0x73,0x74,0x65,0x64,0x5F,0x72,0x6F,0x6F,0x74,0x00,
0x1C,0x00,0x14,0x00,0x0C,0x00,0x10,0x00,0x08,0x00,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x00,0x0C,0x00,
0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x90,0xFD,0xFF,0xFF,0x00,0x00,0x00,0x0D,0x01,0x00,0x00,0x00,
0x0B,0x00,0x00,0x00,0x6E,0x65,0x61,0x72,0x5F,0x73,0x74,0x72,0x69,0x6E,0x67,0x00,0xBC,0xFF,0xFF,0xFF,
0x00,0x00,0x01,0x01,0x03,0x00,0x0A,0x00,0x28,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x10,0x00,0x10,0x00,
0x06,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x0C,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x12,0x04,
0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x0A,0x00,0x00,0x00,0x62,0x69,0x67,0x5F,0x76,0x65,0x63,0x74,
0x6F,0x72,0x00,0x00,0x20,0x00,0x14,0x00,0x0C,0x00,0x10,0x00,0x08,0x00,0x0A,0x00,0x00,0x00,0x00,0x00,
0xDC,0x03,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFC,0xFF,0xFF,0x40,0x00,0x00,0x00,
0x0C,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0xC0,0x03,0x00,0x00,0x0B,0x00,0x00,0x00,0x9C,0x02,0x00,0x00,
0x00,0x02,0x00,0x00,0xAC,0x00,0x00,0x00,0xC4,0x01,0x00,0x00,0x5C,0x02,0x00,0x00,0xF0,0x00,0x00,0x00,
0xA8,0x02,0x00,0x00,0x20,0x00,0x00,0x00,0x5C,0x00,0x00,0x00,0x7C,0x01,0x00,0x00,0x28,0x01,0x00,0x00,
0x09,0x00,0x00,0x00,0x52,0x6F,0x6F,0x74,0x54,0x61,0x62,0x6C,0x65,0x00,0x00,0x00,0xF0,0xFD,0xFF,0xFF,
0x00,0x00,0x01,0x01,0x0A,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x38,0xFE,0xFF,0xFF,
0x00,0x00,0x12,0x04,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x66,0x6F,0x72,0x63,
0x65,0x64,0x5F,0x61,0x6C,0x69,0x67,0x6E,0x65,0x64,0x5F,0x76,0x65,0x63,0x74,0x6F,0x72,0x00,0x00,0x00,
0xF8,0xFE,0xFF,0xFF,0x00,0x00,0x00,0x01,0x09,0x00,0x16,0x00,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x78,0xFF,0xFF,0xFF,0x00,0x00,0x0E,0x0F,0x02,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
0x6D,0x61,0x6E,0x79,0x5F,0x76,0x65,0x63,0x74,0x6F,0x72,0x73,0x00,0x00,0x00,0x00,0x68,0xFE,0xFF,0xFF,
0x00,0x00,0x01,0x01,0x08,0x00,0x14,0x00,0x2C,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x10,0x00,0x14,0x00,
0x06,0x00,0x07,0x00,0x08,0x00,0x00,0x00,0x0C,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x12,0x0F,
0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x62,0x69,0x67,0x5F,
0x73,0x74,0x72,0x75,0x63,0x74,0x5F,0x76,0x65,0x63,0x74,0x6F,0x72,0x00,0x00,0x00,0xB8,0xFE,0xFF,0xFF,
0x00,0x00,0x01,0x01,0x07,0x00,0x12,0x00,0x28,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x10,0x00,0x10,0x00,
0x06,0x00,0x07,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x0E,0x0F,
0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x66,0x61,0x72,0x5F,0x73,0x74,0x72,0x75,
0x63,0x74,0x5F,0x76,0x65,0x63,0x74,0x6F,0x72,0x00,0x00,0x00,0x04,0xFF,0xFF,0xFF,0x00,0x00,0x01,0x01,
0x06,0x00,0x10,0x00,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x4C,0xFF,0xFF,0xFF,0x00,0x00,0x12,0x04,
0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,0x6E,0x65,0x73,0x74,0x65,0x64,0x5F,0x72,
0x6F,0x6F,0x74,0x00,0x1C,0x00,0x14,0x00,0x0C,0x00,0x10,0x00,0x08,0x00,0x0A,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x05,0x00,0x0E,0x00,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x58,0xFD,0xFF,0xFF,0x00,0x00,0x00,0x0D,
0x01,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,0x6E,0x65,0x61,0x72,0x5F,0x73,0x74,0x72,0x69,0x6E,0x67,0x00,
0x84,0xFF,0xFF,0xFF,0x00,0x00,0x01,0x01,0x04,0x00,0x0C,0x00,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0xCC,0xFF,0xFF,0xFF,0x00,0x00,0x12,0x04,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x0A,0x00,0x00,0x00,
0x62,0x69,0x67,0x5F,0x76,0x65,0x63,0x74,0x6F,0x72,0x00,0x00,0xB8,0xFF,0xFF,0xFF,0x00,0x00,0x01,0x01,
0x03,0x00,0x0A,0x00,0x28,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x06,0x00,0x07,0x00,
0x00,0x00,0x00,0x00,0x08,0x00,0x0C,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x12,0x04,0x08,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x62,0x69,0x67,0x5F,0x62,0x6F,0x6F,0x6C,0x5F,0x76,0x65,0x63,
0x74,0x6F,0x72,0x00,0x20,0x00,0x14,0x00,0x0C,0x00,0x10,0x00,0x08,0x00,0x0A,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x07,0x00,0x20,0x00,0x00,0x00,
0x00,0x00,0x01,0x01,0x02,0x00,0x08,0x00,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x24,0xFE,0xFF,0xFF,
0x00,0x00,0x00,0x0D,0x01,0x00,0x00,0x00,0x0A,0x00,0x00,0x00,0x66,0x61,0x72,0x5F,0x73,0x74,0x72,0x69,
@@ -77,7 +80,7 @@ struct RootTableBinarySchema {
return bfbsData;
}
static size_t size() {
return 1248;
return 1308;
}
const uint8_t *begin() {
return data();

View File

@@ -161,6 +161,7 @@ struct RootTableT : public ::flatbuffers::NativeTable {
std::vector<uint8_t> far_vector{};
int32_t a = 0;
std::string far_string{};
std::vector<uint8_t> big_bool_vector{};
std::vector<uint8_t> big_vector{};
std::string near_string{};
std::vector<uint8_t> nested_root{};
@@ -185,13 +186,14 @@ struct RootTable FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
VT_FAR_VECTOR = 4,
VT_A = 6,
VT_FAR_STRING = 8,
VT_BIG_VECTOR = 10,
VT_NEAR_STRING = 12,
VT_NESTED_ROOT = 14,
VT_FAR_STRUCT_VECTOR = 16,
VT_BIG_STRUCT_VECTOR = 18,
VT_MANY_VECTORS = 20,
VT_FORCED_ALIGNED_VECTOR = 22
VT_BIG_BOOL_VECTOR = 10,
VT_BIG_VECTOR = 12,
VT_NEAR_STRING = 14,
VT_NESTED_ROOT = 16,
VT_FAR_STRUCT_VECTOR = 18,
VT_BIG_STRUCT_VECTOR = 20,
VT_MANY_VECTORS = 22,
VT_FORCED_ALIGNED_VECTOR = 24
};
const ::flatbuffers::Vector<uint8_t> *far_vector() const {
return GetPointer64<const ::flatbuffers::Vector<uint8_t> *>(VT_FAR_VECTOR);
@@ -211,6 +213,12 @@ struct RootTable FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
::flatbuffers::String *mutable_far_string() {
return GetPointer64<::flatbuffers::String *>(VT_FAR_STRING);
}
const ::flatbuffers::Vector64<uint8_t> *big_bool_vector() const {
return GetPointer64<const ::flatbuffers::Vector64<uint8_t> *>(VT_BIG_BOOL_VECTOR);
}
::flatbuffers::Vector64<uint8_t> *mutable_big_bool_vector() {
return GetPointer64<::flatbuffers::Vector64<uint8_t> *>(VT_BIG_BOOL_VECTOR);
}
const ::flatbuffers::Vector64<uint8_t> *big_vector() const {
return GetPointer64<const ::flatbuffers::Vector64<uint8_t> *>(VT_BIG_VECTOR);
}
@@ -265,6 +273,8 @@ struct RootTable FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
VerifyField<int32_t>(verifier, VT_A, 4) &&
VerifyOffset64(verifier, VT_FAR_STRING) &&
verifier.VerifyString(far_string()) &&
VerifyOffset64(verifier, VT_BIG_BOOL_VECTOR) &&
verifier.VerifyVector(big_bool_vector()) &&
VerifyOffset64(verifier, VT_BIG_VECTOR) &&
verifier.VerifyVector(big_vector()) &&
VerifyOffset(verifier, VT_NEAR_STRING) &&
@@ -301,6 +311,9 @@ struct RootTableBuilder {
void add_far_string(::flatbuffers::Offset64<::flatbuffers::String> far_string) {
fbb_.AddOffset(RootTable::VT_FAR_STRING, far_string);
}
void add_big_bool_vector(::flatbuffers::Offset64<::flatbuffers::Vector64<uint8_t>> big_bool_vector) {
fbb_.AddOffset(RootTable::VT_BIG_BOOL_VECTOR, big_bool_vector);
}
void add_big_vector(::flatbuffers::Offset64<::flatbuffers::Vector64<uint8_t>> big_vector) {
fbb_.AddOffset(RootTable::VT_BIG_VECTOR, big_vector);
}
@@ -338,6 +351,7 @@ inline ::flatbuffers::Offset<RootTable> CreateRootTable(
::flatbuffers::Offset64<::flatbuffers::Vector<uint8_t>> far_vector = 0,
int32_t a = 0,
::flatbuffers::Offset64<::flatbuffers::String> far_string = 0,
::flatbuffers::Offset64<::flatbuffers::Vector64<uint8_t>> big_bool_vector = 0,
::flatbuffers::Offset64<::flatbuffers::Vector64<uint8_t>> big_vector = 0,
::flatbuffers::Offset<::flatbuffers::String> near_string = 0,
::flatbuffers::Offset64<::flatbuffers::Vector64<uint8_t>> nested_root = 0,
@@ -350,6 +364,7 @@ inline ::flatbuffers::Offset<RootTable> CreateRootTable(
builder_.add_big_struct_vector(big_struct_vector);
builder_.add_nested_root(nested_root);
builder_.add_big_vector(big_vector);
builder_.add_big_bool_vector(big_bool_vector);
builder_.add_many_vectors(many_vectors);
builder_.add_far_struct_vector(far_struct_vector);
builder_.add_near_string(near_string);
@@ -364,6 +379,7 @@ inline ::flatbuffers::Offset<RootTable> CreateRootTableDirect(
const std::vector<uint8_t> *far_vector = nullptr,
int32_t a = 0,
const char *far_string = nullptr,
const std::vector<uint8_t> *big_bool_vector = nullptr,
const std::vector<uint8_t> *big_vector = nullptr,
const char *near_string = nullptr,
const std::vector<uint8_t> *nested_root = nullptr,
@@ -373,6 +389,7 @@ inline ::flatbuffers::Offset<RootTable> CreateRootTableDirect(
const std::vector<uint8_t> *forced_aligned_vector = nullptr) {
auto far_vector__ = far_vector ? _fbb.CreateVector64<::flatbuffers::Vector>(*far_vector) : 0;
auto far_string__ = far_string ? _fbb.CreateString<::flatbuffers::Offset64>(far_string) : 0;
auto big_bool_vector__ = big_bool_vector ? _fbb.CreateVector64(*big_bool_vector) : 0;
auto big_vector__ = big_vector ? _fbb.CreateVector64(*big_vector) : 0;
auto nested_root__ = nested_root ? _fbb.CreateVector64(*nested_root) : 0;
auto far_struct_vector__ = far_struct_vector ? _fbb.CreateVectorOfStructs64<::flatbuffers::Vector>(*far_struct_vector) : 0;
@@ -386,6 +403,7 @@ inline ::flatbuffers::Offset<RootTable> CreateRootTableDirect(
far_vector__,
a,
far_string__,
big_bool_vector__,
big_vector__,
near_string__,
nested_root__,
@@ -440,6 +458,7 @@ inline bool operator==(const RootTableT &lhs, const RootTableT &rhs) {
(lhs.far_vector == rhs.far_vector) &&
(lhs.a == rhs.a) &&
(lhs.far_string == rhs.far_string) &&
(lhs.big_bool_vector == rhs.big_bool_vector) &&
(lhs.big_vector == rhs.big_vector) &&
(lhs.near_string == rhs.near_string) &&
(lhs.nested_root == rhs.nested_root) &&
@@ -458,6 +477,7 @@ inline RootTableT::RootTableT(const RootTableT &o)
: far_vector(o.far_vector),
a(o.a),
far_string(o.far_string),
big_bool_vector(o.big_bool_vector),
big_vector(o.big_vector),
near_string(o.near_string),
nested_root(o.nested_root),
@@ -472,6 +492,7 @@ inline RootTableT &RootTableT::operator=(RootTableT o) FLATBUFFERS_NOEXCEPT {
std::swap(far_vector, o.far_vector);
std::swap(a, o.a);
std::swap(far_string, o.far_string);
std::swap(big_bool_vector, o.big_bool_vector);
std::swap(big_vector, o.big_vector);
std::swap(near_string, o.near_string);
std::swap(nested_root, o.nested_root);
@@ -494,6 +515,7 @@ inline void RootTable::UnPackTo(RootTableT *_o, const ::flatbuffers::resolver_fu
{ auto _e = far_vector(); if (_e) { _o->far_vector.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->far_vector.begin()); } }
{ auto _e = a(); _o->a = _e; }
{ auto _e = far_string(); if (_e) _o->far_string = _e->str(); }
{ auto _e = big_bool_vector(); if (_e) { _o->big_bool_vector.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->big_bool_vector.begin()); } }
{ auto _e = big_vector(); if (_e) { _o->big_vector.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->big_vector.begin()); } }
{ auto _e = near_string(); if (_e) _o->near_string = _e->str(); }
{ auto _e = nested_root(); if (_e) { _o->nested_root.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->nested_root.begin()); } }
@@ -514,6 +536,7 @@ inline ::flatbuffers::Offset<RootTable> RootTable::Pack(::flatbuffers::FlatBuffe
auto _far_vector = _o->far_vector.size() ? _fbb.CreateVector64<::flatbuffers::Vector>(_o->far_vector) : 0;
auto _a = _o->a;
auto _far_string = _o->far_string.empty() ? 0 : _fbb.CreateString<::flatbuffers::Offset64>(_o->far_string);
auto _big_bool_vector = _o->big_bool_vector.size() ? _fbb.CreateVector64(_o->big_bool_vector) : 0;
auto _big_vector = _o->big_vector.size() ? _fbb.CreateVector64(_o->big_vector) : 0;
auto _near_string = _o->near_string.empty() ? 0 : _fbb.CreateString(_o->near_string);
auto _nested_root = _o->nested_root.size() ? _fbb.CreateVector64(_o->nested_root) : 0;
@@ -527,6 +550,7 @@ inline ::flatbuffers::Offset<RootTable> RootTable::Pack(::flatbuffers::FlatBuffe
_far_vector,
_a,
_far_string,
_big_bool_vector,
_big_vector,
_near_string,
_nested_root,
@@ -571,6 +595,7 @@ inline const ::flatbuffers::TypeTable *RootTableTypeTable() {
{ ::flatbuffers::ET_INT, 0, -1 },
{ ::flatbuffers::ET_STRING, 0, -1 },
{ ::flatbuffers::ET_UCHAR, 1, -1 },
{ ::flatbuffers::ET_UCHAR, 1, -1 },
{ ::flatbuffers::ET_STRING, 0, -1 },
{ ::flatbuffers::ET_UCHAR, 1, -1 },
{ ::flatbuffers::ET_SEQUENCE, 1, 0 },
@@ -586,6 +611,7 @@ inline const ::flatbuffers::TypeTable *RootTableTypeTable() {
"far_vector",
"a",
"far_string",
"big_bool_vector",
"big_vector",
"near_string",
"nested_root",
@@ -595,7 +621,7 @@ inline const ::flatbuffers::TypeTable *RootTableTypeTable() {
"forced_aligned_vector"
};
static const ::flatbuffers::TypeTable tt = {
::flatbuffers::ST_TABLE, 10, type_codes, type_refs, nullptr, nullptr, names
::flatbuffers::ST_TABLE, 11, type_codes, type_refs, nullptr, nullptr, names
};
return &tt;
}