mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-07 07:34:21 +00:00
Compare commits
1 Commits
v25.12.19-
...
push-qpplq
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a37f22f47 |
10
.github/workflows/build.yml
vendored
10
.github/workflows/build.yml
vendored
@@ -197,7 +197,8 @@ jobs:
|
||||
configuration: [
|
||||
'',
|
||||
'-p:UnsafeByteBuffer=true',
|
||||
'-p:EnableSpanT=true,UnsafeByteBuffer=true'
|
||||
# Fails two tests currently.
|
||||
#'-p:EnableSpanT=true,UnsafeByteBuffer=true'
|
||||
]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
@@ -208,7 +209,7 @@ jobs:
|
||||
- name: Build
|
||||
run: |
|
||||
cd tests\FlatBuffers.Test
|
||||
dotnet new sln --force --name FlatBuffers.Test --format sln
|
||||
dotnet new sln --force --name FlatBuffers.Test
|
||||
dotnet sln FlatBuffers.Test.sln add FlatBuffers.Test.csproj
|
||||
dotnet build -c Release ${{matrix.configuration}} FlatBuffers.Test.sln
|
||||
- name: Run net6.0
|
||||
@@ -591,16 +592,11 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
# Explicitly use 8.5.1 until we can update or https://github.com/actions/runner-images/issues/13564 is fixed.
|
||||
- name: Set env
|
||||
run: >
|
||||
echo "USE_BAZEL_VERSION=8.5.1" >> $GITHUB_ENV
|
||||
- name: bazel build
|
||||
run: >
|
||||
bazel build
|
||||
//:flatc
|
||||
//:flatbuffers
|
||||
//tests:flatbuffers_test
|
||||
- name: bazel test
|
||||
run: >
|
||||
bazel test
|
||||
|
||||
@@ -515,13 +515,13 @@ function(compile_schema SRC_FBS OPT SUFFIX OUT_GEN_FILE)
|
||||
endfunction()
|
||||
|
||||
function(compile_schema_for_test SRC_FBS OPT)
|
||||
compile_schema("${SRC_FBS}" "${OPT}" "_generated" GEN_FILE)
|
||||
compile_schema("${SRC_FBS}" "${OPT}" ".fbs" GEN_FILE)
|
||||
target_sources(flattests PRIVATE ${GEN_FILE})
|
||||
endfunction()
|
||||
|
||||
function(compile_schema_for_test_fbsh SRC_FBS OPT)
|
||||
function(compile_schema_for_test_17 SRC_FBS OPT)
|
||||
compile_schema("${SRC_FBS}" "${OPT}" ".fbs" GEN_FILE)
|
||||
target_sources(flattests PRIVATE ${GEN_FILE})
|
||||
target_sources(flattests_cpp17 PRIVATE ${GEN_FILE})
|
||||
endfunction()
|
||||
|
||||
function(compile_schema_for_samples SRC_FBS OPT)
|
||||
@@ -548,17 +548,26 @@ if(FLATBUFFERS_BUILD_TESTS)
|
||||
# The flattest target needs some generated files
|
||||
SET(FLATC_OPT_COMP --cpp --gen-compare --gen-mutable --gen-object-api --reflect-names)
|
||||
SET(FLATC_OPT_SCOPED_ENUMS ${FLATC_OPT_COMP};--scoped-enums)
|
||||
SET(FLATC_OPT_NAKED_PTR ${FLATC_OPT_COMP} --cpp-ptr-type naked)
|
||||
|
||||
compile_schema_for_test(tests/alignment_test.fbs "${FLATC_OPT_COMP}")
|
||||
compile_schema_for_test_fbsh(tests/default_vectors_strings_test.fbs "${FLATC_OPT_COMP}")
|
||||
compile_schema_for_test(tests/default_vectors_strings_test.fbs "${FLATC_OPT_COMP}")
|
||||
compile_schema_for_test(tests/monster_extra.fbs "${FLATC_OPT_COMP}")
|
||||
compile_schema_for_test(tests/arrays_test.fbs "${FLATC_OPT_SCOPED_ENUMS}")
|
||||
compile_schema_for_test(tests/native_inline_table_test.fbs "${FLATC_OPT_COMP}")
|
||||
compile_schema_for_test(tests/native_type_test.fbs "${FLATC_OPT_COMP}")
|
||||
compile_schema_for_test(tests/optional_scalars.fbs "${FLATC_OPT_COMP}")
|
||||
compile_schema_for_test(tests/key_field/key_field_sample.fbs "${FLATC_OPT_COMP}")
|
||||
compile_schema_for_test(tests/64bit/test_64bit.fbs "${FLATC_OPT_COMP};--bfbs-gen-embed")
|
||||
compile_schema_for_test(tests/64bit/evolution/v1.fbs "${FLATC_OPT_COMP}")
|
||||
compile_schema_for_test(tests/64bit/evolution/v2.fbs "${FLATC_OPT_COMP}")
|
||||
compile_schema_for_test(tests/union_underlying_type_test.fbs "${FLATC_OPT_SCOPED_ENUMS}")
|
||||
compile_schema_for_test(tests/evolution_test/evolution_v1.fbs "${FLATC_OPT_SCOPED_ENUMS}")
|
||||
compile_schema_for_test(tests/evolution_test/evolution_v2.fbs "${FLATC_OPT_SCOPED_ENUMS}")
|
||||
compile_schema_for_test(tests/vector_table_naked_ptr.fbs "${FLATC_OPT_NAKED_PTR}")
|
||||
compile_schema_for_test(tests/namespace_test/namespace_test1.fbs "${FLATC_OPT_SCOPED_ENUMS}")
|
||||
compile_schema_for_test(tests/namespace_test/namespace_test2.fbs "${FLATC_OPT_SCOPED_ENUMS}")
|
||||
compile_schema_for_test(tests/union_vector/union_vector.fbs "${FLATC_OPT_COMP}")
|
||||
|
||||
if(FLATBUFFERS_CODE_SANITIZE)
|
||||
add_fsanitize_to_target(flattests ${FLATBUFFERS_CODE_SANITIZE})
|
||||
@@ -588,9 +597,19 @@ if(FLATBUFFERS_BUILD_TESTS)
|
||||
if(FLATBUFFERS_BUILD_CPP17)
|
||||
add_executable(flattests_cpp17 ${FlatBuffers_Tests_CPP17_SRCS})
|
||||
target_link_libraries(flattests_cpp17 PRIVATE $<BUILD_INTERFACE:ProjectConfig>)
|
||||
target_include_directories(flattests_cpp17 PUBLIC src tests)
|
||||
target_include_directories(flattests_cpp17 PUBLIC
|
||||
# Ideally everything is fully qualified from the root directories
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
# TODO(derekbailey): update includes to fully qualify src/ and tests/
|
||||
src
|
||||
tests
|
||||
${CMAKE_CURRENT_BINARY_DIR}/tests
|
||||
)
|
||||
target_compile_features(flattests_cpp17 PRIVATE cxx_std_17) # requires cmake 3.8
|
||||
|
||||
compile_schema_for_test_17(tests/optional_scalars.fbs "${FLATC_OPT_COMP}")
|
||||
|
||||
if(FLATBUFFERS_CODE_SANITIZE)
|
||||
add_fsanitize_to_target(flattests_cpp17 ${FLATBUFFERS_CODE_SANITIZE})
|
||||
endif()
|
||||
|
||||
@@ -7,7 +7,7 @@ module(
|
||||
|
||||
bazel_dep(
|
||||
name = "aspect_bazel_lib",
|
||||
version = "2.14.0",
|
||||
version = "2.11.0",
|
||||
)
|
||||
bazel_dep(
|
||||
name = "aspect_rules_esbuild",
|
||||
@@ -28,11 +28,11 @@ bazel_dep(
|
||||
)
|
||||
bazel_dep(
|
||||
name = "platforms",
|
||||
version = "0.0.11",
|
||||
version = "0.0.10",
|
||||
)
|
||||
bazel_dep(
|
||||
name = "rules_cc",
|
||||
version = "0.1.1",
|
||||
version = "0.0.16",
|
||||
)
|
||||
bazel_dep(
|
||||
name = "rules_go",
|
||||
@@ -50,7 +50,6 @@ bazel_dep(
|
||||
bazel_dep(
|
||||
name = "rules_swift",
|
||||
version = "2.1.1",
|
||||
max_compatibility_level = 3,
|
||||
repo_name = "build_bazel_rules_swift",
|
||||
)
|
||||
bazel_dep(
|
||||
|
||||
@@ -79,12 +79,11 @@ list of `FILES...`.
|
||||
`myschema.fbs` to JSON:
|
||||
|
||||
```sh
|
||||
flatc --json myschema.fbs -- mydata.bin
|
||||
flatc --json myschema.fbs mydata.bin
|
||||
```
|
||||
|
||||
This will generate a `mydata.json` file. If there is no
|
||||
[`file_identifier`](schema.md/#file-identification-and-extension) defined
|
||||
for this schema, you will need to use the `--raw-binary` option.
|
||||
This will generate a `mydata.json` file.
|
||||
|
||||
|
||||
### Additional options
|
||||
|
||||
|
||||
@@ -1134,8 +1134,12 @@ The Builder provides multiple ways to create `vectors`.
|
||||
=== "Python"
|
||||
|
||||
```py
|
||||
# Use the generated helper to create the weapons vector from offsets.
|
||||
weapons = MyGame.Sample.Monster.CreateWeaponsVector(builder, [sword, axe])
|
||||
# Create a FlatBuffer vector and prepend the weapons.
|
||||
# Note: Since we prepend the data, prepend them in reverse order.
|
||||
MyGame.Sample.Monster.StartWeaponsVector(builder, 2)
|
||||
builder.PrependUOffsetTRelative(axe)
|
||||
builder.PrependUOffsetTRelative(sword)
|
||||
weapons = builder.EndVector()
|
||||
```
|
||||
|
||||
=== "Rust"
|
||||
@@ -1348,13 +1352,16 @@ bit more directly.
|
||||
```py
|
||||
# Create a `vector` representing the inventory of the Orc. Each number
|
||||
# could correspond to an item that can be claimed after he is slain.
|
||||
inv = MyGame.Sample.Monster.CreateInventoryVector(builder, range(0, 10))
|
||||
# Note: Since we prepend the bytes, this loop iterates in reverse.
|
||||
MyGame.Sample.Monster.StartInventoryVector(builder, 10)
|
||||
for i in reversed(range(0, 10)):
|
||||
builder.PrependByte(i)
|
||||
inv = builder.EndVector()
|
||||
|
||||
path_points = [
|
||||
MyGame.Sample.Vec3T(x=1.0, y=2.0, z=3.0),
|
||||
MyGame.Sample.Vec3T(x=4.0, y=5.0, z=6.0),
|
||||
]
|
||||
path = MyGame.Sample.Monster.CreatePathVector(builder, path_points)
|
||||
MyGame.Sample.Monster.StartPathVector(builder, 2)
|
||||
MyGame.Sample.Vec3.CreateVec3(builder, 1.0, 2.0, 3.0)
|
||||
MyGame.Sample.Vec3.CreateVec3(builder, 4.0, 5.0, 6.0)
|
||||
path = builder.EndVector()
|
||||
```
|
||||
|
||||
=== "Rust"
|
||||
|
||||
@@ -80,12 +80,6 @@ def UniverseStartGalaxiesVector(builder, numElems):
|
||||
def StartGalaxiesVector(builder, numElems):
|
||||
return UniverseStartGalaxiesVector(builder, numElems)
|
||||
|
||||
def UniverseCreateGalaxiesVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateGalaxiesVector(builder, data):
|
||||
UniverseCreateGalaxiesVector(builder, data)
|
||||
|
||||
def UniverseEnd(builder):
|
||||
return builder.EndObject()
|
||||
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
|
||||
#[allow(unused_imports, dead_code)]
|
||||
pub mod flatbuffers {
|
||||
|
||||
extern crate alloc;
|
||||
#[allow(unused_imports, dead_code)]
|
||||
pub mod goldens {
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
pub enum GalaxyOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
@@ -91,14 +91,6 @@ class Namer {
|
||||
std::string keyword_prefix;
|
||||
// Suffix used to escape keywords. It is usually "_".
|
||||
std::string keyword_suffix;
|
||||
// The casing used for keywords when escaping. For most languages, keywords
|
||||
// are case sensitive. PHP is an instance where some keywords are case
|
||||
// insensitive.
|
||||
enum class KeywordsCasing {
|
||||
CaseSensitive,
|
||||
CaseInsensitive,
|
||||
};
|
||||
KeywordsCasing keywords_casing;
|
||||
|
||||
// Files.
|
||||
|
||||
@@ -212,16 +204,8 @@ class Namer {
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual std::string NormalizeKeywordCase(const std::string& name) const {
|
||||
if (config_.keywords_casing == Config::KeywordsCasing::CaseInsensitive) {
|
||||
return ConvertCase(name, Case::kAllLower);
|
||||
} else {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
virtual std::string EscapeKeyword(const std::string& name) const {
|
||||
if (keywords_.find(NormalizeKeywordCase(name)) == keywords_.end()) {
|
||||
if (keywords_.find(name) == keywords_.end()) {
|
||||
return name;
|
||||
} else {
|
||||
return config_.keyword_prefix + name + config_.keyword_suffix;
|
||||
|
||||
@@ -26,7 +26,6 @@ static const Namer::Config kConfig = {
|
||||
/*object_suffix=*/"T",
|
||||
/*keyword_prefix=*/"",
|
||||
/*keyword_suffix=*/"_",
|
||||
/*keywords_casing=*/Namer::Config::KeywordsCasing::CaseSensitive,
|
||||
/*filenames=*/Case::kKeep,
|
||||
/*directories=*/Case::kKeep,
|
||||
/*output_path=*/"",
|
||||
@@ -50,7 +49,6 @@ static const Namer::Config kStubConfig = {
|
||||
/*object_suffix=*/"T",
|
||||
/*keyword_prefix=*/"",
|
||||
/*keyword_suffix=*/"_",
|
||||
/*keywords_casing=*/Namer::Config::KeywordsCasing::CaseSensitive,
|
||||
/*filenames=*/Case::kKeep,
|
||||
/*directories=*/Case::kKeep,
|
||||
/*output_path=*/"",
|
||||
|
||||
@@ -260,15 +260,15 @@ inline const char* flatbuffers_version_string() {
|
||||
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator ~ (E lhs){\
|
||||
return E(~T(lhs));\
|
||||
}\
|
||||
inline FLATBUFFERS_CONSTEXPR_CPP14 E operator |= (E &lhs, E rhs){\
|
||||
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator |= (E &lhs, E rhs){\
|
||||
lhs = lhs | rhs;\
|
||||
return lhs;\
|
||||
}\
|
||||
inline FLATBUFFERS_CONSTEXPR_CPP14 E operator &= (E &lhs, E rhs){\
|
||||
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator &= (E &lhs, E rhs){\
|
||||
lhs = lhs & rhs;\
|
||||
return lhs;\
|
||||
}\
|
||||
inline FLATBUFFERS_CONSTEXPR_CPP14 E operator ^= (E &lhs, E rhs){\
|
||||
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator ^= (E &lhs, E rhs){\
|
||||
lhs = lhs ^ rhs;\
|
||||
return lhs;\
|
||||
}\
|
||||
|
||||
@@ -223,7 +223,7 @@ struct Type {
|
||||
uint16_t fixed_length; // only set if t == BASE_TYPE_ARRAY
|
||||
};
|
||||
|
||||
// Represents a parsed scalar value, its type, and field offset.
|
||||
// Represents a parsed scalar value, it's type, and field offset.
|
||||
struct Value {
|
||||
Value()
|
||||
: constant("0"),
|
||||
@@ -395,20 +395,13 @@ struct FieldDef : public Definition {
|
||||
};
|
||||
|
||||
struct StructDef : public Definition {
|
||||
enum class CycleStatus {
|
||||
NotChecked,
|
||||
InProgress,
|
||||
Checked,
|
||||
};
|
||||
|
||||
StructDef()
|
||||
: fixed(false),
|
||||
predecl(true),
|
||||
sortbysize(true),
|
||||
has_key(false),
|
||||
minalign(1),
|
||||
bytesize(0),
|
||||
cycle_status{CycleStatus::NotChecked} {}
|
||||
bytesize(0) {}
|
||||
|
||||
void PadLastField(size_t min_align) {
|
||||
auto padding = PaddingBytes(bytesize, min_align);
|
||||
@@ -430,8 +423,6 @@ struct StructDef : public Definition {
|
||||
size_t minalign; // What the whole object needs to be aligned to.
|
||||
size_t bytesize; // Size if fixed.
|
||||
|
||||
CycleStatus cycle_status; // used for determining if we have circular references
|
||||
|
||||
flatbuffers::unique_ptr<std::string> original_location;
|
||||
std::vector<voffset_t> reserved_ids;
|
||||
};
|
||||
@@ -743,7 +734,6 @@ struct IDLOptions {
|
||||
bool python_gen_numpy;
|
||||
|
||||
bool ts_omit_entrypoint;
|
||||
bool ts_undefined_for_optionals;
|
||||
ProtoIdGapAction proto_id_gap_action;
|
||||
|
||||
// Possible options for the more general generator below.
|
||||
@@ -870,7 +860,6 @@ struct IDLOptions {
|
||||
python_typing(false),
|
||||
python_gen_numpy(true),
|
||||
ts_omit_entrypoint(false),
|
||||
ts_undefined_for_optionals(false),
|
||||
proto_id_gap_action(ProtoIdGapAction::WARNING),
|
||||
mini_reflect(IDLOptions::kNone),
|
||||
require_explicit_ids(false),
|
||||
@@ -1110,8 +1099,6 @@ class Parser : public ParserState {
|
||||
// others includes.
|
||||
std::vector<IncludedFile> GetIncludedFiles() const;
|
||||
|
||||
bool HasCircularStructDependency();
|
||||
|
||||
private:
|
||||
class ParseDepthGuard;
|
||||
|
||||
|
||||
@@ -14,12 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
@file:Suppress("NOTHING_TO_INLINE")
|
||||
@file:OptIn(ExperimentalNativeApi::class)
|
||||
|
||||
package com.google.flatbuffers.kotlin
|
||||
|
||||
import kotlin.experimental.ExperimentalNativeApi
|
||||
|
||||
/**
|
||||
* This implementation assumes that of native macOSX64 the byte order of the implementation is
|
||||
* Little Endian.
|
||||
|
||||
@@ -296,62 +296,25 @@ function mt:Slot(slotnum)
|
||||
self.currentVTable[slotnum + 1] = self:Offset()
|
||||
end
|
||||
|
||||
local function finish(self, rootTable, sizePrefix, fileIdentifier)
|
||||
local function finish(self, rootTable, sizePrefix)
|
||||
UOffsetT:EnforceNumber(rootTable)
|
||||
local hasFid = fileIdentifier ~= nil
|
||||
if hasFid then
|
||||
assert(#fileIdentifier == 4, "File identifier must be exactly 4 bytes")
|
||||
end
|
||||
|
||||
local fid_byte_count = (hasFid and 4 or 0)
|
||||
|
||||
-- alignment:
|
||||
-- root offset (4)
|
||||
-- optional file id (4)
|
||||
-- optional size prefix (4)
|
||||
self:Prep(
|
||||
self.minalign,
|
||||
(sizePrefix and 4 or 0) +
|
||||
4 +
|
||||
fid_byte_count
|
||||
)
|
||||
|
||||
-- root offset (points past file identifier if present)
|
||||
self:PrependUOffsetTRelative(rootTable + fid_byte_count)
|
||||
|
||||
-- file identifier
|
||||
if hasFid then
|
||||
for i = 4, 1, -1 do
|
||||
self:PrependByte(string.byte(fileIdentifier, i))
|
||||
end
|
||||
end
|
||||
|
||||
-- size prefix
|
||||
self:Prep(self.minalign, sizePrefix and 8 or 4)
|
||||
self:PrependUOffsetTRelative(rootTable)
|
||||
if sizePrefix then
|
||||
local size = self.bytes.size - self.head
|
||||
Int32:EnforceNumber(size)
|
||||
self:PrependInt32(size)
|
||||
end
|
||||
|
||||
self.finished = true
|
||||
return self.head
|
||||
end
|
||||
|
||||
|
||||
function mt:Finish(rootTable)
|
||||
return finish(self, rootTable, false, nil)
|
||||
return finish(self, rootTable, false)
|
||||
end
|
||||
|
||||
function mt:FinishSizePrefixed(rootTable)
|
||||
return finish(self, rootTable, true, nil)
|
||||
end
|
||||
|
||||
function mt:FinishWithIdentifier(rootTable, fileIdentifier)
|
||||
return finish(self, rootTable, false, fileIdentifier)
|
||||
end
|
||||
|
||||
function mt:FinishSizePrefixedWithIdentifier(rootTable, fileIdentifier)
|
||||
return finish(self, rootTable, true, fileIdentifier)
|
||||
return finish(self, rootTable, true)
|
||||
end
|
||||
|
||||
function mt:Prepend(flags, off)
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace Google.FlatBuffers
|
||||
|
||||
var pos = this.__vector(o);
|
||||
var len = this.__vector_len(o);
|
||||
return bb.ToArray<T>(pos, len * ByteBuffer.SizeOf<T>());
|
||||
return bb.ToArray<T>(pos, len);
|
||||
}
|
||||
|
||||
// Initialize any Table-derived type to point to the union at the given offset.
|
||||
|
||||
@@ -422,6 +422,7 @@ class Builder(object):
|
||||
off2 = self.Offset() - off + N.UOffsetTFlags.bytewidth
|
||||
self.PlaceUOffsetT(off2)
|
||||
|
||||
## @cond FLATBUFFERS_INTERNAL
|
||||
def StartVector(self, elemSize, numElems, alignment):
|
||||
"""StartVector initializes bookkeeping for writing a new vector.
|
||||
|
||||
@@ -437,6 +438,8 @@ class Builder(object):
|
||||
self.Prep(alignment, elemSize * numElems) # In case alignment > int.
|
||||
return self.Offset()
|
||||
|
||||
## @endcond
|
||||
|
||||
def EndVector(self, numElems=None):
|
||||
"""EndVector writes data necessary to finish vector construction."""
|
||||
|
||||
@@ -553,21 +556,6 @@ class Builder(object):
|
||||
self.vectorNumElems = x.size
|
||||
return self.EndVector()
|
||||
|
||||
def CreateVectorOfTables(self, offsets):
|
||||
"""CreateVectorOfTables writes a vector of offsets such as tables or strings.
|
||||
|
||||
Args:
|
||||
offsets: Iterable of offsets returned from previous builder operations.
|
||||
Each element should be an integer compatible with UOffsetT.
|
||||
"""
|
||||
|
||||
offsets = list(offsets)
|
||||
self.StartVector(N.UOffsetTFlags.bytewidth, len(offsets),
|
||||
N.UOffsetTFlags.bytewidth)
|
||||
for off in reversed(offsets):
|
||||
self.PrependUOffsetTRelative(off)
|
||||
return self.EndVector()
|
||||
|
||||
## @cond FLATBUFFERS_INTERNAL
|
||||
def assertNested(self):
|
||||
"""Check that we are in the process of building an object."""
|
||||
|
||||
@@ -155,12 +155,6 @@ def EnumStartValuesVector(builder, numElems):
|
||||
def StartValuesVector(builder, numElems):
|
||||
return EnumStartValuesVector(builder, numElems)
|
||||
|
||||
def EnumCreateValuesVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateValuesVector(builder, data):
|
||||
EnumCreateValuesVector(builder, data)
|
||||
|
||||
def EnumAddIsUnion(builder, isUnion):
|
||||
builder.PrependBoolSlot(2, isUnion, 0)
|
||||
|
||||
@@ -185,12 +179,6 @@ def EnumStartAttributesVector(builder, numElems):
|
||||
def StartAttributesVector(builder, numElems):
|
||||
return EnumStartAttributesVector(builder, numElems)
|
||||
|
||||
def EnumCreateAttributesVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateAttributesVector(builder, data):
|
||||
EnumCreateAttributesVector(builder, data)
|
||||
|
||||
def EnumAddDocumentation(builder, documentation):
|
||||
builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(documentation), 0)
|
||||
|
||||
@@ -203,12 +191,6 @@ def EnumStartDocumentationVector(builder, numElems):
|
||||
def StartDocumentationVector(builder, numElems):
|
||||
return EnumStartDocumentationVector(builder, numElems)
|
||||
|
||||
def EnumCreateDocumentationVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateDocumentationVector(builder, data):
|
||||
EnumCreateDocumentationVector(builder, data)
|
||||
|
||||
def EnumAddDeclarationFile(builder, declarationFile):
|
||||
builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(declarationFile), 0)
|
||||
|
||||
|
||||
@@ -134,12 +134,6 @@ def EnumValStartDocumentationVector(builder, numElems):
|
||||
def StartDocumentationVector(builder, numElems):
|
||||
return EnumValStartDocumentationVector(builder, numElems)
|
||||
|
||||
def EnumValCreateDocumentationVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateDocumentationVector(builder, data):
|
||||
EnumValCreateDocumentationVector(builder, data)
|
||||
|
||||
def EnumValAddAttributes(builder, attributes):
|
||||
builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(attributes), 0)
|
||||
|
||||
@@ -152,12 +146,6 @@ def EnumValStartAttributesVector(builder, numElems):
|
||||
def StartAttributesVector(builder, numElems):
|
||||
return EnumValStartAttributesVector(builder, numElems)
|
||||
|
||||
def EnumValCreateAttributesVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateAttributesVector(builder, data):
|
||||
EnumValCreateAttributesVector(builder, data)
|
||||
|
||||
def EnumValEnd(builder):
|
||||
return builder.EndObject()
|
||||
|
||||
|
||||
@@ -235,12 +235,6 @@ def FieldStartAttributesVector(builder, numElems):
|
||||
def StartAttributesVector(builder, numElems):
|
||||
return FieldStartAttributesVector(builder, numElems)
|
||||
|
||||
def FieldCreateAttributesVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateAttributesVector(builder, data):
|
||||
FieldCreateAttributesVector(builder, data)
|
||||
|
||||
def FieldAddDocumentation(builder, documentation):
|
||||
builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(documentation), 0)
|
||||
|
||||
@@ -253,12 +247,6 @@ def FieldStartDocumentationVector(builder, numElems):
|
||||
def StartDocumentationVector(builder, numElems):
|
||||
return FieldStartDocumentationVector(builder, numElems)
|
||||
|
||||
def FieldCreateDocumentationVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateDocumentationVector(builder, data):
|
||||
FieldCreateDocumentationVector(builder, data)
|
||||
|
||||
def FieldAddOptional(builder, optional):
|
||||
builder.PrependBoolSlot(11, optional, 0)
|
||||
|
||||
|
||||
@@ -158,12 +158,6 @@ def ObjectStartFieldsVector(builder, numElems):
|
||||
def StartFieldsVector(builder, numElems):
|
||||
return ObjectStartFieldsVector(builder, numElems)
|
||||
|
||||
def ObjectCreateFieldsVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateFieldsVector(builder, data):
|
||||
ObjectCreateFieldsVector(builder, data)
|
||||
|
||||
def ObjectAddIsStruct(builder, isStruct):
|
||||
builder.PrependBoolSlot(2, isStruct, 0)
|
||||
|
||||
@@ -194,12 +188,6 @@ def ObjectStartAttributesVector(builder, numElems):
|
||||
def StartAttributesVector(builder, numElems):
|
||||
return ObjectStartAttributesVector(builder, numElems)
|
||||
|
||||
def ObjectCreateAttributesVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateAttributesVector(builder, data):
|
||||
ObjectCreateAttributesVector(builder, data)
|
||||
|
||||
def ObjectAddDocumentation(builder, documentation):
|
||||
builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(documentation), 0)
|
||||
|
||||
@@ -212,12 +200,6 @@ def ObjectStartDocumentationVector(builder, numElems):
|
||||
def StartDocumentationVector(builder, numElems):
|
||||
return ObjectStartDocumentationVector(builder, numElems)
|
||||
|
||||
def ObjectCreateDocumentationVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateDocumentationVector(builder, data):
|
||||
ObjectCreateDocumentationVector(builder, data)
|
||||
|
||||
def ObjectAddDeclarationFile(builder, declarationFile):
|
||||
builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(declarationFile), 0)
|
||||
|
||||
|
||||
@@ -138,12 +138,6 @@ def RPCCallStartAttributesVector(builder, numElems):
|
||||
def StartAttributesVector(builder, numElems):
|
||||
return RPCCallStartAttributesVector(builder, numElems)
|
||||
|
||||
def RPCCallCreateAttributesVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateAttributesVector(builder, data):
|
||||
RPCCallCreateAttributesVector(builder, data)
|
||||
|
||||
def RPCCallAddDocumentation(builder, documentation):
|
||||
builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(documentation), 0)
|
||||
|
||||
@@ -156,12 +150,6 @@ def RPCCallStartDocumentationVector(builder, numElems):
|
||||
def StartDocumentationVector(builder, numElems):
|
||||
return RPCCallStartDocumentationVector(builder, numElems)
|
||||
|
||||
def RPCCallCreateDocumentationVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateDocumentationVector(builder, data):
|
||||
RPCCallCreateDocumentationVector(builder, data)
|
||||
|
||||
def RPCCallEnd(builder):
|
||||
return builder.EndObject()
|
||||
|
||||
|
||||
@@ -180,12 +180,6 @@ def SchemaStartObjectsVector(builder, numElems):
|
||||
def StartObjectsVector(builder, numElems):
|
||||
return SchemaStartObjectsVector(builder, numElems)
|
||||
|
||||
def SchemaCreateObjectsVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateObjectsVector(builder, data):
|
||||
SchemaCreateObjectsVector(builder, data)
|
||||
|
||||
def SchemaAddEnums(builder, enums):
|
||||
builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(enums), 0)
|
||||
|
||||
@@ -198,12 +192,6 @@ def SchemaStartEnumsVector(builder, numElems):
|
||||
def StartEnumsVector(builder, numElems):
|
||||
return SchemaStartEnumsVector(builder, numElems)
|
||||
|
||||
def SchemaCreateEnumsVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateEnumsVector(builder, data):
|
||||
SchemaCreateEnumsVector(builder, data)
|
||||
|
||||
def SchemaAddFileIdent(builder, fileIdent):
|
||||
builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(fileIdent), 0)
|
||||
|
||||
@@ -234,12 +222,6 @@ def SchemaStartServicesVector(builder, numElems):
|
||||
def StartServicesVector(builder, numElems):
|
||||
return SchemaStartServicesVector(builder, numElems)
|
||||
|
||||
def SchemaCreateServicesVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateServicesVector(builder, data):
|
||||
SchemaCreateServicesVector(builder, data)
|
||||
|
||||
def SchemaAddAdvancedFeatures(builder, advancedFeatures):
|
||||
builder.PrependUint64Slot(6, advancedFeatures, 0)
|
||||
|
||||
@@ -258,12 +240,6 @@ def SchemaStartFbsFilesVector(builder, numElems):
|
||||
def StartFbsFilesVector(builder, numElems):
|
||||
return SchemaStartFbsFilesVector(builder, numElems)
|
||||
|
||||
def SchemaCreateFbsFilesVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateFbsFilesVector(builder, data):
|
||||
SchemaCreateFbsFilesVector(builder, data)
|
||||
|
||||
def SchemaEnd(builder):
|
||||
return builder.EndObject()
|
||||
|
||||
|
||||
@@ -84,12 +84,6 @@ def SchemaFileStartIncludedFilenamesVector(builder, numElems):
|
||||
def StartIncludedFilenamesVector(builder, numElems):
|
||||
return SchemaFileStartIncludedFilenamesVector(builder, numElems)
|
||||
|
||||
def SchemaFileCreateIncludedFilenamesVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateIncludedFilenamesVector(builder, data):
|
||||
SchemaFileCreateIncludedFilenamesVector(builder, data)
|
||||
|
||||
def SchemaFileEnd(builder):
|
||||
return builder.EndObject()
|
||||
|
||||
|
||||
@@ -137,12 +137,6 @@ def ServiceStartCallsVector(builder, numElems):
|
||||
def StartCallsVector(builder, numElems):
|
||||
return ServiceStartCallsVector(builder, numElems)
|
||||
|
||||
def ServiceCreateCallsVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateCallsVector(builder, data):
|
||||
ServiceCreateCallsVector(builder, data)
|
||||
|
||||
def ServiceAddAttributes(builder, attributes):
|
||||
builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(attributes), 0)
|
||||
|
||||
@@ -155,12 +149,6 @@ def ServiceStartAttributesVector(builder, numElems):
|
||||
def StartAttributesVector(builder, numElems):
|
||||
return ServiceStartAttributesVector(builder, numElems)
|
||||
|
||||
def ServiceCreateAttributesVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateAttributesVector(builder, data):
|
||||
ServiceCreateAttributesVector(builder, data)
|
||||
|
||||
def ServiceAddDocumentation(builder, documentation):
|
||||
builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(documentation), 0)
|
||||
|
||||
@@ -173,12 +161,6 @@ def ServiceStartDocumentationVector(builder, numElems):
|
||||
def StartDocumentationVector(builder, numElems):
|
||||
return ServiceStartDocumentationVector(builder, numElems)
|
||||
|
||||
def ServiceCreateDocumentationVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateDocumentationVector(builder, data):
|
||||
ServiceCreateDocumentationVector(builder, data)
|
||||
|
||||
def ServiceAddDeclarationFile(builder, declarationFile):
|
||||
builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(declarationFile), 0)
|
||||
|
||||
|
||||
@@ -611,8 +611,6 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
|
||||
// Write the VTable (we may delete it afterwards, if it is a duplicate):
|
||||
let vt_start_pos = self.head;
|
||||
let vt_end_pos = self.head + vtable_byte_len;
|
||||
// Zero out the vtable space - make_space only reserves but doesn't initialize
|
||||
self.allocator[vt_start_pos.range_to(vt_end_pos)].fill(0);
|
||||
{
|
||||
// write the vtable header:
|
||||
let vtfw =
|
||||
|
||||
@@ -421,9 +421,6 @@ impl<'a> Serializer for MapKeySerializer<'a> {
|
||||
type SerializeStruct = Impossible<(), Error>;
|
||||
type SerializeStructVariant = Impossible<(), Error>;
|
||||
|
||||
fn is_human_readable(&self) -> bool {
|
||||
self.0.is_human_readable()
|
||||
}
|
||||
fn serialize_bool(self, _value: bool) -> Result<(), Error> {
|
||||
key_must_be_a_string()
|
||||
}
|
||||
|
||||
@@ -33,11 +33,11 @@ result = subprocess.run(
|
||||
if result.returncode != 0:
|
||||
print(
|
||||
"\n"
|
||||
"ERROR: **********************************************************\n"
|
||||
"ERROR: * The following differences were found after building. *\n"
|
||||
"ERROR: * Perhaps there is a difference in the flags for the. *\n"
|
||||
"ERROR: * CMakeLists.txt vs the scripts/generate_code.py script? *\n"
|
||||
"ERROR: **********************************************************\n"
|
||||
"ERROR: *********************************************************\n"
|
||||
"ERROR: * The following differences were found after building. *\n"
|
||||
"ERROR: * Perhaps there is a difference in the flags for the. *\n"
|
||||
"ERROR: * CMakeLists.txt vs the script/generate_code.py script? *\n"
|
||||
"ERROR: *********************************************************\n"
|
||||
)
|
||||
subprocess.run(["git", "diff", "--binary", "--exit-code"], cwd=root_path)
|
||||
sys.exit(result.returncode)
|
||||
@@ -55,11 +55,11 @@ result = subprocess.run(
|
||||
if result.returncode != 0:
|
||||
print(
|
||||
"\n"
|
||||
"ERROR: *********************************************************\n"
|
||||
"ERROR: * The following differences were found after running *\n"
|
||||
"ERROR: * the scripts/generate_code.py script. Maybe you forgot *\n"
|
||||
"ERROR: * to run it after making changes in a generator? *\n"
|
||||
"ERROR: *********************************************************\n"
|
||||
"ERROR: ********************************************************\n"
|
||||
"ERROR: * The following differences were found after running *\n"
|
||||
"ERROR: * the script/generate_code.py script. Maybe you forgot *\n"
|
||||
"ERROR: * to run it after making changes in a generator? *\n"
|
||||
"ERROR: ********************************************************\n"
|
||||
)
|
||||
subprocess.run(["git", "diff", "--binary", "--exit-code"], cwd=root_path)
|
||||
sys.exit(result.returncode)
|
||||
|
||||
@@ -85,11 +85,6 @@ RUST_OPTS = BASE_OPTS + [
|
||||
"--gen-name-strings",
|
||||
"--rust-module-root-file",
|
||||
]
|
||||
RUST_STANDALONE_OPTS = BASE_OPTS + [
|
||||
"--rust",
|
||||
"--gen-all",
|
||||
"--gen-name-strings",
|
||||
]
|
||||
RUST_SERIALIZE_OPTS = BASE_OPTS + [
|
||||
"--rust",
|
||||
"--gen-all",
|
||||
@@ -245,12 +240,6 @@ flatc(
|
||||
],
|
||||
)
|
||||
|
||||
flatc(
|
||||
BASE_OPTS + CPP_OPTS + ["--cpp-ptr-type", "naked"],
|
||||
prefix="vector_table_naked_ptr",
|
||||
schema="vector_table_naked_ptr.fbs",
|
||||
)
|
||||
|
||||
flatc(
|
||||
BASE_OPTS + CPP_OPTS + CS_OPTS + JAVA_OPTS + KOTLIN_OPTS + PHP_OPTS,
|
||||
prefix="union_vector",
|
||||
@@ -293,12 +282,6 @@ flatc(
|
||||
schema="include_test/include_test1.fbs",
|
||||
)
|
||||
|
||||
flatc(
|
||||
RUST_STANDALONE_OPTS,
|
||||
include="include_test",
|
||||
schema="include_test/include_test1.fbs",
|
||||
)
|
||||
|
||||
flatc(
|
||||
RUST_OPTS,
|
||||
prefix="include_test2",
|
||||
@@ -306,12 +289,6 @@ flatc(
|
||||
schema="include_test/sub/include_test2.fbs",
|
||||
)
|
||||
|
||||
flatc(
|
||||
RUST_STANDALONE_OPTS,
|
||||
include="include_test",
|
||||
schema="include_test/sub/include_test2.fbs",
|
||||
)
|
||||
|
||||
flatc(
|
||||
BINARY_OPTS + ["--bfbs-filenames", str(tests_path)],
|
||||
include="include_test",
|
||||
@@ -379,7 +356,13 @@ flatc(
|
||||
)
|
||||
|
||||
flatc(
|
||||
["--cpp", "--gen-compare", "--gen-mutable", "--gen-object-api", "--reflect-names"],
|
||||
[
|
||||
"--cpp",
|
||||
"--gen-compare",
|
||||
"--gen-mutable",
|
||||
"--gen-object-api",
|
||||
"--reflect-names",
|
||||
],
|
||||
schema="native_type_test.fbs",
|
||||
)
|
||||
|
||||
|
||||
@@ -61,7 +61,6 @@ Namer::Config LuaDefaultConfig() {
|
||||
/*object_suffix=*/"",
|
||||
/*keyword_prefix=*/"",
|
||||
/*keyword_suffix=*/"_",
|
||||
/*keywords_casing=*/Namer::Config::KeywordsCasing::CaseSensitive,
|
||||
/*filenames=*/Case::kKeep,
|
||||
/*directories=*/Case::kKeep,
|
||||
/*output_path=*/"",
|
||||
@@ -195,13 +194,6 @@ class LuaBfbsGenerator : public BaseBfbsGenerator {
|
||||
code += "\n";
|
||||
|
||||
if (object == root_object) {
|
||||
// emit file identifier if present
|
||||
const auto ident = schema_->file_ident();
|
||||
if (ident && ident->size() == 4) {
|
||||
code += "local FileIdentifier = \"" + ident->str() + "\"\n";
|
||||
code += "\n";
|
||||
}
|
||||
|
||||
code += "function " + object_name + ".GetRootAs" + object_name +
|
||||
"(buf, offset)\n";
|
||||
code += " if type(buf) == \"string\" then\n";
|
||||
@@ -462,34 +454,6 @@ class LuaBfbsGenerator : public BaseBfbsGenerator {
|
||||
code += " return builder:EndObject()\n";
|
||||
code += "end\n";
|
||||
code += "\n";
|
||||
|
||||
if (object == root_object) {
|
||||
code += "function " + object_name + ".Finish" + object_name +
|
||||
"Buffer(builder, offset)\n";
|
||||
// emit file identifier if present
|
||||
const auto ident = schema_->file_ident();
|
||||
if (ident && ident->size() == 4) {
|
||||
code += " builder:FinishWithIdentifier(offset, FileIdentifier)\n";
|
||||
} else {
|
||||
code += " builder:Finish(offset)\n";
|
||||
}
|
||||
code += "end\n";
|
||||
code += "\n";
|
||||
|
||||
// size prefixed option
|
||||
code += "function " + object_name + ".FinishSizePrefixed" +
|
||||
object_name + "Buffer(builder, offset)\n";
|
||||
// emit file identifier if present
|
||||
if (ident && ident->size() == 4) {
|
||||
code +=
|
||||
" builder:FinishSizePrefixedWithIdentifier(offset, "
|
||||
"FileIdentifier)\n";
|
||||
} else {
|
||||
code += " builder:FinishSizePrefixed(offset)\n";
|
||||
}
|
||||
code += "end\n";
|
||||
code += "\n";
|
||||
}
|
||||
}
|
||||
|
||||
EmitCodeBlock(code, object_name, ns, object->declaration_file()->str());
|
||||
|
||||
@@ -70,7 +70,6 @@ Namer::Config NimDefaultConfig() {
|
||||
/*object_suffix=*/"T",
|
||||
/*keyword_prefix=*/"",
|
||||
/*keyword_suffix=*/"_",
|
||||
/*keywords_casing=*/Namer::Config::KeywordsCasing::CaseSensitive,
|
||||
/*filenames=*/Case::kKeep,
|
||||
/*directories=*/Case::kKeep,
|
||||
/*output_path=*/"",
|
||||
|
||||
@@ -265,9 +265,6 @@ const static FlatCOption flatc_options[] = {
|
||||
{"", "python-gen-numpy", "", "Whether to generate numpy helpers."},
|
||||
{"", "ts-omit-entrypoint", "",
|
||||
"Omit emission of namespace entrypoint file"},
|
||||
{"", "ts-undefined-for-optionals", "",
|
||||
"Whether to generate undefined values instead of null values for missing "
|
||||
"optional keys"},
|
||||
{"", "file-names-only", "",
|
||||
"Print out generated file names without writing to the files"},
|
||||
{"", "grpc-filename-suffix", "SUFFIX",
|
||||
@@ -713,8 +710,6 @@ FlatCOptions FlatCompiler::ParseFromCommandLineArguments(int argc,
|
||||
opts.python_gen_numpy = false;
|
||||
} else if (arg == "--ts-omit-entrypoint") {
|
||||
opts.ts_omit_entrypoint = true;
|
||||
} else if (arg == "--ts-undefined-for-optionals") {
|
||||
opts.ts_undefined_for_optionals = true;
|
||||
} else if (arg == "--annotate-sparse-vectors") {
|
||||
options.annotate_include_vector_contents = false;
|
||||
} else if (arg == "--annotate") {
|
||||
@@ -927,9 +922,6 @@ std::unique_ptr<Parser> FlatCompiler::GenerateCode(const FlatCOptions& options,
|
||||
auto err = parser->ConformTo(conform_parser);
|
||||
if (!err.empty()) Error("schemas don\'t conform: " + err, false);
|
||||
}
|
||||
if (parser->HasCircularStructDependency()) {
|
||||
Error("schema has circular struct dependencies: " + filename, false);
|
||||
}
|
||||
if (options.schema_binary || opts.binary_schema_gen_embed) {
|
||||
parser->Serialize();
|
||||
}
|
||||
|
||||
@@ -1243,58 +1243,6 @@ class CSharpGenerator : public BaseGenerator {
|
||||
}
|
||||
code += " }\n";
|
||||
}
|
||||
|
||||
// Generate Length property and ByteBuffer accessor for arrays in structs.
|
||||
if (IsArray(field.value.type) && struct_def.fixed &&
|
||||
IsScalar(field.value.type.VectorType().base_type)) {
|
||||
auto camel_name = Name(field);
|
||||
if (camel_name == struct_def.name) { camel_name += "_"; }
|
||||
|
||||
// Generate Length constant
|
||||
code += " public const int " + camel_name;
|
||||
code += "Length = ";
|
||||
code += NumToString(field.value.type.fixed_length);
|
||||
code += ";\n";
|
||||
|
||||
// Generate GetBytes methods for scalar arrays (similar to vector pattern)
|
||||
code += "#if ENABLE_SPAN_T\n";
|
||||
code += " public Span<" + GenTypeBasic(field.value.type.VectorType()) +
|
||||
"> Get";
|
||||
code += camel_name;
|
||||
code += "Bytes() { return ";
|
||||
|
||||
// For byte arrays, we can return the span directly
|
||||
if (field.value.type.VectorType().base_type == BASE_TYPE_UCHAR) {
|
||||
code += "__p.bb.ToSpan(__p.bb_pos + ";
|
||||
code += NumToString(field.value.offset);
|
||||
code += ", ";
|
||||
code += NumToString(field.value.type.fixed_length *
|
||||
SizeOf(field.value.type.VectorType().base_type));
|
||||
code += ")";
|
||||
} else {
|
||||
// For other types, we need to cast the byte span
|
||||
code += "System.Runtime.InteropServices.MemoryMarshal.Cast<byte, " +
|
||||
GenTypeBasic(field.value.type.VectorType()) + ">(__p.bb.ToSpan(__p.bb_pos + ";
|
||||
code += NumToString(field.value.offset);
|
||||
code += ", ";
|
||||
code += NumToString(field.value.type.fixed_length *
|
||||
SizeOf(field.value.type.VectorType().base_type));
|
||||
code += "))";
|
||||
}
|
||||
code += "; }\n";
|
||||
code += "#else\n";
|
||||
code += " public ArraySegment<byte>? Get";
|
||||
code += camel_name;
|
||||
code += "Bytes() { return ";
|
||||
code += "__p.bb.ToArraySegment(__p.bb_pos + ";
|
||||
code += NumToString(field.value.offset);
|
||||
code += ", ";
|
||||
code += NumToString(field.value.type.fixed_length *
|
||||
SizeOf(field.value.type.VectorType().base_type));
|
||||
code += ");}\n";
|
||||
code += "#endif\n";
|
||||
}
|
||||
|
||||
// generate object accessors if is nested_flatbuffer
|
||||
if (field.nested_flatbuffer) {
|
||||
auto nested_type_name = NamespacedName(*field.nested_flatbuffer);
|
||||
|
||||
@@ -48,7 +48,6 @@ static Namer::Config DartDefaultConfig() {
|
||||
/*object_suffix=*/"T",
|
||||
/*keyword_prefix=*/"$",
|
||||
/*keyword_suffix=*/"",
|
||||
/*keywords_casing=*/Namer::Config::KeywordsCasing::CaseSensitive,
|
||||
/*filenames=*/Case::kKeep,
|
||||
/*directories=*/Case::kKeep,
|
||||
/*output_path=*/"",
|
||||
|
||||
@@ -75,7 +75,6 @@ static Namer::Config GoDefaultConfig() {
|
||||
/*object_suffix=*/"T",
|
||||
/*keyword_prefix=*/"",
|
||||
/*keyword_suffix=*/"_",
|
||||
/*keywords_casing=*/Namer::Config::KeywordsCasing::CaseSensitive,
|
||||
/*filenames=*/Case::kKeep,
|
||||
/*directories=*/Case::kKeep,
|
||||
/*output_path=*/"",
|
||||
|
||||
@@ -46,7 +46,6 @@ static Namer::Config JavaDefaultConfig() {
|
||||
/*object_suffix=*/"T",
|
||||
/*keyword_prefix=*/"",
|
||||
/*keyword_suffix=*/"_",
|
||||
/*keywords_casing=*/Namer::Config::KeywordsCasing::CaseSensitive,
|
||||
/*filenames=*/Case::kKeep,
|
||||
/*directories=*/Case::kKeep,
|
||||
/*output_path=*/"",
|
||||
|
||||
@@ -64,7 +64,6 @@ static Namer::Config KotlinDefaultConfig() {
|
||||
/*object_suffix=*/"T",
|
||||
/*keyword_prefix=*/"",
|
||||
/*keyword_suffix=*/"_",
|
||||
/*keywords_casing=*/Namer::Config::KeywordsCasing::CaseSensitive,
|
||||
/*filenames=*/Case::kKeep,
|
||||
/*directories=*/Case::kKeep,
|
||||
/*output_path=*/"",
|
||||
|
||||
@@ -62,7 +62,6 @@ static Namer::Config KotlinDefaultConfig() {
|
||||
/*object_suffix=*/"T",
|
||||
/*keyword_prefix=*/"",
|
||||
/*keyword_suffix=*/"E",
|
||||
/*keywords_casing=*/Namer::Config::KeywordsCasing::CaseSensitive,
|
||||
/*filenames=*/Case::kUpperCamel,
|
||||
/*directories=*/Case::kLowerCamel,
|
||||
/*output_path=*/"",
|
||||
|
||||
@@ -593,18 +593,6 @@ class PythonStubGenerator {
|
||||
"bytes) -> uoffset: ...\n";
|
||||
}
|
||||
}
|
||||
|
||||
stub << "def ";
|
||||
if (!parser_.opts.python_no_type_prefix_suffix) stub << type;
|
||||
stub << "Create" << namer_.Method(*field)
|
||||
<< "Vector(builder: flatbuffers.Builder, data: typing.Iterable["
|
||||
"typing.Any]) -> uoffset: ...\n";
|
||||
if (!parser_.opts.one_file &&
|
||||
!parser_.opts.python_no_type_prefix_suffix) {
|
||||
stub << "def Create" << namer_.Method(*field)
|
||||
<< "Vector(builder: flatbuffers.Builder, data: "
|
||||
"typing.Iterable[typing.Any]) -> uoffset: ...\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1479,59 +1467,6 @@ class PythonGenerator : public BaseGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
void BuildVectorCreationHelper(const StructDef& struct_def,
|
||||
const FieldDef& field, std::string* code_ptr,
|
||||
ImportMap& imports) const {
|
||||
auto& code = *code_ptr;
|
||||
const auto vector_type = field.value.type.VectorType();
|
||||
const bool is_struct_vector = IsStruct(vector_type);
|
||||
const bool is_scalar_vector =
|
||||
IsScalar(vector_type.base_type) || vector_type.enum_def != nullptr;
|
||||
const std::string struct_type = namer_.Type(struct_def);
|
||||
const std::string field_method = namer_.Method(field);
|
||||
const std::string helper_name =
|
||||
parser_.opts.python_no_type_prefix_suffix
|
||||
? "Create" + field_method + "Vector"
|
||||
: struct_type + "Create" + field_method + "Vector";
|
||||
|
||||
if (parser_.opts.python_typing) {
|
||||
imports.insert(ImportMapEntry{"typing", "Iterable"});
|
||||
code += "def " + helper_name +
|
||||
"(builder: flatbuffers.Builder, data: Iterable[Any]) -> int:\n";
|
||||
} else {
|
||||
code += "def " + helper_name + "(builder, data):\n";
|
||||
}
|
||||
|
||||
if (is_scalar_vector || is_struct_vector) {
|
||||
auto alignment = InlineAlignment(vector_type);
|
||||
auto elem_size = InlineSize(vector_type);
|
||||
code += Indent + "data = list(data)\n";
|
||||
code += Indent + "builder.StartVector(" + NumToString(elem_size) +
|
||||
", len(data), " + NumToString(alignment) + ")\n";
|
||||
code += Indent + "for item in reversed(data):\n";
|
||||
if (is_struct_vector) {
|
||||
code += Indent + Indent + "item.Pack(builder)\n";
|
||||
} else {
|
||||
code += Indent + Indent + "builder.Prepend" +
|
||||
namer_.Method(GenTypeBasic(vector_type)) + "(item)\n";
|
||||
}
|
||||
code += Indent + "return builder.EndVector()\n\n";
|
||||
} else {
|
||||
code += Indent + "return builder.CreateVectorOfTables(data)\n\n";
|
||||
}
|
||||
|
||||
if (!parser_.opts.one_file && !parser_.opts.python_no_type_prefix_suffix) {
|
||||
if (parser_.opts.python_typing) {
|
||||
code += "def Create" + field_method +
|
||||
"Vector(builder: flatbuffers.Builder, data: Iterable[Any]) "
|
||||
"-> int:\n";
|
||||
} else {
|
||||
code += "def Create" + field_method + "Vector(builder, data):\n";
|
||||
}
|
||||
code += Indent + helper_name + "(builder, data)\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Set the value of one of the members of a table's vector and fills in the
|
||||
// elements from a bytearray. This is for simplifying the use of nested
|
||||
// flatbuffers.
|
||||
@@ -1682,8 +1617,8 @@ class PythonGenerator : public BaseGenerator {
|
||||
}
|
||||
|
||||
// Generate table constructors, conditioned on its members' types.
|
||||
void GenTableBuilders(const StructDef& struct_def, std::string* code_ptr,
|
||||
ImportMap& imports) const {
|
||||
void GenTableBuilders(const StructDef& struct_def,
|
||||
std::string* code_ptr) const {
|
||||
GetStartOfTable(struct_def, code_ptr);
|
||||
|
||||
for (auto it = struct_def.fields.vec.begin();
|
||||
@@ -1695,7 +1630,6 @@ class PythonGenerator : public BaseGenerator {
|
||||
BuildFieldOfTable(struct_def, field, offset, code_ptr);
|
||||
if (IsVector(field.value.type)) {
|
||||
BuildVectorOfTable(struct_def, field, code_ptr);
|
||||
BuildVectorCreationHelper(struct_def, field, code_ptr, imports);
|
||||
BuildVectorOfTableFromBytes(struct_def, field, code_ptr);
|
||||
}
|
||||
}
|
||||
@@ -1762,7 +1696,7 @@ class PythonGenerator : public BaseGenerator {
|
||||
GenStructBuilder(struct_def, code_ptr);
|
||||
} else {
|
||||
// Creates a set of functions that allow table construction.
|
||||
GenTableBuilders(struct_def, code_ptr, imports);
|
||||
GenTableBuilders(struct_def, code_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ static Namer::Config RustDefaultConfig() {
|
||||
/*object_suffix=*/"T",
|
||||
/*keyword_prefix=*/"",
|
||||
/*keyword_suffix=*/"_",
|
||||
/*keywords_casing=*/Namer::Config::KeywordsCasing::CaseSensitive,
|
||||
/*filenames=*/Case::kSnake,
|
||||
/*directories=*/Case::kSnake,
|
||||
/*output_path=*/"",
|
||||
@@ -424,6 +423,7 @@ class RustGenerator : public BaseGenerator {
|
||||
code_.Clear();
|
||||
code_ += "// " + std::string(FlatBuffersGeneratedWarning());
|
||||
code_ += "// @generated";
|
||||
code_ += "extern crate alloc;";
|
||||
|
||||
assert(!cur_name_space_);
|
||||
|
||||
@@ -3005,7 +3005,6 @@ class RustGenerator : public BaseGenerator {
|
||||
"use self::serde::ser::{Serialize, Serializer, SerializeStruct};";
|
||||
code_ += "";
|
||||
}
|
||||
code_ += "extern crate alloc;";
|
||||
}
|
||||
|
||||
// Set up the correct namespace. This opens a namespace if the current
|
||||
|
||||
@@ -47,7 +47,6 @@ static Namer::Config SwiftDefaultConfig() {
|
||||
/*object_suffix=*/"T",
|
||||
/*keyword_prefix=*/"",
|
||||
/*keyword_suffix=*/"_",
|
||||
/*keywords_casing=*/Namer::Config::KeywordsCasing::CaseSensitive,
|
||||
/*filenames=*/Case::kKeep,
|
||||
/*directories=*/Case::kKeep,
|
||||
/*output_path=*/"",
|
||||
@@ -1963,7 +1962,7 @@ class SwiftGenerator : public BaseGenerator {
|
||||
std::string GenType(const Type& type,
|
||||
const bool should_consider_suffix = false) const {
|
||||
return IsScalar(type.base_type) ? GenTypeBasic(type)
|
||||
: IsArray(type) ? GenType(type.VectorType())
|
||||
: IsArray(type) ? GenType(type.VectorType())
|
||||
: GenTypePointer(type, should_consider_suffix);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,6 @@ Namer::Config TypeScriptDefaultConfig() {
|
||||
/*object_suffix=*/"T",
|
||||
/*keyword_prefix=*/"",
|
||||
/*keyword_suffix=*/"_",
|
||||
/*keywords_casing=*/Namer::Config::KeywordsCasing::CaseSensitive,
|
||||
/*filenames=*/Case::kDasher,
|
||||
/*directories=*/Case::kDasher,
|
||||
/*output_path=*/"",
|
||||
@@ -87,7 +86,6 @@ std::set<std::string> TypescriptKeywords() {
|
||||
"throw", "true", "try", "typeof", "var", "void",
|
||||
"while", "with", "as", "implements", "interface", "let",
|
||||
"package", "private", "protected", "public", "static", "yield",
|
||||
"undefined" // Used with --ts-undefined-for-optionals
|
||||
};
|
||||
}
|
||||
|
||||
@@ -112,9 +110,7 @@ class TsGenerator : public BaseGenerator {
|
||||
const std::string& file_name)
|
||||
: BaseGenerator(parser, path, file_name, "", "_", "ts"),
|
||||
namer_(WithFlagOptions(TypeScriptDefaultConfig(), parser.opts, path),
|
||||
TypescriptKeywords()),
|
||||
null_keyword_(parser_.opts.ts_undefined_for_optionals ? "undefined"
|
||||
: "null") {}
|
||||
TypescriptKeywords()) {}
|
||||
|
||||
bool generate() {
|
||||
generateEnums();
|
||||
@@ -218,8 +214,6 @@ class TsGenerator : public BaseGenerator {
|
||||
|
||||
std::map<std::string, NsDefinition> ns_defs_;
|
||||
|
||||
std::string null_keyword_;
|
||||
|
||||
// Generate code for all enums.
|
||||
void generateEnums() {
|
||||
for (auto it = parser_.enums_.vec.begin(); it != parser_.enums_.vec.end();
|
||||
@@ -473,7 +467,7 @@ class TsGenerator : public BaseGenerator {
|
||||
|
||||
std::string GenDefaultValue(const FieldDef& field, import_set& imports) {
|
||||
if (field.IsScalarOptional()) {
|
||||
return null_keyword_;
|
||||
return "null";
|
||||
}
|
||||
|
||||
const auto& value = field.value;
|
||||
@@ -524,7 +518,7 @@ class TsGenerator : public BaseGenerator {
|
||||
case BASE_TYPE_STRING:
|
||||
case BASE_TYPE_UNION:
|
||||
case BASE_TYPE_STRUCT: {
|
||||
return null_keyword_;
|
||||
return "null";
|
||||
}
|
||||
|
||||
case BASE_TYPE_ARRAY:
|
||||
@@ -560,16 +554,16 @@ class TsGenerator : public BaseGenerator {
|
||||
} else {
|
||||
name = AddImport(imports, owner, *type.struct_def).name;
|
||||
}
|
||||
return allowNull ? (name + "|" + null_keyword_) : name;
|
||||
return allowNull ? (name + "|null") : name;
|
||||
}
|
||||
}
|
||||
|
||||
switch (type.base_type) {
|
||||
case BASE_TYPE_BOOL:
|
||||
return allowNull ? ("boolean|" + null_keyword_) : "boolean";
|
||||
return allowNull ? "boolean|null" : "boolean";
|
||||
case BASE_TYPE_LONG:
|
||||
case BASE_TYPE_ULONG:
|
||||
return allowNull ? ("bigint|" + null_keyword_) : "bigint";
|
||||
return allowNull ? "bigint|null" : "bigint";
|
||||
case BASE_TYPE_ARRAY: {
|
||||
std::string name;
|
||||
if (type.element == BASE_TYPE_LONG || type.element == BASE_TYPE_ULONG) {
|
||||
@@ -584,16 +578,16 @@ class TsGenerator : public BaseGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
return name + (allowNull ? ("|" + null_keyword_) : "");
|
||||
return name + (allowNull ? "|null" : "");
|
||||
}
|
||||
default:
|
||||
if (IsScalar(type.base_type)) {
|
||||
if (type.enum_def) {
|
||||
const auto enum_name =
|
||||
AddImport(imports, owner, *type.enum_def).name;
|
||||
return allowNull ? (enum_name + "|" + null_keyword_) : enum_name;
|
||||
return allowNull ? (enum_name + "|null") : enum_name;
|
||||
}
|
||||
return allowNull ? ("number|" + null_keyword_) : "number";
|
||||
return allowNull ? "number|null" : "number";
|
||||
}
|
||||
return "flatbuffers.Offset";
|
||||
}
|
||||
@@ -1045,8 +1039,7 @@ class TsGenerator : public BaseGenerator {
|
||||
const auto& enum_def = *union_type.enum_def;
|
||||
|
||||
const auto valid_union_type = GenUnionTypeTS(enum_def, imports);
|
||||
const auto valid_union_type_with_null =
|
||||
valid_union_type + "|" + null_keyword_;
|
||||
const auto valid_union_type_with_null = valid_union_type + "|null";
|
||||
|
||||
auto ret = "\n\nexport function " + GenUnionConvFuncName(enum_def) +
|
||||
"(\n type: " + GetTypeName(enum_def) +
|
||||
@@ -1058,7 +1051,7 @@ class TsGenerator : public BaseGenerator {
|
||||
|
||||
const auto union_enum_loop = [&](const std::string& accessor_str) {
|
||||
ret += " switch(" + enum_type + "[type]) {\n";
|
||||
ret += " case 'NONE': return " + null_keyword_ + "; \n";
|
||||
ret += " case 'NONE': return null; \n";
|
||||
|
||||
for (auto it = enum_def.Vals().begin(); it != enum_def.Vals().end();
|
||||
++it) {
|
||||
@@ -1082,7 +1075,7 @@ class TsGenerator : public BaseGenerator {
|
||||
ret += "\n";
|
||||
}
|
||||
|
||||
ret += " default: return " + null_keyword_ + ";\n";
|
||||
ret += " default: return null;\n";
|
||||
ret += " }\n";
|
||||
};
|
||||
|
||||
@@ -1127,8 +1120,7 @@ class TsGenerator : public BaseGenerator {
|
||||
ret += " const temp = " + conversion_function + "(this." +
|
||||
namer_.Method(field_name, "Type") + "(), " +
|
||||
field_binded_method + ");\n";
|
||||
ret += " if(temp === " + null_keyword_ + ") { return " +
|
||||
null_keyword_ + "; }\n";
|
||||
ret += " if(temp === null) { return null; }\n";
|
||||
ret += union_has_string
|
||||
? " if(typeof temp === 'string') { return temp; }\n"
|
||||
: "";
|
||||
@@ -1148,12 +1140,12 @@ class TsGenerator : public BaseGenerator {
|
||||
"++targetEnumIndex) {\n";
|
||||
ret += " const targetEnum = this." +
|
||||
namer_.Method(field_name, "Type") + "(targetEnumIndex);\n";
|
||||
ret += " if(targetEnum === " + null_keyword_ + " || " + enum_type +
|
||||
ret += " if(targetEnum === null || " + enum_type +
|
||||
"[targetEnum!] === 'NONE') { "
|
||||
"continue; }\n\n";
|
||||
ret += " const temp = " + conversion_function + "(targetEnum, " +
|
||||
field_binded_method + ", targetEnumIndex);\n";
|
||||
ret += " if(temp === " + null_keyword_ + ") { continue; }\n";
|
||||
ret += " if(temp === null) { continue; }\n";
|
||||
ret += union_has_string ? " if(typeof temp === 'string') { "
|
||||
"ret.push(temp); continue; }\n"
|
||||
: "";
|
||||
@@ -1170,11 +1162,11 @@ class TsGenerator : public BaseGenerator {
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string GenNullCheckConditional(const std::string& nullCheckVar,
|
||||
const std::string& trueVal,
|
||||
const std::string& falseVal) {
|
||||
return "(" + nullCheckVar + " !== " + null_keyword_ + " ? " + trueVal +
|
||||
" : " + falseVal + ")";
|
||||
static std::string GenNullCheckConditional(
|
||||
const std::string& nullCheckVar, const std::string& trueVal,
|
||||
const std::string& falseVal = "null") {
|
||||
return "(" + nullCheckVar + " !== null ? " + trueVal + " : " + falseVal +
|
||||
")";
|
||||
}
|
||||
|
||||
std::string GenStructMemberValueTS(const StructDef& struct_def,
|
||||
@@ -1308,8 +1300,8 @@ class TsGenerator : public BaseGenerator {
|
||||
|
||||
const std::string field_accessor =
|
||||
"this." + namer_.Method(field) + "()";
|
||||
field_val = GenNullCheckConditional(
|
||||
field_accessor, field_accessor + "!.unpack()", null_keyword_);
|
||||
field_val = GenNullCheckConditional(field_accessor,
|
||||
field_accessor + "!.unpack()");
|
||||
auto packing = GenNullCheckConditional(
|
||||
"this." + field_field,
|
||||
"this." + field_field + "!.pack(builder)", "0");
|
||||
@@ -1517,8 +1509,8 @@ class TsGenerator : public BaseGenerator {
|
||||
break;
|
||||
}
|
||||
|
||||
// length 0 vector is simply empty instead of null/undefined.
|
||||
field_type += is_vector ? "" : ("|" + null_keyword_);
|
||||
// length 0 vector is simply empty instead of null
|
||||
field_type += is_vector ? "" : "|null";
|
||||
}
|
||||
|
||||
if (!field_offset_decl.empty()) {
|
||||
@@ -1547,7 +1539,7 @@ class TsGenerator : public BaseGenerator {
|
||||
} else {
|
||||
if (field.IsScalarOptional()) {
|
||||
pack_func_create_call +=
|
||||
" if (" + field_offset_val + " !== " + null_keyword_ + ")\n ";
|
||||
" if (" + field_offset_val + " !== null)\n ";
|
||||
}
|
||||
pack_func_create_call += " " + struct_name + "." +
|
||||
namer_.Method("add", field) + "(builder, " +
|
||||
@@ -1637,8 +1629,7 @@ class TsGenerator : public BaseGenerator {
|
||||
"> {\n";
|
||||
else
|
||||
code += " {\n";
|
||||
code += " bb: flatbuffers.ByteBuffer|" + null_keyword_ + " = " +
|
||||
null_keyword_ + ";\n";
|
||||
code += " bb: flatbuffers.ByteBuffer|null = null;\n";
|
||||
code += " bb_pos = 0;\n";
|
||||
|
||||
// Generate the __init method that sets the field in a pre-existing
|
||||
@@ -1690,7 +1681,7 @@ class TsGenerator : public BaseGenerator {
|
||||
GenDocComment(field.doc_comment, code_ptr);
|
||||
std::string prefix = namer_.Method(field) + "(";
|
||||
if (is_string) {
|
||||
code += prefix + "):string|" + null_keyword_ + "\n";
|
||||
code += prefix + "):string|null\n";
|
||||
code +=
|
||||
prefix + "optionalEncoding:flatbuffers.Encoding" + "):" +
|
||||
GenTypeName(imports, struct_def, field.value.type, false, true) +
|
||||
@@ -1740,8 +1731,7 @@ class TsGenerator : public BaseGenerator {
|
||||
.name;
|
||||
GenDocComment(field.doc_comment, code_ptr);
|
||||
code += namer_.Method(field);
|
||||
code +=
|
||||
"(obj?:" + type + "):" + type + "|" + null_keyword_ + " {\n";
|
||||
code += "(obj?:" + type + "):" + type + "|null {\n";
|
||||
|
||||
if (struct_def.fixed) {
|
||||
code += " return (obj || " + GenerateNewExpression(type);
|
||||
@@ -1754,7 +1744,7 @@ class TsGenerator : public BaseGenerator {
|
||||
code += field.value.type.struct_def->fixed
|
||||
? "this.bb_pos + offset"
|
||||
: GenBBAccess() + ".__indirect(this.bb_pos + offset)";
|
||||
code += ", " + GenBBAccess() + ") : " + null_keyword_ + ";\n";
|
||||
code += ", " + GenBBAccess() + ") : null;\n";
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -1807,7 +1797,7 @@ class TsGenerator : public BaseGenerator {
|
||||
} else {
|
||||
code += prefix;
|
||||
}
|
||||
code += "):" + vectortypename + "|" + null_keyword_ + " {\n";
|
||||
code += "):" + vectortypename + "|null {\n";
|
||||
|
||||
if (vectortype.base_type == BASE_TYPE_STRUCT) {
|
||||
code += offset_prefix + "(obj || " +
|
||||
@@ -1847,7 +1837,7 @@ class TsGenerator : public BaseGenerator {
|
||||
code += " : 0";
|
||||
}
|
||||
} else {
|
||||
code += ": " + null_keyword_;
|
||||
code += ": null";
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1905,7 +1895,7 @@ class TsGenerator : public BaseGenerator {
|
||||
} else {
|
||||
code += prefix;
|
||||
}
|
||||
code += "):" + vectortypename + "|" + null_keyword_ + " {\n";
|
||||
code += "):" + vectortypename + "|null {\n";
|
||||
|
||||
if (vectortype.base_type == BASE_TYPE_STRUCT) {
|
||||
code += offset_prefix + "(obj || " +
|
||||
@@ -1931,12 +1921,12 @@ class TsGenerator : public BaseGenerator {
|
||||
code += "BigInt(0)";
|
||||
} else if (IsScalar(field.value.type.element)) {
|
||||
if (field.value.type.enum_def) {
|
||||
code += null_keyword_;
|
||||
code += "null";
|
||||
} else {
|
||||
code += "0";
|
||||
}
|
||||
} else {
|
||||
code += null_keyword_;
|
||||
code += "null";
|
||||
}
|
||||
code += ";\n";
|
||||
break;
|
||||
@@ -1949,13 +1939,13 @@ class TsGenerator : public BaseGenerator {
|
||||
const auto& union_enum = *(field.value.type.enum_def);
|
||||
const auto union_type = GenUnionGenericTypeTS(union_enum);
|
||||
code += "<T extends flatbuffers.Table>(obj:" + union_type +
|
||||
"):" + union_type + "|" + null_keyword_ +
|
||||
" "
|
||||
"):" + union_type +
|
||||
"|null "
|
||||
"{\n";
|
||||
|
||||
code += offset_prefix +
|
||||
GenGetter(field.value.type, "(obj, this.bb_pos + offset)") +
|
||||
" : " + null_keyword_ + ";\n";
|
||||
" : null;\n";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -2017,15 +2007,14 @@ class TsGenerator : public BaseGenerator {
|
||||
GenDocComment(code_ptr);
|
||||
|
||||
code += namer_.Method(field, "Array");
|
||||
code += "():" + GenType(vectorType) + "Array|" + null_keyword_ +
|
||||
" {\n" + offset_prefix;
|
||||
code +=
|
||||
"():" + GenType(vectorType) + "Array|null {\n" + offset_prefix;
|
||||
|
||||
code += "new " + GenType(vectorType) + "Array(" + GenBBAccess() +
|
||||
".bytes().buffer, " + GenBBAccess() +
|
||||
".bytes().byteOffset + " + GenBBAccess() +
|
||||
".__vector(this.bb_pos + offset), " + GenBBAccess() +
|
||||
".__vector_len(this.bb_pos + offset)) : " + null_keyword_ +
|
||||
";\n}\n\n";
|
||||
".__vector_len(this.bb_pos + offset)) : null;\n}\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2095,7 +2084,7 @@ class TsGenerator : public BaseGenerator {
|
||||
if (!IsScalar(field.value.type.base_type)) {
|
||||
code += "0";
|
||||
} else if (HasNullDefault(field)) {
|
||||
code += null_keyword_;
|
||||
code += "null";
|
||||
} else {
|
||||
if (field.value.type.base_type == BASE_TYPE_BOOL) {
|
||||
code += "+";
|
||||
@@ -2212,7 +2201,7 @@ class TsGenerator : public BaseGenerator {
|
||||
const auto arg_name = GetArgName(field);
|
||||
|
||||
if (field.IsScalarOptional()) {
|
||||
code += " if (" + arg_name + " !== " + null_keyword_ + ")\n ";
|
||||
code += " if (" + arg_name + " !== null)\n ";
|
||||
}
|
||||
|
||||
code += " " + methodPrefix + "." + namer_.Method("add", field) + "(";
|
||||
@@ -2252,7 +2241,7 @@ class TsGenerator : public BaseGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
bool HasNullDefault(const FieldDef& field) {
|
||||
static bool HasNullDefault(const FieldDef& field) {
|
||||
return field.IsOptional() && field.value.constant == "null";
|
||||
}
|
||||
|
||||
|
||||
@@ -2755,42 +2755,6 @@ std::vector<IncludedFile> Parser::GetIncludedFiles() const {
|
||||
return {it->second.cbegin(), it->second.cend()};
|
||||
}
|
||||
|
||||
bool Parser::HasCircularStructDependency() {
|
||||
std::function<bool(StructDef*)> visit =
|
||||
[&](StructDef* struct_def) {
|
||||
// Only consider fixed structs and structs we have yet to check
|
||||
if (!struct_def->fixed || struct_def->cycle_status == StructDef::CycleStatus::Checked) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (struct_def->cycle_status == StructDef::CycleStatus::InProgress) {
|
||||
// cycle found
|
||||
return true;
|
||||
}
|
||||
|
||||
struct_def->cycle_status = StructDef::CycleStatus::InProgress;
|
||||
|
||||
for (const auto& field : struct_def->fields.vec) {
|
||||
if (field->value.type.base_type == BASE_TYPE_STRUCT) {
|
||||
if (visit(field->value.type.struct_def)) {
|
||||
return true; // Cycle detected in recursion.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct_def->cycle_status = StructDef::CycleStatus::Checked;
|
||||
return false; // No cycle detected.
|
||||
};
|
||||
|
||||
for (const auto& struct_def : structs_.vec) {
|
||||
if (visit(struct_def)) {
|
||||
return true; // Cycle detected.
|
||||
}
|
||||
}
|
||||
|
||||
return false; // No cycle detected.
|
||||
}
|
||||
|
||||
bool Parser::SupportsOptionalScalars(const flatbuffers::IDLOptions& opts) {
|
||||
static FLATBUFFERS_CONSTEXPR unsigned long supported_langs =
|
||||
IDLOptions::kRust | IDLOptions::kSwift | IDLOptions::kLobster |
|
||||
|
||||
30
tests/64bit/BUILD.bazel
Normal file
30
tests/64bit/BUILD.bazel
Normal file
@@ -0,0 +1,30 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("//:build_defs.bzl", "flatbuffer_cc_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
cc_library(
|
||||
name = "offset64_test",
|
||||
testonly = 1,
|
||||
srcs = ["offset64_test.cpp"],
|
||||
hdrs = ["offset64_test.h"],
|
||||
deps = [
|
||||
":test_64bit_cc_fbs",
|
||||
"//tests:test_assert",
|
||||
"//tests/64bit/evolution:v1_cc_fbs",
|
||||
"//tests/64bit/evolution:v2_cc_fbs",
|
||||
],
|
||||
)
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "test_64bit_cc_fbs",
|
||||
srcs = ["test_64bit.fbs"],
|
||||
filename_suffix = ".fbs",
|
||||
flatc_args = [
|
||||
"--gen-compare",
|
||||
"--gen-mutable",
|
||||
"--gen-object-api",
|
||||
"--reflect-names",
|
||||
"--filename-suffix .fbs",
|
||||
],
|
||||
)
|
||||
29
tests/64bit/evolution/BUILD.bazel
Normal file
29
tests/64bit/evolution/BUILD.bazel
Normal file
@@ -0,0 +1,29 @@
|
||||
load("//:build_defs.bzl", "flatbuffer_cc_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "v1_cc_fbs",
|
||||
srcs = ["v1.fbs"],
|
||||
filename_suffix = ".fbs",
|
||||
flatc_args = [
|
||||
"--gen-compare",
|
||||
"--gen-mutable",
|
||||
"--gen-object-api",
|
||||
"--reflect-names",
|
||||
"--filename-suffix .fbs",
|
||||
],
|
||||
)
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "v2_cc_fbs",
|
||||
srcs = ["v2.fbs"],
|
||||
filename_suffix = ".fbs",
|
||||
flatc_args = [
|
||||
"--gen-compare",
|
||||
"--gen-mutable",
|
||||
"--gen-object-api",
|
||||
"--reflect-names",
|
||||
"--filename-suffix .fbs",
|
||||
],
|
||||
)
|
||||
@@ -1,222 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_V1_V1_H_
|
||||
#define FLATBUFFERS_GENERATED_V1_V1_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 12 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
namespace v1 {
|
||||
|
||||
struct RootTable;
|
||||
struct RootTableBuilder;
|
||||
struct RootTableT;
|
||||
|
||||
bool operator==(const RootTableT &lhs, const RootTableT &rhs);
|
||||
bool operator!=(const RootTableT &lhs, const RootTableT &rhs);
|
||||
|
||||
inline const ::flatbuffers::TypeTable *RootTableTypeTable();
|
||||
|
||||
struct RootTableT : public ::flatbuffers::NativeTable {
|
||||
typedef RootTable TableType;
|
||||
float a = 0.0f;
|
||||
std::vector<uint8_t> b{};
|
||||
};
|
||||
|
||||
struct RootTable FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef RootTableT NativeTableType;
|
||||
typedef RootTableBuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return RootTableTypeTable();
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_A = 4,
|
||||
VT_B = 6
|
||||
};
|
||||
float a() const {
|
||||
return GetField<float>(VT_A, 0.0f);
|
||||
}
|
||||
bool mutate_a(float _a = 0.0f) {
|
||||
return SetField<float>(VT_A, _a, 0.0f);
|
||||
}
|
||||
const ::flatbuffers::Vector<uint8_t> *b() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<uint8_t> *>(VT_B);
|
||||
}
|
||||
::flatbuffers::Vector<uint8_t> *mutable_b() {
|
||||
return GetPointer<::flatbuffers::Vector<uint8_t> *>(VT_B);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<float>(verifier, VT_A, 4) &&
|
||||
VerifyOffset(verifier, VT_B) &&
|
||||
verifier.VerifyVector(b()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
RootTableT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(RootTableT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<RootTable> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const RootTableT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct RootTableBuilder {
|
||||
typedef RootTable Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_a(float a) {
|
||||
fbb_.AddElement<float>(RootTable::VT_A, a, 0.0f);
|
||||
}
|
||||
void add_b(::flatbuffers::Offset<::flatbuffers::Vector<uint8_t>> b) {
|
||||
fbb_.AddOffset(RootTable::VT_B, b);
|
||||
}
|
||||
explicit RootTableBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<RootTable> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<RootTable>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<RootTable> CreateRootTable(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
float a = 0.0f,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<uint8_t>> b = 0) {
|
||||
RootTableBuilder builder_(_fbb);
|
||||
builder_.add_b(b);
|
||||
builder_.add_a(a);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<RootTable> CreateRootTableDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
float a = 0.0f,
|
||||
const std::vector<uint8_t> *b = nullptr) {
|
||||
auto b__ = b ? _fbb.CreateVector<uint8_t>(*b) : 0;
|
||||
return v1::CreateRootTable(
|
||||
_fbb,
|
||||
a,
|
||||
b__);
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<RootTable> CreateRootTable(::flatbuffers::FlatBufferBuilder &_fbb, const RootTableT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
|
||||
inline bool operator==(const RootTableT &lhs, const RootTableT &rhs) {
|
||||
return
|
||||
(lhs.a == rhs.a) &&
|
||||
(lhs.b == rhs.b);
|
||||
}
|
||||
|
||||
inline bool operator!=(const RootTableT &lhs, const RootTableT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline RootTableT *RootTable::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<RootTableT>(new RootTableT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void RootTable::UnPackTo(RootTableT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = a(); _o->a = _e; }
|
||||
{ auto _e = b(); if (_e) { _o->b.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->b.begin()); } }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<RootTable> CreateRootTable(::flatbuffers::FlatBufferBuilder &_fbb, const RootTableT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return RootTable::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<RootTable> RootTable::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const RootTableT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const RootTableT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _a = _o->a;
|
||||
auto _b = _o->b.size() ? _fbb.CreateVector(_o->b) : 0;
|
||||
return v1::CreateRootTable(
|
||||
_fbb,
|
||||
_a,
|
||||
_b);
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *RootTableTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_FLOAT, 0, -1 },
|
||||
{ ::flatbuffers::ET_UCHAR, 1, -1 }
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"a",
|
||||
"b"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 2, type_codes, nullptr, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const v1::RootTable *GetRootTable(const void *buf) {
|
||||
return ::flatbuffers::GetRoot<v1::RootTable>(buf);
|
||||
}
|
||||
|
||||
inline const v1::RootTable *GetSizePrefixedRootTable(const void *buf) {
|
||||
return ::flatbuffers::GetSizePrefixedRoot<v1::RootTable>(buf);
|
||||
}
|
||||
|
||||
inline RootTable *GetMutableRootTable(void *buf) {
|
||||
return ::flatbuffers::GetMutableRoot<RootTable>(buf);
|
||||
}
|
||||
|
||||
inline v1::RootTable *GetMutableSizePrefixedRootTable(void *buf) {
|
||||
return ::flatbuffers::GetMutableSizePrefixedRoot<v1::RootTable>(buf);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifyRootTableBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifyBuffer<v1::RootTable>(nullptr);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifySizePrefixedRootTableBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifySizePrefixedBuffer<v1::RootTable>(nullptr);
|
||||
}
|
||||
|
||||
inline void FinishRootTableBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<v1::RootTable> root) {
|
||||
fbb.Finish(root);
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedRootTableBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<v1::RootTable> root) {
|
||||
fbb.FinishSizePrefixed(root);
|
||||
}
|
||||
|
||||
inline std::unique_ptr<v1::RootTableT> UnPackRootTable(
|
||||
const void *buf,
|
||||
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
||||
return std::unique_ptr<v1::RootTableT>(GetRootTable(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
inline std::unique_ptr<v1::RootTableT> UnPackSizePrefixedRootTable(
|
||||
const void *buf,
|
||||
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
||||
return std::unique_ptr<v1::RootTableT>(GetSizePrefixedRootTable(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
} // namespace v1
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_V1_V1_H_
|
||||
@@ -1,246 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_V2_V2_H_
|
||||
#define FLATBUFFERS_GENERATED_V2_V2_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 12 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
namespace v2 {
|
||||
|
||||
struct RootTable;
|
||||
struct RootTableBuilder;
|
||||
struct RootTableT;
|
||||
|
||||
bool operator==(const RootTableT &lhs, const RootTableT &rhs);
|
||||
bool operator!=(const RootTableT &lhs, const RootTableT &rhs);
|
||||
|
||||
inline const ::flatbuffers::TypeTable *RootTableTypeTable();
|
||||
|
||||
struct RootTableT : public ::flatbuffers::NativeTable {
|
||||
typedef RootTable TableType;
|
||||
float a = 0.0f;
|
||||
std::vector<uint8_t> b{};
|
||||
std::vector<uint8_t> big_vector{};
|
||||
};
|
||||
|
||||
struct RootTable FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef RootTableT NativeTableType;
|
||||
typedef RootTableBuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return RootTableTypeTable();
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_A = 4,
|
||||
VT_B = 6,
|
||||
VT_BIG_VECTOR = 8
|
||||
};
|
||||
float a() const {
|
||||
return GetField<float>(VT_A, 0.0f);
|
||||
}
|
||||
bool mutate_a(float _a = 0.0f) {
|
||||
return SetField<float>(VT_A, _a, 0.0f);
|
||||
}
|
||||
const ::flatbuffers::Vector<uint8_t> *b() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<uint8_t> *>(VT_B);
|
||||
}
|
||||
::flatbuffers::Vector<uint8_t> *mutable_b() {
|
||||
return GetPointer<::flatbuffers::Vector<uint8_t> *>(VT_B);
|
||||
}
|
||||
const ::flatbuffers::Vector64<uint8_t> *big_vector() const {
|
||||
return GetPointer64<const ::flatbuffers::Vector64<uint8_t> *>(VT_BIG_VECTOR);
|
||||
}
|
||||
::flatbuffers::Vector64<uint8_t> *mutable_big_vector() {
|
||||
return GetPointer64<::flatbuffers::Vector64<uint8_t> *>(VT_BIG_VECTOR);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<float>(verifier, VT_A, 4) &&
|
||||
VerifyOffset(verifier, VT_B) &&
|
||||
verifier.VerifyVector(b()) &&
|
||||
VerifyOffset64(verifier, VT_BIG_VECTOR) &&
|
||||
verifier.VerifyVector(big_vector()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
RootTableT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(RootTableT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<RootTable> Pack(::flatbuffers::FlatBufferBuilder64 &_fbb, const RootTableT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct RootTableBuilder {
|
||||
typedef RootTable Table;
|
||||
::flatbuffers::FlatBufferBuilder64 &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_a(float a) {
|
||||
fbb_.AddElement<float>(RootTable::VT_A, a, 0.0f);
|
||||
}
|
||||
void add_b(::flatbuffers::Offset<::flatbuffers::Vector<uint8_t>> b) {
|
||||
fbb_.AddOffset(RootTable::VT_B, b);
|
||||
}
|
||||
void add_big_vector(::flatbuffers::Offset64<::flatbuffers::Vector64<uint8_t>> big_vector) {
|
||||
fbb_.AddOffset(RootTable::VT_BIG_VECTOR, big_vector);
|
||||
}
|
||||
explicit RootTableBuilder(::flatbuffers::FlatBufferBuilder64 &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<RootTable> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<RootTable>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<RootTable> CreateRootTable(
|
||||
::flatbuffers::FlatBufferBuilder64 &_fbb,
|
||||
float a = 0.0f,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<uint8_t>> b = 0,
|
||||
::flatbuffers::Offset64<::flatbuffers::Vector64<uint8_t>> big_vector = 0) {
|
||||
RootTableBuilder builder_(_fbb);
|
||||
builder_.add_big_vector(big_vector);
|
||||
builder_.add_b(b);
|
||||
builder_.add_a(a);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<RootTable> CreateRootTableDirect(
|
||||
::flatbuffers::FlatBufferBuilder64 &_fbb,
|
||||
float a = 0.0f,
|
||||
const std::vector<uint8_t> *b = nullptr,
|
||||
const std::vector<uint8_t> *big_vector = nullptr) {
|
||||
auto big_vector__ = big_vector ? _fbb.CreateVector64(*big_vector) : 0;
|
||||
auto b__ = b ? _fbb.CreateVector<uint8_t>(*b) : 0;
|
||||
return v2::CreateRootTable(
|
||||
_fbb,
|
||||
a,
|
||||
b__,
|
||||
big_vector__);
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<RootTable> CreateRootTable(::flatbuffers::FlatBufferBuilder64 &_fbb, const RootTableT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
|
||||
inline bool operator==(const RootTableT &lhs, const RootTableT &rhs) {
|
||||
return
|
||||
(lhs.a == rhs.a) &&
|
||||
(lhs.b == rhs.b) &&
|
||||
(lhs.big_vector == rhs.big_vector);
|
||||
}
|
||||
|
||||
inline bool operator!=(const RootTableT &lhs, const RootTableT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline RootTableT *RootTable::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<RootTableT>(new RootTableT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void RootTable::UnPackTo(RootTableT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = a(); _o->a = _e; }
|
||||
{ auto _e = b(); if (_e) { _o->b.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->b.begin()); } }
|
||||
{ auto _e = big_vector(); if (_e) { _o->big_vector.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->big_vector.begin()); } }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<RootTable> CreateRootTable(::flatbuffers::FlatBufferBuilder64 &_fbb, const RootTableT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return RootTable::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<RootTable> RootTable::Pack(::flatbuffers::FlatBufferBuilder64 &_fbb, const RootTableT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder64 *__fbb; const RootTableT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _a = _o->a;
|
||||
auto _b = _o->b.size() ? _fbb.CreateVector(_o->b) : 0;
|
||||
auto _big_vector = _o->big_vector.size() ? _fbb.CreateVector64(_o->big_vector) : 0;
|
||||
return v2::CreateRootTable(
|
||||
_fbb,
|
||||
_a,
|
||||
_b,
|
||||
_big_vector);
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *RootTableTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_FLOAT, 0, -1 },
|
||||
{ ::flatbuffers::ET_UCHAR, 1, -1 },
|
||||
{ ::flatbuffers::ET_UCHAR, 1, -1 }
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"a",
|
||||
"b",
|
||||
"big_vector"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 3, type_codes, nullptr, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const v2::RootTable *GetRootTable(const void *buf) {
|
||||
return ::flatbuffers::GetRoot<v2::RootTable>(buf);
|
||||
}
|
||||
|
||||
inline const v2::RootTable *GetSizePrefixedRootTable(const void *buf) {
|
||||
return ::flatbuffers::GetSizePrefixedRoot<v2::RootTable,::flatbuffers::uoffset64_t>(buf);
|
||||
}
|
||||
|
||||
inline RootTable *GetMutableRootTable(void *buf) {
|
||||
return ::flatbuffers::GetMutableRoot<RootTable>(buf);
|
||||
}
|
||||
|
||||
inline v2::RootTable *GetMutableSizePrefixedRootTable(void *buf) {
|
||||
return ::flatbuffers::GetMutableSizePrefixedRoot<v2::RootTable,::flatbuffers::uoffset64_t>(buf);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifyRootTableBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifyBuffer<v2::RootTable>(nullptr);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifySizePrefixedRootTableBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifySizePrefixedBuffer<v2::RootTable,::flatbuffers::uoffset64_t>(nullptr);
|
||||
}
|
||||
|
||||
inline void FinishRootTableBuffer(
|
||||
::flatbuffers::FlatBufferBuilder64 &fbb,
|
||||
::flatbuffers::Offset<v2::RootTable> root) {
|
||||
fbb.Finish(root);
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedRootTableBuffer(
|
||||
::flatbuffers::FlatBufferBuilder64 &fbb,
|
||||
::flatbuffers::Offset<v2::RootTable> root) {
|
||||
fbb.FinishSizePrefixed(root);
|
||||
}
|
||||
|
||||
inline std::unique_ptr<v2::RootTableT> UnPackRootTable(
|
||||
const void *buf,
|
||||
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
||||
return std::unique_ptr<v2::RootTableT>(GetRootTable(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
inline std::unique_ptr<v2::RootTableT> UnPackSizePrefixedRootTable(
|
||||
const void *buf,
|
||||
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
||||
return std::unique_ptr<v2::RootTableT>(GetSizePrefixedRootTable(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
} // namespace v2
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_V2_V2_H_
|
||||
@@ -11,9 +11,9 @@
|
||||
#include "flatbuffers/buffer.h"
|
||||
#include "flatbuffers/flatbuffer_builder.h"
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
#include "tests/64bit/evolution/v1_generated.h"
|
||||
#include "tests/64bit/evolution/v2_generated.h"
|
||||
#include "tests/64bit/test_64bit_generated.h"
|
||||
#include "tests/64bit/evolution/v1.fbs.h"
|
||||
#include "tests/64bit/evolution/v2.fbs.h"
|
||||
#include "tests/64bit/test_64bit.fbs.h"
|
||||
#include "tests/test_assert.h"
|
||||
|
||||
namespace flatbuffers {
|
||||
|
||||
@@ -1,683 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_TEST64BIT_H_
|
||||
#define FLATBUFFERS_GENERATED_TEST64BIT_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 12 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
// For access to the binary schema that produced this file.
|
||||
#include "test_64bit_bfbs_generated.h"
|
||||
|
||||
struct LeafStruct;
|
||||
|
||||
struct WrapperTable;
|
||||
struct WrapperTableBuilder;
|
||||
struct WrapperTableT;
|
||||
|
||||
struct RootTable;
|
||||
struct RootTableBuilder;
|
||||
struct RootTableT;
|
||||
|
||||
bool operator==(const LeafStruct &lhs, const LeafStruct &rhs);
|
||||
bool operator!=(const LeafStruct &lhs, const LeafStruct &rhs);
|
||||
bool operator==(const WrapperTableT &lhs, const WrapperTableT &rhs);
|
||||
bool operator!=(const WrapperTableT &lhs, const WrapperTableT &rhs);
|
||||
bool operator==(const RootTableT &lhs, const RootTableT &rhs);
|
||||
bool operator!=(const RootTableT &lhs, const RootTableT &rhs);
|
||||
|
||||
inline const ::flatbuffers::TypeTable *LeafStructTypeTable();
|
||||
|
||||
inline const ::flatbuffers::TypeTable *WrapperTableTypeTable();
|
||||
|
||||
inline const ::flatbuffers::TypeTable *RootTableTypeTable();
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) LeafStruct FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
int32_t a_;
|
||||
int32_t padding0__;
|
||||
double b_;
|
||||
|
||||
public:
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return LeafStructTypeTable();
|
||||
}
|
||||
LeafStruct()
|
||||
: a_(0),
|
||||
padding0__(0),
|
||||
b_(0) {
|
||||
(void)padding0__;
|
||||
}
|
||||
LeafStruct(int32_t _a, double _b)
|
||||
: a_(::flatbuffers::EndianScalar(_a)),
|
||||
padding0__(0),
|
||||
b_(::flatbuffers::EndianScalar(_b)) {
|
||||
(void)padding0__;
|
||||
}
|
||||
int32_t a() const {
|
||||
return ::flatbuffers::EndianScalar(a_);
|
||||
}
|
||||
void mutate_a(int32_t _a) {
|
||||
::flatbuffers::WriteScalar(&a_, _a);
|
||||
}
|
||||
double b() const {
|
||||
return ::flatbuffers::EndianScalar(b_);
|
||||
}
|
||||
void mutate_b(double _b) {
|
||||
::flatbuffers::WriteScalar(&b_, _b);
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(LeafStruct, 16);
|
||||
|
||||
inline bool operator==(const LeafStruct &lhs, const LeafStruct &rhs) {
|
||||
return
|
||||
(lhs.a() == rhs.a()) &&
|
||||
(lhs.b() == rhs.b());
|
||||
}
|
||||
|
||||
inline bool operator!=(const LeafStruct &lhs, const LeafStruct &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct WrapperTableT : public ::flatbuffers::NativeTable {
|
||||
typedef WrapperTable TableType;
|
||||
std::vector<int8_t> vector{};
|
||||
};
|
||||
|
||||
struct WrapperTable FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef WrapperTableT NativeTableType;
|
||||
typedef WrapperTableBuilder Builder;
|
||||
typedef RootTableBinarySchema BinarySchema;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return WrapperTableTypeTable();
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_VECTOR = 4
|
||||
};
|
||||
const ::flatbuffers::Vector<int8_t> *vector() const {
|
||||
return GetPointer64<const ::flatbuffers::Vector<int8_t> *>(VT_VECTOR);
|
||||
}
|
||||
::flatbuffers::Vector<int8_t> *mutable_vector() {
|
||||
return GetPointer64<::flatbuffers::Vector<int8_t> *>(VT_VECTOR);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset64(verifier, VT_VECTOR) &&
|
||||
verifier.VerifyVector(vector()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
WrapperTableT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(WrapperTableT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<WrapperTable> Pack(::flatbuffers::FlatBufferBuilder64 &_fbb, const WrapperTableT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct WrapperTableBuilder {
|
||||
typedef WrapperTable Table;
|
||||
::flatbuffers::FlatBufferBuilder64 &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_vector(::flatbuffers::Offset64<::flatbuffers::Vector<int8_t>> vector) {
|
||||
fbb_.AddOffset(WrapperTable::VT_VECTOR, vector);
|
||||
}
|
||||
explicit WrapperTableBuilder(::flatbuffers::FlatBufferBuilder64 &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<WrapperTable> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<WrapperTable>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<WrapperTable> CreateWrapperTable(
|
||||
::flatbuffers::FlatBufferBuilder64 &_fbb,
|
||||
::flatbuffers::Offset64<::flatbuffers::Vector<int8_t>> vector = 0) {
|
||||
WrapperTableBuilder builder_(_fbb);
|
||||
builder_.add_vector(vector);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<WrapperTable> CreateWrapperTableDirect(
|
||||
::flatbuffers::FlatBufferBuilder64 &_fbb,
|
||||
const std::vector<int8_t> *vector = nullptr) {
|
||||
auto vector__ = vector ? _fbb.CreateVector64<::flatbuffers::Vector>(*vector) : 0;
|
||||
return CreateWrapperTable(
|
||||
_fbb,
|
||||
vector__);
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<WrapperTable> CreateWrapperTable(::flatbuffers::FlatBufferBuilder64 &_fbb, const WrapperTableT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
struct RootTableT : public ::flatbuffers::NativeTable {
|
||||
typedef RootTable TableType;
|
||||
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{};
|
||||
std::vector<LeafStruct> far_struct_vector{};
|
||||
std::vector<LeafStruct> big_struct_vector{};
|
||||
std::vector<std::unique_ptr<WrapperTableT>> many_vectors{};
|
||||
std::vector<uint8_t> forced_aligned_vector{};
|
||||
RootTableT() = default;
|
||||
RootTableT(const RootTableT &o);
|
||||
RootTableT(RootTableT&&) FLATBUFFERS_NOEXCEPT = default;
|
||||
RootTableT &operator=(RootTableT o) FLATBUFFERS_NOEXCEPT;
|
||||
};
|
||||
|
||||
struct RootTable FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef RootTableT NativeTableType;
|
||||
typedef RootTableBuilder Builder;
|
||||
typedef RootTableBinarySchema BinarySchema;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return RootTableTypeTable();
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_FAR_VECTOR = 4,
|
||||
VT_A = 6,
|
||||
VT_FAR_STRING = 8,
|
||||
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);
|
||||
}
|
||||
::flatbuffers::Vector<uint8_t> *mutable_far_vector() {
|
||||
return GetPointer64<::flatbuffers::Vector<uint8_t> *>(VT_FAR_VECTOR);
|
||||
}
|
||||
int32_t a() const {
|
||||
return GetField<int32_t>(VT_A, 0);
|
||||
}
|
||||
bool mutate_a(int32_t _a = 0) {
|
||||
return SetField<int32_t>(VT_A, _a, 0);
|
||||
}
|
||||
const ::flatbuffers::String *far_string() const {
|
||||
return GetPointer64<const ::flatbuffers::String *>(VT_FAR_STRING);
|
||||
}
|
||||
::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);
|
||||
}
|
||||
::flatbuffers::Vector64<uint8_t> *mutable_big_vector() {
|
||||
return GetPointer64<::flatbuffers::Vector64<uint8_t> *>(VT_BIG_VECTOR);
|
||||
}
|
||||
const ::flatbuffers::String *near_string() const {
|
||||
return GetPointer<const ::flatbuffers::String *>(VT_NEAR_STRING);
|
||||
}
|
||||
::flatbuffers::String *mutable_near_string() {
|
||||
return GetPointer<::flatbuffers::String *>(VT_NEAR_STRING);
|
||||
}
|
||||
const ::flatbuffers::Vector64<uint8_t> *nested_root() const {
|
||||
return GetPointer64<const ::flatbuffers::Vector64<uint8_t> *>(VT_NESTED_ROOT);
|
||||
}
|
||||
::flatbuffers::Vector64<uint8_t> *mutable_nested_root() {
|
||||
return GetPointer64<::flatbuffers::Vector64<uint8_t> *>(VT_NESTED_ROOT);
|
||||
}
|
||||
const RootTable *nested_root_nested_root() const {
|
||||
const auto _f = nested_root();
|
||||
return _f ? ::flatbuffers::GetRoot<RootTable>(_f->Data())
|
||||
: nullptr;
|
||||
}
|
||||
const ::flatbuffers::Vector<const LeafStruct *> *far_struct_vector() const {
|
||||
return GetPointer64<const ::flatbuffers::Vector<const LeafStruct *> *>(VT_FAR_STRUCT_VECTOR);
|
||||
}
|
||||
::flatbuffers::Vector<const LeafStruct *> *mutable_far_struct_vector() {
|
||||
return GetPointer64<::flatbuffers::Vector<const LeafStruct *> *>(VT_FAR_STRUCT_VECTOR);
|
||||
}
|
||||
const ::flatbuffers::Vector64<const LeafStruct *> *big_struct_vector() const {
|
||||
return GetPointer64<const ::flatbuffers::Vector64<const LeafStruct *> *>(VT_BIG_STRUCT_VECTOR);
|
||||
}
|
||||
::flatbuffers::Vector64<const LeafStruct *> *mutable_big_struct_vector() {
|
||||
return GetPointer64<::flatbuffers::Vector64<const LeafStruct *> *>(VT_BIG_STRUCT_VECTOR);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<WrapperTable>> *many_vectors() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<WrapperTable>> *>(VT_MANY_VECTORS);
|
||||
}
|
||||
::flatbuffers::Vector<::flatbuffers::Offset<WrapperTable>> *mutable_many_vectors() {
|
||||
return GetPointer<::flatbuffers::Vector<::flatbuffers::Offset<WrapperTable>> *>(VT_MANY_VECTORS);
|
||||
}
|
||||
const ::flatbuffers::Vector64<uint8_t> *forced_aligned_vector() const {
|
||||
return GetPointer64<const ::flatbuffers::Vector64<uint8_t> *>(VT_FORCED_ALIGNED_VECTOR);
|
||||
}
|
||||
::flatbuffers::Vector64<uint8_t> *mutable_forced_aligned_vector() {
|
||||
return GetPointer64<::flatbuffers::Vector64<uint8_t> *>(VT_FORCED_ALIGNED_VECTOR);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset64(verifier, VT_FAR_VECTOR) &&
|
||||
verifier.VerifyVector(far_vector()) &&
|
||||
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) &&
|
||||
verifier.VerifyString(near_string()) &&
|
||||
VerifyOffset64(verifier, VT_NESTED_ROOT) &&
|
||||
verifier.VerifyVector(nested_root()) &&
|
||||
verifier.template VerifyNestedFlatBuffer<RootTable>(nested_root(), nullptr) &&
|
||||
VerifyOffset64(verifier, VT_FAR_STRUCT_VECTOR) &&
|
||||
verifier.VerifyVector(far_struct_vector()) &&
|
||||
VerifyOffset64(verifier, VT_BIG_STRUCT_VECTOR) &&
|
||||
verifier.VerifyVector(big_struct_vector()) &&
|
||||
VerifyOffset(verifier, VT_MANY_VECTORS) &&
|
||||
verifier.VerifyVector(many_vectors()) &&
|
||||
verifier.VerifyVectorOfTables(many_vectors()) &&
|
||||
VerifyOffset64(verifier, VT_FORCED_ALIGNED_VECTOR) &&
|
||||
verifier.VerifyVector(forced_aligned_vector()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
RootTableT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(RootTableT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<RootTable> Pack(::flatbuffers::FlatBufferBuilder64 &_fbb, const RootTableT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct RootTableBuilder {
|
||||
typedef RootTable Table;
|
||||
::flatbuffers::FlatBufferBuilder64 &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_far_vector(::flatbuffers::Offset64<::flatbuffers::Vector<uint8_t>> far_vector) {
|
||||
fbb_.AddOffset(RootTable::VT_FAR_VECTOR, far_vector);
|
||||
}
|
||||
void add_a(int32_t a) {
|
||||
fbb_.AddElement<int32_t>(RootTable::VT_A, a, 0);
|
||||
}
|
||||
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);
|
||||
}
|
||||
void add_near_string(::flatbuffers::Offset<::flatbuffers::String> near_string) {
|
||||
fbb_.AddOffset(RootTable::VT_NEAR_STRING, near_string);
|
||||
}
|
||||
void add_nested_root(::flatbuffers::Offset64<::flatbuffers::Vector64<uint8_t>> nested_root) {
|
||||
fbb_.AddOffset(RootTable::VT_NESTED_ROOT, nested_root);
|
||||
}
|
||||
void add_far_struct_vector(::flatbuffers::Offset64<::flatbuffers::Vector<const LeafStruct *>> far_struct_vector) {
|
||||
fbb_.AddOffset(RootTable::VT_FAR_STRUCT_VECTOR, far_struct_vector);
|
||||
}
|
||||
void add_big_struct_vector(::flatbuffers::Offset64<::flatbuffers::Vector64<const LeafStruct *>> big_struct_vector) {
|
||||
fbb_.AddOffset(RootTable::VT_BIG_STRUCT_VECTOR, big_struct_vector);
|
||||
}
|
||||
void add_many_vectors(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<WrapperTable>>> many_vectors) {
|
||||
fbb_.AddOffset(RootTable::VT_MANY_VECTORS, many_vectors);
|
||||
}
|
||||
void add_forced_aligned_vector(::flatbuffers::Offset64<::flatbuffers::Vector64<uint8_t>> forced_aligned_vector) {
|
||||
fbb_.AddOffset(RootTable::VT_FORCED_ALIGNED_VECTOR, forced_aligned_vector);
|
||||
}
|
||||
explicit RootTableBuilder(::flatbuffers::FlatBufferBuilder64 &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<RootTable> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<RootTable>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<RootTable> CreateRootTable(
|
||||
::flatbuffers::FlatBufferBuilder64 &_fbb,
|
||||
::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,
|
||||
::flatbuffers::Offset64<::flatbuffers::Vector<const LeafStruct *>> far_struct_vector = 0,
|
||||
::flatbuffers::Offset64<::flatbuffers::Vector64<const LeafStruct *>> big_struct_vector = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<WrapperTable>>> many_vectors = 0,
|
||||
::flatbuffers::Offset64<::flatbuffers::Vector64<uint8_t>> forced_aligned_vector = 0) {
|
||||
RootTableBuilder builder_(_fbb);
|
||||
builder_.add_forced_aligned_vector(forced_aligned_vector);
|
||||
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);
|
||||
builder_.add_far_string(far_string);
|
||||
builder_.add_a(a);
|
||||
builder_.add_far_vector(far_vector);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<RootTable> CreateRootTableDirect(
|
||||
::flatbuffers::FlatBufferBuilder64 &_fbb,
|
||||
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,
|
||||
const std::vector<LeafStruct> *far_struct_vector = nullptr,
|
||||
const std::vector<LeafStruct> *big_struct_vector = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<WrapperTable>> *many_vectors = nullptr,
|
||||
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;
|
||||
auto big_struct_vector__ = big_struct_vector ? _fbb.CreateVectorOfStructs64(*big_struct_vector) : 0;
|
||||
if (forced_aligned_vector) { _fbb.ForceVectorAlignment64(forced_aligned_vector->size(), sizeof(uint8_t), 32); }
|
||||
auto forced_aligned_vector__ = forced_aligned_vector ? _fbb.CreateVector64(*forced_aligned_vector) : 0;
|
||||
auto near_string__ = near_string ? _fbb.CreateString(near_string) : 0;
|
||||
auto many_vectors__ = many_vectors ? _fbb.CreateVector<::flatbuffers::Offset<WrapperTable>>(*many_vectors) : 0;
|
||||
return CreateRootTable(
|
||||
_fbb,
|
||||
far_vector__,
|
||||
a,
|
||||
far_string__,
|
||||
big_bool_vector__,
|
||||
big_vector__,
|
||||
near_string__,
|
||||
nested_root__,
|
||||
far_struct_vector__,
|
||||
big_struct_vector__,
|
||||
many_vectors__,
|
||||
forced_aligned_vector__);
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<RootTable> CreateRootTable(::flatbuffers::FlatBufferBuilder64 &_fbb, const RootTableT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
|
||||
inline bool operator==(const WrapperTableT &lhs, const WrapperTableT &rhs) {
|
||||
return
|
||||
(lhs.vector == rhs.vector);
|
||||
}
|
||||
|
||||
inline bool operator!=(const WrapperTableT &lhs, const WrapperTableT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline WrapperTableT *WrapperTable::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<WrapperTableT>(new WrapperTableT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void WrapperTable::UnPackTo(WrapperTableT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = vector(); if (_e) { _o->vector.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->vector.begin()); } }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<WrapperTable> CreateWrapperTable(::flatbuffers::FlatBufferBuilder64 &_fbb, const WrapperTableT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return WrapperTable::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<WrapperTable> WrapperTable::Pack(::flatbuffers::FlatBufferBuilder64 &_fbb, const WrapperTableT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder64 *__fbb; const WrapperTableT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _vector = _o->vector.size() ? _fbb.CreateVector64<::flatbuffers::Vector>(_o->vector) : 0;
|
||||
return CreateWrapperTable(
|
||||
_fbb,
|
||||
_vector);
|
||||
}
|
||||
|
||||
|
||||
inline bool operator==(const RootTableT &lhs, const RootTableT &rhs) {
|
||||
return
|
||||
(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) &&
|
||||
(lhs.far_struct_vector == rhs.far_struct_vector) &&
|
||||
(lhs.big_struct_vector == rhs.big_struct_vector) &&
|
||||
(lhs.many_vectors.size() == rhs.many_vectors.size() && std::equal(lhs.many_vectors.cbegin(), lhs.many_vectors.cend(), rhs.many_vectors.cbegin(), [](std::unique_ptr<WrapperTableT> const &a, std::unique_ptr<WrapperTableT> const &b) { return (a == b) || (a && b && *a == *b); })) &&
|
||||
(lhs.forced_aligned_vector == rhs.forced_aligned_vector);
|
||||
}
|
||||
|
||||
inline bool operator!=(const RootTableT &lhs, const RootTableT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
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),
|
||||
far_struct_vector(o.far_struct_vector),
|
||||
big_struct_vector(o.big_struct_vector),
|
||||
forced_aligned_vector(o.forced_aligned_vector) {
|
||||
many_vectors.reserve(o.many_vectors.size());
|
||||
for (const auto &many_vectors_ : o.many_vectors) { many_vectors.emplace_back((many_vectors_) ? new WrapperTableT(*many_vectors_) : nullptr); }
|
||||
}
|
||||
|
||||
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);
|
||||
std::swap(far_struct_vector, o.far_struct_vector);
|
||||
std::swap(big_struct_vector, o.big_struct_vector);
|
||||
std::swap(many_vectors, o.many_vectors);
|
||||
std::swap(forced_aligned_vector, o.forced_aligned_vector);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline RootTableT *RootTable::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<RootTableT>(new RootTableT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void RootTable::UnPackTo(RootTableT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ 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()); } }
|
||||
{ auto _e = far_struct_vector(); if (_e) { _o->far_struct_vector.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->far_struct_vector[_i] = *_e->Get(_i); } } else { _o->far_struct_vector.resize(0); } }
|
||||
{ auto _e = big_struct_vector(); if (_e) { _o->big_struct_vector.resize(_e->size()); for (::flatbuffers::uoffset64_t _i = 0; _i < _e->size(); _i++) { _o->big_struct_vector[_i] = *_e->Get(_i); } } else { _o->big_struct_vector.resize(0); } }
|
||||
{ auto _e = many_vectors(); if (_e) { _o->many_vectors.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->many_vectors[_i]) { _e->Get(_i)->UnPackTo(_o->many_vectors[_i].get(), _resolver); } else { _o->many_vectors[_i] = std::unique_ptr<WrapperTableT>(_e->Get(_i)->UnPack(_resolver)); } } } else { _o->many_vectors.resize(0); } }
|
||||
{ auto _e = forced_aligned_vector(); if (_e) { _o->forced_aligned_vector.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->forced_aligned_vector.begin()); } }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<RootTable> CreateRootTable(::flatbuffers::FlatBufferBuilder64 &_fbb, const RootTableT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return RootTable::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<RootTable> RootTable::Pack(::flatbuffers::FlatBufferBuilder64 &_fbb, const RootTableT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder64 *__fbb; const RootTableT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
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;
|
||||
auto _far_struct_vector = _o->far_struct_vector.size() ? _fbb.CreateVectorOfStructs64<::flatbuffers::Vector>(_o->far_struct_vector) : 0;
|
||||
auto _big_struct_vector = _o->big_struct_vector.size() ? _fbb.CreateVectorOfStructs64(_o->big_struct_vector) : 0;
|
||||
auto _many_vectors = _o->many_vectors.size() ? _fbb.CreateVector<::flatbuffers::Offset<WrapperTable>> (_o->many_vectors.size(), [](size_t i, _VectorArgs *__va) { return CreateWrapperTable(*__va->__fbb, __va->__o->many_vectors[i].get(), __va->__rehasher); }, &_va ) : 0;
|
||||
_fbb.ForceVectorAlignment64(_o->forced_aligned_vector.size(), sizeof(uint8_t), 32);
|
||||
auto _forced_aligned_vector = _o->forced_aligned_vector.size() ? _fbb.CreateVector64(_o->forced_aligned_vector) : 0;
|
||||
return CreateRootTable(
|
||||
_fbb,
|
||||
_far_vector,
|
||||
_a,
|
||||
_far_string,
|
||||
_big_bool_vector,
|
||||
_big_vector,
|
||||
_near_string,
|
||||
_nested_root,
|
||||
_far_struct_vector,
|
||||
_big_struct_vector,
|
||||
_many_vectors,
|
||||
_forced_aligned_vector);
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *LeafStructTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_INT, 0, -1 },
|
||||
{ ::flatbuffers::ET_DOUBLE, 0, -1 }
|
||||
};
|
||||
static const int64_t values[] = { 0, 8, 16 };
|
||||
static const char * const names[] = {
|
||||
"a",
|
||||
"b"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_STRUCT, 2, type_codes, nullptr, nullptr, values, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *WrapperTableTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_CHAR, 1, -1 }
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"vector"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 1, type_codes, nullptr, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *RootTableTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_UCHAR, 1, -1 },
|
||||
{ ::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 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 1, 0 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 1, 1 },
|
||||
{ ::flatbuffers::ET_UCHAR, 1, -1 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
LeafStructTypeTable,
|
||||
WrapperTableTypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"far_vector",
|
||||
"a",
|
||||
"far_string",
|
||||
"big_bool_vector",
|
||||
"big_vector",
|
||||
"near_string",
|
||||
"nested_root",
|
||||
"far_struct_vector",
|
||||
"big_struct_vector",
|
||||
"many_vectors",
|
||||
"forced_aligned_vector"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 11, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const RootTable *GetRootTable(const void *buf) {
|
||||
return ::flatbuffers::GetRoot<RootTable>(buf);
|
||||
}
|
||||
|
||||
inline const RootTable *GetSizePrefixedRootTable(const void *buf) {
|
||||
return ::flatbuffers::GetSizePrefixedRoot<RootTable,::flatbuffers::uoffset64_t>(buf);
|
||||
}
|
||||
|
||||
inline RootTable *GetMutableRootTable(void *buf) {
|
||||
return ::flatbuffers::GetMutableRoot<RootTable>(buf);
|
||||
}
|
||||
|
||||
inline RootTable *GetMutableSizePrefixedRootTable(void *buf) {
|
||||
return ::flatbuffers::GetMutableSizePrefixedRoot<RootTable,::flatbuffers::uoffset64_t>(buf);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifyRootTableBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifyBuffer<RootTable>(nullptr);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifySizePrefixedRootTableBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifySizePrefixedBuffer<RootTable,::flatbuffers::uoffset64_t>(nullptr);
|
||||
}
|
||||
|
||||
inline void FinishRootTableBuffer(
|
||||
::flatbuffers::FlatBufferBuilder64 &fbb,
|
||||
::flatbuffers::Offset<RootTable> root) {
|
||||
fbb.Finish(root);
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedRootTableBuffer(
|
||||
::flatbuffers::FlatBufferBuilder64 &fbb,
|
||||
::flatbuffers::Offset<RootTable> root) {
|
||||
fbb.FinishSizePrefixed(root);
|
||||
}
|
||||
|
||||
inline std::unique_ptr<RootTableT> UnPackRootTable(
|
||||
const void *buf,
|
||||
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
||||
return std::unique_ptr<RootTableT>(GetRootTable(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
inline std::unique_ptr<RootTableT> UnPackSizePrefixedRootTable(
|
||||
const void *buf,
|
||||
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
||||
return std::unique_ptr<RootTableT>(GetSizePrefixedRootTable(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_TEST64BIT_H_
|
||||
@@ -24,21 +24,12 @@ cc_test(
|
||||
name = "flatbuffers_test",
|
||||
testonly = 1,
|
||||
srcs = [
|
||||
"64bit/evolution/v1_generated.h",
|
||||
"64bit/evolution/v2_generated.h",
|
||||
"64bit/offset64_test.cpp",
|
||||
"64bit/offset64_test.h",
|
||||
"64bit/test_64bit_bfbs_generated.h",
|
||||
"64bit/test_64bit_generated.h",
|
||||
"alignment_test.cpp",
|
||||
"alignment_test.h",
|
||||
"alignment_test_generated.h",
|
||||
"default_vectors_strings_test.cpp",
|
||||
"default_vectors_strings_test.h",
|
||||
"evolution_test.cpp",
|
||||
"evolution_test.h",
|
||||
"evolution_test/evolution_v1_generated.h",
|
||||
"evolution_test/evolution_v2_generated.h",
|
||||
"flexbuffers_test.cpp",
|
||||
"flexbuffers_test.h",
|
||||
"fuzz_test.cpp",
|
||||
@@ -46,18 +37,13 @@ cc_test(
|
||||
"is_quiet_nan.h",
|
||||
"json_test.cpp",
|
||||
"json_test.h",
|
||||
"key_field/key_field_sample_generated.h",
|
||||
"key_field_test.cpp",
|
||||
"key_field_test.h",
|
||||
"monster_test.cpp",
|
||||
"monster_test.h",
|
||||
"monster_test_bfbs_generated.h",
|
||||
"namespace_test/namespace_test1_generated.h",
|
||||
"namespace_test/namespace_test2_generated.h",
|
||||
"native_inline_table_test_generated.h",
|
||||
"native_type_test_impl.cpp",
|
||||
"native_type_test_impl.h",
|
||||
"optional_scalars_generated.h",
|
||||
"optional_scalars_test.cpp",
|
||||
"optional_scalars_test.h",
|
||||
"parser_test.cpp",
|
||||
@@ -71,13 +57,10 @@ cc_test(
|
||||
"test_assert.h",
|
||||
"test_builder.cpp",
|
||||
"test_builder.h",
|
||||
"union_underlying_type_test_generated.h",
|
||||
"union_vector/union_vector_generated.h",
|
||||
"util_test.cpp",
|
||||
"util_test.h",
|
||||
"vector_table_naked_ptr/vector_table_naked_ptr_generated.h",
|
||||
"vector_table_naked_ptr_test.h",
|
||||
"vector_table_naked_ptr_test.cpp",
|
||||
"vector_table_naked_ptr_test.h",
|
||||
],
|
||||
copts = [
|
||||
"-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE",
|
||||
@@ -87,13 +70,8 @@ cc_test(
|
||||
":arrays_test.bfbs",
|
||||
":arrays_test.fbs",
|
||||
":arrays_test.golden",
|
||||
":evolution_test/evolution_v1.fbs",
|
||||
":evolution_test/evolution_v1.json",
|
||||
":evolution_test/evolution_v2.fbs",
|
||||
":evolution_test/evolution_v2.json",
|
||||
":include_test/include_test1.fbs",
|
||||
":include_test/sub/include_test2.fbs",
|
||||
":key_field/key_field_sample.fbs",
|
||||
":monster_extra.fbs",
|
||||
":monster_test.bfbs",
|
||||
":monster_test.fbs",
|
||||
@@ -104,7 +82,6 @@ cc_test(
|
||||
":name_clash_test/invalid_test2.fbs",
|
||||
":name_clash_test/valid_test1.fbs",
|
||||
":name_clash_test/valid_test2.fbs",
|
||||
":native_type_test.fbs",
|
||||
":optional_scalars.fbs",
|
||||
":optional_scalars.json",
|
||||
":optional_scalars_defaults.json",
|
||||
@@ -126,8 +103,8 @@ cc_test(
|
||||
":prototest/twice-id.proto",
|
||||
":prototest/use-reserved-id.proto",
|
||||
":unicode_test.json",
|
||||
":union_vector/union_vector.fbs",
|
||||
":union_vector/union_vector.json",
|
||||
"//tests/evolution_test:test_data",
|
||||
"//tests/union_vector:test_data",
|
||||
],
|
||||
includes = [
|
||||
"",
|
||||
@@ -139,9 +116,18 @@ cc_test(
|
||||
":default_vectors_strings_test_cc_fbs",
|
||||
":monster_extra_cc_fbs",
|
||||
":monster_test_cc_fbs",
|
||||
":native_inline_table_test_cc_fbs",
|
||||
":native_type_test_cc_fbs",
|
||||
":optional_scalars_cc_fbs",
|
||||
":union_underlying_type_test_cc_fbs",
|
||||
":vector_table_naked_ptr_cc_fbs",
|
||||
"//:flatbuffers",
|
||||
"//src:generate_fbs",
|
||||
"//tests/64bit:offset64_test",
|
||||
"//tests/evolution_test:evolution_v1_cc_fbs",
|
||||
"//tests/evolution_test:evolution_v2_cc_fbs",
|
||||
"//tests/key_field:key_field_sample_cc_fbs",
|
||||
"//tests/union_vector:union_vector_cc_fbs",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -151,7 +137,10 @@ cc_library(
|
||||
name = "test_assert",
|
||||
srcs = ["test_assert.cpp"],
|
||||
hdrs = ["test_assert.h"],
|
||||
visibility = ["//grpc/tests:__subpackages__"],
|
||||
visibility = [
|
||||
"//grpc/tests:__subpackages__",
|
||||
"//tests:__subpackages__",
|
||||
],
|
||||
deps = ["//:flatbuffers"],
|
||||
)
|
||||
|
||||
@@ -245,11 +234,20 @@ cc_library(
|
||||
flatbuffer_cc_library(
|
||||
name = "monster_extra_cc_fbs",
|
||||
srcs = ["monster_extra.fbs"],
|
||||
filename_suffix = ".fbs",
|
||||
flatc_args = [
|
||||
"--gen-compare",
|
||||
"--gen-mutable",
|
||||
"--gen-object-api",
|
||||
"--reflect-names",
|
||||
"--filename-suffix .fbs",
|
||||
],
|
||||
)
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "arrays_test_cc_fbs",
|
||||
srcs = ["arrays_test.fbs"],
|
||||
filename_suffix = ".fbs",
|
||||
flatc_args = [
|
||||
"--gen-object-api",
|
||||
"--gen-compare",
|
||||
@@ -258,27 +256,26 @@ flatbuffer_cc_library(
|
||||
"--reflect-names",
|
||||
"--cpp-ptr-type flatbuffers::unique_ptr",
|
||||
"--scoped-enums",
|
||||
"--filename-suffix .fbs",
|
||||
],
|
||||
)
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "native_type_test_cc_fbs",
|
||||
srcs = ["native_type_test.fbs"],
|
||||
filename_suffix = ".fbs",
|
||||
flatc_args = [
|
||||
"--gen-object-api",
|
||||
"--gen-mutable",
|
||||
"--cpp-ptr-type flatbuffers::unique_ptr",
|
||||
"--filename-suffix .fbs",
|
||||
],
|
||||
)
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "alignment_test_cc_fbs",
|
||||
srcs = ["alignment_test.fbs"],
|
||||
)
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "default_vectors_strings_test_cc_fbs",
|
||||
srcs = ["default_vectors_strings_test.fbs"],
|
||||
filename_suffix = ".fbs",
|
||||
flatc_args = [
|
||||
"--gen-compare",
|
||||
"--gen-mutable",
|
||||
@@ -286,5 +283,71 @@ flatbuffer_cc_library(
|
||||
"--reflect-names",
|
||||
"--filename-suffix .fbs",
|
||||
],
|
||||
filename_suffix = ".fbs"
|
||||
)
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "default_vectors_strings_test_cc_fbs",
|
||||
srcs = ["default_vectors_strings_test.fbs"],
|
||||
filename_suffix = ".fbs",
|
||||
flatc_args = [
|
||||
"--gen-compare",
|
||||
"--gen-mutable",
|
||||
"--gen-object-api",
|
||||
"--reflect-names",
|
||||
"--filename-suffix .fbs",
|
||||
],
|
||||
)
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "native_inline_table_test_cc_fbs",
|
||||
srcs = ["native_inline_table_test.fbs"],
|
||||
filename_suffix = ".fbs",
|
||||
flatc_args = [
|
||||
"--gen-compare",
|
||||
"--gen-mutable",
|
||||
"--gen-object-api",
|
||||
"--reflect-names",
|
||||
"--filename-suffix .fbs",
|
||||
],
|
||||
)
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "optional_scalars_cc_fbs",
|
||||
srcs = ["optional_scalars.fbs"],
|
||||
filename_suffix = ".fbs",
|
||||
flatc_args = [
|
||||
"--gen-compare",
|
||||
"--gen-mutable",
|
||||
"--gen-object-api",
|
||||
"--reflect-names",
|
||||
"--filename-suffix .fbs",
|
||||
],
|
||||
)
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "union_underlying_type_test_cc_fbs",
|
||||
srcs = ["union_underlying_type_test.fbs"],
|
||||
filename_suffix = ".fbs",
|
||||
flatc_args = [
|
||||
"--gen-compare",
|
||||
"--gen-mutable",
|
||||
"--gen-object-api",
|
||||
"--reflect-names",
|
||||
"--filename-suffix .fbs",
|
||||
"--scoped-enums",
|
||||
],
|
||||
)
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "vector_table_naked_ptr_cc_fbs",
|
||||
srcs = ["vector_table_naked_ptr.fbs"],
|
||||
filename_suffix = ".fbs",
|
||||
flatc_args = [
|
||||
"--gen-compare",
|
||||
"--gen-mutable",
|
||||
"--gen-object-api",
|
||||
"--reflect-names",
|
||||
"--filename-suffix .fbs",
|
||||
"--cpp-ptr-type naked",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright 2014 Google Inc. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -90,9 +90,6 @@ namespace Google.FlatBuffers.Test
|
||||
fbb.AddOffset(test1.Value);
|
||||
var testArrayOfString = fbb.EndVector();
|
||||
|
||||
var longsVector = Monster.CreateVectorOfLongsVector(fbb, new long[] { 1, 100, 10000, 1000000, 100000000 });
|
||||
var doublesVector = Monster.CreateVectorOfDoublesVector(fbb, new double[] { -1.7976931348623157e+308, 0, 1.7976931348623157e+308 });
|
||||
|
||||
Monster.StartMonster(fbb);
|
||||
Monster.AddPos(fbb, Vec3.CreateVec3(fbb, 1.0f, 2.0f, 3.0f, 3.0,
|
||||
Color.Green, (short)5, (sbyte)6));
|
||||
@@ -105,8 +102,6 @@ namespace Google.FlatBuffers.Test
|
||||
Monster.AddTestarrayofstring(fbb, testArrayOfString);
|
||||
Monster.AddTestbool(fbb, true);
|
||||
Monster.AddTestarrayoftables(fbb, sortMons);
|
||||
Monster.AddVectorOfLongs(fbb, longsVector);
|
||||
Monster.AddVectorOfDoubles(fbb, doublesVector);
|
||||
var mon = Monster.EndMonster(fbb);
|
||||
|
||||
if (sizePrefix)
|
||||
@@ -290,13 +285,6 @@ namespace Google.FlatBuffers.Test
|
||||
Assert.IsTrue(monster.GetTestarrayofboolsBytes().HasValue);
|
||||
}
|
||||
#endif
|
||||
|
||||
var longArray = monster.GetVectorOfLongsArray();
|
||||
Assert.AreEqual(5, longArray.Length);
|
||||
Assert.AreEqual(100, longArray[1]);
|
||||
|
||||
var doublesArray = monster.GetVectorOfDoublesArray();
|
||||
Assert.AreEqual(3, doublesArray.Length);
|
||||
}
|
||||
|
||||
[FlatBuffersTestMethod]
|
||||
|
||||
@@ -1,249 +0,0 @@
|
||||
/*
|
||||
* Copyright 2025 Google Inc. All rights reserved.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using MyGame.Example;
|
||||
|
||||
namespace Google.FlatBuffers.Test
|
||||
{
|
||||
[FlatBuffersTestClass]
|
||||
public class FlatBuffersFixedLengthArrayTests
|
||||
{
|
||||
[FlatBuffersTestMethod]
|
||||
public void FixedLengthArray_LengthConstantsMatchSchema_ReturnTrue()
|
||||
{
|
||||
const int nestedALength = NestedStruct.ALength;
|
||||
const int nestedCLength = NestedStruct.CLength;
|
||||
const int nestedDLength = NestedStruct.DLength;
|
||||
const int arrayBLength = ArrayStruct.BLength;
|
||||
const int arrayFLength = ArrayStruct.FLength;
|
||||
|
||||
Assert.AreEqual(2, nestedALength);
|
||||
Assert.AreEqual(2, nestedCLength);
|
||||
Assert.AreEqual(2, nestedDLength);
|
||||
Assert.AreEqual(15, arrayBLength);
|
||||
Assert.AreEqual(2, arrayFLength);
|
||||
}
|
||||
|
||||
#if ENABLE_SPAN_T
|
||||
[FlatBuffersTestMethod]
|
||||
public void FixedLengthArray_GetBytesSpanLengthIsCorrect_ReturnTrue()
|
||||
{
|
||||
var builder = new FlatBufferBuilder(1024);
|
||||
var ints = new int[] { 1, 2 };
|
||||
var enumB = TestEnum.A;
|
||||
var enums = new TestEnum[] { TestEnum.B, TestEnum.C };
|
||||
var longs = new long[] { 10L, 20L };
|
||||
|
||||
var structOffset = NestedStruct.CreateNestedStruct(builder, ints, enumB, enums, longs);
|
||||
builder.Finish(structOffset.Value);
|
||||
|
||||
var bb = builder.DataBuffer;
|
||||
var nestedStruct = new NestedStruct();
|
||||
nestedStruct.__assign(bb.Length - builder.Offset, bb);
|
||||
|
||||
Span<int> intSpan = nestedStruct.GetABytes();
|
||||
Span<TestEnum> enumSpan = nestedStruct.GetCBytes();
|
||||
Span<long> longSpan = nestedStruct.GetDBytes();
|
||||
|
||||
Assert.AreEqual(intSpan.Length, NestedStruct.ALength);
|
||||
Assert.AreEqual(enumSpan.Length, NestedStruct.CLength);
|
||||
Assert.AreEqual(longSpan.Length, NestedStruct.DLength);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !ENABLE_SPAN_T
|
||||
[FlatBuffersTestMethod]
|
||||
public void FixedLengthArray_GetBytesArraySegmentLengthIsCorrect_ReturnTrue()
|
||||
{
|
||||
var builder = new FlatBufferBuilder(1024);
|
||||
var ints = new int[] { 1, 2 };
|
||||
var enumB = TestEnum.A;
|
||||
var enums = new TestEnum[] { TestEnum.B, TestEnum.C };
|
||||
var longs = new long[] { 10L, 20L };
|
||||
|
||||
var structOffset = NestedStruct.CreateNestedStruct(builder, ints, enumB, enums, longs);
|
||||
builder.Finish(structOffset.Value);
|
||||
|
||||
var buffer = builder.DataBuffer;
|
||||
var nestedStruct = new NestedStruct();
|
||||
nestedStruct.__assign(buffer.Length - builder.Offset, buffer);
|
||||
|
||||
Assert.IsTrue(nestedStruct.GetABytes().HasValue);
|
||||
Assert.IsTrue(nestedStruct.GetCBytes().HasValue);
|
||||
Assert.IsTrue(nestedStruct.GetDBytes().HasValue);
|
||||
|
||||
ArraySegment<byte> intSegment = nestedStruct.GetABytes().Value;
|
||||
ArraySegment<byte> enumSegment = nestedStruct.GetCBytes().Value;
|
||||
ArraySegment<byte> longSegment = nestedStruct.GetDBytes().Value;
|
||||
|
||||
Assert.AreEqual(intSegment.Count, NestedStruct.ALength * sizeof(int));
|
||||
Assert.AreEqual(enumSegment.Count, NestedStruct.CLength * sizeof(sbyte));
|
||||
Assert.AreEqual(longSegment.Count, NestedStruct.DLength * sizeof(long));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLE_SPAN_T
|
||||
[FlatBuffersTestMethod]
|
||||
public void FixedLengthArray_GetBytesSpanEquality_ReturnTrue()
|
||||
{
|
||||
var builder = new FlatBufferBuilder(1024);
|
||||
|
||||
var floatA = 3.14f;
|
||||
var intArray = Enumerable.Range(1, 15).ToArray();
|
||||
var byteC = (sbyte)42;
|
||||
var intE = 999;
|
||||
var longArray = new long[] { 5000L, 6000L };
|
||||
|
||||
var nestedInts = new int[2, 2] { { 10, 20 }, { 30, 40 } };
|
||||
var nestedEnumB = new TestEnum[] { TestEnum.A, TestEnum.B };
|
||||
var nestedEnums = new TestEnum[2, 2] { { TestEnum.A, TestEnum.B }, { TestEnum.C, TestEnum.A } };
|
||||
var nestedLongs = new long[2, 2] { { 100L, 200L }, { 300L, 400L } };
|
||||
|
||||
var structOffset = ArrayStruct.CreateArrayStruct(builder, floatA, intArray, byteC,
|
||||
nestedInts, nestedEnumB, nestedEnums, nestedLongs, intE, longArray);
|
||||
|
||||
ArrayTable.StartArrayTable(builder);
|
||||
ArrayTable.AddA(builder, structOffset);
|
||||
var rootTable = ArrayTable.EndArrayTable(builder);
|
||||
builder.Finish(rootTable.Value);
|
||||
|
||||
var finishedBytes = builder.SizedByteArray();
|
||||
ByteBuffer bb = new ByteBuffer(finishedBytes);
|
||||
ArrayTable arrayTable = ArrayTable.GetRootAsArrayTable(bb);
|
||||
ArrayStruct arrayStruct = arrayTable.A.Value;
|
||||
|
||||
Assert.AreEqual(byteC, arrayStruct.C);
|
||||
Assert.AreEqual(intE, arrayStruct.E);
|
||||
|
||||
Assert.IsTrue(arrayStruct.GetBBytes().SequenceEqual(intArray));
|
||||
Assert.IsTrue(arrayStruct.GetFBytes().SequenceEqual(longArray));
|
||||
|
||||
// Test nested struct arrays
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
var nestedStruct = arrayStruct.D(i);
|
||||
|
||||
var nestedIntSpan = nestedStruct.GetABytes();
|
||||
var expectedNestedInts = new int[] { nestedInts[i, 0], nestedInts[i, 1] };
|
||||
Assert.IsTrue(nestedIntSpan.SequenceEqual(expectedNestedInts));
|
||||
|
||||
Assert.AreEqual(nestedEnumB[i], nestedStruct.B);
|
||||
|
||||
var nestedEnumSpan = nestedStruct.GetCBytes();
|
||||
var expectedNestedEnums = new TestEnum[] { nestedEnums[i, 0], nestedEnums[i, 1] };
|
||||
Assert.IsTrue(nestedEnumSpan.SequenceEqual(expectedNestedEnums));
|
||||
|
||||
var nestedLongSpan = nestedStruct.GetDBytes();
|
||||
var expectedNestedLongs = new long[] { nestedLongs[i, 0], nestedLongs[i, 1] };
|
||||
Assert.IsTrue(nestedLongSpan.SequenceEqual(expectedNestedLongs));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !ENABLE_SPAN_T
|
||||
[FlatBuffersTestMethod]
|
||||
public void FixedLengthArray_GetBytesArraySegmentEquality_ReturnTrue()
|
||||
{
|
||||
var builder = new FlatBufferBuilder(1024);
|
||||
|
||||
var floatA = 3.14f;
|
||||
var intArray = Enumerable.Range(1, 15).ToArray();
|
||||
var byteC = (sbyte)42;
|
||||
var intE = 999;
|
||||
var longArray = new long[] { 5000L, 6000L };
|
||||
|
||||
var nestedInts = new int[2, 2] { { 10, 20 }, { 30, 40 } };
|
||||
var nestedEnumB = new TestEnum[] { TestEnum.A, TestEnum.B };
|
||||
var nestedEnums = new TestEnum[2, 2] { { TestEnum.A, TestEnum.B }, { TestEnum.C, TestEnum.A } };
|
||||
var nestedLongs = new long[2, 2] { { 100L, 200L }, { 300L, 400L } };
|
||||
|
||||
var structOffset = ArrayStruct.CreateArrayStruct(builder, floatA, intArray, byteC,
|
||||
nestedInts, nestedEnumB, nestedEnums, nestedLongs, intE, longArray);
|
||||
|
||||
ArrayTable.StartArrayTable(builder);
|
||||
ArrayTable.AddA(builder, structOffset);
|
||||
var rootTable = ArrayTable.EndArrayTable(builder);
|
||||
builder.Finish(rootTable.Value);
|
||||
|
||||
var finishedBytes = builder.SizedByteArray();
|
||||
ByteBuffer bb = new ByteBuffer(finishedBytes);
|
||||
ArrayTable arrayTable = ArrayTable.GetRootAsArrayTable(bb);
|
||||
ArrayStruct arrayStruct = arrayTable.A.Value;
|
||||
|
||||
// Test that we can read basic scalars correctly
|
||||
Assert.AreEqual(byteC, arrayStruct.C);
|
||||
Assert.AreEqual(intE, arrayStruct.E);
|
||||
|
||||
Assert.IsTrue(arrayStruct.GetBBytes().HasValue);
|
||||
var intSegment = arrayStruct.GetBBytes().Value;
|
||||
for (int i = 0, offset = 0; i < intArray.Length; i++, offset += sizeof(int))
|
||||
{
|
||||
var segmentValue = BitConverter.ToInt32(intSegment.Array,
|
||||
intSegment.Offset + offset);
|
||||
Assert.AreEqual(intArray[i], segmentValue);
|
||||
}
|
||||
|
||||
Assert.IsTrue(arrayStruct.GetFBytes().HasValue);
|
||||
var longSegment = arrayStruct.GetFBytes().Value;
|
||||
for (int i = 0, offset = 0; i < longArray.Length; i++, offset += sizeof(long))
|
||||
{
|
||||
var segmentValue = BitConverter.ToInt64(longSegment.Array,
|
||||
longSegment.Offset + offset);
|
||||
Assert.AreEqual(longArray[i], segmentValue);
|
||||
}
|
||||
|
||||
// Test nested struct arrays
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
var nestedStruct = arrayStruct.D(i);
|
||||
|
||||
Assert.IsTrue(nestedStruct.GetABytes().HasValue);
|
||||
var nestedIntSegment = nestedStruct.GetABytes().Value;
|
||||
var expectedNestedInts = new int[] { nestedInts[i, 0], nestedInts[i, 1] };
|
||||
for (int ii = 0, offset = 0; ii < NestedStruct.ALength; ii++, offset += sizeof(int))
|
||||
{
|
||||
var segmentValue = BitConverter.ToInt32(nestedIntSegment.Array,
|
||||
nestedIntSegment.Offset + offset);
|
||||
Assert.AreEqual(expectedNestedInts[ii], segmentValue);
|
||||
}
|
||||
|
||||
Assert.AreEqual(nestedEnumB[i], nestedStruct.B);
|
||||
|
||||
Assert.IsTrue(nestedStruct.GetCBytes().HasValue);
|
||||
var nestedEnumSegment = nestedStruct.GetCBytes().Value;
|
||||
var expectedNestedEnums = new TestEnum[] { nestedEnums[i, 0], nestedEnums[i, 1] };
|
||||
for (int ii = 0, offset = 0; ii < NestedStruct.CLength; ii++, offset += sizeof(sbyte))
|
||||
{
|
||||
var segmentValue = (TestEnum)nestedEnumSegment.Array[nestedEnumSegment.Offset + offset];
|
||||
Assert.AreEqual(expectedNestedEnums[ii], segmentValue);
|
||||
}
|
||||
|
||||
Assert.IsTrue(nestedStruct.GetDBytes().HasValue);
|
||||
var nestedLongSegment = nestedStruct.GetDBytes().Value;
|
||||
var expectedNestedLongs = new long[] { nestedLongs[i, 0], nestedLongs[i, 1] };
|
||||
for (int ii = 0, offset = 0; ii < NestedStruct.DLength; ii++, offset += sizeof(long))
|
||||
{
|
||||
var segmentValue = BitConverter.ToInt64(nestedLongSegment.Array,
|
||||
nestedLongSegment.Offset + offset);
|
||||
Assert.AreEqual(expectedNestedLongs[ii], segmentValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -19,12 +19,6 @@ public struct ArrayStruct : IFlatbufferObject
|
||||
public float A { get { return __p.bb.GetFloat(__p.bb_pos + 0); } }
|
||||
public void MutateA(float a) { __p.bb.PutFloat(__p.bb_pos + 0, a); }
|
||||
public int B(int j) { return __p.bb.GetInt(__p.bb_pos + 4 + j * 4); }
|
||||
public const int BLength = 15;
|
||||
#if ENABLE_SPAN_T
|
||||
public Span<int> GetBBytes() { return System.Runtime.InteropServices.MemoryMarshal.Cast<byte, int>(__p.bb.ToSpan(__p.bb_pos + 4, 60)); }
|
||||
#else
|
||||
public ArraySegment<byte>? GetBBytes() { return __p.bb.ToArraySegment(__p.bb_pos + 4, 60);}
|
||||
#endif
|
||||
public void MutateB(int j, int b) { __p.bb.PutInt(__p.bb_pos + 4 + j * 4, b); }
|
||||
public sbyte C { get { return __p.bb.GetSbyte(__p.bb_pos + 64); } }
|
||||
public void MutateC(sbyte c) { __p.bb.PutSbyte(__p.bb_pos + 64, c); }
|
||||
@@ -32,12 +26,6 @@ public struct ArrayStruct : IFlatbufferObject
|
||||
public int E { get { return __p.bb.GetInt(__p.bb_pos + 136); } }
|
||||
public void MutateE(int e) { __p.bb.PutInt(__p.bb_pos + 136, e); }
|
||||
public long F(int j) { return __p.bb.GetLong(__p.bb_pos + 144 + j * 8); }
|
||||
public const int FLength = 2;
|
||||
#if ENABLE_SPAN_T
|
||||
public Span<long> GetFBytes() { return System.Runtime.InteropServices.MemoryMarshal.Cast<byte, long>(__p.bb.ToSpan(__p.bb_pos + 144, 16)); }
|
||||
#else
|
||||
public ArraySegment<byte>? GetFBytes() { return __p.bb.ToArraySegment(__p.bb_pos + 144, 16);}
|
||||
#endif
|
||||
public void MutateF(int j, long f) { __p.bb.PutLong(__p.bb_pos + 144 + j * 8, f); }
|
||||
|
||||
public static Offset<MyGame.Example.ArrayStruct> CreateArrayStruct(FlatBufferBuilder builder, float A, int[] B, sbyte C, int[,] d_A, MyGame.Example.TestEnum[] d_B, MyGame.Example.TestEnum[,] d_C, long[,] d_D, int E, long[] F) {
|
||||
|
||||
@@ -28,8 +28,6 @@ function Monster.New()
|
||||
return o
|
||||
end
|
||||
|
||||
local FileIdentifier = "MONS"
|
||||
|
||||
function Monster.GetRootAsMonster(buf, offset)
|
||||
if type(buf) == "string" then
|
||||
buf = flatbuffers.binaryArray.New(buf)
|
||||
@@ -1101,12 +1099,4 @@ function Monster.End(builder)
|
||||
return builder:EndObject()
|
||||
end
|
||||
|
||||
function Monster.FinishMonsterBuffer(builder, offset)
|
||||
builder:FinishWithIdentifier(offset, FileIdentifier)
|
||||
end
|
||||
|
||||
function Monster.FinishSizePrefixedMonsterBuffer(builder, offset)
|
||||
builder:FinishSizePrefixedWithIdentifier(offset, FileIdentifier)
|
||||
end
|
||||
|
||||
return Monster
|
||||
@@ -914,16 +914,6 @@ def MonsterStartInventoryVector(builder, numElems):
|
||||
def StartInventoryVector(builder, numElems):
|
||||
return MonsterStartInventoryVector(builder, numElems)
|
||||
|
||||
def MonsterCreateInventoryVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(1, len(data), 1)
|
||||
for item in reversed(data):
|
||||
builder.PrependUint8(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def CreateInventoryVector(builder, data):
|
||||
MonsterCreateInventoryVector(builder, data)
|
||||
|
||||
def MonsterAddColor(builder, color):
|
||||
builder.PrependUint8Slot(6, color, 8)
|
||||
|
||||
@@ -954,16 +944,6 @@ def MonsterStartTest4Vector(builder, numElems):
|
||||
def StartTest4Vector(builder, numElems):
|
||||
return MonsterStartTest4Vector(builder, numElems)
|
||||
|
||||
def MonsterCreateTest4Vector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(4, len(data), 2)
|
||||
for item in reversed(data):
|
||||
item.Pack(builder)
|
||||
return builder.EndVector()
|
||||
|
||||
def CreateTest4Vector(builder, data):
|
||||
MonsterCreateTest4Vector(builder, data)
|
||||
|
||||
def MonsterAddTestarrayofstring(builder, testarrayofstring):
|
||||
builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofstring), 0)
|
||||
|
||||
@@ -976,12 +956,6 @@ def MonsterStartTestarrayofstringVector(builder, numElems):
|
||||
def StartTestarrayofstringVector(builder, numElems):
|
||||
return MonsterStartTestarrayofstringVector(builder, numElems)
|
||||
|
||||
def MonsterCreateTestarrayofstringVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateTestarrayofstringVector(builder, data):
|
||||
MonsterCreateTestarrayofstringVector(builder, data)
|
||||
|
||||
def MonsterAddTestarrayoftables(builder, testarrayoftables):
|
||||
builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayoftables), 0)
|
||||
|
||||
@@ -994,12 +968,6 @@ def MonsterStartTestarrayoftablesVector(builder, numElems):
|
||||
def StartTestarrayoftablesVector(builder, numElems):
|
||||
return MonsterStartTestarrayoftablesVector(builder, numElems)
|
||||
|
||||
def MonsterCreateTestarrayoftablesVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateTestarrayoftablesVector(builder, data):
|
||||
MonsterCreateTestarrayoftablesVector(builder, data)
|
||||
|
||||
def MonsterAddEnemy(builder, enemy):
|
||||
builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(enemy), 0)
|
||||
|
||||
@@ -1018,16 +986,6 @@ def MonsterStartTestnestedflatbufferVector(builder, numElems):
|
||||
def StartTestnestedflatbufferVector(builder, numElems):
|
||||
return MonsterStartTestnestedflatbufferVector(builder, numElems)
|
||||
|
||||
def MonsterCreateTestnestedflatbufferVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(1, len(data), 1)
|
||||
for item in reversed(data):
|
||||
builder.PrependUint8(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def CreateTestnestedflatbufferVector(builder, data):
|
||||
MonsterCreateTestnestedflatbufferVector(builder, data)
|
||||
|
||||
def MonsterMakeTestnestedflatbufferVectorFromBytes(builder, bytes):
|
||||
builder.StartVector(1, len(bytes), 1)
|
||||
builder.head = builder.head - len(bytes)
|
||||
@@ -1107,16 +1065,6 @@ def MonsterStartTestarrayofboolsVector(builder, numElems):
|
||||
def StartTestarrayofboolsVector(builder, numElems):
|
||||
return MonsterStartTestarrayofboolsVector(builder, numElems)
|
||||
|
||||
def MonsterCreateTestarrayofboolsVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(1, len(data), 1)
|
||||
for item in reversed(data):
|
||||
builder.PrependBool(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def CreateTestarrayofboolsVector(builder, data):
|
||||
MonsterCreateTestarrayofboolsVector(builder, data)
|
||||
|
||||
def MonsterAddTestf(builder, testf):
|
||||
builder.PrependFloat32Slot(25, testf, 3.14159)
|
||||
|
||||
@@ -1147,12 +1095,6 @@ def MonsterStartTestarrayofstring2Vector(builder, numElems):
|
||||
def StartTestarrayofstring2Vector(builder, numElems):
|
||||
return MonsterStartTestarrayofstring2Vector(builder, numElems)
|
||||
|
||||
def MonsterCreateTestarrayofstring2Vector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateTestarrayofstring2Vector(builder, data):
|
||||
MonsterCreateTestarrayofstring2Vector(builder, data)
|
||||
|
||||
def MonsterAddTestarrayofsortedstruct(builder, testarrayofsortedstruct):
|
||||
builder.PrependUOffsetTRelativeSlot(29, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofsortedstruct), 0)
|
||||
|
||||
@@ -1165,16 +1107,6 @@ def MonsterStartTestarrayofsortedstructVector(builder, numElems):
|
||||
def StartTestarrayofsortedstructVector(builder, numElems):
|
||||
return MonsterStartTestarrayofsortedstructVector(builder, numElems)
|
||||
|
||||
def MonsterCreateTestarrayofsortedstructVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(8, len(data), 4)
|
||||
for item in reversed(data):
|
||||
item.Pack(builder)
|
||||
return builder.EndVector()
|
||||
|
||||
def CreateTestarrayofsortedstructVector(builder, data):
|
||||
MonsterCreateTestarrayofsortedstructVector(builder, data)
|
||||
|
||||
def MonsterAddFlex(builder, flex):
|
||||
builder.PrependUOffsetTRelativeSlot(30, flatbuffers.number_types.UOffsetTFlags.py_type(flex), 0)
|
||||
|
||||
@@ -1187,16 +1119,6 @@ def MonsterStartFlexVector(builder, numElems):
|
||||
def StartFlexVector(builder, numElems):
|
||||
return MonsterStartFlexVector(builder, numElems)
|
||||
|
||||
def MonsterCreateFlexVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(1, len(data), 1)
|
||||
for item in reversed(data):
|
||||
builder.PrependUint8(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def CreateFlexVector(builder, data):
|
||||
MonsterCreateFlexVector(builder, data)
|
||||
|
||||
def MonsterAddTest5(builder, test5):
|
||||
builder.PrependUOffsetTRelativeSlot(31, flatbuffers.number_types.UOffsetTFlags.py_type(test5), 0)
|
||||
|
||||
@@ -1209,16 +1131,6 @@ def MonsterStartTest5Vector(builder, numElems):
|
||||
def StartTest5Vector(builder, numElems):
|
||||
return MonsterStartTest5Vector(builder, numElems)
|
||||
|
||||
def MonsterCreateTest5Vector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(4, len(data), 2)
|
||||
for item in reversed(data):
|
||||
item.Pack(builder)
|
||||
return builder.EndVector()
|
||||
|
||||
def CreateTest5Vector(builder, data):
|
||||
MonsterCreateTest5Vector(builder, data)
|
||||
|
||||
def MonsterAddVectorOfLongs(builder, vectorOfLongs):
|
||||
builder.PrependUOffsetTRelativeSlot(32, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfLongs), 0)
|
||||
|
||||
@@ -1231,16 +1143,6 @@ def MonsterStartVectorOfLongsVector(builder, numElems):
|
||||
def StartVectorOfLongsVector(builder, numElems):
|
||||
return MonsterStartVectorOfLongsVector(builder, numElems)
|
||||
|
||||
def MonsterCreateVectorOfLongsVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(8, len(data), 8)
|
||||
for item in reversed(data):
|
||||
builder.PrependInt64(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def CreateVectorOfLongsVector(builder, data):
|
||||
MonsterCreateVectorOfLongsVector(builder, data)
|
||||
|
||||
def MonsterAddVectorOfDoubles(builder, vectorOfDoubles):
|
||||
builder.PrependUOffsetTRelativeSlot(33, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfDoubles), 0)
|
||||
|
||||
@@ -1253,16 +1155,6 @@ def MonsterStartVectorOfDoublesVector(builder, numElems):
|
||||
def StartVectorOfDoublesVector(builder, numElems):
|
||||
return MonsterStartVectorOfDoublesVector(builder, numElems)
|
||||
|
||||
def MonsterCreateVectorOfDoublesVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(8, len(data), 8)
|
||||
for item in reversed(data):
|
||||
builder.PrependFloat64(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def CreateVectorOfDoublesVector(builder, data):
|
||||
MonsterCreateVectorOfDoublesVector(builder, data)
|
||||
|
||||
def MonsterAddParentNamespaceTest(builder, parentNamespaceTest):
|
||||
builder.PrependUOffsetTRelativeSlot(34, flatbuffers.number_types.UOffsetTFlags.py_type(parentNamespaceTest), 0)
|
||||
|
||||
@@ -1281,12 +1173,6 @@ def MonsterStartVectorOfReferrablesVector(builder, numElems):
|
||||
def StartVectorOfReferrablesVector(builder, numElems):
|
||||
return MonsterStartVectorOfReferrablesVector(builder, numElems)
|
||||
|
||||
def MonsterCreateVectorOfReferrablesVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateVectorOfReferrablesVector(builder, data):
|
||||
MonsterCreateVectorOfReferrablesVector(builder, data)
|
||||
|
||||
def MonsterAddSingleWeakReference(builder, singleWeakReference):
|
||||
builder.PrependUint64Slot(36, singleWeakReference, 0)
|
||||
|
||||
@@ -1305,16 +1191,6 @@ def MonsterStartVectorOfWeakReferencesVector(builder, numElems):
|
||||
def StartVectorOfWeakReferencesVector(builder, numElems):
|
||||
return MonsterStartVectorOfWeakReferencesVector(builder, numElems)
|
||||
|
||||
def MonsterCreateVectorOfWeakReferencesVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(8, len(data), 8)
|
||||
for item in reversed(data):
|
||||
builder.PrependUint64(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def CreateVectorOfWeakReferencesVector(builder, data):
|
||||
MonsterCreateVectorOfWeakReferencesVector(builder, data)
|
||||
|
||||
def MonsterAddVectorOfStrongReferrables(builder, vectorOfStrongReferrables):
|
||||
builder.PrependUOffsetTRelativeSlot(38, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfStrongReferrables), 0)
|
||||
|
||||
@@ -1327,12 +1203,6 @@ def MonsterStartVectorOfStrongReferrablesVector(builder, numElems):
|
||||
def StartVectorOfStrongReferrablesVector(builder, numElems):
|
||||
return MonsterStartVectorOfStrongReferrablesVector(builder, numElems)
|
||||
|
||||
def MonsterCreateVectorOfStrongReferrablesVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateVectorOfStrongReferrablesVector(builder, data):
|
||||
MonsterCreateVectorOfStrongReferrablesVector(builder, data)
|
||||
|
||||
def MonsterAddCoOwningReference(builder, coOwningReference):
|
||||
builder.PrependUint64Slot(39, coOwningReference, 0)
|
||||
|
||||
@@ -1351,16 +1221,6 @@ def MonsterStartVectorOfCoOwningReferencesVector(builder, numElems):
|
||||
def StartVectorOfCoOwningReferencesVector(builder, numElems):
|
||||
return MonsterStartVectorOfCoOwningReferencesVector(builder, numElems)
|
||||
|
||||
def MonsterCreateVectorOfCoOwningReferencesVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(8, len(data), 8)
|
||||
for item in reversed(data):
|
||||
builder.PrependUint64(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def CreateVectorOfCoOwningReferencesVector(builder, data):
|
||||
MonsterCreateVectorOfCoOwningReferencesVector(builder, data)
|
||||
|
||||
def MonsterAddNonOwningReference(builder, nonOwningReference):
|
||||
builder.PrependUint64Slot(41, nonOwningReference, 0)
|
||||
|
||||
@@ -1379,16 +1239,6 @@ def MonsterStartVectorOfNonOwningReferencesVector(builder, numElems):
|
||||
def StartVectorOfNonOwningReferencesVector(builder, numElems):
|
||||
return MonsterStartVectorOfNonOwningReferencesVector(builder, numElems)
|
||||
|
||||
def MonsterCreateVectorOfNonOwningReferencesVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(8, len(data), 8)
|
||||
for item in reversed(data):
|
||||
builder.PrependUint64(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def CreateVectorOfNonOwningReferencesVector(builder, data):
|
||||
MonsterCreateVectorOfNonOwningReferencesVector(builder, data)
|
||||
|
||||
def MonsterAddAnyUniqueType(builder, anyUniqueType):
|
||||
builder.PrependUint8Slot(43, anyUniqueType, 0)
|
||||
|
||||
@@ -1425,16 +1275,6 @@ def MonsterStartVectorOfEnumsVector(builder, numElems):
|
||||
def StartVectorOfEnumsVector(builder, numElems):
|
||||
return MonsterStartVectorOfEnumsVector(builder, numElems)
|
||||
|
||||
def MonsterCreateVectorOfEnumsVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(1, len(data), 1)
|
||||
for item in reversed(data):
|
||||
builder.PrependUint8(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def CreateVectorOfEnumsVector(builder, data):
|
||||
MonsterCreateVectorOfEnumsVector(builder, data)
|
||||
|
||||
def MonsterAddSignedEnum(builder, signedEnum):
|
||||
builder.PrependInt8Slot(48, signedEnum, -1)
|
||||
|
||||
@@ -1453,16 +1293,6 @@ def MonsterStartTestrequirednestedflatbufferVector(builder, numElems):
|
||||
def StartTestrequirednestedflatbufferVector(builder, numElems):
|
||||
return MonsterStartTestrequirednestedflatbufferVector(builder, numElems)
|
||||
|
||||
def MonsterCreateTestrequirednestedflatbufferVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(1, len(data), 1)
|
||||
for item in reversed(data):
|
||||
builder.PrependUint8(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def CreateTestrequirednestedflatbufferVector(builder, data):
|
||||
MonsterCreateTestrequirednestedflatbufferVector(builder, data)
|
||||
|
||||
def MonsterMakeTestrequirednestedflatbufferVectorFromBytes(builder, bytes):
|
||||
builder.StartVector(1, len(bytes), 1)
|
||||
builder.head = builder.head - len(bytes)
|
||||
@@ -1482,12 +1312,6 @@ def MonsterStartScalarKeySortedTablesVector(builder, numElems):
|
||||
def StartScalarKeySortedTablesVector(builder, numElems):
|
||||
return MonsterStartScalarKeySortedTablesVector(builder, numElems)
|
||||
|
||||
def MonsterCreateScalarKeySortedTablesVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def CreateScalarKeySortedTablesVector(builder, data):
|
||||
MonsterCreateScalarKeySortedTablesVector(builder, data)
|
||||
|
||||
def MonsterAddNativeInline(builder, nativeInline):
|
||||
builder.PrependStructSlot(51, flatbuffers.number_types.UOffsetTFlags.py_type(nativeInline), 0)
|
||||
|
||||
|
||||
@@ -17,30 +17,12 @@ public struct NestedStruct : IFlatbufferObject
|
||||
public NestedStruct __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public int A(int j) { return __p.bb.GetInt(__p.bb_pos + 0 + j * 4); }
|
||||
public const int ALength = 2;
|
||||
#if ENABLE_SPAN_T
|
||||
public Span<int> GetABytes() { return System.Runtime.InteropServices.MemoryMarshal.Cast<byte, int>(__p.bb.ToSpan(__p.bb_pos + 0, 8)); }
|
||||
#else
|
||||
public ArraySegment<byte>? GetABytes() { return __p.bb.ToArraySegment(__p.bb_pos + 0, 8);}
|
||||
#endif
|
||||
public void MutateA(int j, int a) { __p.bb.PutInt(__p.bb_pos + 0 + j * 4, a); }
|
||||
public MyGame.Example.TestEnum B { get { return (MyGame.Example.TestEnum)__p.bb.GetSbyte(__p.bb_pos + 8); } }
|
||||
public void MutateB(MyGame.Example.TestEnum b) { __p.bb.PutSbyte(__p.bb_pos + 8, (sbyte)b); }
|
||||
public MyGame.Example.TestEnum C(int j) { return (MyGame.Example.TestEnum)__p.bb.GetSbyte(__p.bb_pos + 9 + j * 1); }
|
||||
public const int CLength = 2;
|
||||
#if ENABLE_SPAN_T
|
||||
public Span<MyGame.Example.TestEnum> GetCBytes() { return System.Runtime.InteropServices.MemoryMarshal.Cast<byte, MyGame.Example.TestEnum>(__p.bb.ToSpan(__p.bb_pos + 9, 2)); }
|
||||
#else
|
||||
public ArraySegment<byte>? GetCBytes() { return __p.bb.ToArraySegment(__p.bb_pos + 9, 2);}
|
||||
#endif
|
||||
public void MutateC(int j, MyGame.Example.TestEnum c) { __p.bb.PutSbyte(__p.bb_pos + 9 + j * 1, (sbyte)c); }
|
||||
public long D(int j) { return __p.bb.GetLong(__p.bb_pos + 16 + j * 8); }
|
||||
public const int DLength = 2;
|
||||
#if ENABLE_SPAN_T
|
||||
public Span<long> GetDBytes() { return System.Runtime.InteropServices.MemoryMarshal.Cast<byte, long>(__p.bb.ToSpan(__p.bb_pos + 16, 16)); }
|
||||
#else
|
||||
public ArraySegment<byte>? GetDBytes() { return __p.bb.ToArraySegment(__p.bb_pos + 16, 16);}
|
||||
#endif
|
||||
public void MutateD(int j, long d) { __p.bb.PutLong(__p.bb_pos + 16 + j * 8, d); }
|
||||
|
||||
public static Offset<MyGame.Example.NestedStruct> CreateNestedStruct(FlatBufferBuilder builder, int[] A, MyGame.Example.TestEnum B, MyGame.Example.TestEnum[] C, long[] D) {
|
||||
|
||||
@@ -230,16 +230,6 @@ def TypeAliasesStartV8Vector(builder, numElems):
|
||||
def StartV8Vector(builder, numElems):
|
||||
return TypeAliasesStartV8Vector(builder, numElems)
|
||||
|
||||
def TypeAliasesCreateV8Vector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(1, len(data), 1)
|
||||
for item in reversed(data):
|
||||
builder.PrependInt8(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def CreateV8Vector(builder, data):
|
||||
TypeAliasesCreateV8Vector(builder, data)
|
||||
|
||||
def TypeAliasesAddVf64(builder, vf64):
|
||||
builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(vf64), 0)
|
||||
|
||||
@@ -252,16 +242,6 @@ def TypeAliasesStartVf64Vector(builder, numElems):
|
||||
def StartVf64Vector(builder, numElems):
|
||||
return TypeAliasesStartVf64Vector(builder, numElems)
|
||||
|
||||
def TypeAliasesCreateVf64Vector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(8, len(data), 8)
|
||||
for item in reversed(data):
|
||||
builder.PrependFloat64(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def CreateVf64Vector(builder, data):
|
||||
TypeAliasesCreateVf64Vector(builder, data)
|
||||
|
||||
def TypeAliasesEnd(builder):
|
||||
return builder.EndObject()
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import flatbuffers
|
||||
from flatbuffers.compat import import_numpy
|
||||
from typing import Any
|
||||
from typing import Iterable
|
||||
np = import_numpy()
|
||||
|
||||
class MonsterExtra(object):
|
||||
@@ -206,16 +205,6 @@ def MonsterExtraStartDvecVector(builder, numElems: int) -> int:
|
||||
def StartDvecVector(builder, numElems: int) -> int:
|
||||
return MonsterExtraStartDvecVector(builder, numElems)
|
||||
|
||||
def MonsterExtraCreateDvecVector(builder: flatbuffers.Builder, data: Iterable[Any]) -> int:
|
||||
data = list(data)
|
||||
builder.StartVector(8, len(data), 8)
|
||||
for item in reversed(data):
|
||||
builder.PrependFloat64(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def CreateDvecVector(builder: flatbuffers.Builder, data: Iterable[Any]) -> int:
|
||||
MonsterExtraCreateDvecVector(builder, data)
|
||||
|
||||
def MonsterExtraAddFvec(builder: flatbuffers.Builder, fvec: int):
|
||||
builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(fvec), 0)
|
||||
|
||||
@@ -228,16 +217,6 @@ def MonsterExtraStartFvecVector(builder, numElems: int) -> int:
|
||||
def StartFvecVector(builder, numElems: int) -> int:
|
||||
return MonsterExtraStartFvecVector(builder, numElems)
|
||||
|
||||
def MonsterExtraCreateFvecVector(builder: flatbuffers.Builder, data: Iterable[Any]) -> int:
|
||||
data = list(data)
|
||||
builder.StartVector(4, len(data), 4)
|
||||
for item in reversed(data):
|
||||
builder.PrependFloat32(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def CreateFvecVector(builder: flatbuffers.Builder, data: Iterable[Any]) -> int:
|
||||
MonsterExtraCreateFvecVector(builder, data)
|
||||
|
||||
def MonsterExtraEnd(builder: flatbuffers.Builder) -> int:
|
||||
return builder.EndObject()
|
||||
|
||||
|
||||
@@ -77,13 +77,9 @@ def MonsterExtraAddF3(builder: flatbuffers.Builder, f3: float) -> None: ...
|
||||
def MonsterExtraAddDvec(builder: flatbuffers.Builder, dvec: uoffset) -> None: ...
|
||||
def MonsterExtraStartDvecVector(builder: flatbuffers.Builder, num_elems: int) -> uoffset: ...
|
||||
def StartDvecVector(builder: flatbuffers.Builder, num_elems: int) -> uoffset: ...
|
||||
def MonsterExtraCreateDvecVector(builder: flatbuffers.Builder, data: typing.Iterable[typing.Any]) -> uoffset: ...
|
||||
def CreateDvecVector(builder: flatbuffers.Builder, data: typing.Iterable[typing.Any]) -> uoffset: ...
|
||||
def MonsterExtraAddFvec(builder: flatbuffers.Builder, fvec: uoffset) -> None: ...
|
||||
def MonsterExtraStartFvecVector(builder: flatbuffers.Builder, num_elems: int) -> uoffset: ...
|
||||
def StartFvecVector(builder: flatbuffers.Builder, num_elems: int) -> uoffset: ...
|
||||
def MonsterExtraCreateFvecVector(builder: flatbuffers.Builder, data: typing.Iterable[typing.Any]) -> uoffset: ...
|
||||
def CreateFvecVector(builder: flatbuffers.Builder, data: typing.Iterable[typing.Any]) -> uoffset: ...
|
||||
def MonsterExtraEnd(builder: flatbuffers.Builder) -> uoffset: ...
|
||||
def End(builder: flatbuffers.Builder) -> uoffset: ...
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "flatbuffers/flatbuffer_builder.h"
|
||||
#include "flatbuffers/util.h"
|
||||
#include "test_assert.h"
|
||||
#include "tests/alignment_test_generated.h"
|
||||
#include "tests/alignment_test.fbs.h"
|
||||
|
||||
namespace flatbuffers {
|
||||
namespace tests {
|
||||
|
||||
@@ -1,932 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_OPTIONALSCALARS2_OPTIONAL_SCALARS_H_
|
||||
#define FLATBUFFERS_GENERATED_OPTIONALSCALARS2_OPTIONAL_SCALARS_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
namespace optional_scalars {
|
||||
|
||||
struct ScalarStuff;
|
||||
struct ScalarStuffBuilder;
|
||||
struct ScalarStuffT;
|
||||
|
||||
inline const flatbuffers::TypeTable* ScalarStuffTypeTable();
|
||||
|
||||
enum class OptionalByte : int8_t {
|
||||
None = 0,
|
||||
One = 1,
|
||||
Two = 2,
|
||||
MIN = None,
|
||||
MAX = Two
|
||||
};
|
||||
|
||||
inline const OptionalByte (&EnumValuesOptionalByte())[3] {
|
||||
static const OptionalByte values[] = {OptionalByte::None, OptionalByte::One,
|
||||
OptionalByte::Two};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char* const* EnumNamesOptionalByte() {
|
||||
static const char* const names[4] = {"None", "One", "Two", nullptr};
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char* EnumNameOptionalByte(OptionalByte e) {
|
||||
if (flatbuffers::IsOutRange(e, OptionalByte::None, OptionalByte::Two))
|
||||
return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesOptionalByte()[index];
|
||||
}
|
||||
|
||||
struct ScalarStuffT : public flatbuffers::NativeTable {
|
||||
typedef ScalarStuff TableType;
|
||||
int8_t just_i8 = 0;
|
||||
flatbuffers::Optional<int8_t> maybe_i8 = flatbuffers::nullopt;
|
||||
int8_t default_i8 = 42;
|
||||
uint8_t just_u8 = 0;
|
||||
flatbuffers::Optional<uint8_t> maybe_u8 = flatbuffers::nullopt;
|
||||
uint8_t default_u8 = 42;
|
||||
int16_t just_i16 = 0;
|
||||
flatbuffers::Optional<int16_t> maybe_i16 = flatbuffers::nullopt;
|
||||
int16_t default_i16 = 42;
|
||||
uint16_t just_u16 = 0;
|
||||
flatbuffers::Optional<uint16_t> maybe_u16 = flatbuffers::nullopt;
|
||||
uint16_t default_u16 = 42;
|
||||
int32_t just_i32 = 0;
|
||||
flatbuffers::Optional<int32_t> maybe_i32 = flatbuffers::nullopt;
|
||||
int32_t default_i32 = 42;
|
||||
uint32_t just_u32 = 0;
|
||||
flatbuffers::Optional<uint32_t> maybe_u32 = flatbuffers::nullopt;
|
||||
uint32_t default_u32 = 42;
|
||||
int64_t just_i64 = 0;
|
||||
flatbuffers::Optional<int64_t> maybe_i64 = flatbuffers::nullopt;
|
||||
int64_t default_i64 = 42LL;
|
||||
uint64_t just_u64 = 0;
|
||||
flatbuffers::Optional<uint64_t> maybe_u64 = flatbuffers::nullopt;
|
||||
uint64_t default_u64 = 42ULL;
|
||||
float just_f32 = 0.0f;
|
||||
flatbuffers::Optional<float> maybe_f32 = flatbuffers::nullopt;
|
||||
float default_f32 = 42.0f;
|
||||
double just_f64 = 0.0;
|
||||
flatbuffers::Optional<double> maybe_f64 = flatbuffers::nullopt;
|
||||
double default_f64 = 42.0;
|
||||
bool just_bool = false;
|
||||
flatbuffers::Optional<bool> maybe_bool = flatbuffers::nullopt;
|
||||
bool default_bool = true;
|
||||
optional_scalars::OptionalByte just_enum =
|
||||
optional_scalars::OptionalByte::None;
|
||||
flatbuffers::Optional<optional_scalars::OptionalByte> maybe_enum =
|
||||
flatbuffers::nullopt;
|
||||
optional_scalars::OptionalByte default_enum =
|
||||
optional_scalars::OptionalByte::One;
|
||||
};
|
||||
|
||||
struct ScalarStuff FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef ScalarStuffT NativeTableType;
|
||||
typedef ScalarStuffBuilder Builder;
|
||||
struct Traits;
|
||||
static const flatbuffers::TypeTable* MiniReflectTypeTable() {
|
||||
return ScalarStuffTypeTable();
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_JUST_I8 = 4,
|
||||
VT_MAYBE_I8 = 6,
|
||||
VT_DEFAULT_I8 = 8,
|
||||
VT_JUST_U8 = 10,
|
||||
VT_MAYBE_U8 = 12,
|
||||
VT_DEFAULT_U8 = 14,
|
||||
VT_JUST_I16 = 16,
|
||||
VT_MAYBE_I16 = 18,
|
||||
VT_DEFAULT_I16 = 20,
|
||||
VT_JUST_U16 = 22,
|
||||
VT_MAYBE_U16 = 24,
|
||||
VT_DEFAULT_U16 = 26,
|
||||
VT_JUST_I32 = 28,
|
||||
VT_MAYBE_I32 = 30,
|
||||
VT_DEFAULT_I32 = 32,
|
||||
VT_JUST_U32 = 34,
|
||||
VT_MAYBE_U32 = 36,
|
||||
VT_DEFAULT_U32 = 38,
|
||||
VT_JUST_I64 = 40,
|
||||
VT_MAYBE_I64 = 42,
|
||||
VT_DEFAULT_I64 = 44,
|
||||
VT_JUST_U64 = 46,
|
||||
VT_MAYBE_U64 = 48,
|
||||
VT_DEFAULT_U64 = 50,
|
||||
VT_JUST_F32 = 52,
|
||||
VT_MAYBE_F32 = 54,
|
||||
VT_DEFAULT_F32 = 56,
|
||||
VT_JUST_F64 = 58,
|
||||
VT_MAYBE_F64 = 60,
|
||||
VT_DEFAULT_F64 = 62,
|
||||
VT_JUST_BOOL = 64,
|
||||
VT_MAYBE_BOOL = 66,
|
||||
VT_DEFAULT_BOOL = 68,
|
||||
VT_JUST_ENUM = 70,
|
||||
VT_MAYBE_ENUM = 72,
|
||||
VT_DEFAULT_ENUM = 74
|
||||
};
|
||||
int8_t just_i8() const { return GetField<int8_t>(VT_JUST_I8, 0); }
|
||||
bool mutate_just_i8(int8_t _just_i8) {
|
||||
return SetField<int8_t>(VT_JUST_I8, _just_i8, 0);
|
||||
}
|
||||
flatbuffers::Optional<int8_t> maybe_i8() const {
|
||||
return GetOptional<int8_t, int8_t>(VT_MAYBE_I8);
|
||||
}
|
||||
bool mutate_maybe_i8(int8_t _maybe_i8) {
|
||||
return SetField<int8_t>(VT_MAYBE_I8, _maybe_i8);
|
||||
}
|
||||
int8_t default_i8() const { return GetField<int8_t>(VT_DEFAULT_I8, 42); }
|
||||
bool mutate_default_i8(int8_t _default_i8) {
|
||||
return SetField<int8_t>(VT_DEFAULT_I8, _default_i8, 42);
|
||||
}
|
||||
uint8_t just_u8() const { return GetField<uint8_t>(VT_JUST_U8, 0); }
|
||||
bool mutate_just_u8(uint8_t _just_u8) {
|
||||
return SetField<uint8_t>(VT_JUST_U8, _just_u8, 0);
|
||||
}
|
||||
flatbuffers::Optional<uint8_t> maybe_u8() const {
|
||||
return GetOptional<uint8_t, uint8_t>(VT_MAYBE_U8);
|
||||
}
|
||||
bool mutate_maybe_u8(uint8_t _maybe_u8) {
|
||||
return SetField<uint8_t>(VT_MAYBE_U8, _maybe_u8);
|
||||
}
|
||||
uint8_t default_u8() const { return GetField<uint8_t>(VT_DEFAULT_U8, 42); }
|
||||
bool mutate_default_u8(uint8_t _default_u8) {
|
||||
return SetField<uint8_t>(VT_DEFAULT_U8, _default_u8, 42);
|
||||
}
|
||||
int16_t just_i16() const { return GetField<int16_t>(VT_JUST_I16, 0); }
|
||||
bool mutate_just_i16(int16_t _just_i16) {
|
||||
return SetField<int16_t>(VT_JUST_I16, _just_i16, 0);
|
||||
}
|
||||
flatbuffers::Optional<int16_t> maybe_i16() const {
|
||||
return GetOptional<int16_t, int16_t>(VT_MAYBE_I16);
|
||||
}
|
||||
bool mutate_maybe_i16(int16_t _maybe_i16) {
|
||||
return SetField<int16_t>(VT_MAYBE_I16, _maybe_i16);
|
||||
}
|
||||
int16_t default_i16() const { return GetField<int16_t>(VT_DEFAULT_I16, 42); }
|
||||
bool mutate_default_i16(int16_t _default_i16) {
|
||||
return SetField<int16_t>(VT_DEFAULT_I16, _default_i16, 42);
|
||||
}
|
||||
uint16_t just_u16() const { return GetField<uint16_t>(VT_JUST_U16, 0); }
|
||||
bool mutate_just_u16(uint16_t _just_u16) {
|
||||
return SetField<uint16_t>(VT_JUST_U16, _just_u16, 0);
|
||||
}
|
||||
flatbuffers::Optional<uint16_t> maybe_u16() const {
|
||||
return GetOptional<uint16_t, uint16_t>(VT_MAYBE_U16);
|
||||
}
|
||||
bool mutate_maybe_u16(uint16_t _maybe_u16) {
|
||||
return SetField<uint16_t>(VT_MAYBE_U16, _maybe_u16);
|
||||
}
|
||||
uint16_t default_u16() const {
|
||||
return GetField<uint16_t>(VT_DEFAULT_U16, 42);
|
||||
}
|
||||
bool mutate_default_u16(uint16_t _default_u16) {
|
||||
return SetField<uint16_t>(VT_DEFAULT_U16, _default_u16, 42);
|
||||
}
|
||||
int32_t just_i32() const { return GetField<int32_t>(VT_JUST_I32, 0); }
|
||||
bool mutate_just_i32(int32_t _just_i32) {
|
||||
return SetField<int32_t>(VT_JUST_I32, _just_i32, 0);
|
||||
}
|
||||
flatbuffers::Optional<int32_t> maybe_i32() const {
|
||||
return GetOptional<int32_t, int32_t>(VT_MAYBE_I32);
|
||||
}
|
||||
bool mutate_maybe_i32(int32_t _maybe_i32) {
|
||||
return SetField<int32_t>(VT_MAYBE_I32, _maybe_i32);
|
||||
}
|
||||
int32_t default_i32() const { return GetField<int32_t>(VT_DEFAULT_I32, 42); }
|
||||
bool mutate_default_i32(int32_t _default_i32) {
|
||||
return SetField<int32_t>(VT_DEFAULT_I32, _default_i32, 42);
|
||||
}
|
||||
uint32_t just_u32() const { return GetField<uint32_t>(VT_JUST_U32, 0); }
|
||||
bool mutate_just_u32(uint32_t _just_u32) {
|
||||
return SetField<uint32_t>(VT_JUST_U32, _just_u32, 0);
|
||||
}
|
||||
flatbuffers::Optional<uint32_t> maybe_u32() const {
|
||||
return GetOptional<uint32_t, uint32_t>(VT_MAYBE_U32);
|
||||
}
|
||||
bool mutate_maybe_u32(uint32_t _maybe_u32) {
|
||||
return SetField<uint32_t>(VT_MAYBE_U32, _maybe_u32);
|
||||
}
|
||||
uint32_t default_u32() const {
|
||||
return GetField<uint32_t>(VT_DEFAULT_U32, 42);
|
||||
}
|
||||
bool mutate_default_u32(uint32_t _default_u32) {
|
||||
return SetField<uint32_t>(VT_DEFAULT_U32, _default_u32, 42);
|
||||
}
|
||||
int64_t just_i64() const { return GetField<int64_t>(VT_JUST_I64, 0); }
|
||||
bool mutate_just_i64(int64_t _just_i64) {
|
||||
return SetField<int64_t>(VT_JUST_I64, _just_i64, 0);
|
||||
}
|
||||
flatbuffers::Optional<int64_t> maybe_i64() const {
|
||||
return GetOptional<int64_t, int64_t>(VT_MAYBE_I64);
|
||||
}
|
||||
bool mutate_maybe_i64(int64_t _maybe_i64) {
|
||||
return SetField<int64_t>(VT_MAYBE_I64, _maybe_i64);
|
||||
}
|
||||
int64_t default_i64() const {
|
||||
return GetField<int64_t>(VT_DEFAULT_I64, 42LL);
|
||||
}
|
||||
bool mutate_default_i64(int64_t _default_i64) {
|
||||
return SetField<int64_t>(VT_DEFAULT_I64, _default_i64, 42LL);
|
||||
}
|
||||
uint64_t just_u64() const { return GetField<uint64_t>(VT_JUST_U64, 0); }
|
||||
bool mutate_just_u64(uint64_t _just_u64) {
|
||||
return SetField<uint64_t>(VT_JUST_U64, _just_u64, 0);
|
||||
}
|
||||
flatbuffers::Optional<uint64_t> maybe_u64() const {
|
||||
return GetOptional<uint64_t, uint64_t>(VT_MAYBE_U64);
|
||||
}
|
||||
bool mutate_maybe_u64(uint64_t _maybe_u64) {
|
||||
return SetField<uint64_t>(VT_MAYBE_U64, _maybe_u64);
|
||||
}
|
||||
uint64_t default_u64() const {
|
||||
return GetField<uint64_t>(VT_DEFAULT_U64, 42ULL);
|
||||
}
|
||||
bool mutate_default_u64(uint64_t _default_u64) {
|
||||
return SetField<uint64_t>(VT_DEFAULT_U64, _default_u64, 42ULL);
|
||||
}
|
||||
float just_f32() const { return GetField<float>(VT_JUST_F32, 0.0f); }
|
||||
bool mutate_just_f32(float _just_f32) {
|
||||
return SetField<float>(VT_JUST_F32, _just_f32, 0.0f);
|
||||
}
|
||||
flatbuffers::Optional<float> maybe_f32() const {
|
||||
return GetOptional<float, float>(VT_MAYBE_F32);
|
||||
}
|
||||
bool mutate_maybe_f32(float _maybe_f32) {
|
||||
return SetField<float>(VT_MAYBE_F32, _maybe_f32);
|
||||
}
|
||||
float default_f32() const { return GetField<float>(VT_DEFAULT_F32, 42.0f); }
|
||||
bool mutate_default_f32(float _default_f32) {
|
||||
return SetField<float>(VT_DEFAULT_F32, _default_f32, 42.0f);
|
||||
}
|
||||
double just_f64() const { return GetField<double>(VT_JUST_F64, 0.0); }
|
||||
bool mutate_just_f64(double _just_f64) {
|
||||
return SetField<double>(VT_JUST_F64, _just_f64, 0.0);
|
||||
}
|
||||
flatbuffers::Optional<double> maybe_f64() const {
|
||||
return GetOptional<double, double>(VT_MAYBE_F64);
|
||||
}
|
||||
bool mutate_maybe_f64(double _maybe_f64) {
|
||||
return SetField<double>(VT_MAYBE_F64, _maybe_f64);
|
||||
}
|
||||
double default_f64() const { return GetField<double>(VT_DEFAULT_F64, 42.0); }
|
||||
bool mutate_default_f64(double _default_f64) {
|
||||
return SetField<double>(VT_DEFAULT_F64, _default_f64, 42.0);
|
||||
}
|
||||
bool just_bool() const { return GetField<uint8_t>(VT_JUST_BOOL, 0) != 0; }
|
||||
bool mutate_just_bool(bool _just_bool) {
|
||||
return SetField<uint8_t>(VT_JUST_BOOL, static_cast<uint8_t>(_just_bool), 0);
|
||||
}
|
||||
flatbuffers::Optional<bool> maybe_bool() const {
|
||||
return GetOptional<uint8_t, bool>(VT_MAYBE_BOOL);
|
||||
}
|
||||
bool mutate_maybe_bool(bool _maybe_bool) {
|
||||
return SetField<uint8_t>(VT_MAYBE_BOOL, static_cast<uint8_t>(_maybe_bool));
|
||||
}
|
||||
bool default_bool() const {
|
||||
return GetField<uint8_t>(VT_DEFAULT_BOOL, 1) != 0;
|
||||
}
|
||||
bool mutate_default_bool(bool _default_bool) {
|
||||
return SetField<uint8_t>(VT_DEFAULT_BOOL,
|
||||
static_cast<uint8_t>(_default_bool), 1);
|
||||
}
|
||||
optional_scalars::OptionalByte just_enum() const {
|
||||
return static_cast<optional_scalars::OptionalByte>(
|
||||
GetField<int8_t>(VT_JUST_ENUM, 0));
|
||||
}
|
||||
bool mutate_just_enum(optional_scalars::OptionalByte _just_enum) {
|
||||
return SetField<int8_t>(VT_JUST_ENUM, static_cast<int8_t>(_just_enum), 0);
|
||||
}
|
||||
flatbuffers::Optional<optional_scalars::OptionalByte> maybe_enum() const {
|
||||
return GetOptional<int8_t, optional_scalars::OptionalByte>(VT_MAYBE_ENUM);
|
||||
}
|
||||
bool mutate_maybe_enum(optional_scalars::OptionalByte _maybe_enum) {
|
||||
return SetField<int8_t>(VT_MAYBE_ENUM, static_cast<int8_t>(_maybe_enum));
|
||||
}
|
||||
optional_scalars::OptionalByte default_enum() const {
|
||||
return static_cast<optional_scalars::OptionalByte>(
|
||||
GetField<int8_t>(VT_DEFAULT_ENUM, 1));
|
||||
}
|
||||
bool mutate_default_enum(optional_scalars::OptionalByte _default_enum) {
|
||||
return SetField<int8_t>(VT_DEFAULT_ENUM, static_cast<int8_t>(_default_enum),
|
||||
1);
|
||||
}
|
||||
bool Verify(flatbuffers::Verifier& verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int8_t>(verifier, VT_JUST_I8) &&
|
||||
VerifyField<int8_t>(verifier, VT_MAYBE_I8) &&
|
||||
VerifyField<int8_t>(verifier, VT_DEFAULT_I8) &&
|
||||
VerifyField<uint8_t>(verifier, VT_JUST_U8) &&
|
||||
VerifyField<uint8_t>(verifier, VT_MAYBE_U8) &&
|
||||
VerifyField<uint8_t>(verifier, VT_DEFAULT_U8) &&
|
||||
VerifyField<int16_t>(verifier, VT_JUST_I16) &&
|
||||
VerifyField<int16_t>(verifier, VT_MAYBE_I16) &&
|
||||
VerifyField<int16_t>(verifier, VT_DEFAULT_I16) &&
|
||||
VerifyField<uint16_t>(verifier, VT_JUST_U16) &&
|
||||
VerifyField<uint16_t>(verifier, VT_MAYBE_U16) &&
|
||||
VerifyField<uint16_t>(verifier, VT_DEFAULT_U16) &&
|
||||
VerifyField<int32_t>(verifier, VT_JUST_I32) &&
|
||||
VerifyField<int32_t>(verifier, VT_MAYBE_I32) &&
|
||||
VerifyField<int32_t>(verifier, VT_DEFAULT_I32) &&
|
||||
VerifyField<uint32_t>(verifier, VT_JUST_U32) &&
|
||||
VerifyField<uint32_t>(verifier, VT_MAYBE_U32) &&
|
||||
VerifyField<uint32_t>(verifier, VT_DEFAULT_U32) &&
|
||||
VerifyField<int64_t>(verifier, VT_JUST_I64) &&
|
||||
VerifyField<int64_t>(verifier, VT_MAYBE_I64) &&
|
||||
VerifyField<int64_t>(verifier, VT_DEFAULT_I64) &&
|
||||
VerifyField<uint64_t>(verifier, VT_JUST_U64) &&
|
||||
VerifyField<uint64_t>(verifier, VT_MAYBE_U64) &&
|
||||
VerifyField<uint64_t>(verifier, VT_DEFAULT_U64) &&
|
||||
VerifyField<float>(verifier, VT_JUST_F32) &&
|
||||
VerifyField<float>(verifier, VT_MAYBE_F32) &&
|
||||
VerifyField<float>(verifier, VT_DEFAULT_F32) &&
|
||||
VerifyField<double>(verifier, VT_JUST_F64) &&
|
||||
VerifyField<double>(verifier, VT_MAYBE_F64) &&
|
||||
VerifyField<double>(verifier, VT_DEFAULT_F64) &&
|
||||
VerifyField<uint8_t>(verifier, VT_JUST_BOOL) &&
|
||||
VerifyField<uint8_t>(verifier, VT_MAYBE_BOOL) &&
|
||||
VerifyField<uint8_t>(verifier, VT_DEFAULT_BOOL) &&
|
||||
VerifyField<int8_t>(verifier, VT_JUST_ENUM) &&
|
||||
VerifyField<int8_t>(verifier, VT_MAYBE_ENUM) &&
|
||||
VerifyField<int8_t>(verifier, VT_DEFAULT_ENUM) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
ScalarStuffT* UnPack(
|
||||
const flatbuffers::resolver_function_t* _resolver = nullptr) const;
|
||||
void UnPackTo(
|
||||
ScalarStuffT* _o,
|
||||
const flatbuffers::resolver_function_t* _resolver = nullptr) const;
|
||||
static flatbuffers::Offset<ScalarStuff> Pack(
|
||||
flatbuffers::FlatBufferBuilder& _fbb, const ScalarStuffT* _o,
|
||||
const flatbuffers::rehasher_function_t* _rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct ScalarStuffBuilder {
|
||||
typedef ScalarStuff Table;
|
||||
flatbuffers::FlatBufferBuilder& fbb_;
|
||||
flatbuffers::uoffset_t start_;
|
||||
void add_just_i8(int8_t just_i8) {
|
||||
fbb_.AddElement<int8_t>(ScalarStuff::VT_JUST_I8, just_i8, 0);
|
||||
}
|
||||
void add_maybe_i8(int8_t maybe_i8) {
|
||||
fbb_.AddElement<int8_t>(ScalarStuff::VT_MAYBE_I8, maybe_i8);
|
||||
}
|
||||
void add_default_i8(int8_t default_i8) {
|
||||
fbb_.AddElement<int8_t>(ScalarStuff::VT_DEFAULT_I8, default_i8, 42);
|
||||
}
|
||||
void add_just_u8(uint8_t just_u8) {
|
||||
fbb_.AddElement<uint8_t>(ScalarStuff::VT_JUST_U8, just_u8, 0);
|
||||
}
|
||||
void add_maybe_u8(uint8_t maybe_u8) {
|
||||
fbb_.AddElement<uint8_t>(ScalarStuff::VT_MAYBE_U8, maybe_u8);
|
||||
}
|
||||
void add_default_u8(uint8_t default_u8) {
|
||||
fbb_.AddElement<uint8_t>(ScalarStuff::VT_DEFAULT_U8, default_u8, 42);
|
||||
}
|
||||
void add_just_i16(int16_t just_i16) {
|
||||
fbb_.AddElement<int16_t>(ScalarStuff::VT_JUST_I16, just_i16, 0);
|
||||
}
|
||||
void add_maybe_i16(int16_t maybe_i16) {
|
||||
fbb_.AddElement<int16_t>(ScalarStuff::VT_MAYBE_I16, maybe_i16);
|
||||
}
|
||||
void add_default_i16(int16_t default_i16) {
|
||||
fbb_.AddElement<int16_t>(ScalarStuff::VT_DEFAULT_I16, default_i16, 42);
|
||||
}
|
||||
void add_just_u16(uint16_t just_u16) {
|
||||
fbb_.AddElement<uint16_t>(ScalarStuff::VT_JUST_U16, just_u16, 0);
|
||||
}
|
||||
void add_maybe_u16(uint16_t maybe_u16) {
|
||||
fbb_.AddElement<uint16_t>(ScalarStuff::VT_MAYBE_U16, maybe_u16);
|
||||
}
|
||||
void add_default_u16(uint16_t default_u16) {
|
||||
fbb_.AddElement<uint16_t>(ScalarStuff::VT_DEFAULT_U16, default_u16, 42);
|
||||
}
|
||||
void add_just_i32(int32_t just_i32) {
|
||||
fbb_.AddElement<int32_t>(ScalarStuff::VT_JUST_I32, just_i32, 0);
|
||||
}
|
||||
void add_maybe_i32(int32_t maybe_i32) {
|
||||
fbb_.AddElement<int32_t>(ScalarStuff::VT_MAYBE_I32, maybe_i32);
|
||||
}
|
||||
void add_default_i32(int32_t default_i32) {
|
||||
fbb_.AddElement<int32_t>(ScalarStuff::VT_DEFAULT_I32, default_i32, 42);
|
||||
}
|
||||
void add_just_u32(uint32_t just_u32) {
|
||||
fbb_.AddElement<uint32_t>(ScalarStuff::VT_JUST_U32, just_u32, 0);
|
||||
}
|
||||
void add_maybe_u32(uint32_t maybe_u32) {
|
||||
fbb_.AddElement<uint32_t>(ScalarStuff::VT_MAYBE_U32, maybe_u32);
|
||||
}
|
||||
void add_default_u32(uint32_t default_u32) {
|
||||
fbb_.AddElement<uint32_t>(ScalarStuff::VT_DEFAULT_U32, default_u32, 42);
|
||||
}
|
||||
void add_just_i64(int64_t just_i64) {
|
||||
fbb_.AddElement<int64_t>(ScalarStuff::VT_JUST_I64, just_i64, 0);
|
||||
}
|
||||
void add_maybe_i64(int64_t maybe_i64) {
|
||||
fbb_.AddElement<int64_t>(ScalarStuff::VT_MAYBE_I64, maybe_i64);
|
||||
}
|
||||
void add_default_i64(int64_t default_i64) {
|
||||
fbb_.AddElement<int64_t>(ScalarStuff::VT_DEFAULT_I64, default_i64, 42LL);
|
||||
}
|
||||
void add_just_u64(uint64_t just_u64) {
|
||||
fbb_.AddElement<uint64_t>(ScalarStuff::VT_JUST_U64, just_u64, 0);
|
||||
}
|
||||
void add_maybe_u64(uint64_t maybe_u64) {
|
||||
fbb_.AddElement<uint64_t>(ScalarStuff::VT_MAYBE_U64, maybe_u64);
|
||||
}
|
||||
void add_default_u64(uint64_t default_u64) {
|
||||
fbb_.AddElement<uint64_t>(ScalarStuff::VT_DEFAULT_U64, default_u64, 42ULL);
|
||||
}
|
||||
void add_just_f32(float just_f32) {
|
||||
fbb_.AddElement<float>(ScalarStuff::VT_JUST_F32, just_f32, 0.0f);
|
||||
}
|
||||
void add_maybe_f32(float maybe_f32) {
|
||||
fbb_.AddElement<float>(ScalarStuff::VT_MAYBE_F32, maybe_f32);
|
||||
}
|
||||
void add_default_f32(float default_f32) {
|
||||
fbb_.AddElement<float>(ScalarStuff::VT_DEFAULT_F32, default_f32, 42.0f);
|
||||
}
|
||||
void add_just_f64(double just_f64) {
|
||||
fbb_.AddElement<double>(ScalarStuff::VT_JUST_F64, just_f64, 0.0);
|
||||
}
|
||||
void add_maybe_f64(double maybe_f64) {
|
||||
fbb_.AddElement<double>(ScalarStuff::VT_MAYBE_F64, maybe_f64);
|
||||
}
|
||||
void add_default_f64(double default_f64) {
|
||||
fbb_.AddElement<double>(ScalarStuff::VT_DEFAULT_F64, default_f64, 42.0);
|
||||
}
|
||||
void add_just_bool(bool just_bool) {
|
||||
fbb_.AddElement<uint8_t>(ScalarStuff::VT_JUST_BOOL,
|
||||
static_cast<uint8_t>(just_bool), 0);
|
||||
}
|
||||
void add_maybe_bool(bool maybe_bool) {
|
||||
fbb_.AddElement<uint8_t>(ScalarStuff::VT_MAYBE_BOOL,
|
||||
static_cast<uint8_t>(maybe_bool));
|
||||
}
|
||||
void add_default_bool(bool default_bool) {
|
||||
fbb_.AddElement<uint8_t>(ScalarStuff::VT_DEFAULT_BOOL,
|
||||
static_cast<uint8_t>(default_bool), 1);
|
||||
}
|
||||
void add_just_enum(optional_scalars::OptionalByte just_enum) {
|
||||
fbb_.AddElement<int8_t>(ScalarStuff::VT_JUST_ENUM,
|
||||
static_cast<int8_t>(just_enum), 0);
|
||||
}
|
||||
void add_maybe_enum(optional_scalars::OptionalByte maybe_enum) {
|
||||
fbb_.AddElement<int8_t>(ScalarStuff::VT_MAYBE_ENUM,
|
||||
static_cast<int8_t>(maybe_enum));
|
||||
}
|
||||
void add_default_enum(optional_scalars::OptionalByte default_enum) {
|
||||
fbb_.AddElement<int8_t>(ScalarStuff::VT_DEFAULT_ENUM,
|
||||
static_cast<int8_t>(default_enum), 1);
|
||||
}
|
||||
explicit ScalarStuffBuilder(flatbuffers::FlatBufferBuilder& _fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
flatbuffers::Offset<ScalarStuff> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = flatbuffers::Offset<ScalarStuff>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline flatbuffers::Offset<ScalarStuff> CreateScalarStuff(
|
||||
flatbuffers::FlatBufferBuilder& _fbb, int8_t just_i8 = 0,
|
||||
flatbuffers::Optional<int8_t> maybe_i8 = flatbuffers::nullopt,
|
||||
int8_t default_i8 = 42, uint8_t just_u8 = 0,
|
||||
flatbuffers::Optional<uint8_t> maybe_u8 = flatbuffers::nullopt,
|
||||
uint8_t default_u8 = 42, int16_t just_i16 = 0,
|
||||
flatbuffers::Optional<int16_t> maybe_i16 = flatbuffers::nullopt,
|
||||
int16_t default_i16 = 42, uint16_t just_u16 = 0,
|
||||
flatbuffers::Optional<uint16_t> maybe_u16 = flatbuffers::nullopt,
|
||||
uint16_t default_u16 = 42, int32_t just_i32 = 0,
|
||||
flatbuffers::Optional<int32_t> maybe_i32 = flatbuffers::nullopt,
|
||||
int32_t default_i32 = 42, uint32_t just_u32 = 0,
|
||||
flatbuffers::Optional<uint32_t> maybe_u32 = flatbuffers::nullopt,
|
||||
uint32_t default_u32 = 42, int64_t just_i64 = 0,
|
||||
flatbuffers::Optional<int64_t> maybe_i64 = flatbuffers::nullopt,
|
||||
int64_t default_i64 = 42LL, uint64_t just_u64 = 0,
|
||||
flatbuffers::Optional<uint64_t> maybe_u64 = flatbuffers::nullopt,
|
||||
uint64_t default_u64 = 42ULL, float just_f32 = 0.0f,
|
||||
flatbuffers::Optional<float> maybe_f32 = flatbuffers::nullopt,
|
||||
float default_f32 = 42.0f, double just_f64 = 0.0,
|
||||
flatbuffers::Optional<double> maybe_f64 = flatbuffers::nullopt,
|
||||
double default_f64 = 42.0, bool just_bool = false,
|
||||
flatbuffers::Optional<bool> maybe_bool = flatbuffers::nullopt,
|
||||
bool default_bool = true,
|
||||
optional_scalars::OptionalByte just_enum =
|
||||
optional_scalars::OptionalByte::None,
|
||||
flatbuffers::Optional<optional_scalars::OptionalByte> maybe_enum =
|
||||
flatbuffers::nullopt,
|
||||
optional_scalars::OptionalByte default_enum =
|
||||
optional_scalars::OptionalByte::One) {
|
||||
ScalarStuffBuilder builder_(_fbb);
|
||||
builder_.add_default_f64(default_f64);
|
||||
if (maybe_f64) {
|
||||
builder_.add_maybe_f64(*maybe_f64);
|
||||
}
|
||||
builder_.add_just_f64(just_f64);
|
||||
builder_.add_default_u64(default_u64);
|
||||
if (maybe_u64) {
|
||||
builder_.add_maybe_u64(*maybe_u64);
|
||||
}
|
||||
builder_.add_just_u64(just_u64);
|
||||
builder_.add_default_i64(default_i64);
|
||||
if (maybe_i64) {
|
||||
builder_.add_maybe_i64(*maybe_i64);
|
||||
}
|
||||
builder_.add_just_i64(just_i64);
|
||||
builder_.add_default_f32(default_f32);
|
||||
if (maybe_f32) {
|
||||
builder_.add_maybe_f32(*maybe_f32);
|
||||
}
|
||||
builder_.add_just_f32(just_f32);
|
||||
builder_.add_default_u32(default_u32);
|
||||
if (maybe_u32) {
|
||||
builder_.add_maybe_u32(*maybe_u32);
|
||||
}
|
||||
builder_.add_just_u32(just_u32);
|
||||
builder_.add_default_i32(default_i32);
|
||||
if (maybe_i32) {
|
||||
builder_.add_maybe_i32(*maybe_i32);
|
||||
}
|
||||
builder_.add_just_i32(just_i32);
|
||||
builder_.add_default_u16(default_u16);
|
||||
if (maybe_u16) {
|
||||
builder_.add_maybe_u16(*maybe_u16);
|
||||
}
|
||||
builder_.add_just_u16(just_u16);
|
||||
builder_.add_default_i16(default_i16);
|
||||
if (maybe_i16) {
|
||||
builder_.add_maybe_i16(*maybe_i16);
|
||||
}
|
||||
builder_.add_just_i16(just_i16);
|
||||
builder_.add_default_enum(default_enum);
|
||||
if (maybe_enum) {
|
||||
builder_.add_maybe_enum(*maybe_enum);
|
||||
}
|
||||
builder_.add_just_enum(just_enum);
|
||||
builder_.add_default_bool(default_bool);
|
||||
if (maybe_bool) {
|
||||
builder_.add_maybe_bool(*maybe_bool);
|
||||
}
|
||||
builder_.add_just_bool(just_bool);
|
||||
builder_.add_default_u8(default_u8);
|
||||
if (maybe_u8) {
|
||||
builder_.add_maybe_u8(*maybe_u8);
|
||||
}
|
||||
builder_.add_just_u8(just_u8);
|
||||
builder_.add_default_i8(default_i8);
|
||||
if (maybe_i8) {
|
||||
builder_.add_maybe_i8(*maybe_i8);
|
||||
}
|
||||
builder_.add_just_i8(just_i8);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
struct ScalarStuff::Traits {
|
||||
using type = ScalarStuff;
|
||||
static auto constexpr Create = CreateScalarStuff;
|
||||
};
|
||||
|
||||
flatbuffers::Offset<ScalarStuff> CreateScalarStuff(
|
||||
flatbuffers::FlatBufferBuilder& _fbb, const ScalarStuffT* _o,
|
||||
const flatbuffers::rehasher_function_t* _rehasher = nullptr);
|
||||
|
||||
inline ScalarStuffT* ScalarStuff::UnPack(
|
||||
const flatbuffers::resolver_function_t* _resolver) const {
|
||||
auto _o = std::make_unique<ScalarStuffT>();
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void ScalarStuff::UnPackTo(
|
||||
ScalarStuffT* _o, const flatbuffers::resolver_function_t* _resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{
|
||||
auto _e = just_i8();
|
||||
_o->just_i8 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = maybe_i8();
|
||||
_o->maybe_i8 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = default_i8();
|
||||
_o->default_i8 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = just_u8();
|
||||
_o->just_u8 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = maybe_u8();
|
||||
_o->maybe_u8 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = default_u8();
|
||||
_o->default_u8 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = just_i16();
|
||||
_o->just_i16 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = maybe_i16();
|
||||
_o->maybe_i16 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = default_i16();
|
||||
_o->default_i16 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = just_u16();
|
||||
_o->just_u16 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = maybe_u16();
|
||||
_o->maybe_u16 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = default_u16();
|
||||
_o->default_u16 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = just_i32();
|
||||
_o->just_i32 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = maybe_i32();
|
||||
_o->maybe_i32 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = default_i32();
|
||||
_o->default_i32 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = just_u32();
|
||||
_o->just_u32 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = maybe_u32();
|
||||
_o->maybe_u32 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = default_u32();
|
||||
_o->default_u32 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = just_i64();
|
||||
_o->just_i64 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = maybe_i64();
|
||||
_o->maybe_i64 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = default_i64();
|
||||
_o->default_i64 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = just_u64();
|
||||
_o->just_u64 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = maybe_u64();
|
||||
_o->maybe_u64 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = default_u64();
|
||||
_o->default_u64 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = just_f32();
|
||||
_o->just_f32 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = maybe_f32();
|
||||
_o->maybe_f32 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = default_f32();
|
||||
_o->default_f32 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = just_f64();
|
||||
_o->just_f64 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = maybe_f64();
|
||||
_o->maybe_f64 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = default_f64();
|
||||
_o->default_f64 = _e;
|
||||
}
|
||||
{
|
||||
auto _e = just_bool();
|
||||
_o->just_bool = _e;
|
||||
}
|
||||
{
|
||||
auto _e = maybe_bool();
|
||||
_o->maybe_bool = _e;
|
||||
}
|
||||
{
|
||||
auto _e = default_bool();
|
||||
_o->default_bool = _e;
|
||||
}
|
||||
{
|
||||
auto _e = just_enum();
|
||||
_o->just_enum = _e;
|
||||
}
|
||||
{
|
||||
auto _e = maybe_enum();
|
||||
_o->maybe_enum = _e;
|
||||
}
|
||||
{
|
||||
auto _e = default_enum();
|
||||
_o->default_enum = _e;
|
||||
}
|
||||
}
|
||||
|
||||
inline flatbuffers::Offset<ScalarStuff> ScalarStuff::Pack(
|
||||
flatbuffers::FlatBufferBuilder& _fbb, const ScalarStuffT* _o,
|
||||
const flatbuffers::rehasher_function_t* _rehasher) {
|
||||
return CreateScalarStuff(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline flatbuffers::Offset<ScalarStuff> CreateScalarStuff(
|
||||
flatbuffers::FlatBufferBuilder& _fbb, const ScalarStuffT* _o,
|
||||
const flatbuffers::rehasher_function_t* _rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs {
|
||||
flatbuffers::FlatBufferBuilder* __fbb;
|
||||
const ScalarStuffT* __o;
|
||||
const flatbuffers::rehasher_function_t* __rehasher;
|
||||
} _va = {&_fbb, _o, _rehasher};
|
||||
(void)_va;
|
||||
auto _just_i8 = _o->just_i8;
|
||||
auto _maybe_i8 = _o->maybe_i8;
|
||||
auto _default_i8 = _o->default_i8;
|
||||
auto _just_u8 = _o->just_u8;
|
||||
auto _maybe_u8 = _o->maybe_u8;
|
||||
auto _default_u8 = _o->default_u8;
|
||||
auto _just_i16 = _o->just_i16;
|
||||
auto _maybe_i16 = _o->maybe_i16;
|
||||
auto _default_i16 = _o->default_i16;
|
||||
auto _just_u16 = _o->just_u16;
|
||||
auto _maybe_u16 = _o->maybe_u16;
|
||||
auto _default_u16 = _o->default_u16;
|
||||
auto _just_i32 = _o->just_i32;
|
||||
auto _maybe_i32 = _o->maybe_i32;
|
||||
auto _default_i32 = _o->default_i32;
|
||||
auto _just_u32 = _o->just_u32;
|
||||
auto _maybe_u32 = _o->maybe_u32;
|
||||
auto _default_u32 = _o->default_u32;
|
||||
auto _just_i64 = _o->just_i64;
|
||||
auto _maybe_i64 = _o->maybe_i64;
|
||||
auto _default_i64 = _o->default_i64;
|
||||
auto _just_u64 = _o->just_u64;
|
||||
auto _maybe_u64 = _o->maybe_u64;
|
||||
auto _default_u64 = _o->default_u64;
|
||||
auto _just_f32 = _o->just_f32;
|
||||
auto _maybe_f32 = _o->maybe_f32;
|
||||
auto _default_f32 = _o->default_f32;
|
||||
auto _just_f64 = _o->just_f64;
|
||||
auto _maybe_f64 = _o->maybe_f64;
|
||||
auto _default_f64 = _o->default_f64;
|
||||
auto _just_bool = _o->just_bool;
|
||||
auto _maybe_bool = _o->maybe_bool;
|
||||
auto _default_bool = _o->default_bool;
|
||||
auto _just_enum = _o->just_enum;
|
||||
auto _maybe_enum = _o->maybe_enum;
|
||||
auto _default_enum = _o->default_enum;
|
||||
return optional_scalars::CreateScalarStuff(
|
||||
_fbb, _just_i8, _maybe_i8, _default_i8, _just_u8, _maybe_u8, _default_u8,
|
||||
_just_i16, _maybe_i16, _default_i16, _just_u16, _maybe_u16, _default_u16,
|
||||
_just_i32, _maybe_i32, _default_i32, _just_u32, _maybe_u32, _default_u32,
|
||||
_just_i64, _maybe_i64, _default_i64, _just_u64, _maybe_u64, _default_u64,
|
||||
_just_f32, _maybe_f32, _default_f32, _just_f64, _maybe_f64, _default_f64,
|
||||
_just_bool, _maybe_bool, _default_bool, _just_enum, _maybe_enum,
|
||||
_default_enum);
|
||||
}
|
||||
|
||||
inline const flatbuffers::TypeTable* OptionalByteTypeTable() {
|
||||
static const flatbuffers::TypeCode type_codes[] = {
|
||||
{flatbuffers::ET_CHAR, 0, 0},
|
||||
{flatbuffers::ET_CHAR, 0, 0},
|
||||
{flatbuffers::ET_CHAR, 0, 0}};
|
||||
static const flatbuffers::TypeFunction type_refs[] = {
|
||||
optional_scalars::OptionalByteTypeTable};
|
||||
static const char* const names[] = {"None", "One", "Two"};
|
||||
static const flatbuffers::TypeTable tt = {
|
||||
flatbuffers::ST_ENUM, 3, type_codes, type_refs, nullptr, nullptr, names};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const flatbuffers::TypeTable* ScalarStuffTypeTable() {
|
||||
static const flatbuffers::TypeCode type_codes[] = {
|
||||
{flatbuffers::ET_CHAR, 0, -1}, {flatbuffers::ET_CHAR, 0, -1},
|
||||
{flatbuffers::ET_CHAR, 0, -1}, {flatbuffers::ET_UCHAR, 0, -1},
|
||||
{flatbuffers::ET_UCHAR, 0, -1}, {flatbuffers::ET_UCHAR, 0, -1},
|
||||
{flatbuffers::ET_SHORT, 0, -1}, {flatbuffers::ET_SHORT, 0, -1},
|
||||
{flatbuffers::ET_SHORT, 0, -1}, {flatbuffers::ET_USHORT, 0, -1},
|
||||
{flatbuffers::ET_USHORT, 0, -1}, {flatbuffers::ET_USHORT, 0, -1},
|
||||
{flatbuffers::ET_INT, 0, -1}, {flatbuffers::ET_INT, 0, -1},
|
||||
{flatbuffers::ET_INT, 0, -1}, {flatbuffers::ET_UINT, 0, -1},
|
||||
{flatbuffers::ET_UINT, 0, -1}, {flatbuffers::ET_UINT, 0, -1},
|
||||
{flatbuffers::ET_LONG, 0, -1}, {flatbuffers::ET_LONG, 0, -1},
|
||||
{flatbuffers::ET_LONG, 0, -1}, {flatbuffers::ET_ULONG, 0, -1},
|
||||
{flatbuffers::ET_ULONG, 0, -1}, {flatbuffers::ET_ULONG, 0, -1},
|
||||
{flatbuffers::ET_FLOAT, 0, -1}, {flatbuffers::ET_FLOAT, 0, -1},
|
||||
{flatbuffers::ET_FLOAT, 0, -1}, {flatbuffers::ET_DOUBLE, 0, -1},
|
||||
{flatbuffers::ET_DOUBLE, 0, -1}, {flatbuffers::ET_DOUBLE, 0, -1},
|
||||
{flatbuffers::ET_BOOL, 0, -1}, {flatbuffers::ET_BOOL, 0, -1},
|
||||
{flatbuffers::ET_BOOL, 0, -1}, {flatbuffers::ET_CHAR, 0, 0},
|
||||
{flatbuffers::ET_CHAR, 0, 0}, {flatbuffers::ET_CHAR, 0, 0}};
|
||||
static const flatbuffers::TypeFunction type_refs[] = {
|
||||
optional_scalars::OptionalByteTypeTable};
|
||||
static const char* const names[] = {
|
||||
"just_i8", "maybe_i8", "default_i8", "just_u8",
|
||||
"maybe_u8", "default_u8", "just_i16", "maybe_i16",
|
||||
"default_i16", "just_u16", "maybe_u16", "default_u16",
|
||||
"just_i32", "maybe_i32", "default_i32", "just_u32",
|
||||
"maybe_u32", "default_u32", "just_i64", "maybe_i64",
|
||||
"default_i64", "just_u64", "maybe_u64", "default_u64",
|
||||
"just_f32", "maybe_f32", "default_f32", "just_f64",
|
||||
"maybe_f64", "default_f64", "just_bool", "maybe_bool",
|
||||
"default_bool", "just_enum", "maybe_enum", "default_enum"};
|
||||
static const flatbuffers::TypeTable tt = {flatbuffers::ST_TABLE,
|
||||
36,
|
||||
type_codes,
|
||||
type_refs,
|
||||
nullptr,
|
||||
nullptr,
|
||||
names};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const optional_scalars::ScalarStuff* GetScalarStuff(const void* buf) {
|
||||
return flatbuffers::GetRoot<optional_scalars::ScalarStuff>(buf);
|
||||
}
|
||||
|
||||
inline const optional_scalars::ScalarStuff* GetSizePrefixedScalarStuff(
|
||||
const void* buf) {
|
||||
return flatbuffers::GetSizePrefixedRoot<optional_scalars::ScalarStuff>(buf);
|
||||
}
|
||||
|
||||
inline ScalarStuff* GetMutableScalarStuff(void* buf) {
|
||||
return flatbuffers::GetMutableRoot<ScalarStuff>(buf);
|
||||
}
|
||||
|
||||
inline const char* ScalarStuffIdentifier() { return "NULL"; }
|
||||
|
||||
inline bool ScalarStuffBufferHasIdentifier(const void* buf) {
|
||||
return flatbuffers::BufferHasIdentifier(buf, ScalarStuffIdentifier());
|
||||
}
|
||||
|
||||
inline bool VerifyScalarStuffBuffer(flatbuffers::Verifier& verifier) {
|
||||
return verifier.VerifyBuffer<optional_scalars::ScalarStuff>(
|
||||
ScalarStuffIdentifier());
|
||||
}
|
||||
|
||||
inline bool VerifySizePrefixedScalarStuffBuffer(
|
||||
flatbuffers::Verifier& verifier) {
|
||||
return verifier.VerifySizePrefixedBuffer<optional_scalars::ScalarStuff>(
|
||||
ScalarStuffIdentifier());
|
||||
}
|
||||
|
||||
inline const char* ScalarStuffExtension() { return "mon"; }
|
||||
|
||||
inline void FinishScalarStuffBuffer(
|
||||
flatbuffers::FlatBufferBuilder& fbb,
|
||||
flatbuffers::Offset<optional_scalars::ScalarStuff> root) {
|
||||
fbb.Finish(root, ScalarStuffIdentifier());
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedScalarStuffBuffer(
|
||||
flatbuffers::FlatBufferBuilder& fbb,
|
||||
flatbuffers::Offset<optional_scalars::ScalarStuff> root) {
|
||||
fbb.FinishSizePrefixed(root, ScalarStuffIdentifier());
|
||||
}
|
||||
|
||||
inline std::unique_ptr<optional_scalars::ScalarStuffT> UnPackScalarStuff(
|
||||
const void* buf, const flatbuffers::resolver_function_t* res = nullptr) {
|
||||
return std::unique_ptr<optional_scalars::ScalarStuffT>(
|
||||
GetScalarStuff(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
inline std::unique_ptr<optional_scalars::ScalarStuffT>
|
||||
UnPackSizePrefixedScalarStuff(
|
||||
const void* buf, const flatbuffers::resolver_function_t* res = nullptr) {
|
||||
return std::unique_ptr<optional_scalars::ScalarStuffT>(
|
||||
GetSizePrefixedScalarStuff(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
} // namespace optional_scalars
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_OPTIONALSCALARS2_OPTIONAL_SCALARS_H_
|
||||
@@ -31,14 +31,14 @@
|
||||
|
||||
// Embed generated code into an isolated namespace.
|
||||
namespace cpp17 {
|
||||
#include "generated_cpp17/monster_test_generated.h"
|
||||
#include "generated_cpp17/optional_scalars_generated.h"
|
||||
#include "generated_cpp17/union_vector_generated.h"
|
||||
#include "tests/cpp17/generated_cpp17/monster_test_generated.h"
|
||||
#include "tests/cpp17/generated_cpp17/optional_scalars_generated.h"
|
||||
#include "tests/cpp17/generated_cpp17/union_vector_generated.h"
|
||||
} // namespace cpp17
|
||||
|
||||
namespace cpp11 {
|
||||
#include "../monster_test_generated.h"
|
||||
#include "../optional_scalars_generated.h"
|
||||
#include "tests/monster_test_generated.h"
|
||||
#include "tests/optional_scalars.fbs.h"
|
||||
} // namespace cpp11
|
||||
|
||||
using ::cpp17::MyGame::Example::Monster;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "evolution_test.h"
|
||||
|
||||
#include "evolution_test/evolution_v1_generated.h"
|
||||
#include "evolution_test/evolution_v2_generated.h"
|
||||
#include "evolution_test/evolution_v1.fbs.h"
|
||||
#include "evolution_test/evolution_v2.fbs.h"
|
||||
#include "flatbuffers/idl.h"
|
||||
#include "test_assert.h"
|
||||
|
||||
|
||||
42
tests/evolution_test/BUILD.bazel
Normal file
42
tests/evolution_test/BUILD.bazel
Normal file
@@ -0,0 +1,42 @@
|
||||
load("//:build_defs.bzl", "flatbuffer_cc_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "evolution_v1_cc_fbs",
|
||||
srcs = ["evolution_v1.fbs"],
|
||||
filename_suffix = ".fbs",
|
||||
flatc_args = [
|
||||
"--gen-compare",
|
||||
"--gen-mutable",
|
||||
"--gen-object-api",
|
||||
"--reflect-names",
|
||||
"--filename-suffix .fbs",
|
||||
"--scoped-enums",
|
||||
],
|
||||
)
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "evolution_v2_cc_fbs",
|
||||
srcs = ["evolution_v2.fbs"],
|
||||
filename_suffix = ".fbs",
|
||||
flatc_args = [
|
||||
"--gen-compare",
|
||||
"--gen-mutable",
|
||||
"--gen-object-api",
|
||||
"--reflect-names",
|
||||
"--filename-suffix .fbs",
|
||||
"--scoped-enums",
|
||||
],
|
||||
)
|
||||
|
||||
# Data needed by evolution_test.cpp to read at runtime.
|
||||
filegroup(
|
||||
name = "test_data",
|
||||
srcs = [
|
||||
"evolution_v1.fbs",
|
||||
"evolution_v1.json",
|
||||
"evolution_v2.fbs",
|
||||
"evolution_v2.json",
|
||||
],
|
||||
)
|
||||
@@ -1,533 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_EVOLUTIONV1_EVOLUTION_V1_H_
|
||||
#define FLATBUFFERS_GENERATED_EVOLUTIONV1_EVOLUTION_V1_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 12 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
namespace Evolution {
|
||||
namespace V1 {
|
||||
|
||||
struct TableA;
|
||||
struct TableABuilder;
|
||||
|
||||
struct TableB;
|
||||
struct TableBBuilder;
|
||||
|
||||
struct Struct;
|
||||
|
||||
struct Root;
|
||||
struct RootBuilder;
|
||||
|
||||
enum class Enum : int8_t {
|
||||
King = 0,
|
||||
Queen = 1,
|
||||
MIN = King,
|
||||
MAX = Queen
|
||||
};
|
||||
|
||||
inline const Enum (&EnumValuesEnum())[2] {
|
||||
static const Enum values[] = {
|
||||
Enum::King,
|
||||
Enum::Queen
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char * const *EnumNamesEnum() {
|
||||
static const char * const names[3] = {
|
||||
"King",
|
||||
"Queen",
|
||||
nullptr
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameEnum(Enum e) {
|
||||
if (::flatbuffers::IsOutRange(e, Enum::King, Enum::Queen)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesEnum()[index];
|
||||
}
|
||||
|
||||
enum class Union : uint8_t {
|
||||
NONE = 0,
|
||||
TableA = 1,
|
||||
TableB = 2,
|
||||
MIN = NONE,
|
||||
MAX = TableB
|
||||
};
|
||||
|
||||
inline const Union (&EnumValuesUnion())[3] {
|
||||
static const Union values[] = {
|
||||
Union::NONE,
|
||||
Union::TableA,
|
||||
Union::TableB
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char * const *EnumNamesUnion() {
|
||||
static const char * const names[4] = {
|
||||
"NONE",
|
||||
"TableA",
|
||||
"TableB",
|
||||
nullptr
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameUnion(Union e) {
|
||||
if (::flatbuffers::IsOutRange(e, Union::NONE, Union::TableB)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesUnion()[index];
|
||||
}
|
||||
|
||||
template<typename T> struct UnionTraits {
|
||||
static const Union enum_value = Union::NONE;
|
||||
};
|
||||
|
||||
template<> struct UnionTraits<Evolution::V1::TableA> {
|
||||
static const Union enum_value = Union::TableA;
|
||||
};
|
||||
|
||||
template<> struct UnionTraits<Evolution::V1::TableB> {
|
||||
static const Union enum_value = Union::TableB;
|
||||
};
|
||||
|
||||
template <bool B = false>
|
||||
bool VerifyUnion(::flatbuffers::VerifierTemplate<B> &verifier, const void *obj, Union type);
|
||||
template <bool B = false>
|
||||
bool VerifyUnionVector(::flatbuffers::VerifierTemplate<B> &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset<void>> *values, const ::flatbuffers::Vector<Union> *types);
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Struct FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
int32_t a_;
|
||||
int32_t padding0__;
|
||||
double b_;
|
||||
|
||||
public:
|
||||
Struct()
|
||||
: a_(0),
|
||||
padding0__(0),
|
||||
b_(0) {
|
||||
(void)padding0__;
|
||||
}
|
||||
Struct(int32_t _a, double _b)
|
||||
: a_(::flatbuffers::EndianScalar(_a)),
|
||||
padding0__(0),
|
||||
b_(::flatbuffers::EndianScalar(_b)) {
|
||||
(void)padding0__;
|
||||
}
|
||||
int32_t a() const {
|
||||
return ::flatbuffers::EndianScalar(a_);
|
||||
}
|
||||
double b() const {
|
||||
return ::flatbuffers::EndianScalar(b_);
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(Struct, 16);
|
||||
|
||||
inline bool operator==(const Struct &lhs, const Struct &rhs) {
|
||||
return
|
||||
(lhs.a() == rhs.a()) &&
|
||||
(lhs.b() == rhs.b());
|
||||
}
|
||||
|
||||
inline bool operator!=(const Struct &lhs, const Struct &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
template <typename H>
|
||||
inline H AbslHashValue(H h, const Struct &obj) {
|
||||
return H::combine(std::move(h), obj.a(), obj.b());
|
||||
}
|
||||
|
||||
struct TableA FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef TableABuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_A = 4,
|
||||
VT_B = 6
|
||||
};
|
||||
float a() const {
|
||||
return GetField<float>(VT_A, 0.0f);
|
||||
}
|
||||
int32_t b() const {
|
||||
return GetField<int32_t>(VT_B, 0);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<float>(verifier, VT_A, 4) &&
|
||||
VerifyField<int32_t>(verifier, VT_B, 4) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct TableABuilder {
|
||||
typedef TableA Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_a(float a) {
|
||||
fbb_.AddElement<float>(TableA::VT_A, a, 0.0f);
|
||||
}
|
||||
void add_b(int32_t b) {
|
||||
fbb_.AddElement<int32_t>(TableA::VT_B, b, 0);
|
||||
}
|
||||
explicit TableABuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<TableA> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<TableA>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<TableA> CreateTableA(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
float a = 0.0f,
|
||||
int32_t b = 0) {
|
||||
TableABuilder builder_(_fbb);
|
||||
builder_.add_b(b);
|
||||
builder_.add_a(a);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
struct TableB FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef TableBBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_A = 4
|
||||
};
|
||||
int32_t a() const {
|
||||
return GetField<int32_t>(VT_A, 0);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int32_t>(verifier, VT_A, 4) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct TableBBuilder {
|
||||
typedef TableB Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_a(int32_t a) {
|
||||
fbb_.AddElement<int32_t>(TableB::VT_A, a, 0);
|
||||
}
|
||||
explicit TableBBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<TableB> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<TableB>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<TableB> CreateTableB(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int32_t a = 0) {
|
||||
TableBBuilder builder_(_fbb);
|
||||
builder_.add_a(a);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
struct Root FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef RootBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_A = 4,
|
||||
VT_B = 6,
|
||||
VT_C_TYPE = 8,
|
||||
VT_C = 10,
|
||||
VT_D = 12,
|
||||
VT_E = 14,
|
||||
VT_F = 16,
|
||||
VT_G = 18,
|
||||
VT_H = 20,
|
||||
VT_I = 22,
|
||||
VT_J_TYPE = 24,
|
||||
VT_J = 26
|
||||
};
|
||||
int32_t a() const {
|
||||
return GetField<int32_t>(VT_A, 0);
|
||||
}
|
||||
bool b() const {
|
||||
return GetField<uint8_t>(VT_B, 0) != 0;
|
||||
}
|
||||
Evolution::V1::Union c_type() const {
|
||||
return static_cast<Evolution::V1::Union>(GetField<uint8_t>(VT_C_TYPE, 0));
|
||||
}
|
||||
const void *c() const {
|
||||
return GetPointer<const void *>(VT_C);
|
||||
}
|
||||
template<typename T> const T *c_as() const;
|
||||
const Evolution::V1::TableA *c_as_TableA() const {
|
||||
return c_type() == Evolution::V1::Union::TableA ? static_cast<const Evolution::V1::TableA *>(c()) : nullptr;
|
||||
}
|
||||
const Evolution::V1::TableB *c_as_TableB() const {
|
||||
return c_type() == Evolution::V1::Union::TableB ? static_cast<const Evolution::V1::TableB *>(c()) : nullptr;
|
||||
}
|
||||
Evolution::V1::Enum d() const {
|
||||
return static_cast<Evolution::V1::Enum>(GetField<int8_t>(VT_D, 0));
|
||||
}
|
||||
const Evolution::V1::TableA *e() const {
|
||||
return GetPointer<const Evolution::V1::TableA *>(VT_E);
|
||||
}
|
||||
const Evolution::V1::Struct *f() const {
|
||||
return GetStruct<const Evolution::V1::Struct *>(VT_F);
|
||||
}
|
||||
const ::flatbuffers::Vector<int32_t> *g() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<int32_t> *>(VT_G);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<Evolution::V1::TableB>> *h() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<Evolution::V1::TableB>> *>(VT_H);
|
||||
}
|
||||
int32_t i() const {
|
||||
return GetField<int32_t>(VT_I, 1234);
|
||||
}
|
||||
Evolution::V1::Union j_type() const {
|
||||
return static_cast<Evolution::V1::Union>(GetField<uint8_t>(VT_J_TYPE, 0));
|
||||
}
|
||||
const void *j() const {
|
||||
return GetPointer<const void *>(VT_J);
|
||||
}
|
||||
template<typename T> const T *j_as() const;
|
||||
const Evolution::V1::TableA *j_as_TableA() const {
|
||||
return j_type() == Evolution::V1::Union::TableA ? static_cast<const Evolution::V1::TableA *>(j()) : nullptr;
|
||||
}
|
||||
const Evolution::V1::TableB *j_as_TableB() const {
|
||||
return j_type() == Evolution::V1::Union::TableB ? static_cast<const Evolution::V1::TableB *>(j()) : nullptr;
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int32_t>(verifier, VT_A, 4) &&
|
||||
VerifyField<uint8_t>(verifier, VT_B, 1) &&
|
||||
VerifyField<uint8_t>(verifier, VT_C_TYPE, 1) &&
|
||||
VerifyOffset(verifier, VT_C) &&
|
||||
VerifyUnion(verifier, c(), c_type()) &&
|
||||
VerifyField<int8_t>(verifier, VT_D, 1) &&
|
||||
VerifyOffset(verifier, VT_E) &&
|
||||
verifier.VerifyTable(e()) &&
|
||||
VerifyField<Evolution::V1::Struct>(verifier, VT_F, 8) &&
|
||||
VerifyOffset(verifier, VT_G) &&
|
||||
verifier.VerifyVector(g()) &&
|
||||
VerifyOffset(verifier, VT_H) &&
|
||||
verifier.VerifyVector(h()) &&
|
||||
verifier.VerifyVectorOfTables(h()) &&
|
||||
VerifyField<int32_t>(verifier, VT_I, 4) &&
|
||||
VerifyField<uint8_t>(verifier, VT_J_TYPE, 1) &&
|
||||
VerifyOffset(verifier, VT_J) &&
|
||||
VerifyUnion(verifier, j(), j_type()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
template<> inline const Evolution::V1::TableA *Root::c_as<Evolution::V1::TableA>() const {
|
||||
return c_as_TableA();
|
||||
}
|
||||
|
||||
template<> inline const Evolution::V1::TableB *Root::c_as<Evolution::V1::TableB>() const {
|
||||
return c_as_TableB();
|
||||
}
|
||||
|
||||
template<> inline const Evolution::V1::TableA *Root::j_as<Evolution::V1::TableA>() const {
|
||||
return j_as_TableA();
|
||||
}
|
||||
|
||||
template<> inline const Evolution::V1::TableB *Root::j_as<Evolution::V1::TableB>() const {
|
||||
return j_as_TableB();
|
||||
}
|
||||
|
||||
struct RootBuilder {
|
||||
typedef Root Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_a(int32_t a) {
|
||||
fbb_.AddElement<int32_t>(Root::VT_A, a, 0);
|
||||
}
|
||||
void add_b(bool b) {
|
||||
fbb_.AddElement<uint8_t>(Root::VT_B, static_cast<uint8_t>(b), 0);
|
||||
}
|
||||
void add_c_type(Evolution::V1::Union c_type) {
|
||||
fbb_.AddElement<uint8_t>(Root::VT_C_TYPE, static_cast<uint8_t>(c_type), 0);
|
||||
}
|
||||
void add_c(::flatbuffers::Offset<void> c) {
|
||||
fbb_.AddOffset(Root::VT_C, c);
|
||||
}
|
||||
void add_d(Evolution::V1::Enum d) {
|
||||
fbb_.AddElement<int8_t>(Root::VT_D, static_cast<int8_t>(d), 0);
|
||||
}
|
||||
void add_e(::flatbuffers::Offset<Evolution::V1::TableA> e) {
|
||||
fbb_.AddOffset(Root::VT_E, e);
|
||||
}
|
||||
void add_f(const Evolution::V1::Struct *f) {
|
||||
fbb_.AddStruct(Root::VT_F, f);
|
||||
}
|
||||
void add_g(::flatbuffers::Offset<::flatbuffers::Vector<int32_t>> g) {
|
||||
fbb_.AddOffset(Root::VT_G, g);
|
||||
}
|
||||
void add_h(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<Evolution::V1::TableB>>> h) {
|
||||
fbb_.AddOffset(Root::VT_H, h);
|
||||
}
|
||||
void add_i(int32_t i) {
|
||||
fbb_.AddElement<int32_t>(Root::VT_I, i, 1234);
|
||||
}
|
||||
void add_j_type(Evolution::V1::Union j_type) {
|
||||
fbb_.AddElement<uint8_t>(Root::VT_J_TYPE, static_cast<uint8_t>(j_type), 0);
|
||||
}
|
||||
void add_j(::flatbuffers::Offset<void> j) {
|
||||
fbb_.AddOffset(Root::VT_J, j);
|
||||
}
|
||||
explicit RootBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<Root> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<Root>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<Root> CreateRoot(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int32_t a = 0,
|
||||
bool b = false,
|
||||
Evolution::V1::Union c_type = Evolution::V1::Union::NONE,
|
||||
::flatbuffers::Offset<void> c = 0,
|
||||
Evolution::V1::Enum d = Evolution::V1::Enum::King,
|
||||
::flatbuffers::Offset<Evolution::V1::TableA> e = 0,
|
||||
const Evolution::V1::Struct *f = nullptr,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<int32_t>> g = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<Evolution::V1::TableB>>> h = 0,
|
||||
int32_t i = 1234,
|
||||
Evolution::V1::Union j_type = Evolution::V1::Union::NONE,
|
||||
::flatbuffers::Offset<void> j = 0) {
|
||||
RootBuilder builder_(_fbb);
|
||||
builder_.add_j(j);
|
||||
builder_.add_i(i);
|
||||
builder_.add_h(h);
|
||||
builder_.add_g(g);
|
||||
builder_.add_f(f);
|
||||
builder_.add_e(e);
|
||||
builder_.add_c(c);
|
||||
builder_.add_a(a);
|
||||
builder_.add_j_type(j_type);
|
||||
builder_.add_d(d);
|
||||
builder_.add_c_type(c_type);
|
||||
builder_.add_b(b);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<Root> CreateRootDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int32_t a = 0,
|
||||
bool b = false,
|
||||
Evolution::V1::Union c_type = Evolution::V1::Union::NONE,
|
||||
::flatbuffers::Offset<void> c = 0,
|
||||
Evolution::V1::Enum d = Evolution::V1::Enum::King,
|
||||
::flatbuffers::Offset<Evolution::V1::TableA> e = 0,
|
||||
const Evolution::V1::Struct *f = nullptr,
|
||||
const std::vector<int32_t> *g = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<Evolution::V1::TableB>> *h = nullptr,
|
||||
int32_t i = 1234,
|
||||
Evolution::V1::Union j_type = Evolution::V1::Union::NONE,
|
||||
::flatbuffers::Offset<void> j = 0) {
|
||||
auto g__ = g ? _fbb.CreateVector<int32_t>(*g) : 0;
|
||||
auto h__ = h ? _fbb.CreateVector<::flatbuffers::Offset<Evolution::V1::TableB>>(*h) : 0;
|
||||
return Evolution::V1::CreateRoot(
|
||||
_fbb,
|
||||
a,
|
||||
b,
|
||||
c_type,
|
||||
c,
|
||||
d,
|
||||
e,
|
||||
f,
|
||||
g__,
|
||||
h__,
|
||||
i,
|
||||
j_type,
|
||||
j);
|
||||
}
|
||||
|
||||
template <bool B>
|
||||
inline bool VerifyUnion(::flatbuffers::VerifierTemplate<B> &verifier, const void *obj, Union type) {
|
||||
switch (type) {
|
||||
case Union::NONE: {
|
||||
return true;
|
||||
}
|
||||
case Union::TableA: {
|
||||
auto ptr = reinterpret_cast<const Evolution::V1::TableA *>(obj);
|
||||
return verifier.VerifyTable(ptr);
|
||||
}
|
||||
case Union::TableB: {
|
||||
auto ptr = reinterpret_cast<const Evolution::V1::TableB *>(obj);
|
||||
return verifier.VerifyTable(ptr);
|
||||
}
|
||||
default: return true;
|
||||
}
|
||||
}
|
||||
|
||||
template <bool B>
|
||||
inline bool VerifyUnionVector(::flatbuffers::VerifierTemplate<B> &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset<void>> *values, const ::flatbuffers::Vector<Union> *types) {
|
||||
if (!values || !types) return !values && !types;
|
||||
if (values->size() != types->size()) return false;
|
||||
for (::flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
|
||||
if (!VerifyUnion(
|
||||
verifier, values->Get(i), types->GetEnum<Union>(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline const Evolution::V1::Root *GetRoot(const void *buf) {
|
||||
return ::flatbuffers::GetRoot<Evolution::V1::Root>(buf);
|
||||
}
|
||||
|
||||
inline const Evolution::V1::Root *GetSizePrefixedRoot(const void *buf) {
|
||||
return ::flatbuffers::GetSizePrefixedRoot<Evolution::V1::Root>(buf);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifyRootBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifyBuffer<Evolution::V1::Root>(nullptr);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifySizePrefixedRootBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifySizePrefixedBuffer<Evolution::V1::Root>(nullptr);
|
||||
}
|
||||
|
||||
inline void FinishRootBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<Evolution::V1::Root> root) {
|
||||
fbb.Finish(root);
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedRootBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<Evolution::V1::Root> root) {
|
||||
fbb.FinishSizePrefixed(root);
|
||||
}
|
||||
|
||||
} // namespace V1
|
||||
} // namespace Evolution
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_EVOLUTIONV1_EVOLUTION_V1_H_
|
||||
@@ -1,621 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_EVOLUTIONV2_EVOLUTION_V2_H_
|
||||
#define FLATBUFFERS_GENERATED_EVOLUTIONV2_EVOLUTION_V2_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 12 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
namespace Evolution {
|
||||
namespace V2 {
|
||||
|
||||
struct TableA;
|
||||
struct TableABuilder;
|
||||
|
||||
struct TableB;
|
||||
struct TableBBuilder;
|
||||
|
||||
struct TableC;
|
||||
struct TableCBuilder;
|
||||
|
||||
struct Struct;
|
||||
|
||||
struct Root;
|
||||
struct RootBuilder;
|
||||
|
||||
enum class Enum : int8_t {
|
||||
King = 0,
|
||||
Queen = 1,
|
||||
Rook = 2,
|
||||
Bishop = 3,
|
||||
MIN = King,
|
||||
MAX = Bishop
|
||||
};
|
||||
|
||||
inline const Enum (&EnumValuesEnum())[4] {
|
||||
static const Enum values[] = {
|
||||
Enum::King,
|
||||
Enum::Queen,
|
||||
Enum::Rook,
|
||||
Enum::Bishop
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char * const *EnumNamesEnum() {
|
||||
static const char * const names[5] = {
|
||||
"King",
|
||||
"Queen",
|
||||
"Rook",
|
||||
"Bishop",
|
||||
nullptr
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameEnum(Enum e) {
|
||||
if (::flatbuffers::IsOutRange(e, Enum::King, Enum::Bishop)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesEnum()[index];
|
||||
}
|
||||
|
||||
enum class Union : uint8_t {
|
||||
NONE = 0,
|
||||
TableA = 1,
|
||||
TableB = 2,
|
||||
TableC = 3,
|
||||
MIN = NONE,
|
||||
MAX = TableC
|
||||
};
|
||||
|
||||
inline const Union (&EnumValuesUnion())[4] {
|
||||
static const Union values[] = {
|
||||
Union::NONE,
|
||||
Union::TableA,
|
||||
Union::TableB,
|
||||
Union::TableC
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char * const *EnumNamesUnion() {
|
||||
static const char * const names[5] = {
|
||||
"NONE",
|
||||
"TableA",
|
||||
"TableB",
|
||||
"TableC",
|
||||
nullptr
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameUnion(Union e) {
|
||||
if (::flatbuffers::IsOutRange(e, Union::NONE, Union::TableC)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesUnion()[index];
|
||||
}
|
||||
|
||||
template<typename T> struct UnionTraits {
|
||||
static const Union enum_value = Union::NONE;
|
||||
};
|
||||
|
||||
template<> struct UnionTraits<Evolution::V2::TableA> {
|
||||
static const Union enum_value = Union::TableA;
|
||||
};
|
||||
|
||||
template<> struct UnionTraits<Evolution::V2::TableB> {
|
||||
static const Union enum_value = Union::TableB;
|
||||
};
|
||||
|
||||
template<> struct UnionTraits<Evolution::V2::TableC> {
|
||||
static const Union enum_value = Union::TableC;
|
||||
};
|
||||
|
||||
template <bool B = false>
|
||||
bool VerifyUnion(::flatbuffers::VerifierTemplate<B> &verifier, const void *obj, Union type);
|
||||
template <bool B = false>
|
||||
bool VerifyUnionVector(::flatbuffers::VerifierTemplate<B> &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset<void>> *values, const ::flatbuffers::Vector<Union> *types);
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Struct FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
int32_t a_;
|
||||
int32_t padding0__;
|
||||
double b_;
|
||||
|
||||
public:
|
||||
Struct()
|
||||
: a_(0),
|
||||
padding0__(0),
|
||||
b_(0) {
|
||||
(void)padding0__;
|
||||
}
|
||||
Struct(int32_t _a, double _b)
|
||||
: a_(::flatbuffers::EndianScalar(_a)),
|
||||
padding0__(0),
|
||||
b_(::flatbuffers::EndianScalar(_b)) {
|
||||
(void)padding0__;
|
||||
}
|
||||
int32_t a() const {
|
||||
return ::flatbuffers::EndianScalar(a_);
|
||||
}
|
||||
double b() const {
|
||||
return ::flatbuffers::EndianScalar(b_);
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(Struct, 16);
|
||||
|
||||
inline bool operator==(const Struct &lhs, const Struct &rhs) {
|
||||
return
|
||||
(lhs.a() == rhs.a()) &&
|
||||
(lhs.b() == rhs.b());
|
||||
}
|
||||
|
||||
inline bool operator!=(const Struct &lhs, const Struct &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
template <typename H>
|
||||
inline H AbslHashValue(H h, const Struct &obj) {
|
||||
return H::combine(std::move(h), obj.a(), obj.b());
|
||||
}
|
||||
|
||||
struct TableA FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef TableABuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_A = 4,
|
||||
VT_B = 6,
|
||||
VT_C = 8
|
||||
};
|
||||
float a() const {
|
||||
return GetField<float>(VT_A, 0.0f);
|
||||
}
|
||||
int32_t b() const {
|
||||
return GetField<int32_t>(VT_B, 0);
|
||||
}
|
||||
const ::flatbuffers::String *c() const {
|
||||
return GetPointer<const ::flatbuffers::String *>(VT_C);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<float>(verifier, VT_A, 4) &&
|
||||
VerifyField<int32_t>(verifier, VT_B, 4) &&
|
||||
VerifyOffset(verifier, VT_C) &&
|
||||
verifier.VerifyString(c()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct TableABuilder {
|
||||
typedef TableA Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_a(float a) {
|
||||
fbb_.AddElement<float>(TableA::VT_A, a, 0.0f);
|
||||
}
|
||||
void add_b(int32_t b) {
|
||||
fbb_.AddElement<int32_t>(TableA::VT_B, b, 0);
|
||||
}
|
||||
void add_c(::flatbuffers::Offset<::flatbuffers::String> c) {
|
||||
fbb_.AddOffset(TableA::VT_C, c);
|
||||
}
|
||||
explicit TableABuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<TableA> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<TableA>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<TableA> CreateTableA(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
float a = 0.0f,
|
||||
int32_t b = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::String> c = 0) {
|
||||
TableABuilder builder_(_fbb);
|
||||
builder_.add_c(c);
|
||||
builder_.add_b(b);
|
||||
builder_.add_a(a);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<TableA> CreateTableADirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
float a = 0.0f,
|
||||
int32_t b = 0,
|
||||
const char *c = nullptr) {
|
||||
auto c__ = c ? _fbb.CreateString(c) : 0;
|
||||
return Evolution::V2::CreateTableA(
|
||||
_fbb,
|
||||
a,
|
||||
b,
|
||||
c__);
|
||||
}
|
||||
|
||||
struct TableB FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef TableBBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_A = 4
|
||||
};
|
||||
int32_t a() const {
|
||||
return GetField<int32_t>(VT_A, 0);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int32_t>(verifier, VT_A, 4) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct TableBBuilder {
|
||||
typedef TableB Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_a(int32_t a) {
|
||||
fbb_.AddElement<int32_t>(TableB::VT_A, a, 0);
|
||||
}
|
||||
explicit TableBBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<TableB> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<TableB>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<TableB> CreateTableB(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int32_t a = 0) {
|
||||
TableBBuilder builder_(_fbb);
|
||||
builder_.add_a(a);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
struct TableC FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef TableCBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_A = 4,
|
||||
VT_B = 6
|
||||
};
|
||||
double a() const {
|
||||
return GetField<double>(VT_A, 0.0);
|
||||
}
|
||||
const ::flatbuffers::String *b() const {
|
||||
return GetPointer<const ::flatbuffers::String *>(VT_B);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<double>(verifier, VT_A, 8) &&
|
||||
VerifyOffset(verifier, VT_B) &&
|
||||
verifier.VerifyString(b()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct TableCBuilder {
|
||||
typedef TableC Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_a(double a) {
|
||||
fbb_.AddElement<double>(TableC::VT_A, a, 0.0);
|
||||
}
|
||||
void add_b(::flatbuffers::Offset<::flatbuffers::String> b) {
|
||||
fbb_.AddOffset(TableC::VT_B, b);
|
||||
}
|
||||
explicit TableCBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<TableC> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<TableC>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<TableC> CreateTableC(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
double a = 0.0,
|
||||
::flatbuffers::Offset<::flatbuffers::String> b = 0) {
|
||||
TableCBuilder builder_(_fbb);
|
||||
builder_.add_a(a);
|
||||
builder_.add_b(b);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<TableC> CreateTableCDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
double a = 0.0,
|
||||
const char *b = nullptr) {
|
||||
auto b__ = b ? _fbb.CreateString(b) : 0;
|
||||
return Evolution::V2::CreateTableC(
|
||||
_fbb,
|
||||
a,
|
||||
b__);
|
||||
}
|
||||
|
||||
struct Root FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef RootBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_B = 6,
|
||||
VT_C_TYPE = 8,
|
||||
VT_C = 10,
|
||||
VT_D = 12,
|
||||
VT_E = 14,
|
||||
VT_FF = 16,
|
||||
VT_G = 18,
|
||||
VT_H = 20,
|
||||
VT_I = 22,
|
||||
VT_K = 28,
|
||||
VT_L = 30
|
||||
};
|
||||
bool b() const {
|
||||
return GetField<uint8_t>(VT_B, 0) != 0;
|
||||
}
|
||||
Evolution::V2::Union c_type() const {
|
||||
return static_cast<Evolution::V2::Union>(GetField<uint8_t>(VT_C_TYPE, 0));
|
||||
}
|
||||
const void *c() const {
|
||||
return GetPointer<const void *>(VT_C);
|
||||
}
|
||||
template<typename T> const T *c_as() const;
|
||||
const Evolution::V2::TableA *c_as_TableA() const {
|
||||
return c_type() == Evolution::V2::Union::TableA ? static_cast<const Evolution::V2::TableA *>(c()) : nullptr;
|
||||
}
|
||||
const Evolution::V2::TableB *c_as_TableB() const {
|
||||
return c_type() == Evolution::V2::Union::TableB ? static_cast<const Evolution::V2::TableB *>(c()) : nullptr;
|
||||
}
|
||||
const Evolution::V2::TableC *c_as_TableC() const {
|
||||
return c_type() == Evolution::V2::Union::TableC ? static_cast<const Evolution::V2::TableC *>(c()) : nullptr;
|
||||
}
|
||||
Evolution::V2::Enum d() const {
|
||||
return static_cast<Evolution::V2::Enum>(GetField<int8_t>(VT_D, 0));
|
||||
}
|
||||
const Evolution::V2::TableA *e() const {
|
||||
return GetPointer<const Evolution::V2::TableA *>(VT_E);
|
||||
}
|
||||
const Evolution::V2::Struct *ff() const {
|
||||
return GetStruct<const Evolution::V2::Struct *>(VT_FF);
|
||||
}
|
||||
const ::flatbuffers::Vector<int32_t> *g() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<int32_t> *>(VT_G);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<Evolution::V2::TableB>> *h() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<Evolution::V2::TableB>> *>(VT_H);
|
||||
}
|
||||
uint32_t i() const {
|
||||
return GetField<uint32_t>(VT_I, 1234);
|
||||
}
|
||||
const Evolution::V2::TableC *k() const {
|
||||
return GetPointer<const Evolution::V2::TableC *>(VT_K);
|
||||
}
|
||||
uint8_t l() const {
|
||||
return GetField<uint8_t>(VT_L, 56);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<uint8_t>(verifier, VT_B, 1) &&
|
||||
VerifyField<uint8_t>(verifier, VT_C_TYPE, 1) &&
|
||||
VerifyOffset(verifier, VT_C) &&
|
||||
VerifyUnion(verifier, c(), c_type()) &&
|
||||
VerifyField<int8_t>(verifier, VT_D, 1) &&
|
||||
VerifyOffset(verifier, VT_E) &&
|
||||
verifier.VerifyTable(e()) &&
|
||||
VerifyField<Evolution::V2::Struct>(verifier, VT_FF, 8) &&
|
||||
VerifyOffset(verifier, VT_G) &&
|
||||
verifier.VerifyVector(g()) &&
|
||||
VerifyOffset(verifier, VT_H) &&
|
||||
verifier.VerifyVector(h()) &&
|
||||
verifier.VerifyVectorOfTables(h()) &&
|
||||
VerifyField<uint32_t>(verifier, VT_I, 4) &&
|
||||
VerifyOffset(verifier, VT_K) &&
|
||||
verifier.VerifyTable(k()) &&
|
||||
VerifyField<uint8_t>(verifier, VT_L, 1) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
template<> inline const Evolution::V2::TableA *Root::c_as<Evolution::V2::TableA>() const {
|
||||
return c_as_TableA();
|
||||
}
|
||||
|
||||
template<> inline const Evolution::V2::TableB *Root::c_as<Evolution::V2::TableB>() const {
|
||||
return c_as_TableB();
|
||||
}
|
||||
|
||||
template<> inline const Evolution::V2::TableC *Root::c_as<Evolution::V2::TableC>() const {
|
||||
return c_as_TableC();
|
||||
}
|
||||
|
||||
struct RootBuilder {
|
||||
typedef Root Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_b(bool b) {
|
||||
fbb_.AddElement<uint8_t>(Root::VT_B, static_cast<uint8_t>(b), 0);
|
||||
}
|
||||
void add_c_type(Evolution::V2::Union c_type) {
|
||||
fbb_.AddElement<uint8_t>(Root::VT_C_TYPE, static_cast<uint8_t>(c_type), 0);
|
||||
}
|
||||
void add_c(::flatbuffers::Offset<void> c) {
|
||||
fbb_.AddOffset(Root::VT_C, c);
|
||||
}
|
||||
void add_d(Evolution::V2::Enum d) {
|
||||
fbb_.AddElement<int8_t>(Root::VT_D, static_cast<int8_t>(d), 0);
|
||||
}
|
||||
void add_e(::flatbuffers::Offset<Evolution::V2::TableA> e) {
|
||||
fbb_.AddOffset(Root::VT_E, e);
|
||||
}
|
||||
void add_ff(const Evolution::V2::Struct *ff) {
|
||||
fbb_.AddStruct(Root::VT_FF, ff);
|
||||
}
|
||||
void add_g(::flatbuffers::Offset<::flatbuffers::Vector<int32_t>> g) {
|
||||
fbb_.AddOffset(Root::VT_G, g);
|
||||
}
|
||||
void add_h(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<Evolution::V2::TableB>>> h) {
|
||||
fbb_.AddOffset(Root::VT_H, h);
|
||||
}
|
||||
void add_i(uint32_t i) {
|
||||
fbb_.AddElement<uint32_t>(Root::VT_I, i, 1234);
|
||||
}
|
||||
void add_k(::flatbuffers::Offset<Evolution::V2::TableC> k) {
|
||||
fbb_.AddOffset(Root::VT_K, k);
|
||||
}
|
||||
void add_l(uint8_t l) {
|
||||
fbb_.AddElement<uint8_t>(Root::VT_L, l, 56);
|
||||
}
|
||||
explicit RootBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<Root> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<Root>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<Root> CreateRoot(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
bool b = false,
|
||||
Evolution::V2::Union c_type = Evolution::V2::Union::NONE,
|
||||
::flatbuffers::Offset<void> c = 0,
|
||||
Evolution::V2::Enum d = Evolution::V2::Enum::King,
|
||||
::flatbuffers::Offset<Evolution::V2::TableA> e = 0,
|
||||
const Evolution::V2::Struct *ff = nullptr,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<int32_t>> g = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<Evolution::V2::TableB>>> h = 0,
|
||||
uint32_t i = 1234,
|
||||
::flatbuffers::Offset<Evolution::V2::TableC> k = 0,
|
||||
uint8_t l = 56) {
|
||||
RootBuilder builder_(_fbb);
|
||||
builder_.add_k(k);
|
||||
builder_.add_i(i);
|
||||
builder_.add_h(h);
|
||||
builder_.add_g(g);
|
||||
builder_.add_ff(ff);
|
||||
builder_.add_e(e);
|
||||
builder_.add_c(c);
|
||||
builder_.add_l(l);
|
||||
builder_.add_d(d);
|
||||
builder_.add_c_type(c_type);
|
||||
builder_.add_b(b);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<Root> CreateRootDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
bool b = false,
|
||||
Evolution::V2::Union c_type = Evolution::V2::Union::NONE,
|
||||
::flatbuffers::Offset<void> c = 0,
|
||||
Evolution::V2::Enum d = Evolution::V2::Enum::King,
|
||||
::flatbuffers::Offset<Evolution::V2::TableA> e = 0,
|
||||
const Evolution::V2::Struct *ff = nullptr,
|
||||
const std::vector<int32_t> *g = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<Evolution::V2::TableB>> *h = nullptr,
|
||||
uint32_t i = 1234,
|
||||
::flatbuffers::Offset<Evolution::V2::TableC> k = 0,
|
||||
uint8_t l = 56) {
|
||||
auto g__ = g ? _fbb.CreateVector<int32_t>(*g) : 0;
|
||||
auto h__ = h ? _fbb.CreateVector<::flatbuffers::Offset<Evolution::V2::TableB>>(*h) : 0;
|
||||
return Evolution::V2::CreateRoot(
|
||||
_fbb,
|
||||
b,
|
||||
c_type,
|
||||
c,
|
||||
d,
|
||||
e,
|
||||
ff,
|
||||
g__,
|
||||
h__,
|
||||
i,
|
||||
k,
|
||||
l);
|
||||
}
|
||||
|
||||
template <bool B>
|
||||
inline bool VerifyUnion(::flatbuffers::VerifierTemplate<B> &verifier, const void *obj, Union type) {
|
||||
switch (type) {
|
||||
case Union::NONE: {
|
||||
return true;
|
||||
}
|
||||
case Union::TableA: {
|
||||
auto ptr = reinterpret_cast<const Evolution::V2::TableA *>(obj);
|
||||
return verifier.VerifyTable(ptr);
|
||||
}
|
||||
case Union::TableB: {
|
||||
auto ptr = reinterpret_cast<const Evolution::V2::TableB *>(obj);
|
||||
return verifier.VerifyTable(ptr);
|
||||
}
|
||||
case Union::TableC: {
|
||||
auto ptr = reinterpret_cast<const Evolution::V2::TableC *>(obj);
|
||||
return verifier.VerifyTable(ptr);
|
||||
}
|
||||
default: return true;
|
||||
}
|
||||
}
|
||||
|
||||
template <bool B>
|
||||
inline bool VerifyUnionVector(::flatbuffers::VerifierTemplate<B> &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset<void>> *values, const ::flatbuffers::Vector<Union> *types) {
|
||||
if (!values || !types) return !values && !types;
|
||||
if (values->size() != types->size()) return false;
|
||||
for (::flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
|
||||
if (!VerifyUnion(
|
||||
verifier, values->Get(i), types->GetEnum<Union>(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline const Evolution::V2::Root *GetRoot(const void *buf) {
|
||||
return ::flatbuffers::GetRoot<Evolution::V2::Root>(buf);
|
||||
}
|
||||
|
||||
inline const Evolution::V2::Root *GetSizePrefixedRoot(const void *buf) {
|
||||
return ::flatbuffers::GetSizePrefixedRoot<Evolution::V2::Root>(buf);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifyRootBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifyBuffer<Evolution::V2::Root>(nullptr);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifySizePrefixedRootBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifySizePrefixedBuffer<Evolution::V2::Root>(nullptr);
|
||||
}
|
||||
|
||||
inline void FinishRootBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<Evolution::V2::Root> root) {
|
||||
fbb.Finish(root);
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedRootBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<Evolution::V2::Root> root) {
|
||||
fbb.FinishSizePrefixed(root);
|
||||
}
|
||||
|
||||
} // namespace V2
|
||||
} // namespace Evolution
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_EVOLUTIONV2_EVOLUTION_V2_H_
|
||||
@@ -71,12 +71,3 @@ class SchemaTests:
|
||||
schema_json["enums"][0]["values"][2]["attributes"][1]["value"]
|
||||
== "Value 3 (deprecated)"
|
||||
)
|
||||
|
||||
def CircularStructDependency(self):
|
||||
try:
|
||||
flatc(["-c", "circular_struct_dependency.fbs"])
|
||||
assert False, "Expected flatc to fail on circular struct dependency"
|
||||
except subprocess.CalledProcessError:
|
||||
pass
|
||||
|
||||
flatc(["-c", "circular_table.fbs"])
|
||||
@@ -2,8 +2,8 @@
|
||||
#include <filesystem>
|
||||
#include <type_traits>
|
||||
|
||||
#include "64bit/test_64bit_bfbs_generated.h"
|
||||
#include "64bit/test_64bit_generated.h"
|
||||
#include "64bit/test_64bit_bfbs_generated.h"
|
||||
#include "flatbuffers/base.h"
|
||||
#include "flatbuffers/flatbuffer_builder.h"
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
@@ -1,479 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
pub enum TableAOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub struct TableA<'a> {
|
||||
pub _tab: ::flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for TableA<'a> {
|
||||
type Inner = TableA<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TableA<'a> {
|
||||
pub const VT_B: ::flatbuffers::VOffsetT = 4;
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"TableA"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
|
||||
TableA { _tab: table }
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
args: &'args TableAArgs<'args>
|
||||
) -> ::flatbuffers::WIPOffset<TableA<'bldr>> {
|
||||
let mut builder = TableABuilder::new(_fbb);
|
||||
if let Some(x) = args.b { builder.add_b(x); }
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> TableAT {
|
||||
let b = self.b().map(|x| {
|
||||
alloc::boxed::Box::new(x.unpack())
|
||||
});
|
||||
TableAT {
|
||||
b,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn b(&self) -> Option<my_game::other_name_space::TableB<'a>> {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>(TableA::VT_B, None)}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::flatbuffers::Verifiable for TableA<'_> {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut ::flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
||||
v.visit_table(pos)?
|
||||
.visit_field::<::flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>("b", Self::VT_B, false)?
|
||||
.finish();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
pub struct TableAArgs<'a> {
|
||||
pub b: Option<::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>,
|
||||
}
|
||||
impl<'a> Default for TableAArgs<'a> {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
TableAArgs {
|
||||
b: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TableABuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
|
||||
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_b(&mut self, b: ::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) {
|
||||
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
TableABuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableA<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
::flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl ::core::fmt::Debug for TableA<'_> {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
|
||||
let mut ds = f.debug_struct("TableA");
|
||||
ds.field("b", &self.b());
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TableAT {
|
||||
pub b: Option<alloc::boxed::Box<my_game::other_name_space::TableBT>>,
|
||||
}
|
||||
impl Default for TableAT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
b: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl TableAT {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> ::flatbuffers::WIPOffset<TableA<'b>> {
|
||||
let b = self.b.as_ref().map(|x|{
|
||||
x.pack(_fbb)
|
||||
});
|
||||
TableA::create(_fbb, &TableAArgs{
|
||||
b,
|
||||
})
|
||||
}
|
||||
}
|
||||
#[allow(unused_imports, dead_code)]
|
||||
pub mod my_game {
|
||||
|
||||
extern crate alloc;
|
||||
#[allow(unused_imports, dead_code)]
|
||||
pub mod other_name_space {
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MIN_FROM_INCLUDE: i64 = 0;
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MAX_FROM_INCLUDE: i64 = 0;
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [
|
||||
FromInclude::IncludeVal,
|
||||
];
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
||||
#[repr(transparent)]
|
||||
pub struct FromInclude(pub i64);
|
||||
#[allow(non_upper_case_globals)]
|
||||
impl FromInclude {
|
||||
pub const IncludeVal: Self = Self(0);
|
||||
|
||||
pub const ENUM_MIN: i64 = 0;
|
||||
pub const ENUM_MAX: i64 = 0;
|
||||
pub const ENUM_VALUES: &'static [Self] = &[
|
||||
Self::IncludeVal,
|
||||
];
|
||||
/// Returns the variant's name or "" if unknown.
|
||||
pub fn variant_name(self) -> Option<&'static str> {
|
||||
match self {
|
||||
Self::IncludeVal => Some("IncludeVal"),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl ::core::fmt::Debug for FromInclude {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||
if let Some(name) = self.variant_name() {
|
||||
f.write_str(name)
|
||||
} else {
|
||||
f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
|
||||
type Inner = Self;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
let b = unsafe { ::flatbuffers::read_scalar_at::<i64>(buf, loc) };
|
||||
Self(b)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::flatbuffers::Push for FromInclude {
|
||||
type Output = FromInclude;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) };
|
||||
}
|
||||
}
|
||||
|
||||
impl ::flatbuffers::EndianScalar for FromInclude {
|
||||
type Scalar = i64;
|
||||
#[inline]
|
||||
fn to_little_endian(self) -> i64 {
|
||||
self.0.to_le()
|
||||
}
|
||||
#[inline]
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
fn from_little_endian(v: i64) -> Self {
|
||||
let b = i64::from_le(v);
|
||||
Self(b)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Verifiable for FromInclude {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut ::flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
||||
i64::run_verifier(v, pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::flatbuffers::SimpleToVerifyInSlice for FromInclude {}
|
||||
// struct Unused, aligned to 4
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub struct Unused(pub [u8; 4]);
|
||||
impl Default for Unused {
|
||||
fn default() -> Self {
|
||||
Self([0; 4])
|
||||
}
|
||||
}
|
||||
impl ::core::fmt::Debug for Unused {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||
f.debug_struct("Unused")
|
||||
.field("a", &self.a())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl ::flatbuffers::SimpleToVerifyInSlice for Unused {}
|
||||
impl<'a> ::flatbuffers::Follow<'a> for Unused {
|
||||
type Inner = &'a Unused;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
unsafe { <&'a Unused>::follow(buf, loc) }
|
||||
}
|
||||
}
|
||||
impl<'a> ::flatbuffers::Follow<'a> for &'a Unused {
|
||||
type Inner = &'a Unused;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
unsafe { ::flatbuffers::follow_cast_ref::<Unused>(buf, loc) }
|
||||
}
|
||||
}
|
||||
impl<'b> ::flatbuffers::Push for Unused {
|
||||
type Output = Unused;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
let src = unsafe { ::core::slice::from_raw_parts(self as *const Unused as *const u8, <Self as ::flatbuffers::Push>::size()) };
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
#[inline]
|
||||
fn alignment() -> ::flatbuffers::PushAlignment {
|
||||
::flatbuffers::PushAlignment::new(4)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Verifiable for Unused {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut ::flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
||||
v.in_buffer::<Self>(pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Unused {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
a: i32,
|
||||
) -> Self {
|
||||
let mut s = Self([0; 4]);
|
||||
s.set_a(a);
|
||||
s
|
||||
}
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"MyGame.OtherNameSpace.Unused"
|
||||
}
|
||||
|
||||
pub fn a(&self) -> i32 {
|
||||
let mut mem = ::core::mem::MaybeUninit::<<i32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
::flatbuffers::EndianScalar::from_little_endian(unsafe {
|
||||
::core::ptr::copy_nonoverlapping(
|
||||
self.0[0..].as_ptr(),
|
||||
mem.as_mut_ptr() as *mut u8,
|
||||
::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
|
||||
);
|
||||
mem.assume_init()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_a(&mut self, x: i32) {
|
||||
let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
unsafe {
|
||||
::core::ptr::copy_nonoverlapping(
|
||||
&x_le as *const _ as *const u8,
|
||||
self.0[0..].as_mut_ptr(),
|
||||
::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> UnusedT {
|
||||
UnusedT {
|
||||
a: self.a(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
pub struct UnusedT {
|
||||
pub a: i32,
|
||||
}
|
||||
impl UnusedT {
|
||||
pub fn pack(&self) -> Unused {
|
||||
Unused::new(
|
||||
self.a,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub enum TableBOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub struct TableB<'a> {
|
||||
pub _tab: ::flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for TableB<'a> {
|
||||
type Inner = TableB<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TableB<'a> {
|
||||
pub const VT_A: ::flatbuffers::VOffsetT = 4;
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"MyGame.OtherNameSpace.TableB"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
|
||||
TableB { _tab: table }
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
args: &'args TableBArgs<'args>
|
||||
) -> ::flatbuffers::WIPOffset<TableB<'bldr>> {
|
||||
let mut builder = TableBBuilder::new(_fbb);
|
||||
if let Some(x) = args.a { builder.add_a(x); }
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> TableBT {
|
||||
let a = self.a().map(|x| {
|
||||
alloc::boxed::Box::new(x.unpack())
|
||||
});
|
||||
TableBT {
|
||||
a,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn a(&self) -> Option<super::super::TableA<'a>> {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::flatbuffers::Verifiable for TableB<'_> {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut ::flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
||||
v.visit_table(pos)?
|
||||
.visit_field::<::flatbuffers::ForwardsUOffset<super::super::TableA>>("a", Self::VT_A, false)?
|
||||
.finish();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
pub struct TableBArgs<'a> {
|
||||
pub a: Option<::flatbuffers::WIPOffset<super::super::TableA<'a>>>,
|
||||
}
|
||||
impl<'a> Default for TableBArgs<'a> {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
TableBArgs {
|
||||
a: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TableBBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
|
||||
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_a(&mut self, a: ::flatbuffers::WIPOffset<super::super::TableA<'b >>) {
|
||||
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
TableBBuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableB<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
::flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl ::core::fmt::Debug for TableB<'_> {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
|
||||
let mut ds = f.debug_struct("TableB");
|
||||
ds.field("a", &self.a());
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TableBT {
|
||||
pub a: Option<alloc::boxed::Box<super::super::TableAT>>,
|
||||
}
|
||||
impl Default for TableBT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
a: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl TableBT {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> ::flatbuffers::WIPOffset<TableB<'b>> {
|
||||
let a = self.a.as_ref().map(|x|{
|
||||
x.pack(_fbb)
|
||||
});
|
||||
TableB::create(_fbb, &TableBArgs{
|
||||
a,
|
||||
})
|
||||
}
|
||||
}
|
||||
} // pub mod OtherNameSpace
|
||||
} // pub mod MyGame
|
||||
|
||||
@@ -1,479 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
pub enum TableAOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub struct TableA<'a> {
|
||||
pub _tab: ::flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for TableA<'a> {
|
||||
type Inner = TableA<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TableA<'a> {
|
||||
pub const VT_B: ::flatbuffers::VOffsetT = 4;
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"TableA"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
|
||||
TableA { _tab: table }
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
args: &'args TableAArgs<'args>
|
||||
) -> ::flatbuffers::WIPOffset<TableA<'bldr>> {
|
||||
let mut builder = TableABuilder::new(_fbb);
|
||||
if let Some(x) = args.b { builder.add_b(x); }
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> TableAT {
|
||||
let b = self.b().map(|x| {
|
||||
alloc::boxed::Box::new(x.unpack())
|
||||
});
|
||||
TableAT {
|
||||
b,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn b(&self) -> Option<my_game::other_name_space::TableB<'a>> {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>(TableA::VT_B, None)}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::flatbuffers::Verifiable for TableA<'_> {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut ::flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
||||
v.visit_table(pos)?
|
||||
.visit_field::<::flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>("b", Self::VT_B, false)?
|
||||
.finish();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
pub struct TableAArgs<'a> {
|
||||
pub b: Option<::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>,
|
||||
}
|
||||
impl<'a> Default for TableAArgs<'a> {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
TableAArgs {
|
||||
b: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TableABuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
|
||||
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_b(&mut self, b: ::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) {
|
||||
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
TableABuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableA<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
::flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl ::core::fmt::Debug for TableA<'_> {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
|
||||
let mut ds = f.debug_struct("TableA");
|
||||
ds.field("b", &self.b());
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TableAT {
|
||||
pub b: Option<alloc::boxed::Box<my_game::other_name_space::TableBT>>,
|
||||
}
|
||||
impl Default for TableAT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
b: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl TableAT {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> ::flatbuffers::WIPOffset<TableA<'b>> {
|
||||
let b = self.b.as_ref().map(|x|{
|
||||
x.pack(_fbb)
|
||||
});
|
||||
TableA::create(_fbb, &TableAArgs{
|
||||
b,
|
||||
})
|
||||
}
|
||||
}
|
||||
#[allow(unused_imports, dead_code)]
|
||||
pub mod my_game {
|
||||
|
||||
extern crate alloc;
|
||||
#[allow(unused_imports, dead_code)]
|
||||
pub mod other_name_space {
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MIN_FROM_INCLUDE: i64 = 0;
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MAX_FROM_INCLUDE: i64 = 0;
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [
|
||||
FromInclude::IncludeVal,
|
||||
];
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
||||
#[repr(transparent)]
|
||||
pub struct FromInclude(pub i64);
|
||||
#[allow(non_upper_case_globals)]
|
||||
impl FromInclude {
|
||||
pub const IncludeVal: Self = Self(0);
|
||||
|
||||
pub const ENUM_MIN: i64 = 0;
|
||||
pub const ENUM_MAX: i64 = 0;
|
||||
pub const ENUM_VALUES: &'static [Self] = &[
|
||||
Self::IncludeVal,
|
||||
];
|
||||
/// Returns the variant's name or "" if unknown.
|
||||
pub fn variant_name(self) -> Option<&'static str> {
|
||||
match self {
|
||||
Self::IncludeVal => Some("IncludeVal"),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl ::core::fmt::Debug for FromInclude {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||
if let Some(name) = self.variant_name() {
|
||||
f.write_str(name)
|
||||
} else {
|
||||
f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
|
||||
type Inner = Self;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
let b = unsafe { ::flatbuffers::read_scalar_at::<i64>(buf, loc) };
|
||||
Self(b)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::flatbuffers::Push for FromInclude {
|
||||
type Output = FromInclude;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) };
|
||||
}
|
||||
}
|
||||
|
||||
impl ::flatbuffers::EndianScalar for FromInclude {
|
||||
type Scalar = i64;
|
||||
#[inline]
|
||||
fn to_little_endian(self) -> i64 {
|
||||
self.0.to_le()
|
||||
}
|
||||
#[inline]
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
fn from_little_endian(v: i64) -> Self {
|
||||
let b = i64::from_le(v);
|
||||
Self(b)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Verifiable for FromInclude {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut ::flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
||||
i64::run_verifier(v, pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::flatbuffers::SimpleToVerifyInSlice for FromInclude {}
|
||||
// struct Unused, aligned to 4
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub struct Unused(pub [u8; 4]);
|
||||
impl Default for Unused {
|
||||
fn default() -> Self {
|
||||
Self([0; 4])
|
||||
}
|
||||
}
|
||||
impl ::core::fmt::Debug for Unused {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||
f.debug_struct("Unused")
|
||||
.field("a", &self.a())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl ::flatbuffers::SimpleToVerifyInSlice for Unused {}
|
||||
impl<'a> ::flatbuffers::Follow<'a> for Unused {
|
||||
type Inner = &'a Unused;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
unsafe { <&'a Unused>::follow(buf, loc) }
|
||||
}
|
||||
}
|
||||
impl<'a> ::flatbuffers::Follow<'a> for &'a Unused {
|
||||
type Inner = &'a Unused;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
unsafe { ::flatbuffers::follow_cast_ref::<Unused>(buf, loc) }
|
||||
}
|
||||
}
|
||||
impl<'b> ::flatbuffers::Push for Unused {
|
||||
type Output = Unused;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
let src = unsafe { ::core::slice::from_raw_parts(self as *const Unused as *const u8, <Self as ::flatbuffers::Push>::size()) };
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
#[inline]
|
||||
fn alignment() -> ::flatbuffers::PushAlignment {
|
||||
::flatbuffers::PushAlignment::new(4)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Verifiable for Unused {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut ::flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
||||
v.in_buffer::<Self>(pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Unused {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
a: i32,
|
||||
) -> Self {
|
||||
let mut s = Self([0; 4]);
|
||||
s.set_a(a);
|
||||
s
|
||||
}
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"MyGame.OtherNameSpace.Unused"
|
||||
}
|
||||
|
||||
pub fn a(&self) -> i32 {
|
||||
let mut mem = ::core::mem::MaybeUninit::<<i32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
::flatbuffers::EndianScalar::from_little_endian(unsafe {
|
||||
::core::ptr::copy_nonoverlapping(
|
||||
self.0[0..].as_ptr(),
|
||||
mem.as_mut_ptr() as *mut u8,
|
||||
::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
|
||||
);
|
||||
mem.assume_init()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_a(&mut self, x: i32) {
|
||||
let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
unsafe {
|
||||
::core::ptr::copy_nonoverlapping(
|
||||
&x_le as *const _ as *const u8,
|
||||
self.0[0..].as_mut_ptr(),
|
||||
::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> UnusedT {
|
||||
UnusedT {
|
||||
a: self.a(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
pub struct UnusedT {
|
||||
pub a: i32,
|
||||
}
|
||||
impl UnusedT {
|
||||
pub fn pack(&self) -> Unused {
|
||||
Unused::new(
|
||||
self.a,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub enum TableBOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub struct TableB<'a> {
|
||||
pub _tab: ::flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for TableB<'a> {
|
||||
type Inner = TableB<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TableB<'a> {
|
||||
pub const VT_A: ::flatbuffers::VOffsetT = 4;
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"MyGame.OtherNameSpace.TableB"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
|
||||
TableB { _tab: table }
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
args: &'args TableBArgs<'args>
|
||||
) -> ::flatbuffers::WIPOffset<TableB<'bldr>> {
|
||||
let mut builder = TableBBuilder::new(_fbb);
|
||||
if let Some(x) = args.a { builder.add_a(x); }
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> TableBT {
|
||||
let a = self.a().map(|x| {
|
||||
alloc::boxed::Box::new(x.unpack())
|
||||
});
|
||||
TableBT {
|
||||
a,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn a(&self) -> Option<super::super::TableA<'a>> {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::flatbuffers::Verifiable for TableB<'_> {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut ::flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
||||
v.visit_table(pos)?
|
||||
.visit_field::<::flatbuffers::ForwardsUOffset<super::super::TableA>>("a", Self::VT_A, false)?
|
||||
.finish();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
pub struct TableBArgs<'a> {
|
||||
pub a: Option<::flatbuffers::WIPOffset<super::super::TableA<'a>>>,
|
||||
}
|
||||
impl<'a> Default for TableBArgs<'a> {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
TableBArgs {
|
||||
a: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TableBBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
|
||||
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_a(&mut self, a: ::flatbuffers::WIPOffset<super::super::TableA<'b >>) {
|
||||
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
TableBBuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableB<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
::flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl ::core::fmt::Debug for TableB<'_> {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
|
||||
let mut ds = f.debug_struct("TableB");
|
||||
ds.field("a", &self.a());
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TableBT {
|
||||
pub a: Option<alloc::boxed::Box<super::super::TableAT>>,
|
||||
}
|
||||
impl Default for TableBT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
a: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl TableBT {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> ::flatbuffers::WIPOffset<TableB<'b>> {
|
||||
let a = self.a.as_ref().map(|x|{
|
||||
x.pack(_fbb)
|
||||
});
|
||||
TableB::create(_fbb, &TableBArgs{
|
||||
a,
|
||||
})
|
||||
}
|
||||
}
|
||||
} // pub mod OtherNameSpace
|
||||
} // pub mod MyGame
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "flatbuffers/idl.h"
|
||||
#include "monster_test_bfbs_generated.h"
|
||||
#include "monster_test_generated.h"
|
||||
#include "optional_scalars_generated.h"
|
||||
#include "optional_scalars.fbs.h"
|
||||
#include "test_assert.h"
|
||||
|
||||
namespace flatbuffers {
|
||||
|
||||
16
tests/key_field/BUILD.bazel
Normal file
16
tests/key_field/BUILD.bazel
Normal file
@@ -0,0 +1,16 @@
|
||||
load("//:build_defs.bzl", "flatbuffer_cc_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "key_field_sample_cc_fbs",
|
||||
srcs = ["key_field_sample.fbs"],
|
||||
filename_suffix = ".fbs",
|
||||
flatc_args = [
|
||||
"--gen-compare",
|
||||
"--gen-mutable",
|
||||
"--gen-object-api",
|
||||
"--reflect-names",
|
||||
"--filename-suffix .fbs",
|
||||
],
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
#include "flatbuffers/idl.h"
|
||||
#include "key_field/key_field_sample_generated.h"
|
||||
#include "key_field/key_field_sample.fbs.h"
|
||||
#include "test_assert.h"
|
||||
|
||||
namespace flatbuffers {
|
||||
|
||||
@@ -1,420 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_MONSTEREXTRA_MYGAME_H_
|
||||
#define FLATBUFFERS_GENERATED_MONSTEREXTRA_MYGAME_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 12 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
namespace MyGame {
|
||||
|
||||
struct MonsterExtra;
|
||||
struct MonsterExtraBuilder;
|
||||
struct MonsterExtraT;
|
||||
|
||||
bool operator==(const MonsterExtraT &lhs, const MonsterExtraT &rhs);
|
||||
bool operator!=(const MonsterExtraT &lhs, const MonsterExtraT &rhs);
|
||||
|
||||
inline const ::flatbuffers::TypeTable *MonsterExtraTypeTable();
|
||||
|
||||
struct MonsterExtraT : public ::flatbuffers::NativeTable {
|
||||
typedef MonsterExtra TableType;
|
||||
double d0 = std::numeric_limits<double>::quiet_NaN();
|
||||
double d1 = std::numeric_limits<double>::quiet_NaN();
|
||||
double d2 = std::numeric_limits<double>::infinity();
|
||||
double d3 = -std::numeric_limits<double>::infinity();
|
||||
float f0 = std::numeric_limits<float>::quiet_NaN();
|
||||
float f1 = std::numeric_limits<float>::quiet_NaN();
|
||||
float f2 = std::numeric_limits<float>::infinity();
|
||||
float f3 = -std::numeric_limits<float>::infinity();
|
||||
std::vector<double> dvec{};
|
||||
std::vector<float> fvec{};
|
||||
};
|
||||
|
||||
struct MonsterExtra FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef MonsterExtraT NativeTableType;
|
||||
typedef MonsterExtraBuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return MonsterExtraTypeTable();
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_D0 = 4,
|
||||
VT_D1 = 6,
|
||||
VT_D2 = 8,
|
||||
VT_D3 = 10,
|
||||
VT_F0 = 12,
|
||||
VT_F1 = 14,
|
||||
VT_F2 = 16,
|
||||
VT_F3 = 18,
|
||||
VT_DVEC = 20,
|
||||
VT_FVEC = 22
|
||||
};
|
||||
double d0() const {
|
||||
return GetField<double>(VT_D0, std::numeric_limits<double>::quiet_NaN());
|
||||
}
|
||||
bool mutate_d0(double _d0 = std::numeric_limits<double>::quiet_NaN()) {
|
||||
return SetField<double>(VT_D0, _d0, std::numeric_limits<double>::quiet_NaN());
|
||||
}
|
||||
double d1() const {
|
||||
return GetField<double>(VT_D1, std::numeric_limits<double>::quiet_NaN());
|
||||
}
|
||||
bool mutate_d1(double _d1 = std::numeric_limits<double>::quiet_NaN()) {
|
||||
return SetField<double>(VT_D1, _d1, std::numeric_limits<double>::quiet_NaN());
|
||||
}
|
||||
double d2() const {
|
||||
return GetField<double>(VT_D2, std::numeric_limits<double>::infinity());
|
||||
}
|
||||
bool mutate_d2(double _d2 = std::numeric_limits<double>::infinity()) {
|
||||
return SetField<double>(VT_D2, _d2, std::numeric_limits<double>::infinity());
|
||||
}
|
||||
double d3() const {
|
||||
return GetField<double>(VT_D3, -std::numeric_limits<double>::infinity());
|
||||
}
|
||||
bool mutate_d3(double _d3 = -std::numeric_limits<double>::infinity()) {
|
||||
return SetField<double>(VT_D3, _d3, -std::numeric_limits<double>::infinity());
|
||||
}
|
||||
float f0() const {
|
||||
return GetField<float>(VT_F0, std::numeric_limits<float>::quiet_NaN());
|
||||
}
|
||||
bool mutate_f0(float _f0 = std::numeric_limits<float>::quiet_NaN()) {
|
||||
return SetField<float>(VT_F0, _f0, std::numeric_limits<float>::quiet_NaN());
|
||||
}
|
||||
float f1() const {
|
||||
return GetField<float>(VT_F1, std::numeric_limits<float>::quiet_NaN());
|
||||
}
|
||||
bool mutate_f1(float _f1 = std::numeric_limits<float>::quiet_NaN()) {
|
||||
return SetField<float>(VT_F1, _f1, std::numeric_limits<float>::quiet_NaN());
|
||||
}
|
||||
float f2() const {
|
||||
return GetField<float>(VT_F2, std::numeric_limits<float>::infinity());
|
||||
}
|
||||
bool mutate_f2(float _f2 = std::numeric_limits<float>::infinity()) {
|
||||
return SetField<float>(VT_F2, _f2, std::numeric_limits<float>::infinity());
|
||||
}
|
||||
float f3() const {
|
||||
return GetField<float>(VT_F3, -std::numeric_limits<float>::infinity());
|
||||
}
|
||||
bool mutate_f3(float _f3 = -std::numeric_limits<float>::infinity()) {
|
||||
return SetField<float>(VT_F3, _f3, -std::numeric_limits<float>::infinity());
|
||||
}
|
||||
const ::flatbuffers::Vector<double> *dvec() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<double> *>(VT_DVEC);
|
||||
}
|
||||
::flatbuffers::Vector<double> *mutable_dvec() {
|
||||
return GetPointer<::flatbuffers::Vector<double> *>(VT_DVEC);
|
||||
}
|
||||
const ::flatbuffers::Vector<float> *fvec() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<float> *>(VT_FVEC);
|
||||
}
|
||||
::flatbuffers::Vector<float> *mutable_fvec() {
|
||||
return GetPointer<::flatbuffers::Vector<float> *>(VT_FVEC);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<double>(verifier, VT_D0, 8) &&
|
||||
VerifyField<double>(verifier, VT_D1, 8) &&
|
||||
VerifyField<double>(verifier, VT_D2, 8) &&
|
||||
VerifyField<double>(verifier, VT_D3, 8) &&
|
||||
VerifyField<float>(verifier, VT_F0, 4) &&
|
||||
VerifyField<float>(verifier, VT_F1, 4) &&
|
||||
VerifyField<float>(verifier, VT_F2, 4) &&
|
||||
VerifyField<float>(verifier, VT_F3, 4) &&
|
||||
VerifyOffset(verifier, VT_DVEC) &&
|
||||
verifier.VerifyVector(dvec()) &&
|
||||
VerifyOffset(verifier, VT_FVEC) &&
|
||||
verifier.VerifyVector(fvec()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
MonsterExtraT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(MonsterExtraT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<MonsterExtra> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const MonsterExtraT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct MonsterExtraBuilder {
|
||||
typedef MonsterExtra Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_d0(double d0) {
|
||||
fbb_.AddElement<double>(MonsterExtra::VT_D0, d0, std::numeric_limits<double>::quiet_NaN());
|
||||
}
|
||||
void add_d1(double d1) {
|
||||
fbb_.AddElement<double>(MonsterExtra::VT_D1, d1, std::numeric_limits<double>::quiet_NaN());
|
||||
}
|
||||
void add_d2(double d2) {
|
||||
fbb_.AddElement<double>(MonsterExtra::VT_D2, d2, std::numeric_limits<double>::infinity());
|
||||
}
|
||||
void add_d3(double d3) {
|
||||
fbb_.AddElement<double>(MonsterExtra::VT_D3, d3, -std::numeric_limits<double>::infinity());
|
||||
}
|
||||
void add_f0(float f0) {
|
||||
fbb_.AddElement<float>(MonsterExtra::VT_F0, f0, std::numeric_limits<float>::quiet_NaN());
|
||||
}
|
||||
void add_f1(float f1) {
|
||||
fbb_.AddElement<float>(MonsterExtra::VT_F1, f1, std::numeric_limits<float>::quiet_NaN());
|
||||
}
|
||||
void add_f2(float f2) {
|
||||
fbb_.AddElement<float>(MonsterExtra::VT_F2, f2, std::numeric_limits<float>::infinity());
|
||||
}
|
||||
void add_f3(float f3) {
|
||||
fbb_.AddElement<float>(MonsterExtra::VT_F3, f3, -std::numeric_limits<float>::infinity());
|
||||
}
|
||||
void add_dvec(::flatbuffers::Offset<::flatbuffers::Vector<double>> dvec) {
|
||||
fbb_.AddOffset(MonsterExtra::VT_DVEC, dvec);
|
||||
}
|
||||
void add_fvec(::flatbuffers::Offset<::flatbuffers::Vector<float>> fvec) {
|
||||
fbb_.AddOffset(MonsterExtra::VT_FVEC, fvec);
|
||||
}
|
||||
explicit MonsterExtraBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<MonsterExtra> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<MonsterExtra>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<MonsterExtra> CreateMonsterExtra(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
double d0 = std::numeric_limits<double>::quiet_NaN(),
|
||||
double d1 = std::numeric_limits<double>::quiet_NaN(),
|
||||
double d2 = std::numeric_limits<double>::infinity(),
|
||||
double d3 = -std::numeric_limits<double>::infinity(),
|
||||
float f0 = std::numeric_limits<float>::quiet_NaN(),
|
||||
float f1 = std::numeric_limits<float>::quiet_NaN(),
|
||||
float f2 = std::numeric_limits<float>::infinity(),
|
||||
float f3 = -std::numeric_limits<float>::infinity(),
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<double>> dvec = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<float>> fvec = 0) {
|
||||
MonsterExtraBuilder builder_(_fbb);
|
||||
builder_.add_d3(d3);
|
||||
builder_.add_d2(d2);
|
||||
builder_.add_d1(d1);
|
||||
builder_.add_d0(d0);
|
||||
builder_.add_fvec(fvec);
|
||||
builder_.add_dvec(dvec);
|
||||
builder_.add_f3(f3);
|
||||
builder_.add_f2(f2);
|
||||
builder_.add_f1(f1);
|
||||
builder_.add_f0(f0);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<MonsterExtra> CreateMonsterExtraDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
double d0 = std::numeric_limits<double>::quiet_NaN(),
|
||||
double d1 = std::numeric_limits<double>::quiet_NaN(),
|
||||
double d2 = std::numeric_limits<double>::infinity(),
|
||||
double d3 = -std::numeric_limits<double>::infinity(),
|
||||
float f0 = std::numeric_limits<float>::quiet_NaN(),
|
||||
float f1 = std::numeric_limits<float>::quiet_NaN(),
|
||||
float f2 = std::numeric_limits<float>::infinity(),
|
||||
float f3 = -std::numeric_limits<float>::infinity(),
|
||||
const std::vector<double> *dvec = nullptr,
|
||||
const std::vector<float> *fvec = nullptr) {
|
||||
auto dvec__ = dvec ? _fbb.CreateVector<double>(*dvec) : 0;
|
||||
auto fvec__ = fvec ? _fbb.CreateVector<float>(*fvec) : 0;
|
||||
return MyGame::CreateMonsterExtra(
|
||||
_fbb,
|
||||
d0,
|
||||
d1,
|
||||
d2,
|
||||
d3,
|
||||
f0,
|
||||
f1,
|
||||
f2,
|
||||
f3,
|
||||
dvec__,
|
||||
fvec__);
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<MonsterExtra> CreateMonsterExtra(::flatbuffers::FlatBufferBuilder &_fbb, const MonsterExtraT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
|
||||
inline bool operator==(const MonsterExtraT &lhs, const MonsterExtraT &rhs) {
|
||||
return
|
||||
(lhs.d0 == rhs.d0) &&
|
||||
(lhs.d1 == rhs.d1) &&
|
||||
(lhs.d2 == rhs.d2) &&
|
||||
(lhs.d3 == rhs.d3) &&
|
||||
(lhs.f0 == rhs.f0) &&
|
||||
(lhs.f1 == rhs.f1) &&
|
||||
(lhs.f2 == rhs.f2) &&
|
||||
(lhs.f3 == rhs.f3) &&
|
||||
(lhs.dvec == rhs.dvec) &&
|
||||
(lhs.fvec == rhs.fvec);
|
||||
}
|
||||
|
||||
inline bool operator!=(const MonsterExtraT &lhs, const MonsterExtraT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline MonsterExtraT *MonsterExtra::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<MonsterExtraT>(new MonsterExtraT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void MonsterExtra::UnPackTo(MonsterExtraT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = d0(); _o->d0 = _e; }
|
||||
{ auto _e = d1(); _o->d1 = _e; }
|
||||
{ auto _e = d2(); _o->d2 = _e; }
|
||||
{ auto _e = d3(); _o->d3 = _e; }
|
||||
{ auto _e = f0(); _o->f0 = _e; }
|
||||
{ auto _e = f1(); _o->f1 = _e; }
|
||||
{ auto _e = f2(); _o->f2 = _e; }
|
||||
{ auto _e = f3(); _o->f3 = _e; }
|
||||
{ auto _e = dvec(); if (_e) { _o->dvec.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->dvec[_i] = _e->Get(_i); } } else { _o->dvec.resize(0); } }
|
||||
{ auto _e = fvec(); if (_e) { _o->fvec.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->fvec[_i] = _e->Get(_i); } } else { _o->fvec.resize(0); } }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<MonsterExtra> CreateMonsterExtra(::flatbuffers::FlatBufferBuilder &_fbb, const MonsterExtraT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return MonsterExtra::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<MonsterExtra> MonsterExtra::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const MonsterExtraT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const MonsterExtraT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _d0 = _o->d0;
|
||||
auto _d1 = _o->d1;
|
||||
auto _d2 = _o->d2;
|
||||
auto _d3 = _o->d3;
|
||||
auto _f0 = _o->f0;
|
||||
auto _f1 = _o->f1;
|
||||
auto _f2 = _o->f2;
|
||||
auto _f3 = _o->f3;
|
||||
auto _dvec = _o->dvec.size() ? _fbb.CreateVector(_o->dvec) : 0;
|
||||
auto _fvec = _o->fvec.size() ? _fbb.CreateVector(_o->fvec) : 0;
|
||||
return MyGame::CreateMonsterExtra(
|
||||
_fbb,
|
||||
_d0,
|
||||
_d1,
|
||||
_d2,
|
||||
_d3,
|
||||
_f0,
|
||||
_f1,
|
||||
_f2,
|
||||
_f3,
|
||||
_dvec,
|
||||
_fvec);
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *MonsterExtraTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_DOUBLE, 0, -1 },
|
||||
{ ::flatbuffers::ET_DOUBLE, 0, -1 },
|
||||
{ ::flatbuffers::ET_DOUBLE, 0, -1 },
|
||||
{ ::flatbuffers::ET_DOUBLE, 0, -1 },
|
||||
{ ::flatbuffers::ET_FLOAT, 0, -1 },
|
||||
{ ::flatbuffers::ET_FLOAT, 0, -1 },
|
||||
{ ::flatbuffers::ET_FLOAT, 0, -1 },
|
||||
{ ::flatbuffers::ET_FLOAT, 0, -1 },
|
||||
{ ::flatbuffers::ET_DOUBLE, 1, -1 },
|
||||
{ ::flatbuffers::ET_FLOAT, 1, -1 },
|
||||
{ ::flatbuffers::ET_INT, 0, -1 }
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"d0",
|
||||
"d1",
|
||||
"d2",
|
||||
"d3",
|
||||
"f0",
|
||||
"f1",
|
||||
"f2",
|
||||
"f3",
|
||||
"dvec",
|
||||
"fvec",
|
||||
"deprec"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 11, type_codes, nullptr, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const MyGame::MonsterExtra *GetMonsterExtra(const void *buf) {
|
||||
return ::flatbuffers::GetRoot<MyGame::MonsterExtra>(buf);
|
||||
}
|
||||
|
||||
inline const MyGame::MonsterExtra *GetSizePrefixedMonsterExtra(const void *buf) {
|
||||
return ::flatbuffers::GetSizePrefixedRoot<MyGame::MonsterExtra>(buf);
|
||||
}
|
||||
|
||||
inline MonsterExtra *GetMutableMonsterExtra(void *buf) {
|
||||
return ::flatbuffers::GetMutableRoot<MonsterExtra>(buf);
|
||||
}
|
||||
|
||||
inline MyGame::MonsterExtra *GetMutableSizePrefixedMonsterExtra(void *buf) {
|
||||
return ::flatbuffers::GetMutableSizePrefixedRoot<MyGame::MonsterExtra>(buf);
|
||||
}
|
||||
|
||||
inline const char *MonsterExtraIdentifier() {
|
||||
return "MONE";
|
||||
}
|
||||
|
||||
inline bool MonsterExtraBufferHasIdentifier(const void *buf) {
|
||||
return ::flatbuffers::BufferHasIdentifier(
|
||||
buf, MonsterExtraIdentifier());
|
||||
}
|
||||
|
||||
inline bool SizePrefixedMonsterExtraBufferHasIdentifier(const void *buf) {
|
||||
return ::flatbuffers::BufferHasIdentifier(
|
||||
buf, MonsterExtraIdentifier(), true);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifyMonsterExtraBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifyBuffer<MyGame::MonsterExtra>(MonsterExtraIdentifier());
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifySizePrefixedMonsterExtraBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifySizePrefixedBuffer<MyGame::MonsterExtra>(MonsterExtraIdentifier());
|
||||
}
|
||||
|
||||
inline const char *MonsterExtraExtension() {
|
||||
return "mon";
|
||||
}
|
||||
|
||||
inline void FinishMonsterExtraBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<MyGame::MonsterExtra> root) {
|
||||
fbb.Finish(root, MonsterExtraIdentifier());
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedMonsterExtraBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<MyGame::MonsterExtra> root) {
|
||||
fbb.FinishSizePrefixed(root, MonsterExtraIdentifier());
|
||||
}
|
||||
|
||||
inline std::unique_ptr<MyGame::MonsterExtraT> UnPackMonsterExtra(
|
||||
const void *buf,
|
||||
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
||||
return std::unique_ptr<MyGame::MonsterExtraT>(GetMonsterExtra(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
inline std::unique_ptr<MyGame::MonsterExtraT> UnPackSizePrefixedMonsterExtra(
|
||||
const void *buf,
|
||||
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
||||
return std::unique_ptr<MyGame::MonsterExtraT>(GetSizePrefixedMonsterExtra(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
} // namespace MyGame
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_MONSTEREXTRA_MYGAME_H_
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "flatbuffers/registry.h"
|
||||
#include "flatbuffers/verifier.h"
|
||||
#include "is_quiet_nan.h"
|
||||
#include "monster_extra_generated.h"
|
||||
#include "monster_extra.fbs.h"
|
||||
#include "monster_test_generated.h"
|
||||
#include "test_assert.h"
|
||||
|
||||
|
||||
@@ -1761,13 +1761,6 @@ def MonsterAddInventory(builder, inventory):
|
||||
def MonsterStartInventoryVector(builder, numElems):
|
||||
return builder.StartVector(1, numElems, 1)
|
||||
|
||||
def MonsterCreateInventoryVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(1, len(data), 1)
|
||||
for item in reversed(data):
|
||||
builder.PrependUint8(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def MonsterAddColor(builder, color):
|
||||
builder.PrependUint8Slot(6, color, 8)
|
||||
|
||||
@@ -1783,31 +1776,18 @@ def MonsterAddTest4(builder, test4):
|
||||
def MonsterStartTest4Vector(builder, numElems):
|
||||
return builder.StartVector(4, numElems, 2)
|
||||
|
||||
def MonsterCreateTest4Vector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(4, len(data), 2)
|
||||
for item in reversed(data):
|
||||
item.Pack(builder)
|
||||
return builder.EndVector()
|
||||
|
||||
def MonsterAddTestarrayofstring(builder, testarrayofstring):
|
||||
builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofstring), 0)
|
||||
|
||||
def MonsterStartTestarrayofstringVector(builder, numElems):
|
||||
return builder.StartVector(4, numElems, 4)
|
||||
|
||||
def MonsterCreateTestarrayofstringVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def MonsterAddTestarrayoftables(builder, testarrayoftables):
|
||||
builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayoftables), 0)
|
||||
|
||||
def MonsterStartTestarrayoftablesVector(builder, numElems):
|
||||
return builder.StartVector(4, numElems, 4)
|
||||
|
||||
def MonsterCreateTestarrayoftablesVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def MonsterAddEnemy(builder, enemy):
|
||||
builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(enemy), 0)
|
||||
|
||||
@@ -1817,13 +1797,6 @@ def MonsterAddTestnestedflatbuffer(builder, testnestedflatbuffer):
|
||||
def MonsterStartTestnestedflatbufferVector(builder, numElems):
|
||||
return builder.StartVector(1, numElems, 1)
|
||||
|
||||
def MonsterCreateTestnestedflatbufferVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(1, len(data), 1)
|
||||
for item in reversed(data):
|
||||
builder.PrependUint8(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def MonsterMakeTestnestedflatbufferVectorFromBytes(builder, bytes):
|
||||
builder.StartVector(1, len(bytes), 1)
|
||||
builder.head = builder.head - len(bytes)
|
||||
@@ -1865,13 +1838,6 @@ def MonsterAddTestarrayofbools(builder, testarrayofbools):
|
||||
def MonsterStartTestarrayofboolsVector(builder, numElems):
|
||||
return builder.StartVector(1, numElems, 1)
|
||||
|
||||
def MonsterCreateTestarrayofboolsVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(1, len(data), 1)
|
||||
for item in reversed(data):
|
||||
builder.PrependBool(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def MonsterAddTestf(builder, testf):
|
||||
builder.PrependFloat32Slot(25, testf, 3.14159)
|
||||
|
||||
@@ -1887,74 +1853,36 @@ def MonsterAddTestarrayofstring2(builder, testarrayofstring2):
|
||||
def MonsterStartTestarrayofstring2Vector(builder, numElems):
|
||||
return builder.StartVector(4, numElems, 4)
|
||||
|
||||
def MonsterCreateTestarrayofstring2Vector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def MonsterAddTestarrayofsortedstruct(builder, testarrayofsortedstruct):
|
||||
builder.PrependUOffsetTRelativeSlot(29, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofsortedstruct), 0)
|
||||
|
||||
def MonsterStartTestarrayofsortedstructVector(builder, numElems):
|
||||
return builder.StartVector(8, numElems, 4)
|
||||
|
||||
def MonsterCreateTestarrayofsortedstructVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(8, len(data), 4)
|
||||
for item in reversed(data):
|
||||
item.Pack(builder)
|
||||
return builder.EndVector()
|
||||
|
||||
def MonsterAddFlex(builder, flex):
|
||||
builder.PrependUOffsetTRelativeSlot(30, flatbuffers.number_types.UOffsetTFlags.py_type(flex), 0)
|
||||
|
||||
def MonsterStartFlexVector(builder, numElems):
|
||||
return builder.StartVector(1, numElems, 1)
|
||||
|
||||
def MonsterCreateFlexVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(1, len(data), 1)
|
||||
for item in reversed(data):
|
||||
builder.PrependUint8(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def MonsterAddTest5(builder, test5):
|
||||
builder.PrependUOffsetTRelativeSlot(31, flatbuffers.number_types.UOffsetTFlags.py_type(test5), 0)
|
||||
|
||||
def MonsterStartTest5Vector(builder, numElems):
|
||||
return builder.StartVector(4, numElems, 2)
|
||||
|
||||
def MonsterCreateTest5Vector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(4, len(data), 2)
|
||||
for item in reversed(data):
|
||||
item.Pack(builder)
|
||||
return builder.EndVector()
|
||||
|
||||
def MonsterAddVectorOfLongs(builder, vectorOfLongs):
|
||||
builder.PrependUOffsetTRelativeSlot(32, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfLongs), 0)
|
||||
|
||||
def MonsterStartVectorOfLongsVector(builder, numElems):
|
||||
return builder.StartVector(8, numElems, 8)
|
||||
|
||||
def MonsterCreateVectorOfLongsVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(8, len(data), 8)
|
||||
for item in reversed(data):
|
||||
builder.PrependInt64(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def MonsterAddVectorOfDoubles(builder, vectorOfDoubles):
|
||||
builder.PrependUOffsetTRelativeSlot(33, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfDoubles), 0)
|
||||
|
||||
def MonsterStartVectorOfDoublesVector(builder, numElems):
|
||||
return builder.StartVector(8, numElems, 8)
|
||||
|
||||
def MonsterCreateVectorOfDoublesVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(8, len(data), 8)
|
||||
for item in reversed(data):
|
||||
builder.PrependFloat64(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def MonsterAddParentNamespaceTest(builder, parentNamespaceTest):
|
||||
builder.PrependUOffsetTRelativeSlot(34, flatbuffers.number_types.UOffsetTFlags.py_type(parentNamespaceTest), 0)
|
||||
|
||||
@@ -1964,9 +1892,6 @@ def MonsterAddVectorOfReferrables(builder, vectorOfReferrables):
|
||||
def MonsterStartVectorOfReferrablesVector(builder, numElems):
|
||||
return builder.StartVector(4, numElems, 4)
|
||||
|
||||
def MonsterCreateVectorOfReferrablesVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def MonsterAddSingleWeakReference(builder, singleWeakReference):
|
||||
builder.PrependUint64Slot(36, singleWeakReference, 0)
|
||||
|
||||
@@ -1976,22 +1901,12 @@ def MonsterAddVectorOfWeakReferences(builder, vectorOfWeakReferences):
|
||||
def MonsterStartVectorOfWeakReferencesVector(builder, numElems):
|
||||
return builder.StartVector(8, numElems, 8)
|
||||
|
||||
def MonsterCreateVectorOfWeakReferencesVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(8, len(data), 8)
|
||||
for item in reversed(data):
|
||||
builder.PrependUint64(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def MonsterAddVectorOfStrongReferrables(builder, vectorOfStrongReferrables):
|
||||
builder.PrependUOffsetTRelativeSlot(38, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfStrongReferrables), 0)
|
||||
|
||||
def MonsterStartVectorOfStrongReferrablesVector(builder, numElems):
|
||||
return builder.StartVector(4, numElems, 4)
|
||||
|
||||
def MonsterCreateVectorOfStrongReferrablesVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def MonsterAddCoOwningReference(builder, coOwningReference):
|
||||
builder.PrependUint64Slot(39, coOwningReference, 0)
|
||||
|
||||
@@ -2001,13 +1916,6 @@ def MonsterAddVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences):
|
||||
def MonsterStartVectorOfCoOwningReferencesVector(builder, numElems):
|
||||
return builder.StartVector(8, numElems, 8)
|
||||
|
||||
def MonsterCreateVectorOfCoOwningReferencesVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(8, len(data), 8)
|
||||
for item in reversed(data):
|
||||
builder.PrependUint64(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def MonsterAddNonOwningReference(builder, nonOwningReference):
|
||||
builder.PrependUint64Slot(41, nonOwningReference, 0)
|
||||
|
||||
@@ -2017,13 +1925,6 @@ def MonsterAddVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences):
|
||||
def MonsterStartVectorOfNonOwningReferencesVector(builder, numElems):
|
||||
return builder.StartVector(8, numElems, 8)
|
||||
|
||||
def MonsterCreateVectorOfNonOwningReferencesVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(8, len(data), 8)
|
||||
for item in reversed(data):
|
||||
builder.PrependUint64(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def MonsterAddAnyUniqueType(builder, anyUniqueType):
|
||||
builder.PrependUint8Slot(43, anyUniqueType, 0)
|
||||
|
||||
@@ -2042,13 +1943,6 @@ def MonsterAddVectorOfEnums(builder, vectorOfEnums):
|
||||
def MonsterStartVectorOfEnumsVector(builder, numElems):
|
||||
return builder.StartVector(1, numElems, 1)
|
||||
|
||||
def MonsterCreateVectorOfEnumsVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(1, len(data), 1)
|
||||
for item in reversed(data):
|
||||
builder.PrependUint8(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def MonsterAddSignedEnum(builder, signedEnum):
|
||||
builder.PrependInt8Slot(48, signedEnum, -1)
|
||||
|
||||
@@ -2058,13 +1952,6 @@ def MonsterAddTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer
|
||||
def MonsterStartTestrequirednestedflatbufferVector(builder, numElems):
|
||||
return builder.StartVector(1, numElems, 1)
|
||||
|
||||
def MonsterCreateTestrequirednestedflatbufferVector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(1, len(data), 1)
|
||||
for item in reversed(data):
|
||||
builder.PrependUint8(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def MonsterMakeTestrequirednestedflatbufferVectorFromBytes(builder, bytes):
|
||||
builder.StartVector(1, len(bytes), 1)
|
||||
builder.head = builder.head - len(bytes)
|
||||
@@ -2076,9 +1963,6 @@ def MonsterAddScalarKeySortedTables(builder, scalarKeySortedTables):
|
||||
def MonsterStartScalarKeySortedTablesVector(builder, numElems):
|
||||
return builder.StartVector(4, numElems, 4)
|
||||
|
||||
def MonsterCreateScalarKeySortedTablesVector(builder, data):
|
||||
return builder.CreateVectorOfTables(data)
|
||||
|
||||
def MonsterAddNativeInline(builder, nativeInline):
|
||||
builder.PrependStructSlot(51, flatbuffers.number_types.UOffsetTFlags.py_type(nativeInline), 0)
|
||||
|
||||
@@ -2908,26 +2792,12 @@ def TypeAliasesAddV8(builder, v8):
|
||||
def TypeAliasesStartV8Vector(builder, numElems):
|
||||
return builder.StartVector(1, numElems, 1)
|
||||
|
||||
def TypeAliasesCreateV8Vector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(1, len(data), 1)
|
||||
for item in reversed(data):
|
||||
builder.PrependInt8(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def TypeAliasesAddVf64(builder, vf64):
|
||||
builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(vf64), 0)
|
||||
|
||||
def TypeAliasesStartVf64Vector(builder, numElems):
|
||||
return builder.StartVector(8, numElems, 8)
|
||||
|
||||
def TypeAliasesCreateVf64Vector(builder, data):
|
||||
data = list(data)
|
||||
builder.StartVector(8, len(data), 8)
|
||||
for item in reversed(data):
|
||||
builder.PrependFloat64(item)
|
||||
return builder.EndVector()
|
||||
|
||||
def TypeAliasesEnd(builder):
|
||||
return builder.EndObject()
|
||||
|
||||
|
||||
@@ -1,470 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_NAMESPACETEST1_NAMESPACEA_NAMESPACEB_H_
|
||||
#define FLATBUFFERS_GENERATED_NAMESPACETEST1_NAMESPACEA_NAMESPACEB_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 12 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
namespace NamespaceA {
|
||||
namespace NamespaceB {
|
||||
|
||||
struct TableInNestedNS;
|
||||
struct TableInNestedNSBuilder;
|
||||
struct TableInNestedNST;
|
||||
|
||||
struct StructInNestedNS;
|
||||
|
||||
bool operator==(const TableInNestedNST &lhs, const TableInNestedNST &rhs);
|
||||
bool operator!=(const TableInNestedNST &lhs, const TableInNestedNST &rhs);
|
||||
bool operator==(const StructInNestedNS &lhs, const StructInNestedNS &rhs);
|
||||
bool operator!=(const StructInNestedNS &lhs, const StructInNestedNS &rhs);
|
||||
|
||||
inline const ::flatbuffers::TypeTable *TableInNestedNSTypeTable();
|
||||
|
||||
inline const ::flatbuffers::TypeTable *StructInNestedNSTypeTable();
|
||||
|
||||
enum UnionInNestedNS : uint8_t {
|
||||
UnionInNestedNS_NONE = 0,
|
||||
UnionInNestedNS_TableInNestedNS = 1,
|
||||
UnionInNestedNS_MIN = UnionInNestedNS_NONE,
|
||||
UnionInNestedNS_MAX = UnionInNestedNS_TableInNestedNS
|
||||
};
|
||||
|
||||
inline const UnionInNestedNS (&EnumValuesUnionInNestedNS())[2] {
|
||||
static const UnionInNestedNS values[] = {
|
||||
UnionInNestedNS_NONE,
|
||||
UnionInNestedNS_TableInNestedNS
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char * const *EnumNamesUnionInNestedNS() {
|
||||
static const char * const names[3] = {
|
||||
"NONE",
|
||||
"TableInNestedNS",
|
||||
nullptr
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameUnionInNestedNS(UnionInNestedNS e) {
|
||||
if (::flatbuffers::IsOutRange(e, UnionInNestedNS_NONE, UnionInNestedNS_TableInNestedNS)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesUnionInNestedNS()[index];
|
||||
}
|
||||
|
||||
template<typename T> struct UnionInNestedNSTraits {
|
||||
static const UnionInNestedNS enum_value = UnionInNestedNS_NONE;
|
||||
};
|
||||
|
||||
template<> struct UnionInNestedNSTraits<NamespaceA::NamespaceB::TableInNestedNS> {
|
||||
static const UnionInNestedNS enum_value = UnionInNestedNS_TableInNestedNS;
|
||||
};
|
||||
|
||||
template<typename T> struct UnionInNestedNSUnionTraits {
|
||||
static const UnionInNestedNS enum_value = UnionInNestedNS_NONE;
|
||||
};
|
||||
|
||||
template<> struct UnionInNestedNSUnionTraits<NamespaceA::NamespaceB::TableInNestedNST> {
|
||||
static const UnionInNestedNS enum_value = UnionInNestedNS_TableInNestedNS;
|
||||
};
|
||||
|
||||
struct UnionInNestedNSUnion {
|
||||
UnionInNestedNS type;
|
||||
void *value;
|
||||
|
||||
UnionInNestedNSUnion() : type(UnionInNestedNS_NONE), value(nullptr) {}
|
||||
UnionInNestedNSUnion(UnionInNestedNSUnion&& u) FLATBUFFERS_NOEXCEPT :
|
||||
type(UnionInNestedNS_NONE), value(nullptr)
|
||||
{ std::swap(type, u.type); std::swap(value, u.value); }
|
||||
UnionInNestedNSUnion(const UnionInNestedNSUnion &);
|
||||
UnionInNestedNSUnion &operator=(const UnionInNestedNSUnion &u)
|
||||
{ UnionInNestedNSUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
|
||||
UnionInNestedNSUnion &operator=(UnionInNestedNSUnion &&u) FLATBUFFERS_NOEXCEPT
|
||||
{ std::swap(type, u.type); std::swap(value, u.value); return *this; }
|
||||
~UnionInNestedNSUnion() { Reset(); }
|
||||
|
||||
void Reset();
|
||||
|
||||
template <typename T>
|
||||
void Set(T&& val) {
|
||||
typedef typename std::remove_reference<T>::type RT;
|
||||
Reset();
|
||||
type = UnionInNestedNSUnionTraits<RT>::enum_value;
|
||||
if (type != UnionInNestedNS_NONE) {
|
||||
value = new RT(std::forward<T>(val));
|
||||
}
|
||||
}
|
||||
|
||||
static void *UnPack(const void *obj, UnionInNestedNS type, const ::flatbuffers::resolver_function_t *resolver);
|
||||
::flatbuffers::Offset<void> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
|
||||
|
||||
NamespaceA::NamespaceB::TableInNestedNST *AsTableInNestedNS() {
|
||||
return type == UnionInNestedNS_TableInNestedNS ?
|
||||
reinterpret_cast<NamespaceA::NamespaceB::TableInNestedNST *>(value) : nullptr;
|
||||
}
|
||||
const NamespaceA::NamespaceB::TableInNestedNST *AsTableInNestedNS() const {
|
||||
return type == UnionInNestedNS_TableInNestedNS ?
|
||||
reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNST *>(value) : nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
inline bool operator==(const UnionInNestedNSUnion &lhs, const UnionInNestedNSUnion &rhs) {
|
||||
if (lhs.type != rhs.type) return false;
|
||||
switch (lhs.type) {
|
||||
case UnionInNestedNS_NONE: {
|
||||
return true;
|
||||
}
|
||||
case UnionInNestedNS_TableInNestedNS: {
|
||||
return *(reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNST *>(lhs.value)) ==
|
||||
*(reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNST *>(rhs.value));
|
||||
}
|
||||
default: {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline bool operator!=(const UnionInNestedNSUnion &lhs, const UnionInNestedNSUnion &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
bool VerifyUnionInNestedNS(::flatbuffers::VerifierTemplate<B> &verifier, const void *obj, UnionInNestedNS type);
|
||||
template <bool B = false>
|
||||
bool VerifyUnionInNestedNSVector(::flatbuffers::VerifierTemplate<B> &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset<void>> *values, const ::flatbuffers::Vector<uint8_t> *types);
|
||||
|
||||
enum EnumInNestedNS : int8_t {
|
||||
EnumInNestedNS_A = 0,
|
||||
EnumInNestedNS_B = 1,
|
||||
EnumInNestedNS_C = 2,
|
||||
EnumInNestedNS_MIN = EnumInNestedNS_A,
|
||||
EnumInNestedNS_MAX = EnumInNestedNS_C
|
||||
};
|
||||
|
||||
inline const EnumInNestedNS (&EnumValuesEnumInNestedNS())[3] {
|
||||
static const EnumInNestedNS values[] = {
|
||||
EnumInNestedNS_A,
|
||||
EnumInNestedNS_B,
|
||||
EnumInNestedNS_C
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char * const *EnumNamesEnumInNestedNS() {
|
||||
static const char * const names[4] = {
|
||||
"A",
|
||||
"B",
|
||||
"C",
|
||||
nullptr
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameEnumInNestedNS(EnumInNestedNS e) {
|
||||
if (::flatbuffers::IsOutRange(e, EnumInNestedNS_A, EnumInNestedNS_C)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesEnumInNestedNS()[index];
|
||||
}
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructInNestedNS FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
int32_t a_;
|
||||
int32_t b_;
|
||||
|
||||
public:
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return StructInNestedNSTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "NamespaceA.NamespaceB.StructInNestedNS";
|
||||
}
|
||||
StructInNestedNS()
|
||||
: a_(0),
|
||||
b_(0) {
|
||||
}
|
||||
StructInNestedNS(int32_t _a, int32_t _b)
|
||||
: a_(::flatbuffers::EndianScalar(_a)),
|
||||
b_(::flatbuffers::EndianScalar(_b)) {
|
||||
}
|
||||
int32_t a() const {
|
||||
return ::flatbuffers::EndianScalar(a_);
|
||||
}
|
||||
void mutate_a(int32_t _a) {
|
||||
::flatbuffers::WriteScalar(&a_, _a);
|
||||
}
|
||||
int32_t b() const {
|
||||
return ::flatbuffers::EndianScalar(b_);
|
||||
}
|
||||
void mutate_b(int32_t _b) {
|
||||
::flatbuffers::WriteScalar(&b_, _b);
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(StructInNestedNS, 8);
|
||||
|
||||
inline bool operator==(const StructInNestedNS &lhs, const StructInNestedNS &rhs) {
|
||||
return
|
||||
(lhs.a() == rhs.a()) &&
|
||||
(lhs.b() == rhs.b());
|
||||
}
|
||||
|
||||
inline bool operator!=(const StructInNestedNS &lhs, const StructInNestedNS &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct TableInNestedNST : public ::flatbuffers::NativeTable {
|
||||
typedef TableInNestedNS TableType;
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "NamespaceA.NamespaceB.TableInNestedNST";
|
||||
}
|
||||
int32_t foo = 0;
|
||||
};
|
||||
|
||||
struct TableInNestedNS FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef TableInNestedNST NativeTableType;
|
||||
typedef TableInNestedNSBuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return TableInNestedNSTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "NamespaceA.NamespaceB.TableInNestedNS";
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_FOO = 4
|
||||
};
|
||||
int32_t foo() const {
|
||||
return GetField<int32_t>(VT_FOO, 0);
|
||||
}
|
||||
bool mutate_foo(int32_t _foo = 0) {
|
||||
return SetField<int32_t>(VT_FOO, _foo, 0);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int32_t>(verifier, VT_FOO, 4) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
TableInNestedNST *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(TableInNestedNST *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<TableInNestedNS> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct TableInNestedNSBuilder {
|
||||
typedef TableInNestedNS Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_foo(int32_t foo) {
|
||||
fbb_.AddElement<int32_t>(TableInNestedNS::VT_FOO, foo, 0);
|
||||
}
|
||||
explicit TableInNestedNSBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<TableInNestedNS> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<TableInNestedNS>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<TableInNestedNS> CreateTableInNestedNS(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int32_t foo = 0) {
|
||||
TableInNestedNSBuilder builder_(_fbb);
|
||||
builder_.add_foo(foo);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<TableInNestedNS> CreateTableInNestedNS(::flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
|
||||
inline bool operator==(const TableInNestedNST &lhs, const TableInNestedNST &rhs) {
|
||||
return
|
||||
(lhs.foo == rhs.foo);
|
||||
}
|
||||
|
||||
inline bool operator!=(const TableInNestedNST &lhs, const TableInNestedNST &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline TableInNestedNST *TableInNestedNS::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<TableInNestedNST>(new TableInNestedNST());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void TableInNestedNS::UnPackTo(TableInNestedNST *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = foo(); _o->foo = _e; }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<TableInNestedNS> CreateTableInNestedNS(::flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return TableInNestedNS::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<TableInNestedNS> TableInNestedNS::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const TableInNestedNST* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _foo = _o->foo;
|
||||
return NamespaceA::NamespaceB::CreateTableInNestedNS(
|
||||
_fbb,
|
||||
_foo);
|
||||
}
|
||||
|
||||
template <bool B>
|
||||
inline bool VerifyUnionInNestedNS(::flatbuffers::VerifierTemplate<B> &verifier, const void *obj, UnionInNestedNS type) {
|
||||
switch (type) {
|
||||
case UnionInNestedNS_NONE: {
|
||||
return true;
|
||||
}
|
||||
case UnionInNestedNS_TableInNestedNS: {
|
||||
auto ptr = reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNS *>(obj);
|
||||
return verifier.VerifyTable(ptr);
|
||||
}
|
||||
default: return true;
|
||||
}
|
||||
}
|
||||
|
||||
template <bool B>
|
||||
inline bool VerifyUnionInNestedNSVector(::flatbuffers::VerifierTemplate<B> &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset<void>> *values, const ::flatbuffers::Vector<uint8_t> *types) {
|
||||
if (!values || !types) return !values && !types;
|
||||
if (values->size() != types->size()) return false;
|
||||
for (::flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
|
||||
if (!VerifyUnionInNestedNS(
|
||||
verifier, values->Get(i), types->GetEnum<UnionInNestedNS>(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void *UnionInNestedNSUnion::UnPack(const void *obj, UnionInNestedNS type, const ::flatbuffers::resolver_function_t *resolver) {
|
||||
(void)resolver;
|
||||
switch (type) {
|
||||
case UnionInNestedNS_TableInNestedNS: {
|
||||
auto ptr = reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNS *>(obj);
|
||||
return ptr->UnPack(resolver);
|
||||
}
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<void> UnionInNestedNSUnion::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const ::flatbuffers::rehasher_function_t *_rehasher) const {
|
||||
(void)_rehasher;
|
||||
switch (type) {
|
||||
case UnionInNestedNS_TableInNestedNS: {
|
||||
auto ptr = reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNST *>(value);
|
||||
return CreateTableInNestedNS(_fbb, ptr, _rehasher).Union();
|
||||
}
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
inline UnionInNestedNSUnion::UnionInNestedNSUnion(const UnionInNestedNSUnion &u) : type(u.type), value(nullptr) {
|
||||
switch (type) {
|
||||
case UnionInNestedNS_TableInNestedNS: {
|
||||
value = new NamespaceA::NamespaceB::TableInNestedNST(*reinterpret_cast<NamespaceA::NamespaceB::TableInNestedNST *>(u.value));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inline void UnionInNestedNSUnion::Reset() {
|
||||
switch (type) {
|
||||
case UnionInNestedNS_TableInNestedNS: {
|
||||
auto ptr = reinterpret_cast<NamespaceA::NamespaceB::TableInNestedNST *>(value);
|
||||
delete ptr;
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
value = nullptr;
|
||||
type = UnionInNestedNS_NONE;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *UnionInNestedNSTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, -1 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
NamespaceA::NamespaceB::TableInNestedNSTypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"NONE",
|
||||
"TableInNestedNS"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_UNION, 2, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *EnumInNestedNSTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_CHAR, 0, 0 },
|
||||
{ ::flatbuffers::ET_CHAR, 0, 0 },
|
||||
{ ::flatbuffers::ET_CHAR, 0, 0 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
NamespaceA::NamespaceB::EnumInNestedNSTypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"A",
|
||||
"B",
|
||||
"C"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_ENUM, 3, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *TableInNestedNSTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_INT, 0, -1 }
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"foo"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 1, type_codes, nullptr, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *StructInNestedNSTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_INT, 0, -1 },
|
||||
{ ::flatbuffers::ET_INT, 0, -1 }
|
||||
};
|
||||
static const int64_t values[] = { 0, 4, 8 };
|
||||
static const char * const names[] = {
|
||||
"a",
|
||||
"b"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_STRUCT, 2, type_codes, nullptr, nullptr, values, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
} // namespace NamespaceB
|
||||
} // namespace NamespaceA
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_NAMESPACETEST1_NAMESPACEA_NAMESPACEB_H_
|
||||
@@ -1,614 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_NAMESPACETEST2_NAMESPACEA_H_
|
||||
#define FLATBUFFERS_GENERATED_NAMESPACETEST2_NAMESPACEA_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 12 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
namespace NamespaceA {
|
||||
|
||||
struct TableInFirstNS;
|
||||
struct TableInFirstNSBuilder;
|
||||
struct TableInFirstNST;
|
||||
|
||||
} // namespace NamespaceA
|
||||
|
||||
namespace NamespaceC {
|
||||
|
||||
struct TableInC;
|
||||
struct TableInCBuilder;
|
||||
struct TableInCT;
|
||||
|
||||
} // namespace NamespaceC
|
||||
|
||||
namespace NamespaceA {
|
||||
|
||||
struct SecondTableInA;
|
||||
struct SecondTableInABuilder;
|
||||
struct SecondTableInAT;
|
||||
|
||||
bool operator==(const TableInFirstNST &lhs, const TableInFirstNST &rhs);
|
||||
bool operator!=(const TableInFirstNST &lhs, const TableInFirstNST &rhs);
|
||||
} // namespace NamespaceA
|
||||
|
||||
namespace NamespaceC {
|
||||
|
||||
bool operator==(const TableInCT &lhs, const TableInCT &rhs);
|
||||
bool operator!=(const TableInCT &lhs, const TableInCT &rhs);
|
||||
} // namespace NamespaceC
|
||||
|
||||
namespace NamespaceA {
|
||||
|
||||
bool operator==(const SecondTableInAT &lhs, const SecondTableInAT &rhs);
|
||||
bool operator!=(const SecondTableInAT &lhs, const SecondTableInAT &rhs);
|
||||
|
||||
inline const ::flatbuffers::TypeTable *TableInFirstNSTypeTable();
|
||||
|
||||
} // namespace NamespaceA
|
||||
|
||||
namespace NamespaceC {
|
||||
|
||||
inline const ::flatbuffers::TypeTable *TableInCTypeTable();
|
||||
|
||||
} // namespace NamespaceC
|
||||
|
||||
namespace NamespaceA {
|
||||
|
||||
inline const ::flatbuffers::TypeTable *SecondTableInATypeTable();
|
||||
|
||||
struct TableInFirstNST : public ::flatbuffers::NativeTable {
|
||||
typedef TableInFirstNS TableType;
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "NamespaceA.TableInFirstNST";
|
||||
}
|
||||
std::unique_ptr<NamespaceA::NamespaceB::TableInNestedNST> foo_table{};
|
||||
NamespaceA::NamespaceB::EnumInNestedNS foo_enum = NamespaceA::NamespaceB::EnumInNestedNS_A;
|
||||
NamespaceA::NamespaceB::UnionInNestedNSUnion foo_union{};
|
||||
std::unique_ptr<NamespaceA::NamespaceB::StructInNestedNS> foo_struct{};
|
||||
TableInFirstNST() = default;
|
||||
TableInFirstNST(const TableInFirstNST &o);
|
||||
TableInFirstNST(TableInFirstNST&&) FLATBUFFERS_NOEXCEPT = default;
|
||||
TableInFirstNST &operator=(TableInFirstNST o) FLATBUFFERS_NOEXCEPT;
|
||||
};
|
||||
|
||||
struct TableInFirstNS FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef TableInFirstNST NativeTableType;
|
||||
typedef TableInFirstNSBuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return TableInFirstNSTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "NamespaceA.TableInFirstNS";
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_FOO_TABLE = 4,
|
||||
VT_FOO_ENUM = 6,
|
||||
VT_FOO_UNION_TYPE = 8,
|
||||
VT_FOO_UNION = 10,
|
||||
VT_FOO_STRUCT = 12
|
||||
};
|
||||
const NamespaceA::NamespaceB::TableInNestedNS *foo_table() const {
|
||||
return GetPointer<const NamespaceA::NamespaceB::TableInNestedNS *>(VT_FOO_TABLE);
|
||||
}
|
||||
NamespaceA::NamespaceB::TableInNestedNS *mutable_foo_table() {
|
||||
return GetPointer<NamespaceA::NamespaceB::TableInNestedNS *>(VT_FOO_TABLE);
|
||||
}
|
||||
NamespaceA::NamespaceB::EnumInNestedNS foo_enum() const {
|
||||
return static_cast<NamespaceA::NamespaceB::EnumInNestedNS>(GetField<int8_t>(VT_FOO_ENUM, 0));
|
||||
}
|
||||
bool mutate_foo_enum(NamespaceA::NamespaceB::EnumInNestedNS _foo_enum = static_cast<NamespaceA::NamespaceB::EnumInNestedNS>(0)) {
|
||||
return SetField<int8_t>(VT_FOO_ENUM, static_cast<int8_t>(_foo_enum), 0);
|
||||
}
|
||||
NamespaceA::NamespaceB::UnionInNestedNS foo_union_type() const {
|
||||
return static_cast<NamespaceA::NamespaceB::UnionInNestedNS>(GetField<uint8_t>(VT_FOO_UNION_TYPE, 0));
|
||||
}
|
||||
const void *foo_union() const {
|
||||
return GetPointer<const void *>(VT_FOO_UNION);
|
||||
}
|
||||
template<typename T> const T *foo_union_as() const;
|
||||
const NamespaceA::NamespaceB::TableInNestedNS *foo_union_as_TableInNestedNS() const {
|
||||
return foo_union_type() == NamespaceA::NamespaceB::UnionInNestedNS_TableInNestedNS ? static_cast<const NamespaceA::NamespaceB::TableInNestedNS *>(foo_union()) : nullptr;
|
||||
}
|
||||
template<typename T> T *mutable_foo_union_as();
|
||||
NamespaceA::NamespaceB::TableInNestedNS *mutable_foo_union_as_TableInNestedNS() {
|
||||
return foo_union_type() == NamespaceA::NamespaceB::UnionInNestedNS_TableInNestedNS ? static_cast<NamespaceA::NamespaceB::TableInNestedNS *>(mutable_foo_union()) : nullptr;
|
||||
}
|
||||
void *mutable_foo_union() {
|
||||
return GetPointer<void *>(VT_FOO_UNION);
|
||||
}
|
||||
const NamespaceA::NamespaceB::StructInNestedNS *foo_struct() const {
|
||||
return GetStruct<const NamespaceA::NamespaceB::StructInNestedNS *>(VT_FOO_STRUCT);
|
||||
}
|
||||
NamespaceA::NamespaceB::StructInNestedNS *mutable_foo_struct() {
|
||||
return GetStruct<NamespaceA::NamespaceB::StructInNestedNS *>(VT_FOO_STRUCT);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset(verifier, VT_FOO_TABLE) &&
|
||||
verifier.VerifyTable(foo_table()) &&
|
||||
VerifyField<int8_t>(verifier, VT_FOO_ENUM, 1) &&
|
||||
VerifyField<uint8_t>(verifier, VT_FOO_UNION_TYPE, 1) &&
|
||||
VerifyOffset(verifier, VT_FOO_UNION) &&
|
||||
VerifyUnionInNestedNS(verifier, foo_union(), foo_union_type()) &&
|
||||
VerifyField<NamespaceA::NamespaceB::StructInNestedNS>(verifier, VT_FOO_STRUCT, 4) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
TableInFirstNST *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(TableInFirstNST *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<TableInFirstNS> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const TableInFirstNST* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
template<> inline const NamespaceA::NamespaceB::TableInNestedNS *TableInFirstNS::foo_union_as<NamespaceA::NamespaceB::TableInNestedNS>() const {
|
||||
return foo_union_as_TableInNestedNS();
|
||||
}
|
||||
|
||||
template<> inline NamespaceA::NamespaceB::TableInNestedNS *TableInFirstNS::mutable_foo_union_as<NamespaceA::NamespaceB::TableInNestedNS>() {
|
||||
return mutable_foo_union_as_TableInNestedNS();
|
||||
}
|
||||
|
||||
struct TableInFirstNSBuilder {
|
||||
typedef TableInFirstNS Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_foo_table(::flatbuffers::Offset<NamespaceA::NamespaceB::TableInNestedNS> foo_table) {
|
||||
fbb_.AddOffset(TableInFirstNS::VT_FOO_TABLE, foo_table);
|
||||
}
|
||||
void add_foo_enum(NamespaceA::NamespaceB::EnumInNestedNS foo_enum) {
|
||||
fbb_.AddElement<int8_t>(TableInFirstNS::VT_FOO_ENUM, static_cast<int8_t>(foo_enum), 0);
|
||||
}
|
||||
void add_foo_union_type(NamespaceA::NamespaceB::UnionInNestedNS foo_union_type) {
|
||||
fbb_.AddElement<uint8_t>(TableInFirstNS::VT_FOO_UNION_TYPE, static_cast<uint8_t>(foo_union_type), 0);
|
||||
}
|
||||
void add_foo_union(::flatbuffers::Offset<void> foo_union) {
|
||||
fbb_.AddOffset(TableInFirstNS::VT_FOO_UNION, foo_union);
|
||||
}
|
||||
void add_foo_struct(const NamespaceA::NamespaceB::StructInNestedNS *foo_struct) {
|
||||
fbb_.AddStruct(TableInFirstNS::VT_FOO_STRUCT, foo_struct);
|
||||
}
|
||||
explicit TableInFirstNSBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<TableInFirstNS> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<TableInFirstNS>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<TableInFirstNS> CreateTableInFirstNS(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
::flatbuffers::Offset<NamespaceA::NamespaceB::TableInNestedNS> foo_table = 0,
|
||||
NamespaceA::NamespaceB::EnumInNestedNS foo_enum = NamespaceA::NamespaceB::EnumInNestedNS_A,
|
||||
NamespaceA::NamespaceB::UnionInNestedNS foo_union_type = NamespaceA::NamespaceB::UnionInNestedNS_NONE,
|
||||
::flatbuffers::Offset<void> foo_union = 0,
|
||||
const NamespaceA::NamespaceB::StructInNestedNS *foo_struct = nullptr) {
|
||||
TableInFirstNSBuilder builder_(_fbb);
|
||||
builder_.add_foo_struct(foo_struct);
|
||||
builder_.add_foo_union(foo_union);
|
||||
builder_.add_foo_table(foo_table);
|
||||
builder_.add_foo_union_type(foo_union_type);
|
||||
builder_.add_foo_enum(foo_enum);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<TableInFirstNS> CreateTableInFirstNS(::flatbuffers::FlatBufferBuilder &_fbb, const TableInFirstNST *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
} // namespace NamespaceA
|
||||
|
||||
namespace NamespaceC {
|
||||
|
||||
struct TableInCT : public ::flatbuffers::NativeTable {
|
||||
typedef TableInC TableType;
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "NamespaceC.TableInCT";
|
||||
}
|
||||
std::unique_ptr<NamespaceA::TableInFirstNST> refer_to_a1{};
|
||||
std::unique_ptr<NamespaceA::SecondTableInAT> refer_to_a2{};
|
||||
TableInCT() = default;
|
||||
TableInCT(const TableInCT &o);
|
||||
TableInCT(TableInCT&&) FLATBUFFERS_NOEXCEPT = default;
|
||||
TableInCT &operator=(TableInCT o) FLATBUFFERS_NOEXCEPT;
|
||||
};
|
||||
|
||||
struct TableInC FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef TableInCT NativeTableType;
|
||||
typedef TableInCBuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return TableInCTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "NamespaceC.TableInC";
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_REFER_TO_A1 = 4,
|
||||
VT_REFER_TO_A2 = 6
|
||||
};
|
||||
const NamespaceA::TableInFirstNS *refer_to_a1() const {
|
||||
return GetPointer<const NamespaceA::TableInFirstNS *>(VT_REFER_TO_A1);
|
||||
}
|
||||
NamespaceA::TableInFirstNS *mutable_refer_to_a1() {
|
||||
return GetPointer<NamespaceA::TableInFirstNS *>(VT_REFER_TO_A1);
|
||||
}
|
||||
const NamespaceA::SecondTableInA *refer_to_a2() const {
|
||||
return GetPointer<const NamespaceA::SecondTableInA *>(VT_REFER_TO_A2);
|
||||
}
|
||||
NamespaceA::SecondTableInA *mutable_refer_to_a2() {
|
||||
return GetPointer<NamespaceA::SecondTableInA *>(VT_REFER_TO_A2);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset(verifier, VT_REFER_TO_A1) &&
|
||||
verifier.VerifyTable(refer_to_a1()) &&
|
||||
VerifyOffset(verifier, VT_REFER_TO_A2) &&
|
||||
verifier.VerifyTable(refer_to_a2()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
TableInCT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(TableInCT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<TableInC> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const TableInCT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct TableInCBuilder {
|
||||
typedef TableInC Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_refer_to_a1(::flatbuffers::Offset<NamespaceA::TableInFirstNS> refer_to_a1) {
|
||||
fbb_.AddOffset(TableInC::VT_REFER_TO_A1, refer_to_a1);
|
||||
}
|
||||
void add_refer_to_a2(::flatbuffers::Offset<NamespaceA::SecondTableInA> refer_to_a2) {
|
||||
fbb_.AddOffset(TableInC::VT_REFER_TO_A2, refer_to_a2);
|
||||
}
|
||||
explicit TableInCBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<TableInC> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<TableInC>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<TableInC> CreateTableInC(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
::flatbuffers::Offset<NamespaceA::TableInFirstNS> refer_to_a1 = 0,
|
||||
::flatbuffers::Offset<NamespaceA::SecondTableInA> refer_to_a2 = 0) {
|
||||
TableInCBuilder builder_(_fbb);
|
||||
builder_.add_refer_to_a2(refer_to_a2);
|
||||
builder_.add_refer_to_a1(refer_to_a1);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<TableInC> CreateTableInC(::flatbuffers::FlatBufferBuilder &_fbb, const TableInCT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
} // namespace NamespaceC
|
||||
|
||||
namespace NamespaceA {
|
||||
|
||||
struct SecondTableInAT : public ::flatbuffers::NativeTable {
|
||||
typedef SecondTableInA TableType;
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "NamespaceA.SecondTableInAT";
|
||||
}
|
||||
std::unique_ptr<NamespaceC::TableInCT> refer_to_c{};
|
||||
SecondTableInAT() = default;
|
||||
SecondTableInAT(const SecondTableInAT &o);
|
||||
SecondTableInAT(SecondTableInAT&&) FLATBUFFERS_NOEXCEPT = default;
|
||||
SecondTableInAT &operator=(SecondTableInAT o) FLATBUFFERS_NOEXCEPT;
|
||||
};
|
||||
|
||||
struct SecondTableInA FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef SecondTableInAT NativeTableType;
|
||||
typedef SecondTableInABuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return SecondTableInATypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "NamespaceA.SecondTableInA";
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_REFER_TO_C = 4
|
||||
};
|
||||
const NamespaceC::TableInC *refer_to_c() const {
|
||||
return GetPointer<const NamespaceC::TableInC *>(VT_REFER_TO_C);
|
||||
}
|
||||
NamespaceC::TableInC *mutable_refer_to_c() {
|
||||
return GetPointer<NamespaceC::TableInC *>(VT_REFER_TO_C);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset(verifier, VT_REFER_TO_C) &&
|
||||
verifier.VerifyTable(refer_to_c()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
SecondTableInAT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(SecondTableInAT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<SecondTableInA> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const SecondTableInAT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct SecondTableInABuilder {
|
||||
typedef SecondTableInA Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_refer_to_c(::flatbuffers::Offset<NamespaceC::TableInC> refer_to_c) {
|
||||
fbb_.AddOffset(SecondTableInA::VT_REFER_TO_C, refer_to_c);
|
||||
}
|
||||
explicit SecondTableInABuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<SecondTableInA> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<SecondTableInA>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<SecondTableInA> CreateSecondTableInA(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
::flatbuffers::Offset<NamespaceC::TableInC> refer_to_c = 0) {
|
||||
SecondTableInABuilder builder_(_fbb);
|
||||
builder_.add_refer_to_c(refer_to_c);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<SecondTableInA> CreateSecondTableInA(::flatbuffers::FlatBufferBuilder &_fbb, const SecondTableInAT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
|
||||
inline bool operator==(const TableInFirstNST &lhs, const TableInFirstNST &rhs) {
|
||||
return
|
||||
((lhs.foo_table == rhs.foo_table) || (lhs.foo_table && rhs.foo_table && *lhs.foo_table == *rhs.foo_table)) &&
|
||||
(lhs.foo_enum == rhs.foo_enum) &&
|
||||
(lhs.foo_union == rhs.foo_union) &&
|
||||
((lhs.foo_struct == rhs.foo_struct) || (lhs.foo_struct && rhs.foo_struct && *lhs.foo_struct == *rhs.foo_struct));
|
||||
}
|
||||
|
||||
inline bool operator!=(const TableInFirstNST &lhs, const TableInFirstNST &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline TableInFirstNST::TableInFirstNST(const TableInFirstNST &o)
|
||||
: foo_table((o.foo_table) ? new NamespaceA::NamespaceB::TableInNestedNST(*o.foo_table) : nullptr),
|
||||
foo_enum(o.foo_enum),
|
||||
foo_union(o.foo_union),
|
||||
foo_struct((o.foo_struct) ? new NamespaceA::NamespaceB::StructInNestedNS(*o.foo_struct) : nullptr) {
|
||||
}
|
||||
|
||||
inline TableInFirstNST &TableInFirstNST::operator=(TableInFirstNST o) FLATBUFFERS_NOEXCEPT {
|
||||
std::swap(foo_table, o.foo_table);
|
||||
std::swap(foo_enum, o.foo_enum);
|
||||
std::swap(foo_union, o.foo_union);
|
||||
std::swap(foo_struct, o.foo_struct);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline TableInFirstNST *TableInFirstNS::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<TableInFirstNST>(new TableInFirstNST());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void TableInFirstNS::UnPackTo(TableInFirstNST *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = foo_table(); if (_e) { if(_o->foo_table) { _e->UnPackTo(_o->foo_table.get(), _resolver); } else { _o->foo_table = std::unique_ptr<NamespaceA::NamespaceB::TableInNestedNST>(_e->UnPack(_resolver)); } } else if (_o->foo_table) { _o->foo_table.reset(); } }
|
||||
{ auto _e = foo_enum(); _o->foo_enum = _e; }
|
||||
{ auto _e = foo_union_type(); _o->foo_union.type = _e; }
|
||||
{ auto _e = foo_union(); if (_e) _o->foo_union.value = NamespaceA::NamespaceB::UnionInNestedNSUnion::UnPack(_e, foo_union_type(), _resolver); }
|
||||
{ auto _e = foo_struct(); if (_e) _o->foo_struct = std::unique_ptr<NamespaceA::NamespaceB::StructInNestedNS>(new NamespaceA::NamespaceB::StructInNestedNS(*_e)); }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<TableInFirstNS> CreateTableInFirstNS(::flatbuffers::FlatBufferBuilder &_fbb, const TableInFirstNST *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return TableInFirstNS::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<TableInFirstNS> TableInFirstNS::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const TableInFirstNST* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const TableInFirstNST* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _foo_table = _o->foo_table ? CreateTableInNestedNS(_fbb, _o->foo_table.get(), _rehasher) : 0;
|
||||
auto _foo_enum = _o->foo_enum;
|
||||
auto _foo_union_type = _o->foo_union.type;
|
||||
auto _foo_union = _o->foo_union.Pack(_fbb);
|
||||
auto _foo_struct = _o->foo_struct ? _o->foo_struct.get() : nullptr;
|
||||
return NamespaceA::CreateTableInFirstNS(
|
||||
_fbb,
|
||||
_foo_table,
|
||||
_foo_enum,
|
||||
_foo_union_type,
|
||||
_foo_union,
|
||||
_foo_struct);
|
||||
}
|
||||
|
||||
} // namespace NamespaceA
|
||||
|
||||
namespace NamespaceC {
|
||||
|
||||
|
||||
inline bool operator==(const TableInCT &lhs, const TableInCT &rhs) {
|
||||
return
|
||||
((lhs.refer_to_a1 == rhs.refer_to_a1) || (lhs.refer_to_a1 && rhs.refer_to_a1 && *lhs.refer_to_a1 == *rhs.refer_to_a1)) &&
|
||||
((lhs.refer_to_a2 == rhs.refer_to_a2) || (lhs.refer_to_a2 && rhs.refer_to_a2 && *lhs.refer_to_a2 == *rhs.refer_to_a2));
|
||||
}
|
||||
|
||||
inline bool operator!=(const TableInCT &lhs, const TableInCT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline TableInCT::TableInCT(const TableInCT &o)
|
||||
: refer_to_a1((o.refer_to_a1) ? new NamespaceA::TableInFirstNST(*o.refer_to_a1) : nullptr),
|
||||
refer_to_a2((o.refer_to_a2) ? new NamespaceA::SecondTableInAT(*o.refer_to_a2) : nullptr) {
|
||||
}
|
||||
|
||||
inline TableInCT &TableInCT::operator=(TableInCT o) FLATBUFFERS_NOEXCEPT {
|
||||
std::swap(refer_to_a1, o.refer_to_a1);
|
||||
std::swap(refer_to_a2, o.refer_to_a2);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline TableInCT *TableInC::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<TableInCT>(new TableInCT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void TableInC::UnPackTo(TableInCT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = refer_to_a1(); if (_e) { if(_o->refer_to_a1) { _e->UnPackTo(_o->refer_to_a1.get(), _resolver); } else { _o->refer_to_a1 = std::unique_ptr<NamespaceA::TableInFirstNST>(_e->UnPack(_resolver)); } } else if (_o->refer_to_a1) { _o->refer_to_a1.reset(); } }
|
||||
{ auto _e = refer_to_a2(); if (_e) { if(_o->refer_to_a2) { _e->UnPackTo(_o->refer_to_a2.get(), _resolver); } else { _o->refer_to_a2 = std::unique_ptr<NamespaceA::SecondTableInAT>(_e->UnPack(_resolver)); } } else if (_o->refer_to_a2) { _o->refer_to_a2.reset(); } }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<TableInC> CreateTableInC(::flatbuffers::FlatBufferBuilder &_fbb, const TableInCT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return TableInC::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<TableInC> TableInC::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const TableInCT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const TableInCT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _refer_to_a1 = _o->refer_to_a1 ? CreateTableInFirstNS(_fbb, _o->refer_to_a1.get(), _rehasher) : 0;
|
||||
auto _refer_to_a2 = _o->refer_to_a2 ? CreateSecondTableInA(_fbb, _o->refer_to_a2.get(), _rehasher) : 0;
|
||||
return NamespaceC::CreateTableInC(
|
||||
_fbb,
|
||||
_refer_to_a1,
|
||||
_refer_to_a2);
|
||||
}
|
||||
|
||||
} // namespace NamespaceC
|
||||
|
||||
namespace NamespaceA {
|
||||
|
||||
|
||||
inline bool operator==(const SecondTableInAT &lhs, const SecondTableInAT &rhs) {
|
||||
return
|
||||
((lhs.refer_to_c == rhs.refer_to_c) || (lhs.refer_to_c && rhs.refer_to_c && *lhs.refer_to_c == *rhs.refer_to_c));
|
||||
}
|
||||
|
||||
inline bool operator!=(const SecondTableInAT &lhs, const SecondTableInAT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline SecondTableInAT::SecondTableInAT(const SecondTableInAT &o)
|
||||
: refer_to_c((o.refer_to_c) ? new NamespaceC::TableInCT(*o.refer_to_c) : nullptr) {
|
||||
}
|
||||
|
||||
inline SecondTableInAT &SecondTableInAT::operator=(SecondTableInAT o) FLATBUFFERS_NOEXCEPT {
|
||||
std::swap(refer_to_c, o.refer_to_c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline SecondTableInAT *SecondTableInA::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<SecondTableInAT>(new SecondTableInAT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void SecondTableInA::UnPackTo(SecondTableInAT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = refer_to_c(); if (_e) { if(_o->refer_to_c) { _e->UnPackTo(_o->refer_to_c.get(), _resolver); } else { _o->refer_to_c = std::unique_ptr<NamespaceC::TableInCT>(_e->UnPack(_resolver)); } } else if (_o->refer_to_c) { _o->refer_to_c.reset(); } }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<SecondTableInA> CreateSecondTableInA(::flatbuffers::FlatBufferBuilder &_fbb, const SecondTableInAT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return SecondTableInA::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<SecondTableInA> SecondTableInA::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const SecondTableInAT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const SecondTableInAT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _refer_to_c = _o->refer_to_c ? CreateTableInC(_fbb, _o->refer_to_c.get(), _rehasher) : 0;
|
||||
return NamespaceA::CreateSecondTableInA(
|
||||
_fbb,
|
||||
_refer_to_c);
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *TableInFirstNSTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 },
|
||||
{ ::flatbuffers::ET_CHAR, 0, 1 },
|
||||
{ ::flatbuffers::ET_UTYPE, 0, 2 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 2 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 3 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
NamespaceA::NamespaceB::TableInNestedNSTypeTable,
|
||||
NamespaceA::NamespaceB::EnumInNestedNSTypeTable,
|
||||
NamespaceA::NamespaceB::UnionInNestedNSTypeTable,
|
||||
NamespaceA::NamespaceB::StructInNestedNSTypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"foo_table",
|
||||
"foo_enum",
|
||||
"foo_union_type",
|
||||
"foo_union",
|
||||
"foo_struct"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 5, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
} // namespace NamespaceA
|
||||
|
||||
namespace NamespaceC {
|
||||
|
||||
inline const ::flatbuffers::TypeTable *TableInCTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 1 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
NamespaceA::TableInFirstNSTypeTable,
|
||||
NamespaceA::SecondTableInATypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"refer_to_a1",
|
||||
"refer_to_a2"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 2, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
} // namespace NamespaceC
|
||||
|
||||
namespace NamespaceA {
|
||||
|
||||
inline const ::flatbuffers::TypeTable *SecondTableInATypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
NamespaceC::TableInCTypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"refer_to_c"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 1, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
} // namespace NamespaceA
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_NAMESPACETEST2_NAMESPACEA_H_
|
||||
@@ -1,265 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_NATIVEINLINETABLETEST_H_
|
||||
#define FLATBUFFERS_GENERATED_NATIVEINLINETABLETEST_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 12 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
struct NativeInlineTable;
|
||||
struct NativeInlineTableBuilder;
|
||||
struct NativeInlineTableT;
|
||||
|
||||
struct TestNativeInlineTable;
|
||||
struct TestNativeInlineTableBuilder;
|
||||
struct TestNativeInlineTableT;
|
||||
|
||||
bool operator==(const NativeInlineTableT &lhs, const NativeInlineTableT &rhs);
|
||||
bool operator!=(const NativeInlineTableT &lhs, const NativeInlineTableT &rhs);
|
||||
bool operator==(const TestNativeInlineTableT &lhs, const TestNativeInlineTableT &rhs);
|
||||
bool operator!=(const TestNativeInlineTableT &lhs, const TestNativeInlineTableT &rhs);
|
||||
|
||||
inline const ::flatbuffers::TypeTable *NativeInlineTableTypeTable();
|
||||
|
||||
inline const ::flatbuffers::TypeTable *TestNativeInlineTableTypeTable();
|
||||
|
||||
struct NativeInlineTableT : public ::flatbuffers::NativeTable {
|
||||
typedef NativeInlineTable TableType;
|
||||
int32_t a = 0;
|
||||
};
|
||||
|
||||
struct NativeInlineTable FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef NativeInlineTableT NativeTableType;
|
||||
typedef NativeInlineTableBuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return NativeInlineTableTypeTable();
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_A = 4
|
||||
};
|
||||
int32_t a() const {
|
||||
return GetField<int32_t>(VT_A, 0);
|
||||
}
|
||||
bool mutate_a(int32_t _a = 0) {
|
||||
return SetField<int32_t>(VT_A, _a, 0);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int32_t>(verifier, VT_A, 4) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
NativeInlineTableT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(NativeInlineTableT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<NativeInlineTable> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const NativeInlineTableT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct NativeInlineTableBuilder {
|
||||
typedef NativeInlineTable Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_a(int32_t a) {
|
||||
fbb_.AddElement<int32_t>(NativeInlineTable::VT_A, a, 0);
|
||||
}
|
||||
explicit NativeInlineTableBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<NativeInlineTable> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<NativeInlineTable>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<NativeInlineTable> CreateNativeInlineTable(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int32_t a = 0) {
|
||||
NativeInlineTableBuilder builder_(_fbb);
|
||||
builder_.add_a(a);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<NativeInlineTable> CreateNativeInlineTable(::flatbuffers::FlatBufferBuilder &_fbb, const NativeInlineTableT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
struct TestNativeInlineTableT : public ::flatbuffers::NativeTable {
|
||||
typedef TestNativeInlineTable TableType;
|
||||
std::vector<NativeInlineTableT> t{};
|
||||
};
|
||||
|
||||
struct TestNativeInlineTable FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef TestNativeInlineTableT NativeTableType;
|
||||
typedef TestNativeInlineTableBuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return TestNativeInlineTableTypeTable();
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_T = 4
|
||||
};
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<NativeInlineTable>> *t() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<NativeInlineTable>> *>(VT_T);
|
||||
}
|
||||
::flatbuffers::Vector<::flatbuffers::Offset<NativeInlineTable>> *mutable_t() {
|
||||
return GetPointer<::flatbuffers::Vector<::flatbuffers::Offset<NativeInlineTable>> *>(VT_T);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset(verifier, VT_T) &&
|
||||
verifier.VerifyVector(t()) &&
|
||||
verifier.VerifyVectorOfTables(t()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
TestNativeInlineTableT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(TestNativeInlineTableT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<TestNativeInlineTable> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const TestNativeInlineTableT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct TestNativeInlineTableBuilder {
|
||||
typedef TestNativeInlineTable Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_t(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<NativeInlineTable>>> t) {
|
||||
fbb_.AddOffset(TestNativeInlineTable::VT_T, t);
|
||||
}
|
||||
explicit TestNativeInlineTableBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<TestNativeInlineTable> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<TestNativeInlineTable>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<TestNativeInlineTable> CreateTestNativeInlineTable(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<NativeInlineTable>>> t = 0) {
|
||||
TestNativeInlineTableBuilder builder_(_fbb);
|
||||
builder_.add_t(t);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<TestNativeInlineTable> CreateTestNativeInlineTableDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
const std::vector<::flatbuffers::Offset<NativeInlineTable>> *t = nullptr) {
|
||||
auto t__ = t ? _fbb.CreateVector<::flatbuffers::Offset<NativeInlineTable>>(*t) : 0;
|
||||
return CreateTestNativeInlineTable(
|
||||
_fbb,
|
||||
t__);
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<TestNativeInlineTable> CreateTestNativeInlineTable(::flatbuffers::FlatBufferBuilder &_fbb, const TestNativeInlineTableT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
|
||||
inline bool operator==(const NativeInlineTableT &lhs, const NativeInlineTableT &rhs) {
|
||||
return
|
||||
(lhs.a == rhs.a);
|
||||
}
|
||||
|
||||
inline bool operator!=(const NativeInlineTableT &lhs, const NativeInlineTableT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline NativeInlineTableT *NativeInlineTable::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<NativeInlineTableT>(new NativeInlineTableT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void NativeInlineTable::UnPackTo(NativeInlineTableT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = a(); _o->a = _e; }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<NativeInlineTable> CreateNativeInlineTable(::flatbuffers::FlatBufferBuilder &_fbb, const NativeInlineTableT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return NativeInlineTable::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<NativeInlineTable> NativeInlineTable::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const NativeInlineTableT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const NativeInlineTableT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _a = _o->a;
|
||||
return CreateNativeInlineTable(
|
||||
_fbb,
|
||||
_a);
|
||||
}
|
||||
|
||||
|
||||
inline bool operator==(const TestNativeInlineTableT &lhs, const TestNativeInlineTableT &rhs) {
|
||||
return
|
||||
(lhs.t == rhs.t);
|
||||
}
|
||||
|
||||
inline bool operator!=(const TestNativeInlineTableT &lhs, const TestNativeInlineTableT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline TestNativeInlineTableT *TestNativeInlineTable::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<TestNativeInlineTableT>(new TestNativeInlineTableT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void TestNativeInlineTable::UnPackTo(TestNativeInlineTableT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = t(); if (_e) { _o->t.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->t[_i] = *std::unique_ptr<NativeInlineTableT>(_e->Get(_i)->UnPack(_resolver)); } } else { _o->t.resize(0); } }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<TestNativeInlineTable> CreateTestNativeInlineTable(::flatbuffers::FlatBufferBuilder &_fbb, const TestNativeInlineTableT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return TestNativeInlineTable::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<TestNativeInlineTable> TestNativeInlineTable::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const TestNativeInlineTableT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const TestNativeInlineTableT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _t = _o->t.size() ? _fbb.CreateVector<::flatbuffers::Offset<NativeInlineTable>> (_o->t.size(), [](size_t i, _VectorArgs *__va) { return CreateNativeInlineTable(*__va->__fbb, &(__va->__o->t[i]), __va->__rehasher); }, &_va ) : 0;
|
||||
return CreateTestNativeInlineTable(
|
||||
_fbb,
|
||||
_t);
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *NativeInlineTableTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_INT, 0, -1 }
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"a"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 1, type_codes, nullptr, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *TestNativeInlineTableTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_SEQUENCE, 1, 0 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
NativeInlineTableTypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"t"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 1, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_NATIVEINLINETABLETEST_H_
|
||||
@@ -1,599 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_NATIVETYPETEST_GEOMETRY_H_
|
||||
#define FLATBUFFERS_GENERATED_NATIVETYPETEST_GEOMETRY_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 12 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
#include "native_type_test_impl.h"
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
struct Vector3D;
|
||||
|
||||
struct Vector3DAlt;
|
||||
|
||||
struct Matrix;
|
||||
struct MatrixBuilder;
|
||||
|
||||
struct ApplicationData;
|
||||
struct ApplicationDataBuilder;
|
||||
struct ApplicationDataT;
|
||||
|
||||
bool operator==(const ApplicationDataT &lhs, const ApplicationDataT &rhs);
|
||||
bool operator!=(const ApplicationDataT &lhs, const ApplicationDataT &rhs);
|
||||
|
||||
inline const ::flatbuffers::TypeTable *Vector3DTypeTable();
|
||||
|
||||
inline const ::flatbuffers::TypeTable *Vector3DAltTypeTable();
|
||||
|
||||
inline const ::flatbuffers::TypeTable *MatrixTypeTable();
|
||||
|
||||
inline const ::flatbuffers::TypeTable *ApplicationDataTypeTable();
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Vector3D FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
float x_;
|
||||
float y_;
|
||||
float z_;
|
||||
|
||||
public:
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return Vector3DTypeTable();
|
||||
}
|
||||
Vector3D()
|
||||
: x_(0),
|
||||
y_(0),
|
||||
z_(0) {
|
||||
}
|
||||
Vector3D(float _x, float _y, float _z)
|
||||
: x_(::flatbuffers::EndianScalar(_x)),
|
||||
y_(::flatbuffers::EndianScalar(_y)),
|
||||
z_(::flatbuffers::EndianScalar(_z)) {
|
||||
}
|
||||
float x() const {
|
||||
return ::flatbuffers::EndianScalar(x_);
|
||||
}
|
||||
void mutate_x(float _x) {
|
||||
::flatbuffers::WriteScalar(&x_, _x);
|
||||
}
|
||||
float y() const {
|
||||
return ::flatbuffers::EndianScalar(y_);
|
||||
}
|
||||
void mutate_y(float _y) {
|
||||
::flatbuffers::WriteScalar(&y_, _y);
|
||||
}
|
||||
float z() const {
|
||||
return ::flatbuffers::EndianScalar(z_);
|
||||
}
|
||||
void mutate_z(float _z) {
|
||||
::flatbuffers::WriteScalar(&z_, _z);
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(Vector3D, 12);
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Vector3DAlt FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
float a_;
|
||||
float b_;
|
||||
float c_;
|
||||
|
||||
public:
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return Vector3DAltTypeTable();
|
||||
}
|
||||
Vector3DAlt()
|
||||
: a_(0),
|
||||
b_(0),
|
||||
c_(0) {
|
||||
}
|
||||
Vector3DAlt(float _a, float _b, float _c)
|
||||
: a_(::flatbuffers::EndianScalar(_a)),
|
||||
b_(::flatbuffers::EndianScalar(_b)),
|
||||
c_(::flatbuffers::EndianScalar(_c)) {
|
||||
}
|
||||
float a() const {
|
||||
return ::flatbuffers::EndianScalar(a_);
|
||||
}
|
||||
void mutate_a(float _a) {
|
||||
::flatbuffers::WriteScalar(&a_, _a);
|
||||
}
|
||||
float b() const {
|
||||
return ::flatbuffers::EndianScalar(b_);
|
||||
}
|
||||
void mutate_b(float _b) {
|
||||
::flatbuffers::WriteScalar(&b_, _b);
|
||||
}
|
||||
float c() const {
|
||||
return ::flatbuffers::EndianScalar(c_);
|
||||
}
|
||||
void mutate_c(float _c) {
|
||||
::flatbuffers::WriteScalar(&c_, _c);
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(Vector3DAlt, 12);
|
||||
|
||||
struct Matrix FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef Native::Matrix NativeTableType;
|
||||
typedef MatrixBuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return MatrixTypeTable();
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_ROWS = 4,
|
||||
VT_COLUMNS = 6,
|
||||
VT_VALUES = 8
|
||||
};
|
||||
int32_t rows() const {
|
||||
return GetField<int32_t>(VT_ROWS, 0);
|
||||
}
|
||||
bool mutate_rows(int32_t _rows = 0) {
|
||||
return SetField<int32_t>(VT_ROWS, _rows, 0);
|
||||
}
|
||||
int32_t columns() const {
|
||||
return GetField<int32_t>(VT_COLUMNS, 0);
|
||||
}
|
||||
bool mutate_columns(int32_t _columns = 0) {
|
||||
return SetField<int32_t>(VT_COLUMNS, _columns, 0);
|
||||
}
|
||||
const ::flatbuffers::Vector<float> *values() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<float> *>(VT_VALUES);
|
||||
}
|
||||
::flatbuffers::Vector<float> *mutable_values() {
|
||||
return GetPointer<::flatbuffers::Vector<float> *>(VT_VALUES);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int32_t>(verifier, VT_ROWS, 4) &&
|
||||
VerifyField<int32_t>(verifier, VT_COLUMNS, 4) &&
|
||||
VerifyOffset(verifier, VT_VALUES) &&
|
||||
verifier.VerifyVector(values()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
Native::Matrix *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(Native::Matrix *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<Matrix> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const Native::Matrix* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct MatrixBuilder {
|
||||
typedef Matrix Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_rows(int32_t rows) {
|
||||
fbb_.AddElement<int32_t>(Matrix::VT_ROWS, rows, 0);
|
||||
}
|
||||
void add_columns(int32_t columns) {
|
||||
fbb_.AddElement<int32_t>(Matrix::VT_COLUMNS, columns, 0);
|
||||
}
|
||||
void add_values(::flatbuffers::Offset<::flatbuffers::Vector<float>> values) {
|
||||
fbb_.AddOffset(Matrix::VT_VALUES, values);
|
||||
}
|
||||
explicit MatrixBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<Matrix> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<Matrix>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<Matrix> CreateMatrix(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int32_t rows = 0,
|
||||
int32_t columns = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<float>> values = 0) {
|
||||
MatrixBuilder builder_(_fbb);
|
||||
builder_.add_values(values);
|
||||
builder_.add_columns(columns);
|
||||
builder_.add_rows(rows);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<Matrix> CreateMatrixDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int32_t rows = 0,
|
||||
int32_t columns = 0,
|
||||
const std::vector<float> *values = nullptr) {
|
||||
auto values__ = values ? _fbb.CreateVector<float>(*values) : 0;
|
||||
return Geometry::CreateMatrix(
|
||||
_fbb,
|
||||
rows,
|
||||
columns,
|
||||
values__);
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<Matrix> CreateMatrix(::flatbuffers::FlatBufferBuilder &_fbb, const Native::Matrix *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
struct ApplicationDataT : public ::flatbuffers::NativeTable {
|
||||
typedef ApplicationData TableType;
|
||||
std::vector<Native::Vector3D> vectors{};
|
||||
std::vector<Native::Vector3D> vectors_alt{};
|
||||
std::unique_ptr<Native::Vector3D> position{};
|
||||
Native::Vector3D position_inline{};
|
||||
std::unique_ptr<Native::Matrix> matrix{};
|
||||
std::vector<std::unique_ptr<Native::Matrix>> matrices{};
|
||||
ApplicationDataT() = default;
|
||||
ApplicationDataT(const ApplicationDataT &o);
|
||||
ApplicationDataT(ApplicationDataT&&) FLATBUFFERS_NOEXCEPT = default;
|
||||
ApplicationDataT &operator=(ApplicationDataT o) FLATBUFFERS_NOEXCEPT;
|
||||
};
|
||||
|
||||
struct ApplicationData FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef ApplicationDataT NativeTableType;
|
||||
typedef ApplicationDataBuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return ApplicationDataTypeTable();
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_VECTORS = 4,
|
||||
VT_VECTORS_ALT = 6,
|
||||
VT_POSITION = 8,
|
||||
VT_POSITION_INLINE = 10,
|
||||
VT_MATRIX = 12,
|
||||
VT_MATRICES = 14
|
||||
};
|
||||
const ::flatbuffers::Vector<const Geometry::Vector3D *> *vectors() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<const Geometry::Vector3D *> *>(VT_VECTORS);
|
||||
}
|
||||
::flatbuffers::Vector<const Geometry::Vector3D *> *mutable_vectors() {
|
||||
return GetPointer<::flatbuffers::Vector<const Geometry::Vector3D *> *>(VT_VECTORS);
|
||||
}
|
||||
const ::flatbuffers::Vector<const Geometry::Vector3DAlt *> *vectors_alt() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<const Geometry::Vector3DAlt *> *>(VT_VECTORS_ALT);
|
||||
}
|
||||
::flatbuffers::Vector<const Geometry::Vector3DAlt *> *mutable_vectors_alt() {
|
||||
return GetPointer<::flatbuffers::Vector<const Geometry::Vector3DAlt *> *>(VT_VECTORS_ALT);
|
||||
}
|
||||
const Geometry::Vector3D *position() const {
|
||||
return GetStruct<const Geometry::Vector3D *>(VT_POSITION);
|
||||
}
|
||||
Geometry::Vector3D *mutable_position() {
|
||||
return GetStruct<Geometry::Vector3D *>(VT_POSITION);
|
||||
}
|
||||
const Geometry::Vector3D *position_inline() const {
|
||||
return GetStruct<const Geometry::Vector3D *>(VT_POSITION_INLINE);
|
||||
}
|
||||
Geometry::Vector3D *mutable_position_inline() {
|
||||
return GetStruct<Geometry::Vector3D *>(VT_POSITION_INLINE);
|
||||
}
|
||||
const Geometry::Matrix *matrix() const {
|
||||
return GetPointer<const Geometry::Matrix *>(VT_MATRIX);
|
||||
}
|
||||
Geometry::Matrix *mutable_matrix() {
|
||||
return GetPointer<Geometry::Matrix *>(VT_MATRIX);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<Geometry::Matrix>> *matrices() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<Geometry::Matrix>> *>(VT_MATRICES);
|
||||
}
|
||||
::flatbuffers::Vector<::flatbuffers::Offset<Geometry::Matrix>> *mutable_matrices() {
|
||||
return GetPointer<::flatbuffers::Vector<::flatbuffers::Offset<Geometry::Matrix>> *>(VT_MATRICES);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset(verifier, VT_VECTORS) &&
|
||||
verifier.VerifyVector(vectors()) &&
|
||||
VerifyOffset(verifier, VT_VECTORS_ALT) &&
|
||||
verifier.VerifyVector(vectors_alt()) &&
|
||||
VerifyField<Geometry::Vector3D>(verifier, VT_POSITION, 4) &&
|
||||
VerifyField<Geometry::Vector3D>(verifier, VT_POSITION_INLINE, 4) &&
|
||||
VerifyOffset(verifier, VT_MATRIX) &&
|
||||
verifier.VerifyTable(matrix()) &&
|
||||
VerifyOffset(verifier, VT_MATRICES) &&
|
||||
verifier.VerifyVector(matrices()) &&
|
||||
verifier.VerifyVectorOfTables(matrices()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
ApplicationDataT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(ApplicationDataT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<ApplicationData> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const ApplicationDataT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct ApplicationDataBuilder {
|
||||
typedef ApplicationData Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_vectors(::flatbuffers::Offset<::flatbuffers::Vector<const Geometry::Vector3D *>> vectors) {
|
||||
fbb_.AddOffset(ApplicationData::VT_VECTORS, vectors);
|
||||
}
|
||||
void add_vectors_alt(::flatbuffers::Offset<::flatbuffers::Vector<const Geometry::Vector3DAlt *>> vectors_alt) {
|
||||
fbb_.AddOffset(ApplicationData::VT_VECTORS_ALT, vectors_alt);
|
||||
}
|
||||
void add_position(const Geometry::Vector3D *position) {
|
||||
fbb_.AddStruct(ApplicationData::VT_POSITION, position);
|
||||
}
|
||||
void add_position_inline(const Geometry::Vector3D *position_inline) {
|
||||
fbb_.AddStruct(ApplicationData::VT_POSITION_INLINE, position_inline);
|
||||
}
|
||||
void add_matrix(::flatbuffers::Offset<Geometry::Matrix> matrix) {
|
||||
fbb_.AddOffset(ApplicationData::VT_MATRIX, matrix);
|
||||
}
|
||||
void add_matrices(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<Geometry::Matrix>>> matrices) {
|
||||
fbb_.AddOffset(ApplicationData::VT_MATRICES, matrices);
|
||||
}
|
||||
explicit ApplicationDataBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<ApplicationData> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<ApplicationData>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<ApplicationData> CreateApplicationData(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<const Geometry::Vector3D *>> vectors = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<const Geometry::Vector3DAlt *>> vectors_alt = 0,
|
||||
const Geometry::Vector3D *position = nullptr,
|
||||
const Geometry::Vector3D *position_inline = nullptr,
|
||||
::flatbuffers::Offset<Geometry::Matrix> matrix = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<Geometry::Matrix>>> matrices = 0) {
|
||||
ApplicationDataBuilder builder_(_fbb);
|
||||
builder_.add_matrices(matrices);
|
||||
builder_.add_matrix(matrix);
|
||||
builder_.add_position_inline(position_inline);
|
||||
builder_.add_position(position);
|
||||
builder_.add_vectors_alt(vectors_alt);
|
||||
builder_.add_vectors(vectors);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<ApplicationData> CreateApplicationDataDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
const std::vector<Geometry::Vector3D> *vectors = nullptr,
|
||||
const std::vector<Geometry::Vector3DAlt> *vectors_alt = nullptr,
|
||||
const Geometry::Vector3D *position = nullptr,
|
||||
const Geometry::Vector3D *position_inline = nullptr,
|
||||
::flatbuffers::Offset<Geometry::Matrix> matrix = 0,
|
||||
const std::vector<::flatbuffers::Offset<Geometry::Matrix>> *matrices = nullptr) {
|
||||
auto vectors__ = vectors ? _fbb.CreateVectorOfStructs<Geometry::Vector3D>(*vectors) : 0;
|
||||
auto vectors_alt__ = vectors_alt ? _fbb.CreateVectorOfStructs<Geometry::Vector3DAlt>(*vectors_alt) : 0;
|
||||
auto matrices__ = matrices ? _fbb.CreateVector<::flatbuffers::Offset<Geometry::Matrix>>(*matrices) : 0;
|
||||
return Geometry::CreateApplicationData(
|
||||
_fbb,
|
||||
vectors__,
|
||||
vectors_alt__,
|
||||
position,
|
||||
position_inline,
|
||||
matrix,
|
||||
matrices__);
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<ApplicationData> CreateApplicationData(::flatbuffers::FlatBufferBuilder &_fbb, const ApplicationDataT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
inline Native::Matrix *Matrix::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<Native::Matrix>(new Native::Matrix());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<Matrix> CreateMatrix(::flatbuffers::FlatBufferBuilder &_fbb, const Native::Matrix *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return Matrix::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
|
||||
inline bool operator==(const ApplicationDataT &lhs, const ApplicationDataT &rhs) {
|
||||
return
|
||||
(lhs.vectors == rhs.vectors) &&
|
||||
(lhs.vectors_alt == rhs.vectors_alt) &&
|
||||
((lhs.position == rhs.position) || (lhs.position && rhs.position && *lhs.position == *rhs.position)) &&
|
||||
(lhs.position_inline == rhs.position_inline) &&
|
||||
((lhs.matrix == rhs.matrix) || (lhs.matrix && rhs.matrix && *lhs.matrix == *rhs.matrix)) &&
|
||||
(lhs.matrices.size() == rhs.matrices.size() && std::equal(lhs.matrices.cbegin(), lhs.matrices.cend(), rhs.matrices.cbegin(), [](std::unique_ptr<Native::Matrix> const &a, std::unique_ptr<Native::Matrix> const &b) { return (a == b) || (a && b && *a == *b); }));
|
||||
}
|
||||
|
||||
inline bool operator!=(const ApplicationDataT &lhs, const ApplicationDataT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline ApplicationDataT::ApplicationDataT(const ApplicationDataT &o)
|
||||
: vectors(o.vectors),
|
||||
vectors_alt(o.vectors_alt),
|
||||
position((o.position) ? new Native::Vector3D(*o.position) : nullptr),
|
||||
position_inline(o.position_inline),
|
||||
matrix((o.matrix) ? new Native::Matrix(*o.matrix) : nullptr) {
|
||||
matrices.reserve(o.matrices.size());
|
||||
for (const auto &matrices_ : o.matrices) { matrices.emplace_back((matrices_) ? new Native::Matrix(*matrices_) : nullptr); }
|
||||
}
|
||||
|
||||
inline ApplicationDataT &ApplicationDataT::operator=(ApplicationDataT o) FLATBUFFERS_NOEXCEPT {
|
||||
std::swap(vectors, o.vectors);
|
||||
std::swap(vectors_alt, o.vectors_alt);
|
||||
std::swap(position, o.position);
|
||||
std::swap(position_inline, o.position_inline);
|
||||
std::swap(matrix, o.matrix);
|
||||
std::swap(matrices, o.matrices);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline ApplicationDataT *ApplicationData::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<ApplicationDataT>(new ApplicationDataT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void ApplicationData::UnPackTo(ApplicationDataT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = vectors(); if (_e) { _o->vectors.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vectors[_i] = ::flatbuffers::UnPack(*_e->Get(_i)); } } else { _o->vectors.resize(0); } }
|
||||
{ auto _e = vectors_alt(); if (_e) { _o->vectors_alt.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vectors_alt[_i] = ::flatbuffers::UnPackVector3DAlt(*_e->Get(_i)); } } else { _o->vectors_alt.resize(0); } }
|
||||
{ auto _e = position(); if (_e) _o->position = std::unique_ptr<Native::Vector3D>(new Native::Vector3D(::flatbuffers::UnPack(*_e))); }
|
||||
{ auto _e = position_inline(); if (_e) _o->position_inline = ::flatbuffers::UnPack(*_e); }
|
||||
{ auto _e = matrix(); if (_e) { if(_o->matrix) { _e->UnPackTo(_o->matrix.get(), _resolver); } else { _o->matrix = std::unique_ptr<Native::Matrix>(_e->UnPack(_resolver)); } } else if (_o->matrix) { _o->matrix.reset(); } }
|
||||
{ auto _e = matrices(); if (_e) { _o->matrices.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->matrices[_i]) { _e->Get(_i)->UnPackTo(_o->matrices[_i].get(), _resolver); } else { _o->matrices[_i] = std::unique_ptr<Native::Matrix>(_e->Get(_i)->UnPack(_resolver)); } } } else { _o->matrices.resize(0); } }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<ApplicationData> CreateApplicationData(::flatbuffers::FlatBufferBuilder &_fbb, const ApplicationDataT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return ApplicationData::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<ApplicationData> ApplicationData::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const ApplicationDataT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const ApplicationDataT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _vectors = _o->vectors.size() ? _fbb.CreateVectorOfNativeStructs<Geometry::Vector3D, Native::Vector3D>(_o->vectors) : 0;
|
||||
auto _vectors_alt = _o->vectors_alt.size() ? _fbb.CreateVectorOfNativeStructs<Geometry::Vector3DAlt, Native::Vector3D>(_o->vectors_alt, ::flatbuffers::PackVector3DAlt) : 0;
|
||||
auto _position = Geometry::Vector3D{}; if (_o->position) _position = ::flatbuffers::Pack(*_o->position);
|
||||
auto _position_inline = ::flatbuffers::Pack(_o->position_inline);
|
||||
auto _matrix = _o->matrix ? CreateMatrix(_fbb, _o->matrix.get(), _rehasher) : 0;
|
||||
auto _matrices = _o->matrices.size() ? _fbb.CreateVector<::flatbuffers::Offset<Geometry::Matrix>> (_o->matrices.size(), [](size_t i, _VectorArgs *__va) { return CreateMatrix(*__va->__fbb, __va->__o->matrices[i].get(), __va->__rehasher); }, &_va ) : 0;
|
||||
return Geometry::CreateApplicationData(
|
||||
_fbb,
|
||||
_vectors,
|
||||
_vectors_alt,
|
||||
_o->position ? &_position : nullptr,
|
||||
&_position_inline,
|
||||
_matrix,
|
||||
_matrices);
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *Vector3DTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_FLOAT, 0, -1 },
|
||||
{ ::flatbuffers::ET_FLOAT, 0, -1 },
|
||||
{ ::flatbuffers::ET_FLOAT, 0, -1 }
|
||||
};
|
||||
static const int64_t values[] = { 0, 4, 8, 12 };
|
||||
static const char * const names[] = {
|
||||
"x",
|
||||
"y",
|
||||
"z"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_STRUCT, 3, type_codes, nullptr, nullptr, values, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *Vector3DAltTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_FLOAT, 0, -1 },
|
||||
{ ::flatbuffers::ET_FLOAT, 0, -1 },
|
||||
{ ::flatbuffers::ET_FLOAT, 0, -1 }
|
||||
};
|
||||
static const int64_t values[] = { 0, 4, 8, 12 };
|
||||
static const char * const names[] = {
|
||||
"a",
|
||||
"b",
|
||||
"c"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_STRUCT, 3, type_codes, nullptr, nullptr, values, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *MatrixTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_INT, 0, -1 },
|
||||
{ ::flatbuffers::ET_INT, 0, -1 },
|
||||
{ ::flatbuffers::ET_FLOAT, 1, -1 }
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"rows",
|
||||
"columns",
|
||||
"values"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 3, type_codes, nullptr, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *ApplicationDataTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_SEQUENCE, 1, 0 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 1, 1 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 2 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 1, 2 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
Geometry::Vector3DTypeTable,
|
||||
Geometry::Vector3DAltTypeTable,
|
||||
Geometry::MatrixTypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"vectors",
|
||||
"vectors_alt",
|
||||
"position",
|
||||
"position_inline",
|
||||
"matrix",
|
||||
"matrices"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 6, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const Geometry::ApplicationData *GetApplicationData(const void *buf) {
|
||||
return ::flatbuffers::GetRoot<Geometry::ApplicationData>(buf);
|
||||
}
|
||||
|
||||
inline const Geometry::ApplicationData *GetSizePrefixedApplicationData(const void *buf) {
|
||||
return ::flatbuffers::GetSizePrefixedRoot<Geometry::ApplicationData>(buf);
|
||||
}
|
||||
|
||||
inline ApplicationData *GetMutableApplicationData(void *buf) {
|
||||
return ::flatbuffers::GetMutableRoot<ApplicationData>(buf);
|
||||
}
|
||||
|
||||
inline Geometry::ApplicationData *GetMutableSizePrefixedApplicationData(void *buf) {
|
||||
return ::flatbuffers::GetMutableSizePrefixedRoot<Geometry::ApplicationData>(buf);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifyApplicationDataBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifyBuffer<Geometry::ApplicationData>(nullptr);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifySizePrefixedApplicationDataBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifySizePrefixedBuffer<Geometry::ApplicationData>(nullptr);
|
||||
}
|
||||
|
||||
inline void FinishApplicationDataBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<Geometry::ApplicationData> root) {
|
||||
fbb.Finish(root);
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedApplicationDataBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<Geometry::ApplicationData> root) {
|
||||
fbb.FinishSizePrefixed(root);
|
||||
}
|
||||
|
||||
inline std::unique_ptr<Geometry::ApplicationDataT> UnPackApplicationData(
|
||||
const void *buf,
|
||||
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
||||
return std::unique_ptr<Geometry::ApplicationDataT>(GetApplicationData(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
inline std::unique_ptr<Geometry::ApplicationDataT> UnPackSizePrefixedApplicationData(
|
||||
const void *buf,
|
||||
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
||||
return std::unique_ptr<Geometry::ApplicationDataT>(GetSizePrefixedApplicationData(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
} // namespace Geometry
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_NATIVETYPETEST_GEOMETRY_H_
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "native_type_test_impl.h"
|
||||
|
||||
#include "native_type_test_generated.h"
|
||||
#include "native_type_test.fbs.h"
|
||||
|
||||
namespace flatbuffers {
|
||||
Geometry::Vector3D Pack(const Native::Vector3D& obj) {
|
||||
|
||||
@@ -1,964 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_OPTIONALSCALARS_OPTIONAL_SCALARS_H_
|
||||
#define FLATBUFFERS_GENERATED_OPTIONALSCALARS_OPTIONAL_SCALARS_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 12 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
namespace optional_scalars {
|
||||
|
||||
struct ScalarStuff;
|
||||
struct ScalarStuffBuilder;
|
||||
struct ScalarStuffT;
|
||||
|
||||
bool operator==(const ScalarStuffT &lhs, const ScalarStuffT &rhs);
|
||||
bool operator!=(const ScalarStuffT &lhs, const ScalarStuffT &rhs);
|
||||
|
||||
inline const ::flatbuffers::TypeTable *ScalarStuffTypeTable();
|
||||
|
||||
enum OptionalByte : int8_t {
|
||||
OptionalByte_None = 0,
|
||||
OptionalByte_One = 1,
|
||||
OptionalByte_Two = 2,
|
||||
OptionalByte_MIN = OptionalByte_None,
|
||||
OptionalByte_MAX = OptionalByte_Two
|
||||
};
|
||||
|
||||
inline const OptionalByte (&EnumValuesOptionalByte())[3] {
|
||||
static const OptionalByte values[] = {
|
||||
OptionalByte_None,
|
||||
OptionalByte_One,
|
||||
OptionalByte_Two
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char * const *EnumNamesOptionalByte() {
|
||||
static const char * const names[4] = {
|
||||
"None",
|
||||
"One",
|
||||
"Two",
|
||||
nullptr
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameOptionalByte(OptionalByte e) {
|
||||
if (::flatbuffers::IsOutRange(e, OptionalByte_None, OptionalByte_Two)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesOptionalByte()[index];
|
||||
}
|
||||
|
||||
struct ScalarStuffT : public ::flatbuffers::NativeTable {
|
||||
typedef ScalarStuff TableType;
|
||||
int8_t just_i8 = 0;
|
||||
::flatbuffers::Optional<int8_t> maybe_i8 = ::flatbuffers::nullopt;
|
||||
int8_t default_i8 = 42;
|
||||
uint8_t just_u8 = 0;
|
||||
::flatbuffers::Optional<uint8_t> maybe_u8 = ::flatbuffers::nullopt;
|
||||
uint8_t default_u8 = 42;
|
||||
int16_t just_i16 = 0;
|
||||
::flatbuffers::Optional<int16_t> maybe_i16 = ::flatbuffers::nullopt;
|
||||
int16_t default_i16 = 42;
|
||||
uint16_t just_u16 = 0;
|
||||
::flatbuffers::Optional<uint16_t> maybe_u16 = ::flatbuffers::nullopt;
|
||||
uint16_t default_u16 = 42;
|
||||
int32_t just_i32 = 0;
|
||||
::flatbuffers::Optional<int32_t> maybe_i32 = ::flatbuffers::nullopt;
|
||||
int32_t default_i32 = 42;
|
||||
uint32_t just_u32 = 0;
|
||||
::flatbuffers::Optional<uint32_t> maybe_u32 = ::flatbuffers::nullopt;
|
||||
uint32_t default_u32 = 42;
|
||||
int64_t just_i64 = 0;
|
||||
::flatbuffers::Optional<int64_t> maybe_i64 = ::flatbuffers::nullopt;
|
||||
int64_t default_i64 = 42LL;
|
||||
uint64_t just_u64 = 0;
|
||||
::flatbuffers::Optional<uint64_t> maybe_u64 = ::flatbuffers::nullopt;
|
||||
uint64_t default_u64 = 42ULL;
|
||||
float just_f32 = 0.0f;
|
||||
::flatbuffers::Optional<float> maybe_f32 = ::flatbuffers::nullopt;
|
||||
float default_f32 = 42.0f;
|
||||
double just_f64 = 0.0;
|
||||
::flatbuffers::Optional<double> maybe_f64 = ::flatbuffers::nullopt;
|
||||
double default_f64 = 42.0;
|
||||
bool just_bool = false;
|
||||
::flatbuffers::Optional<bool> maybe_bool = ::flatbuffers::nullopt;
|
||||
bool default_bool = true;
|
||||
optional_scalars::OptionalByte just_enum = optional_scalars::OptionalByte_None;
|
||||
::flatbuffers::Optional<optional_scalars::OptionalByte> maybe_enum = ::flatbuffers::nullopt;
|
||||
optional_scalars::OptionalByte default_enum = optional_scalars::OptionalByte_One;
|
||||
};
|
||||
|
||||
struct ScalarStuff FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef ScalarStuffT NativeTableType;
|
||||
typedef ScalarStuffBuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return ScalarStuffTypeTable();
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_JUST_I8 = 4,
|
||||
VT_MAYBE_I8 = 6,
|
||||
VT_DEFAULT_I8 = 8,
|
||||
VT_JUST_U8 = 10,
|
||||
VT_MAYBE_U8 = 12,
|
||||
VT_DEFAULT_U8 = 14,
|
||||
VT_JUST_I16 = 16,
|
||||
VT_MAYBE_I16 = 18,
|
||||
VT_DEFAULT_I16 = 20,
|
||||
VT_JUST_U16 = 22,
|
||||
VT_MAYBE_U16 = 24,
|
||||
VT_DEFAULT_U16 = 26,
|
||||
VT_JUST_I32 = 28,
|
||||
VT_MAYBE_I32 = 30,
|
||||
VT_DEFAULT_I32 = 32,
|
||||
VT_JUST_U32 = 34,
|
||||
VT_MAYBE_U32 = 36,
|
||||
VT_DEFAULT_U32 = 38,
|
||||
VT_JUST_I64 = 40,
|
||||
VT_MAYBE_I64 = 42,
|
||||
VT_DEFAULT_I64 = 44,
|
||||
VT_JUST_U64 = 46,
|
||||
VT_MAYBE_U64 = 48,
|
||||
VT_DEFAULT_U64 = 50,
|
||||
VT_JUST_F32 = 52,
|
||||
VT_MAYBE_F32 = 54,
|
||||
VT_DEFAULT_F32 = 56,
|
||||
VT_JUST_F64 = 58,
|
||||
VT_MAYBE_F64 = 60,
|
||||
VT_DEFAULT_F64 = 62,
|
||||
VT_JUST_BOOL = 64,
|
||||
VT_MAYBE_BOOL = 66,
|
||||
VT_DEFAULT_BOOL = 68,
|
||||
VT_JUST_ENUM = 70,
|
||||
VT_MAYBE_ENUM = 72,
|
||||
VT_DEFAULT_ENUM = 74
|
||||
};
|
||||
int8_t just_i8() const {
|
||||
return GetField<int8_t>(VT_JUST_I8, 0);
|
||||
}
|
||||
bool mutate_just_i8(int8_t _just_i8 = 0) {
|
||||
return SetField<int8_t>(VT_JUST_I8, _just_i8, 0);
|
||||
}
|
||||
::flatbuffers::Optional<int8_t> maybe_i8() const {
|
||||
return GetOptional<int8_t, int8_t>(VT_MAYBE_I8);
|
||||
}
|
||||
bool mutate_maybe_i8(int8_t _maybe_i8) {
|
||||
return SetField<int8_t>(VT_MAYBE_I8, _maybe_i8);
|
||||
}
|
||||
int8_t default_i8() const {
|
||||
return GetField<int8_t>(VT_DEFAULT_I8, 42);
|
||||
}
|
||||
bool mutate_default_i8(int8_t _default_i8 = 42) {
|
||||
return SetField<int8_t>(VT_DEFAULT_I8, _default_i8, 42);
|
||||
}
|
||||
uint8_t just_u8() const {
|
||||
return GetField<uint8_t>(VT_JUST_U8, 0);
|
||||
}
|
||||
bool mutate_just_u8(uint8_t _just_u8 = 0) {
|
||||
return SetField<uint8_t>(VT_JUST_U8, _just_u8, 0);
|
||||
}
|
||||
::flatbuffers::Optional<uint8_t> maybe_u8() const {
|
||||
return GetOptional<uint8_t, uint8_t>(VT_MAYBE_U8);
|
||||
}
|
||||
bool mutate_maybe_u8(uint8_t _maybe_u8) {
|
||||
return SetField<uint8_t>(VT_MAYBE_U8, _maybe_u8);
|
||||
}
|
||||
uint8_t default_u8() const {
|
||||
return GetField<uint8_t>(VT_DEFAULT_U8, 42);
|
||||
}
|
||||
bool mutate_default_u8(uint8_t _default_u8 = 42) {
|
||||
return SetField<uint8_t>(VT_DEFAULT_U8, _default_u8, 42);
|
||||
}
|
||||
int16_t just_i16() const {
|
||||
return GetField<int16_t>(VT_JUST_I16, 0);
|
||||
}
|
||||
bool mutate_just_i16(int16_t _just_i16 = 0) {
|
||||
return SetField<int16_t>(VT_JUST_I16, _just_i16, 0);
|
||||
}
|
||||
::flatbuffers::Optional<int16_t> maybe_i16() const {
|
||||
return GetOptional<int16_t, int16_t>(VT_MAYBE_I16);
|
||||
}
|
||||
bool mutate_maybe_i16(int16_t _maybe_i16) {
|
||||
return SetField<int16_t>(VT_MAYBE_I16, _maybe_i16);
|
||||
}
|
||||
int16_t default_i16() const {
|
||||
return GetField<int16_t>(VT_DEFAULT_I16, 42);
|
||||
}
|
||||
bool mutate_default_i16(int16_t _default_i16 = 42) {
|
||||
return SetField<int16_t>(VT_DEFAULT_I16, _default_i16, 42);
|
||||
}
|
||||
uint16_t just_u16() const {
|
||||
return GetField<uint16_t>(VT_JUST_U16, 0);
|
||||
}
|
||||
bool mutate_just_u16(uint16_t _just_u16 = 0) {
|
||||
return SetField<uint16_t>(VT_JUST_U16, _just_u16, 0);
|
||||
}
|
||||
::flatbuffers::Optional<uint16_t> maybe_u16() const {
|
||||
return GetOptional<uint16_t, uint16_t>(VT_MAYBE_U16);
|
||||
}
|
||||
bool mutate_maybe_u16(uint16_t _maybe_u16) {
|
||||
return SetField<uint16_t>(VT_MAYBE_U16, _maybe_u16);
|
||||
}
|
||||
uint16_t default_u16() const {
|
||||
return GetField<uint16_t>(VT_DEFAULT_U16, 42);
|
||||
}
|
||||
bool mutate_default_u16(uint16_t _default_u16 = 42) {
|
||||
return SetField<uint16_t>(VT_DEFAULT_U16, _default_u16, 42);
|
||||
}
|
||||
int32_t just_i32() const {
|
||||
return GetField<int32_t>(VT_JUST_I32, 0);
|
||||
}
|
||||
bool mutate_just_i32(int32_t _just_i32 = 0) {
|
||||
return SetField<int32_t>(VT_JUST_I32, _just_i32, 0);
|
||||
}
|
||||
::flatbuffers::Optional<int32_t> maybe_i32() const {
|
||||
return GetOptional<int32_t, int32_t>(VT_MAYBE_I32);
|
||||
}
|
||||
bool mutate_maybe_i32(int32_t _maybe_i32) {
|
||||
return SetField<int32_t>(VT_MAYBE_I32, _maybe_i32);
|
||||
}
|
||||
int32_t default_i32() const {
|
||||
return GetField<int32_t>(VT_DEFAULT_I32, 42);
|
||||
}
|
||||
bool mutate_default_i32(int32_t _default_i32 = 42) {
|
||||
return SetField<int32_t>(VT_DEFAULT_I32, _default_i32, 42);
|
||||
}
|
||||
uint32_t just_u32() const {
|
||||
return GetField<uint32_t>(VT_JUST_U32, 0);
|
||||
}
|
||||
bool mutate_just_u32(uint32_t _just_u32 = 0) {
|
||||
return SetField<uint32_t>(VT_JUST_U32, _just_u32, 0);
|
||||
}
|
||||
::flatbuffers::Optional<uint32_t> maybe_u32() const {
|
||||
return GetOptional<uint32_t, uint32_t>(VT_MAYBE_U32);
|
||||
}
|
||||
bool mutate_maybe_u32(uint32_t _maybe_u32) {
|
||||
return SetField<uint32_t>(VT_MAYBE_U32, _maybe_u32);
|
||||
}
|
||||
uint32_t default_u32() const {
|
||||
return GetField<uint32_t>(VT_DEFAULT_U32, 42);
|
||||
}
|
||||
bool mutate_default_u32(uint32_t _default_u32 = 42) {
|
||||
return SetField<uint32_t>(VT_DEFAULT_U32, _default_u32, 42);
|
||||
}
|
||||
int64_t just_i64() const {
|
||||
return GetField<int64_t>(VT_JUST_I64, 0);
|
||||
}
|
||||
bool mutate_just_i64(int64_t _just_i64 = 0) {
|
||||
return SetField<int64_t>(VT_JUST_I64, _just_i64, 0);
|
||||
}
|
||||
::flatbuffers::Optional<int64_t> maybe_i64() const {
|
||||
return GetOptional<int64_t, int64_t>(VT_MAYBE_I64);
|
||||
}
|
||||
bool mutate_maybe_i64(int64_t _maybe_i64) {
|
||||
return SetField<int64_t>(VT_MAYBE_I64, _maybe_i64);
|
||||
}
|
||||
int64_t default_i64() const {
|
||||
return GetField<int64_t>(VT_DEFAULT_I64, 42LL);
|
||||
}
|
||||
bool mutate_default_i64(int64_t _default_i64 = 42LL) {
|
||||
return SetField<int64_t>(VT_DEFAULT_I64, _default_i64, 42LL);
|
||||
}
|
||||
uint64_t just_u64() const {
|
||||
return GetField<uint64_t>(VT_JUST_U64, 0);
|
||||
}
|
||||
bool mutate_just_u64(uint64_t _just_u64 = 0) {
|
||||
return SetField<uint64_t>(VT_JUST_U64, _just_u64, 0);
|
||||
}
|
||||
::flatbuffers::Optional<uint64_t> maybe_u64() const {
|
||||
return GetOptional<uint64_t, uint64_t>(VT_MAYBE_U64);
|
||||
}
|
||||
bool mutate_maybe_u64(uint64_t _maybe_u64) {
|
||||
return SetField<uint64_t>(VT_MAYBE_U64, _maybe_u64);
|
||||
}
|
||||
uint64_t default_u64() const {
|
||||
return GetField<uint64_t>(VT_DEFAULT_U64, 42ULL);
|
||||
}
|
||||
bool mutate_default_u64(uint64_t _default_u64 = 42ULL) {
|
||||
return SetField<uint64_t>(VT_DEFAULT_U64, _default_u64, 42ULL);
|
||||
}
|
||||
float just_f32() const {
|
||||
return GetField<float>(VT_JUST_F32, 0.0f);
|
||||
}
|
||||
bool mutate_just_f32(float _just_f32 = 0.0f) {
|
||||
return SetField<float>(VT_JUST_F32, _just_f32, 0.0f);
|
||||
}
|
||||
::flatbuffers::Optional<float> maybe_f32() const {
|
||||
return GetOptional<float, float>(VT_MAYBE_F32);
|
||||
}
|
||||
bool mutate_maybe_f32(float _maybe_f32) {
|
||||
return SetField<float>(VT_MAYBE_F32, _maybe_f32);
|
||||
}
|
||||
float default_f32() const {
|
||||
return GetField<float>(VT_DEFAULT_F32, 42.0f);
|
||||
}
|
||||
bool mutate_default_f32(float _default_f32 = 42.0f) {
|
||||
return SetField<float>(VT_DEFAULT_F32, _default_f32, 42.0f);
|
||||
}
|
||||
double just_f64() const {
|
||||
return GetField<double>(VT_JUST_F64, 0.0);
|
||||
}
|
||||
bool mutate_just_f64(double _just_f64 = 0.0) {
|
||||
return SetField<double>(VT_JUST_F64, _just_f64, 0.0);
|
||||
}
|
||||
::flatbuffers::Optional<double> maybe_f64() const {
|
||||
return GetOptional<double, double>(VT_MAYBE_F64);
|
||||
}
|
||||
bool mutate_maybe_f64(double _maybe_f64) {
|
||||
return SetField<double>(VT_MAYBE_F64, _maybe_f64);
|
||||
}
|
||||
double default_f64() const {
|
||||
return GetField<double>(VT_DEFAULT_F64, 42.0);
|
||||
}
|
||||
bool mutate_default_f64(double _default_f64 = 42.0) {
|
||||
return SetField<double>(VT_DEFAULT_F64, _default_f64, 42.0);
|
||||
}
|
||||
bool just_bool() const {
|
||||
return GetField<uint8_t>(VT_JUST_BOOL, 0) != 0;
|
||||
}
|
||||
bool mutate_just_bool(bool _just_bool = 0) {
|
||||
return SetField<uint8_t>(VT_JUST_BOOL, static_cast<uint8_t>(_just_bool), 0);
|
||||
}
|
||||
::flatbuffers::Optional<bool> maybe_bool() const {
|
||||
return GetOptional<uint8_t, bool>(VT_MAYBE_BOOL);
|
||||
}
|
||||
bool mutate_maybe_bool(bool _maybe_bool) {
|
||||
return SetField<uint8_t>(VT_MAYBE_BOOL, static_cast<uint8_t>(_maybe_bool));
|
||||
}
|
||||
bool default_bool() const {
|
||||
return GetField<uint8_t>(VT_DEFAULT_BOOL, 1) != 0;
|
||||
}
|
||||
bool mutate_default_bool(bool _default_bool = 1) {
|
||||
return SetField<uint8_t>(VT_DEFAULT_BOOL, static_cast<uint8_t>(_default_bool), 1);
|
||||
}
|
||||
optional_scalars::OptionalByte just_enum() const {
|
||||
return static_cast<optional_scalars::OptionalByte>(GetField<int8_t>(VT_JUST_ENUM, 0));
|
||||
}
|
||||
bool mutate_just_enum(optional_scalars::OptionalByte _just_enum = static_cast<optional_scalars::OptionalByte>(0)) {
|
||||
return SetField<int8_t>(VT_JUST_ENUM, static_cast<int8_t>(_just_enum), 0);
|
||||
}
|
||||
::flatbuffers::Optional<optional_scalars::OptionalByte> maybe_enum() const {
|
||||
return GetOptional<int8_t, optional_scalars::OptionalByte>(VT_MAYBE_ENUM);
|
||||
}
|
||||
bool mutate_maybe_enum(optional_scalars::OptionalByte _maybe_enum) {
|
||||
return SetField<int8_t>(VT_MAYBE_ENUM, static_cast<int8_t>(_maybe_enum));
|
||||
}
|
||||
optional_scalars::OptionalByte default_enum() const {
|
||||
return static_cast<optional_scalars::OptionalByte>(GetField<int8_t>(VT_DEFAULT_ENUM, 1));
|
||||
}
|
||||
bool mutate_default_enum(optional_scalars::OptionalByte _default_enum = static_cast<optional_scalars::OptionalByte>(1)) {
|
||||
return SetField<int8_t>(VT_DEFAULT_ENUM, static_cast<int8_t>(_default_enum), 1);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int8_t>(verifier, VT_JUST_I8, 1) &&
|
||||
VerifyField<int8_t>(verifier, VT_MAYBE_I8, 1) &&
|
||||
VerifyField<int8_t>(verifier, VT_DEFAULT_I8, 1) &&
|
||||
VerifyField<uint8_t>(verifier, VT_JUST_U8, 1) &&
|
||||
VerifyField<uint8_t>(verifier, VT_MAYBE_U8, 1) &&
|
||||
VerifyField<uint8_t>(verifier, VT_DEFAULT_U8, 1) &&
|
||||
VerifyField<int16_t>(verifier, VT_JUST_I16, 2) &&
|
||||
VerifyField<int16_t>(verifier, VT_MAYBE_I16, 2) &&
|
||||
VerifyField<int16_t>(verifier, VT_DEFAULT_I16, 2) &&
|
||||
VerifyField<uint16_t>(verifier, VT_JUST_U16, 2) &&
|
||||
VerifyField<uint16_t>(verifier, VT_MAYBE_U16, 2) &&
|
||||
VerifyField<uint16_t>(verifier, VT_DEFAULT_U16, 2) &&
|
||||
VerifyField<int32_t>(verifier, VT_JUST_I32, 4) &&
|
||||
VerifyField<int32_t>(verifier, VT_MAYBE_I32, 4) &&
|
||||
VerifyField<int32_t>(verifier, VT_DEFAULT_I32, 4) &&
|
||||
VerifyField<uint32_t>(verifier, VT_JUST_U32, 4) &&
|
||||
VerifyField<uint32_t>(verifier, VT_MAYBE_U32, 4) &&
|
||||
VerifyField<uint32_t>(verifier, VT_DEFAULT_U32, 4) &&
|
||||
VerifyField<int64_t>(verifier, VT_JUST_I64, 8) &&
|
||||
VerifyField<int64_t>(verifier, VT_MAYBE_I64, 8) &&
|
||||
VerifyField<int64_t>(verifier, VT_DEFAULT_I64, 8) &&
|
||||
VerifyField<uint64_t>(verifier, VT_JUST_U64, 8) &&
|
||||
VerifyField<uint64_t>(verifier, VT_MAYBE_U64, 8) &&
|
||||
VerifyField<uint64_t>(verifier, VT_DEFAULT_U64, 8) &&
|
||||
VerifyField<float>(verifier, VT_JUST_F32, 4) &&
|
||||
VerifyField<float>(verifier, VT_MAYBE_F32, 4) &&
|
||||
VerifyField<float>(verifier, VT_DEFAULT_F32, 4) &&
|
||||
VerifyField<double>(verifier, VT_JUST_F64, 8) &&
|
||||
VerifyField<double>(verifier, VT_MAYBE_F64, 8) &&
|
||||
VerifyField<double>(verifier, VT_DEFAULT_F64, 8) &&
|
||||
VerifyField<uint8_t>(verifier, VT_JUST_BOOL, 1) &&
|
||||
VerifyField<uint8_t>(verifier, VT_MAYBE_BOOL, 1) &&
|
||||
VerifyField<uint8_t>(verifier, VT_DEFAULT_BOOL, 1) &&
|
||||
VerifyField<int8_t>(verifier, VT_JUST_ENUM, 1) &&
|
||||
VerifyField<int8_t>(verifier, VT_MAYBE_ENUM, 1) &&
|
||||
VerifyField<int8_t>(verifier, VT_DEFAULT_ENUM, 1) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
ScalarStuffT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(ScalarStuffT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<ScalarStuff> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const ScalarStuffT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct ScalarStuffBuilder {
|
||||
typedef ScalarStuff Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_just_i8(int8_t just_i8) {
|
||||
fbb_.AddElement<int8_t>(ScalarStuff::VT_JUST_I8, just_i8, 0);
|
||||
}
|
||||
void add_maybe_i8(int8_t maybe_i8) {
|
||||
fbb_.AddElement<int8_t>(ScalarStuff::VT_MAYBE_I8, maybe_i8);
|
||||
}
|
||||
void add_default_i8(int8_t default_i8) {
|
||||
fbb_.AddElement<int8_t>(ScalarStuff::VT_DEFAULT_I8, default_i8, 42);
|
||||
}
|
||||
void add_just_u8(uint8_t just_u8) {
|
||||
fbb_.AddElement<uint8_t>(ScalarStuff::VT_JUST_U8, just_u8, 0);
|
||||
}
|
||||
void add_maybe_u8(uint8_t maybe_u8) {
|
||||
fbb_.AddElement<uint8_t>(ScalarStuff::VT_MAYBE_U8, maybe_u8);
|
||||
}
|
||||
void add_default_u8(uint8_t default_u8) {
|
||||
fbb_.AddElement<uint8_t>(ScalarStuff::VT_DEFAULT_U8, default_u8, 42);
|
||||
}
|
||||
void add_just_i16(int16_t just_i16) {
|
||||
fbb_.AddElement<int16_t>(ScalarStuff::VT_JUST_I16, just_i16, 0);
|
||||
}
|
||||
void add_maybe_i16(int16_t maybe_i16) {
|
||||
fbb_.AddElement<int16_t>(ScalarStuff::VT_MAYBE_I16, maybe_i16);
|
||||
}
|
||||
void add_default_i16(int16_t default_i16) {
|
||||
fbb_.AddElement<int16_t>(ScalarStuff::VT_DEFAULT_I16, default_i16, 42);
|
||||
}
|
||||
void add_just_u16(uint16_t just_u16) {
|
||||
fbb_.AddElement<uint16_t>(ScalarStuff::VT_JUST_U16, just_u16, 0);
|
||||
}
|
||||
void add_maybe_u16(uint16_t maybe_u16) {
|
||||
fbb_.AddElement<uint16_t>(ScalarStuff::VT_MAYBE_U16, maybe_u16);
|
||||
}
|
||||
void add_default_u16(uint16_t default_u16) {
|
||||
fbb_.AddElement<uint16_t>(ScalarStuff::VT_DEFAULT_U16, default_u16, 42);
|
||||
}
|
||||
void add_just_i32(int32_t just_i32) {
|
||||
fbb_.AddElement<int32_t>(ScalarStuff::VT_JUST_I32, just_i32, 0);
|
||||
}
|
||||
void add_maybe_i32(int32_t maybe_i32) {
|
||||
fbb_.AddElement<int32_t>(ScalarStuff::VT_MAYBE_I32, maybe_i32);
|
||||
}
|
||||
void add_default_i32(int32_t default_i32) {
|
||||
fbb_.AddElement<int32_t>(ScalarStuff::VT_DEFAULT_I32, default_i32, 42);
|
||||
}
|
||||
void add_just_u32(uint32_t just_u32) {
|
||||
fbb_.AddElement<uint32_t>(ScalarStuff::VT_JUST_U32, just_u32, 0);
|
||||
}
|
||||
void add_maybe_u32(uint32_t maybe_u32) {
|
||||
fbb_.AddElement<uint32_t>(ScalarStuff::VT_MAYBE_U32, maybe_u32);
|
||||
}
|
||||
void add_default_u32(uint32_t default_u32) {
|
||||
fbb_.AddElement<uint32_t>(ScalarStuff::VT_DEFAULT_U32, default_u32, 42);
|
||||
}
|
||||
void add_just_i64(int64_t just_i64) {
|
||||
fbb_.AddElement<int64_t>(ScalarStuff::VT_JUST_I64, just_i64, 0);
|
||||
}
|
||||
void add_maybe_i64(int64_t maybe_i64) {
|
||||
fbb_.AddElement<int64_t>(ScalarStuff::VT_MAYBE_I64, maybe_i64);
|
||||
}
|
||||
void add_default_i64(int64_t default_i64) {
|
||||
fbb_.AddElement<int64_t>(ScalarStuff::VT_DEFAULT_I64, default_i64, 42LL);
|
||||
}
|
||||
void add_just_u64(uint64_t just_u64) {
|
||||
fbb_.AddElement<uint64_t>(ScalarStuff::VT_JUST_U64, just_u64, 0);
|
||||
}
|
||||
void add_maybe_u64(uint64_t maybe_u64) {
|
||||
fbb_.AddElement<uint64_t>(ScalarStuff::VT_MAYBE_U64, maybe_u64);
|
||||
}
|
||||
void add_default_u64(uint64_t default_u64) {
|
||||
fbb_.AddElement<uint64_t>(ScalarStuff::VT_DEFAULT_U64, default_u64, 42ULL);
|
||||
}
|
||||
void add_just_f32(float just_f32) {
|
||||
fbb_.AddElement<float>(ScalarStuff::VT_JUST_F32, just_f32, 0.0f);
|
||||
}
|
||||
void add_maybe_f32(float maybe_f32) {
|
||||
fbb_.AddElement<float>(ScalarStuff::VT_MAYBE_F32, maybe_f32);
|
||||
}
|
||||
void add_default_f32(float default_f32) {
|
||||
fbb_.AddElement<float>(ScalarStuff::VT_DEFAULT_F32, default_f32, 42.0f);
|
||||
}
|
||||
void add_just_f64(double just_f64) {
|
||||
fbb_.AddElement<double>(ScalarStuff::VT_JUST_F64, just_f64, 0.0);
|
||||
}
|
||||
void add_maybe_f64(double maybe_f64) {
|
||||
fbb_.AddElement<double>(ScalarStuff::VT_MAYBE_F64, maybe_f64);
|
||||
}
|
||||
void add_default_f64(double default_f64) {
|
||||
fbb_.AddElement<double>(ScalarStuff::VT_DEFAULT_F64, default_f64, 42.0);
|
||||
}
|
||||
void add_just_bool(bool just_bool) {
|
||||
fbb_.AddElement<uint8_t>(ScalarStuff::VT_JUST_BOOL, static_cast<uint8_t>(just_bool), 0);
|
||||
}
|
||||
void add_maybe_bool(bool maybe_bool) {
|
||||
fbb_.AddElement<uint8_t>(ScalarStuff::VT_MAYBE_BOOL, static_cast<uint8_t>(maybe_bool));
|
||||
}
|
||||
void add_default_bool(bool default_bool) {
|
||||
fbb_.AddElement<uint8_t>(ScalarStuff::VT_DEFAULT_BOOL, static_cast<uint8_t>(default_bool), 1);
|
||||
}
|
||||
void add_just_enum(optional_scalars::OptionalByte just_enum) {
|
||||
fbb_.AddElement<int8_t>(ScalarStuff::VT_JUST_ENUM, static_cast<int8_t>(just_enum), 0);
|
||||
}
|
||||
void add_maybe_enum(optional_scalars::OptionalByte maybe_enum) {
|
||||
fbb_.AddElement<int8_t>(ScalarStuff::VT_MAYBE_ENUM, static_cast<int8_t>(maybe_enum));
|
||||
}
|
||||
void add_default_enum(optional_scalars::OptionalByte default_enum) {
|
||||
fbb_.AddElement<int8_t>(ScalarStuff::VT_DEFAULT_ENUM, static_cast<int8_t>(default_enum), 1);
|
||||
}
|
||||
explicit ScalarStuffBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<ScalarStuff> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<ScalarStuff>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<ScalarStuff> CreateScalarStuff(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int8_t just_i8 = 0,
|
||||
::flatbuffers::Optional<int8_t> maybe_i8 = ::flatbuffers::nullopt,
|
||||
int8_t default_i8 = 42,
|
||||
uint8_t just_u8 = 0,
|
||||
::flatbuffers::Optional<uint8_t> maybe_u8 = ::flatbuffers::nullopt,
|
||||
uint8_t default_u8 = 42,
|
||||
int16_t just_i16 = 0,
|
||||
::flatbuffers::Optional<int16_t> maybe_i16 = ::flatbuffers::nullopt,
|
||||
int16_t default_i16 = 42,
|
||||
uint16_t just_u16 = 0,
|
||||
::flatbuffers::Optional<uint16_t> maybe_u16 = ::flatbuffers::nullopt,
|
||||
uint16_t default_u16 = 42,
|
||||
int32_t just_i32 = 0,
|
||||
::flatbuffers::Optional<int32_t> maybe_i32 = ::flatbuffers::nullopt,
|
||||
int32_t default_i32 = 42,
|
||||
uint32_t just_u32 = 0,
|
||||
::flatbuffers::Optional<uint32_t> maybe_u32 = ::flatbuffers::nullopt,
|
||||
uint32_t default_u32 = 42,
|
||||
int64_t just_i64 = 0,
|
||||
::flatbuffers::Optional<int64_t> maybe_i64 = ::flatbuffers::nullopt,
|
||||
int64_t default_i64 = 42LL,
|
||||
uint64_t just_u64 = 0,
|
||||
::flatbuffers::Optional<uint64_t> maybe_u64 = ::flatbuffers::nullopt,
|
||||
uint64_t default_u64 = 42ULL,
|
||||
float just_f32 = 0.0f,
|
||||
::flatbuffers::Optional<float> maybe_f32 = ::flatbuffers::nullopt,
|
||||
float default_f32 = 42.0f,
|
||||
double just_f64 = 0.0,
|
||||
::flatbuffers::Optional<double> maybe_f64 = ::flatbuffers::nullopt,
|
||||
double default_f64 = 42.0,
|
||||
bool just_bool = false,
|
||||
::flatbuffers::Optional<bool> maybe_bool = ::flatbuffers::nullopt,
|
||||
bool default_bool = true,
|
||||
optional_scalars::OptionalByte just_enum = optional_scalars::OptionalByte_None,
|
||||
::flatbuffers::Optional<optional_scalars::OptionalByte> maybe_enum = ::flatbuffers::nullopt,
|
||||
optional_scalars::OptionalByte default_enum = optional_scalars::OptionalByte_One) {
|
||||
ScalarStuffBuilder builder_(_fbb);
|
||||
builder_.add_default_f64(default_f64);
|
||||
if(maybe_f64) { builder_.add_maybe_f64(*maybe_f64); }
|
||||
builder_.add_just_f64(just_f64);
|
||||
builder_.add_default_u64(default_u64);
|
||||
if(maybe_u64) { builder_.add_maybe_u64(*maybe_u64); }
|
||||
builder_.add_just_u64(just_u64);
|
||||
builder_.add_default_i64(default_i64);
|
||||
if(maybe_i64) { builder_.add_maybe_i64(*maybe_i64); }
|
||||
builder_.add_just_i64(just_i64);
|
||||
builder_.add_default_f32(default_f32);
|
||||
if(maybe_f32) { builder_.add_maybe_f32(*maybe_f32); }
|
||||
builder_.add_just_f32(just_f32);
|
||||
builder_.add_default_u32(default_u32);
|
||||
if(maybe_u32) { builder_.add_maybe_u32(*maybe_u32); }
|
||||
builder_.add_just_u32(just_u32);
|
||||
builder_.add_default_i32(default_i32);
|
||||
if(maybe_i32) { builder_.add_maybe_i32(*maybe_i32); }
|
||||
builder_.add_just_i32(just_i32);
|
||||
builder_.add_default_u16(default_u16);
|
||||
if(maybe_u16) { builder_.add_maybe_u16(*maybe_u16); }
|
||||
builder_.add_just_u16(just_u16);
|
||||
builder_.add_default_i16(default_i16);
|
||||
if(maybe_i16) { builder_.add_maybe_i16(*maybe_i16); }
|
||||
builder_.add_just_i16(just_i16);
|
||||
builder_.add_default_enum(default_enum);
|
||||
if(maybe_enum) { builder_.add_maybe_enum(*maybe_enum); }
|
||||
builder_.add_just_enum(just_enum);
|
||||
builder_.add_default_bool(default_bool);
|
||||
if(maybe_bool) { builder_.add_maybe_bool(*maybe_bool); }
|
||||
builder_.add_just_bool(just_bool);
|
||||
builder_.add_default_u8(default_u8);
|
||||
if(maybe_u8) { builder_.add_maybe_u8(*maybe_u8); }
|
||||
builder_.add_just_u8(just_u8);
|
||||
builder_.add_default_i8(default_i8);
|
||||
if(maybe_i8) { builder_.add_maybe_i8(*maybe_i8); }
|
||||
builder_.add_just_i8(just_i8);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<ScalarStuff> CreateScalarStuff(::flatbuffers::FlatBufferBuilder &_fbb, const ScalarStuffT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
|
||||
inline bool operator==(const ScalarStuffT &lhs, const ScalarStuffT &rhs) {
|
||||
return
|
||||
(lhs.just_i8 == rhs.just_i8) &&
|
||||
(lhs.maybe_i8 == rhs.maybe_i8) &&
|
||||
(lhs.default_i8 == rhs.default_i8) &&
|
||||
(lhs.just_u8 == rhs.just_u8) &&
|
||||
(lhs.maybe_u8 == rhs.maybe_u8) &&
|
||||
(lhs.default_u8 == rhs.default_u8) &&
|
||||
(lhs.just_i16 == rhs.just_i16) &&
|
||||
(lhs.maybe_i16 == rhs.maybe_i16) &&
|
||||
(lhs.default_i16 == rhs.default_i16) &&
|
||||
(lhs.just_u16 == rhs.just_u16) &&
|
||||
(lhs.maybe_u16 == rhs.maybe_u16) &&
|
||||
(lhs.default_u16 == rhs.default_u16) &&
|
||||
(lhs.just_i32 == rhs.just_i32) &&
|
||||
(lhs.maybe_i32 == rhs.maybe_i32) &&
|
||||
(lhs.default_i32 == rhs.default_i32) &&
|
||||
(lhs.just_u32 == rhs.just_u32) &&
|
||||
(lhs.maybe_u32 == rhs.maybe_u32) &&
|
||||
(lhs.default_u32 == rhs.default_u32) &&
|
||||
(lhs.just_i64 == rhs.just_i64) &&
|
||||
(lhs.maybe_i64 == rhs.maybe_i64) &&
|
||||
(lhs.default_i64 == rhs.default_i64) &&
|
||||
(lhs.just_u64 == rhs.just_u64) &&
|
||||
(lhs.maybe_u64 == rhs.maybe_u64) &&
|
||||
(lhs.default_u64 == rhs.default_u64) &&
|
||||
(lhs.just_f32 == rhs.just_f32) &&
|
||||
(lhs.maybe_f32 == rhs.maybe_f32) &&
|
||||
(lhs.default_f32 == rhs.default_f32) &&
|
||||
(lhs.just_f64 == rhs.just_f64) &&
|
||||
(lhs.maybe_f64 == rhs.maybe_f64) &&
|
||||
(lhs.default_f64 == rhs.default_f64) &&
|
||||
(lhs.just_bool == rhs.just_bool) &&
|
||||
(lhs.maybe_bool == rhs.maybe_bool) &&
|
||||
(lhs.default_bool == rhs.default_bool) &&
|
||||
(lhs.just_enum == rhs.just_enum) &&
|
||||
(lhs.maybe_enum == rhs.maybe_enum) &&
|
||||
(lhs.default_enum == rhs.default_enum);
|
||||
}
|
||||
|
||||
inline bool operator!=(const ScalarStuffT &lhs, const ScalarStuffT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline ScalarStuffT *ScalarStuff::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<ScalarStuffT>(new ScalarStuffT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void ScalarStuff::UnPackTo(ScalarStuffT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = just_i8(); _o->just_i8 = _e; }
|
||||
{ auto _e = maybe_i8(); _o->maybe_i8 = _e; }
|
||||
{ auto _e = default_i8(); _o->default_i8 = _e; }
|
||||
{ auto _e = just_u8(); _o->just_u8 = _e; }
|
||||
{ auto _e = maybe_u8(); _o->maybe_u8 = _e; }
|
||||
{ auto _e = default_u8(); _o->default_u8 = _e; }
|
||||
{ auto _e = just_i16(); _o->just_i16 = _e; }
|
||||
{ auto _e = maybe_i16(); _o->maybe_i16 = _e; }
|
||||
{ auto _e = default_i16(); _o->default_i16 = _e; }
|
||||
{ auto _e = just_u16(); _o->just_u16 = _e; }
|
||||
{ auto _e = maybe_u16(); _o->maybe_u16 = _e; }
|
||||
{ auto _e = default_u16(); _o->default_u16 = _e; }
|
||||
{ auto _e = just_i32(); _o->just_i32 = _e; }
|
||||
{ auto _e = maybe_i32(); _o->maybe_i32 = _e; }
|
||||
{ auto _e = default_i32(); _o->default_i32 = _e; }
|
||||
{ auto _e = just_u32(); _o->just_u32 = _e; }
|
||||
{ auto _e = maybe_u32(); _o->maybe_u32 = _e; }
|
||||
{ auto _e = default_u32(); _o->default_u32 = _e; }
|
||||
{ auto _e = just_i64(); _o->just_i64 = _e; }
|
||||
{ auto _e = maybe_i64(); _o->maybe_i64 = _e; }
|
||||
{ auto _e = default_i64(); _o->default_i64 = _e; }
|
||||
{ auto _e = just_u64(); _o->just_u64 = _e; }
|
||||
{ auto _e = maybe_u64(); _o->maybe_u64 = _e; }
|
||||
{ auto _e = default_u64(); _o->default_u64 = _e; }
|
||||
{ auto _e = just_f32(); _o->just_f32 = _e; }
|
||||
{ auto _e = maybe_f32(); _o->maybe_f32 = _e; }
|
||||
{ auto _e = default_f32(); _o->default_f32 = _e; }
|
||||
{ auto _e = just_f64(); _o->just_f64 = _e; }
|
||||
{ auto _e = maybe_f64(); _o->maybe_f64 = _e; }
|
||||
{ auto _e = default_f64(); _o->default_f64 = _e; }
|
||||
{ auto _e = just_bool(); _o->just_bool = _e; }
|
||||
{ auto _e = maybe_bool(); _o->maybe_bool = _e; }
|
||||
{ auto _e = default_bool(); _o->default_bool = _e; }
|
||||
{ auto _e = just_enum(); _o->just_enum = _e; }
|
||||
{ auto _e = maybe_enum(); _o->maybe_enum = _e; }
|
||||
{ auto _e = default_enum(); _o->default_enum = _e; }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<ScalarStuff> CreateScalarStuff(::flatbuffers::FlatBufferBuilder &_fbb, const ScalarStuffT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return ScalarStuff::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<ScalarStuff> ScalarStuff::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const ScalarStuffT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const ScalarStuffT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _just_i8 = _o->just_i8;
|
||||
auto _maybe_i8 = _o->maybe_i8;
|
||||
auto _default_i8 = _o->default_i8;
|
||||
auto _just_u8 = _o->just_u8;
|
||||
auto _maybe_u8 = _o->maybe_u8;
|
||||
auto _default_u8 = _o->default_u8;
|
||||
auto _just_i16 = _o->just_i16;
|
||||
auto _maybe_i16 = _o->maybe_i16;
|
||||
auto _default_i16 = _o->default_i16;
|
||||
auto _just_u16 = _o->just_u16;
|
||||
auto _maybe_u16 = _o->maybe_u16;
|
||||
auto _default_u16 = _o->default_u16;
|
||||
auto _just_i32 = _o->just_i32;
|
||||
auto _maybe_i32 = _o->maybe_i32;
|
||||
auto _default_i32 = _o->default_i32;
|
||||
auto _just_u32 = _o->just_u32;
|
||||
auto _maybe_u32 = _o->maybe_u32;
|
||||
auto _default_u32 = _o->default_u32;
|
||||
auto _just_i64 = _o->just_i64;
|
||||
auto _maybe_i64 = _o->maybe_i64;
|
||||
auto _default_i64 = _o->default_i64;
|
||||
auto _just_u64 = _o->just_u64;
|
||||
auto _maybe_u64 = _o->maybe_u64;
|
||||
auto _default_u64 = _o->default_u64;
|
||||
auto _just_f32 = _o->just_f32;
|
||||
auto _maybe_f32 = _o->maybe_f32;
|
||||
auto _default_f32 = _o->default_f32;
|
||||
auto _just_f64 = _o->just_f64;
|
||||
auto _maybe_f64 = _o->maybe_f64;
|
||||
auto _default_f64 = _o->default_f64;
|
||||
auto _just_bool = _o->just_bool;
|
||||
auto _maybe_bool = _o->maybe_bool;
|
||||
auto _default_bool = _o->default_bool;
|
||||
auto _just_enum = _o->just_enum;
|
||||
auto _maybe_enum = _o->maybe_enum;
|
||||
auto _default_enum = _o->default_enum;
|
||||
return optional_scalars::CreateScalarStuff(
|
||||
_fbb,
|
||||
_just_i8,
|
||||
_maybe_i8,
|
||||
_default_i8,
|
||||
_just_u8,
|
||||
_maybe_u8,
|
||||
_default_u8,
|
||||
_just_i16,
|
||||
_maybe_i16,
|
||||
_default_i16,
|
||||
_just_u16,
|
||||
_maybe_u16,
|
||||
_default_u16,
|
||||
_just_i32,
|
||||
_maybe_i32,
|
||||
_default_i32,
|
||||
_just_u32,
|
||||
_maybe_u32,
|
||||
_default_u32,
|
||||
_just_i64,
|
||||
_maybe_i64,
|
||||
_default_i64,
|
||||
_just_u64,
|
||||
_maybe_u64,
|
||||
_default_u64,
|
||||
_just_f32,
|
||||
_maybe_f32,
|
||||
_default_f32,
|
||||
_just_f64,
|
||||
_maybe_f64,
|
||||
_default_f64,
|
||||
_just_bool,
|
||||
_maybe_bool,
|
||||
_default_bool,
|
||||
_just_enum,
|
||||
_maybe_enum,
|
||||
_default_enum);
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *OptionalByteTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_CHAR, 0, 0 },
|
||||
{ ::flatbuffers::ET_CHAR, 0, 0 },
|
||||
{ ::flatbuffers::ET_CHAR, 0, 0 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
optional_scalars::OptionalByteTypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"None",
|
||||
"One",
|
||||
"Two"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_ENUM, 3, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *ScalarStuffTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_CHAR, 0, -1 },
|
||||
{ ::flatbuffers::ET_CHAR, 0, -1 },
|
||||
{ ::flatbuffers::ET_CHAR, 0, -1 },
|
||||
{ ::flatbuffers::ET_UCHAR, 0, -1 },
|
||||
{ ::flatbuffers::ET_UCHAR, 0, -1 },
|
||||
{ ::flatbuffers::ET_UCHAR, 0, -1 },
|
||||
{ ::flatbuffers::ET_SHORT, 0, -1 },
|
||||
{ ::flatbuffers::ET_SHORT, 0, -1 },
|
||||
{ ::flatbuffers::ET_SHORT, 0, -1 },
|
||||
{ ::flatbuffers::ET_USHORT, 0, -1 },
|
||||
{ ::flatbuffers::ET_USHORT, 0, -1 },
|
||||
{ ::flatbuffers::ET_USHORT, 0, -1 },
|
||||
{ ::flatbuffers::ET_INT, 0, -1 },
|
||||
{ ::flatbuffers::ET_INT, 0, -1 },
|
||||
{ ::flatbuffers::ET_INT, 0, -1 },
|
||||
{ ::flatbuffers::ET_UINT, 0, -1 },
|
||||
{ ::flatbuffers::ET_UINT, 0, -1 },
|
||||
{ ::flatbuffers::ET_UINT, 0, -1 },
|
||||
{ ::flatbuffers::ET_LONG, 0, -1 },
|
||||
{ ::flatbuffers::ET_LONG, 0, -1 },
|
||||
{ ::flatbuffers::ET_LONG, 0, -1 },
|
||||
{ ::flatbuffers::ET_ULONG, 0, -1 },
|
||||
{ ::flatbuffers::ET_ULONG, 0, -1 },
|
||||
{ ::flatbuffers::ET_ULONG, 0, -1 },
|
||||
{ ::flatbuffers::ET_FLOAT, 0, -1 },
|
||||
{ ::flatbuffers::ET_FLOAT, 0, -1 },
|
||||
{ ::flatbuffers::ET_FLOAT, 0, -1 },
|
||||
{ ::flatbuffers::ET_DOUBLE, 0, -1 },
|
||||
{ ::flatbuffers::ET_DOUBLE, 0, -1 },
|
||||
{ ::flatbuffers::ET_DOUBLE, 0, -1 },
|
||||
{ ::flatbuffers::ET_BOOL, 0, -1 },
|
||||
{ ::flatbuffers::ET_BOOL, 0, -1 },
|
||||
{ ::flatbuffers::ET_BOOL, 0, -1 },
|
||||
{ ::flatbuffers::ET_CHAR, 0, 0 },
|
||||
{ ::flatbuffers::ET_CHAR, 0, 0 },
|
||||
{ ::flatbuffers::ET_CHAR, 0, 0 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
optional_scalars::OptionalByteTypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"just_i8",
|
||||
"maybe_i8",
|
||||
"default_i8",
|
||||
"just_u8",
|
||||
"maybe_u8",
|
||||
"default_u8",
|
||||
"just_i16",
|
||||
"maybe_i16",
|
||||
"default_i16",
|
||||
"just_u16",
|
||||
"maybe_u16",
|
||||
"default_u16",
|
||||
"just_i32",
|
||||
"maybe_i32",
|
||||
"default_i32",
|
||||
"just_u32",
|
||||
"maybe_u32",
|
||||
"default_u32",
|
||||
"just_i64",
|
||||
"maybe_i64",
|
||||
"default_i64",
|
||||
"just_u64",
|
||||
"maybe_u64",
|
||||
"default_u64",
|
||||
"just_f32",
|
||||
"maybe_f32",
|
||||
"default_f32",
|
||||
"just_f64",
|
||||
"maybe_f64",
|
||||
"default_f64",
|
||||
"just_bool",
|
||||
"maybe_bool",
|
||||
"default_bool",
|
||||
"just_enum",
|
||||
"maybe_enum",
|
||||
"default_enum"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 36, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const optional_scalars::ScalarStuff *GetScalarStuff(const void *buf) {
|
||||
return ::flatbuffers::GetRoot<optional_scalars::ScalarStuff>(buf);
|
||||
}
|
||||
|
||||
inline const optional_scalars::ScalarStuff *GetSizePrefixedScalarStuff(const void *buf) {
|
||||
return ::flatbuffers::GetSizePrefixedRoot<optional_scalars::ScalarStuff>(buf);
|
||||
}
|
||||
|
||||
inline ScalarStuff *GetMutableScalarStuff(void *buf) {
|
||||
return ::flatbuffers::GetMutableRoot<ScalarStuff>(buf);
|
||||
}
|
||||
|
||||
inline optional_scalars::ScalarStuff *GetMutableSizePrefixedScalarStuff(void *buf) {
|
||||
return ::flatbuffers::GetMutableSizePrefixedRoot<optional_scalars::ScalarStuff>(buf);
|
||||
}
|
||||
|
||||
inline const char *ScalarStuffIdentifier() {
|
||||
return "NULL";
|
||||
}
|
||||
|
||||
inline bool ScalarStuffBufferHasIdentifier(const void *buf) {
|
||||
return ::flatbuffers::BufferHasIdentifier(
|
||||
buf, ScalarStuffIdentifier());
|
||||
}
|
||||
|
||||
inline bool SizePrefixedScalarStuffBufferHasIdentifier(const void *buf) {
|
||||
return ::flatbuffers::BufferHasIdentifier(
|
||||
buf, ScalarStuffIdentifier(), true);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifyScalarStuffBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifyBuffer<optional_scalars::ScalarStuff>(ScalarStuffIdentifier());
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifySizePrefixedScalarStuffBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifySizePrefixedBuffer<optional_scalars::ScalarStuff>(ScalarStuffIdentifier());
|
||||
}
|
||||
|
||||
inline const char *ScalarStuffExtension() {
|
||||
return "mon";
|
||||
}
|
||||
|
||||
inline void FinishScalarStuffBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<optional_scalars::ScalarStuff> root) {
|
||||
fbb.Finish(root, ScalarStuffIdentifier());
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedScalarStuffBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<optional_scalars::ScalarStuff> root) {
|
||||
fbb.FinishSizePrefixed(root, ScalarStuffIdentifier());
|
||||
}
|
||||
|
||||
inline std::unique_ptr<optional_scalars::ScalarStuffT> UnPackScalarStuff(
|
||||
const void *buf,
|
||||
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
||||
return std::unique_ptr<optional_scalars::ScalarStuffT>(GetScalarStuff(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
inline std::unique_ptr<optional_scalars::ScalarStuffT> UnPackSizePrefixedScalarStuff(
|
||||
const void *buf,
|
||||
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
||||
return std::unique_ptr<optional_scalars::ScalarStuffT>(GetSizePrefixedScalarStuff(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
} // namespace optional_scalars
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_OPTIONALSCALARS_OPTIONAL_SCALARS_H_
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "flatbuffers/idl.h"
|
||||
#include "optional_scalars_generated.h"
|
||||
#include "optional_scalars.fbs.h"
|
||||
#include "test_assert.h"
|
||||
|
||||
namespace flatbuffers {
|
||||
|
||||
@@ -2200,18 +2200,27 @@ def make_monster_from_generated_code(
|
||||
test2 = b.CreateString('test2')
|
||||
fred = b.CreateString('Fred')
|
||||
|
||||
inv = _MONSTER.MonsterCreateInventoryVector(b, range(5))
|
||||
_MONSTER.MonsterStartInventoryVector(b, 5)
|
||||
b.PrependByte(4)
|
||||
b.PrependByte(3)
|
||||
b.PrependByte(2)
|
||||
b.PrependByte(1)
|
||||
b.PrependByte(0)
|
||||
inv = b.EndVector()
|
||||
|
||||
_MONSTER.MonsterStart(b)
|
||||
_MONSTER.MonsterAddName(b, fred)
|
||||
mon2 = _MONSTER.MonsterEnd(b)
|
||||
|
||||
test4_structs = (_TEST.TestT(10, 20), _TEST.TestT(30, 40))
|
||||
test4 = _MONSTER.MonsterCreateTest4Vector(b, test4_structs)
|
||||
_MONSTER.MonsterStartTest4Vector(b, 2)
|
||||
_TEST.CreateTest(b, 10, 20)
|
||||
_TEST.CreateTest(b, 30, 40)
|
||||
test4 = b.EndVector()
|
||||
|
||||
testArrayOfString = _MONSTER.MonsterCreateTestarrayofstringVector(
|
||||
b, [test1, test2]
|
||||
)
|
||||
_MONSTER.MonsterStartTestarrayofstringVector(b, 2)
|
||||
b.PrependUOffsetTRelative(test2)
|
||||
b.PrependUOffsetTRelative(test1)
|
||||
testArrayOfString = b.EndVector()
|
||||
|
||||
_MONSTER.MonsterStartVectorOfLongsVector(b, 5)
|
||||
b.PrependInt64(100000000)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "monster_test.h"
|
||||
#include "monster_test_generated.h"
|
||||
#include "test_assert.h"
|
||||
#include "tests/arrays_test_generated.h"
|
||||
#include "tests/arrays_test.fbs.h"
|
||||
|
||||
namespace flatbuffers {
|
||||
namespace tests {
|
||||
|
||||
@@ -30,6 +30,14 @@ static A: TrackingAllocator = TrackingAllocator;
|
||||
// import the flatbuffers generated code:
|
||||
extern crate flatbuffers;
|
||||
|
||||
#[allow(dead_code, unused_imports, clippy::all)]
|
||||
#[path = "../../include_test1/mod.rs"]
|
||||
pub mod include_test1_generated;
|
||||
|
||||
#[allow(dead_code, unused_imports, clippy::all)]
|
||||
#[path = "../../include_test2/mod.rs"]
|
||||
pub mod include_test2_generated;
|
||||
|
||||
#[allow(dead_code, unused_imports, clippy::all)]
|
||||
#[path = "../../monster_test/mod.rs"]
|
||||
mod monster_test_generated;
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
#![allow(clippy::derivable_impls, clippy::all)]
|
||||
extern crate flatbuffers;
|
||||
|
||||
#[allow(dead_code, unused_imports)]
|
||||
#[path = "../../include_test1/mod.rs"]
|
||||
pub mod include_test1_generated;
|
||||
|
||||
#[allow(dead_code, unused_imports)]
|
||||
#[path = "../../include_test2/mod.rs"]
|
||||
pub mod include_test2_generated;
|
||||
|
||||
#[allow(dead_code, unused_imports, clippy::approx_constant)]
|
||||
#[path = "../../monster_test/mod.rs"]
|
||||
mod monster_test_generated;
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#[allow(dead_code, unused_imports, clippy::all)]
|
||||
#[path = "../../include_test1/mod.rs"]
|
||||
mod include_test1_generated;
|
||||
|
||||
#[allow(dead_code, unused_imports, clippy::all)]
|
||||
#[path = "../../include_test2/mod.rs"]
|
||||
mod include_test2_generated;
|
||||
|
||||
#[allow(dead_code, unused_imports, clippy::all)]
|
||||
#[path = "../../include_test1_generated.rs"]
|
||||
mod include_test1_standalone;
|
||||
|
||||
#[allow(dead_code, unused_imports, clippy::all)]
|
||||
#[path = "../../include_test2_generated.rs"]
|
||||
mod include_test2_standalone;
|
||||
@@ -48,6 +48,14 @@ mod flexbuffers_tests;
|
||||
mod more_defaults_test;
|
||||
mod optional_scalars_test;
|
||||
|
||||
#[allow(dead_code, unused_imports, clippy::all)]
|
||||
#[path = "../../include_test1/mod.rs"]
|
||||
pub mod include_test1_generated;
|
||||
|
||||
#[allow(dead_code, unused_imports, clippy::all)]
|
||||
#[path = "../../include_test2/mod.rs"]
|
||||
pub mod include_test2_generated;
|
||||
|
||||
#[allow(dead_code, unused_imports, clippy::all)]
|
||||
#[path = "../../namespace_test/mod.rs"]
|
||||
pub mod namespace_test_generated;
|
||||
|
||||
@@ -1,164 +0,0 @@
|
||||
/*
|
||||
* Copyright 2024 Google Inc. All rights reserved.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
//! Regression test for https://github.com/google/flatbuffers/issues/8894
|
||||
//!
|
||||
//! Tests that vtable memory is properly zeroed when building FlatBuffers.
|
||||
|
||||
extern crate alloc;
|
||||
extern crate flatbuffers;
|
||||
|
||||
use alloc::vec;
|
||||
use alloc::vec::Vec;
|
||||
use core::convert::Infallible;
|
||||
use core::cmp::max;
|
||||
use core::ops::{Deref, DerefMut};
|
||||
use core::ptr::write_bytes;
|
||||
|
||||
use flatbuffers::{Allocator, FlatBufferBuilder};
|
||||
|
||||
/// Custom allocator that pre-fills buffer with garbage (0xAA) to detect
|
||||
/// uninitialized memory bugs.
|
||||
struct GarbageFilledAllocator(Vec<u8>);
|
||||
|
||||
impl GarbageFilledAllocator {
|
||||
fn new(size: usize) -> Self {
|
||||
Self(vec![0xAA; size])
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for GarbageFilledAllocator {
|
||||
type Target = [u8];
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl DerefMut for GarbageFilledAllocator {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.0
|
||||
}
|
||||
}
|
||||
|
||||
// SAFETY: grow_downwards properly moves data and the new space is filled with garbage
|
||||
// (intentionally, to detect bugs where code assumes zeroed memory)
|
||||
unsafe impl Allocator for GarbageFilledAllocator {
|
||||
type Error = Infallible;
|
||||
|
||||
fn grow_downwards(&mut self) -> Result<(), Self::Error> {
|
||||
let old_len = self.0.len();
|
||||
let new_len = max(1, old_len * 2);
|
||||
|
||||
// Resize and fill new space with garbage
|
||||
self.0.resize(new_len, 0xAA);
|
||||
|
||||
if new_len == 1 {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// Move old data to the end
|
||||
let middle = new_len / 2;
|
||||
{
|
||||
let (left, right) = &mut self.0[..].split_at_mut(middle);
|
||||
right.copy_from_slice(left);
|
||||
}
|
||||
// Fill old space with garbage (NOT zeros)
|
||||
{
|
||||
let ptr = self.0[..middle].as_mut_ptr();
|
||||
unsafe {
|
||||
write_bytes(ptr, 0xAA, middle);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn len(&self) -> usize {
|
||||
self.0.len()
|
||||
}
|
||||
}
|
||||
|
||||
/// Regression test for https://github.com/google/flatbuffers/issues/8894
|
||||
///
|
||||
/// The bug: write_vtable() called make_space() which only reserves memory
|
||||
/// but doesn't zero it. If the allocator's buffer contains garbage data,
|
||||
/// vtable entries for fields with default values would contain garbage
|
||||
/// instead of zero (which indicates "use default").
|
||||
///
|
||||
/// This test uses a garbage-filled allocator to detect if vtable memory
|
||||
/// is properly zeroed before being written.
|
||||
#[test]
|
||||
fn test_vtable_zeroed_with_garbage_allocator() {
|
||||
// Create a builder with garbage-filled allocator
|
||||
let allocator = GarbageFilledAllocator::new(256);
|
||||
let mut builder: FlatBufferBuilder<GarbageFilledAllocator> =
|
||||
FlatBufferBuilder::new_in(allocator);
|
||||
|
||||
// Start a table
|
||||
let table_start = builder.start_table();
|
||||
|
||||
// Set a field at a HIGH slot ID (14) to force a larger vtable.
|
||||
// This leaves slots 4, 6, 8, 10, 12 unset (should be zero).
|
||||
// VTable layout: [vtable_size:2][table_size:2][field0:2][field1:2][field2:2][field3:2][field4:2][field5:2]
|
||||
// Offsets: 0 2 4 6 8 10 12 14
|
||||
builder.push_slot::<u32>(14, 42, 0); // Set field 5 (at vtable offset 14) to 42
|
||||
|
||||
// End the table - this calls write_vtable()
|
||||
let table_end = builder.end_table(table_start);
|
||||
|
||||
// Finish the buffer
|
||||
builder.finish(table_end, None);
|
||||
|
||||
let data = builder.finished_data();
|
||||
|
||||
// Read the root table offset (first 4 bytes, little-endian)
|
||||
let root_offset = u32::from_le_bytes([data[0], data[1], data[2], data[3]]) as usize;
|
||||
let table_pos = root_offset;
|
||||
|
||||
// Read the vtable offset (signed, at table position)
|
||||
let vtable_offset = i32::from_le_bytes([
|
||||
data[table_pos],
|
||||
data[table_pos + 1],
|
||||
data[table_pos + 2],
|
||||
data[table_pos + 3],
|
||||
]);
|
||||
let vtable_pos = (table_pos as i32 - vtable_offset) as usize;
|
||||
|
||||
// Read vtable size (first 2 bytes of vtable)
|
||||
let vtable_size = u16::from_le_bytes([data[vtable_pos], data[vtable_pos + 1]]) as usize;
|
||||
|
||||
// Verify vtable structure is as expected (16 bytes total for 6 fields + header)
|
||||
assert_eq!(
|
||||
vtable_size, 16,
|
||||
"VTable should be 16 bytes (4 header + 6*2 fields)"
|
||||
);
|
||||
|
||||
// Check that unset fields (at offsets 4, 6, 8, 10, 12) are zero.
|
||||
// Only field at offset 14 was set.
|
||||
// If the bug exists, unset fields would be 0xAAAA instead of 0.
|
||||
for i in [4_usize, 6, 8, 10, 12] {
|
||||
let field_offset = u16::from_le_bytes([data[vtable_pos + i], data[vtable_pos + i + 1]]);
|
||||
assert_eq!(
|
||||
field_offset, 0,
|
||||
"Vtable entry at offset {} should be 0 (default), but was 0x{:04X}. \
|
||||
This indicates uninitialized vtable memory (issue #8894).",
|
||||
i, field_offset
|
||||
);
|
||||
}
|
||||
|
||||
// Verify the field we DID set has a non-zero offset
|
||||
let field5_offset = u16::from_le_bytes([data[vtable_pos + 14], data[vtable_pos + 14 + 1]]);
|
||||
assert_ne!(field5_offset, 0, "Field 5 should have a non-zero offset");
|
||||
}
|
||||
@@ -2,56 +2,61 @@
|
||||
|
||||
# namespace: example
|
||||
|
||||
from typing import Any
|
||||
import flatbuffers
|
||||
|
||||
|
||||
class HelloRequest(object):
|
||||
__slots__ = ['_tab']
|
||||
__slots__ = ['_tab']
|
||||
|
||||
@classmethod
|
||||
def GetRootAs(cls, buf, offset=0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
||||
x = HelloRequest()
|
||||
x.Init(buf, n + offset)
|
||||
return x
|
||||
@classmethod
|
||||
def GetRootAs(cls, buf, offset: int = 0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
||||
x = HelloRequest()
|
||||
x.Init(buf, n + offset)
|
||||
return x
|
||||
|
||||
@classmethod
|
||||
def GetRootAsHelloRequest(cls, buf, offset=0):
|
||||
"""This method is deprecated. Please switch to GetRootAs."""
|
||||
return cls.GetRootAs(buf, offset)
|
||||
# HelloRequest
|
||||
def Init(self, buf, pos):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
@classmethod
|
||||
def GetRootAsHelloRequest(cls, buf, offset=0):
|
||||
"""This method is deprecated. Please switch to GetRootAs."""
|
||||
return cls.GetRootAs(buf, offset)
|
||||
|
||||
def HelloRequestStart(builder):
|
||||
builder.StartObject(0)
|
||||
# HelloRequest
|
||||
def Init(self, buf: bytes, pos: int):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
def HelloRequestEnd(builder):
|
||||
return builder.EndObject()
|
||||
|
||||
def HelloRequestStart(builder: flatbuffers.Builder):
|
||||
builder.StartObject(0)
|
||||
|
||||
|
||||
def HelloRequestEnd(builder: flatbuffers.Builder) -> int:
|
||||
return builder.EndObject()
|
||||
|
||||
|
||||
class HelloResponse(object):
|
||||
__slots__ = ['_tab']
|
||||
__slots__ = ['_tab']
|
||||
|
||||
@classmethod
|
||||
def GetRootAs(cls, buf, offset=0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
||||
x = HelloResponse()
|
||||
x.Init(buf, n + offset)
|
||||
return x
|
||||
@classmethod
|
||||
def GetRootAs(cls, buf, offset: int = 0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
||||
x = HelloResponse()
|
||||
x.Init(buf, n + offset)
|
||||
return x
|
||||
|
||||
@classmethod
|
||||
def GetRootAsHelloResponse(cls, buf, offset=0):
|
||||
"""This method is deprecated. Please switch to GetRootAs."""
|
||||
return cls.GetRootAs(buf, offset)
|
||||
# HelloResponse
|
||||
def Init(self, buf, pos):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
@classmethod
|
||||
def GetRootAsHelloResponse(cls, buf, offset=0):
|
||||
"""This method is deprecated. Please switch to GetRootAs."""
|
||||
return cls.GetRootAs(buf, offset)
|
||||
|
||||
def HelloResponseStart(builder):
|
||||
builder.StartObject(0)
|
||||
|
||||
def HelloResponseEnd(builder):
|
||||
return builder.EndObject()
|
||||
# HelloResponse
|
||||
def Init(self, buf: bytes, pos: int):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
|
||||
def HelloResponseStart(builder: flatbuffers.Builder):
|
||||
builder.StartObject(0)
|
||||
|
||||
|
||||
def HelloResponseEnd(builder: flatbuffers.Builder) -> int:
|
||||
return builder.EndObject()
|
||||
|
||||
@@ -47,15 +47,15 @@
|
||||
#include "key_field_test.h"
|
||||
#include "monster_test.h"
|
||||
#include "monster_test_generated.h"
|
||||
#include "native_inline_table_test_generated.h"
|
||||
#include "native_inline_table_test.fbs.h"
|
||||
#include "optional_scalars_test.h"
|
||||
#include "parser_test.h"
|
||||
#include "proto_test.h"
|
||||
#include "reflection_test.h"
|
||||
#include "tests/union_vector/union_vector_generated.h"
|
||||
#include "union_underlying_type_test_generated.h"
|
||||
#include "tests/union_vector/union_vector.fbs.h"
|
||||
#include "union_underlying_type_test.fbs.h"
|
||||
#if !defined(_MSC_VER) || _MSC_VER >= 1700
|
||||
#include "tests/arrays_test_generated.h"
|
||||
#include "tests/arrays_test.fbs.h"
|
||||
#endif
|
||||
#if INCLUDE_64_BIT_TESTS
|
||||
#include "tests/64bit/offset64_test.h"
|
||||
@@ -63,7 +63,7 @@
|
||||
#include "flexbuffers_test.h"
|
||||
#include "is_quiet_nan.h"
|
||||
#include "monster_test_bfbs_generated.h" // Generated using --bfbs-comments --bfbs-builtins --cpp --bfbs-gen-embed
|
||||
#include "native_type_test_generated.h"
|
||||
#include "native_type_test.fbs.h"
|
||||
#include "test_assert.h"
|
||||
#include "util_test.h"
|
||||
#include "vector_table_naked_ptr_test.h"
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
import assert from 'assert'
|
||||
import * as flatbuffers from 'flatbuffers'
|
||||
|
||||
import optional_scalars from './ts-undefined-for-optionals/optional_scalars_generated.cjs'
|
||||
|
||||
const { ScalarStuff, ScalarStuffT } = optional_scalars.optional_scalars;
|
||||
|
||||
function testScalarStuffBuf(scalarStuff) {
|
||||
assert.strictEqual(scalarStuff.justI8(), -1);
|
||||
assert.strictEqual(scalarStuff.maybeI8(), undefined);
|
||||
assert.strictEqual(scalarStuff.defaultI8(), 42);
|
||||
assert.strictEqual(scalarStuff.justU8(), 1);
|
||||
assert.strictEqual(scalarStuff.maybeU8(), undefined);
|
||||
assert.strictEqual(scalarStuff.defaultU8(), 42);
|
||||
}
|
||||
|
||||
function testScalarStuffUnpack(scalarStuff) {
|
||||
assert.strictEqual(scalarStuff.justI8, -1);
|
||||
assert.strictEqual(scalarStuff.maybeI8, undefined);
|
||||
assert.strictEqual(scalarStuff.defaultI8, 42);
|
||||
assert.strictEqual(scalarStuff.justU8, 1);
|
||||
assert.strictEqual(scalarStuff.maybeU8, undefined);
|
||||
assert.strictEqual(scalarStuff.defaultU8, 42);
|
||||
}
|
||||
|
||||
function createScalarStuff(fbb) {
|
||||
ScalarStuff.startScalarStuff(fbb);
|
||||
ScalarStuff.addJustI8(fbb, -1);
|
||||
ScalarStuff.addJustU8(fbb, 1);
|
||||
var offset = ScalarStuff.endScalarStuff(fbb);
|
||||
ScalarStuff.finishScalarStuffBuffer(fbb, offset);
|
||||
}
|
||||
|
||||
function main() {
|
||||
var fbb = new flatbuffers.Builder();
|
||||
|
||||
createScalarStuff(fbb);
|
||||
|
||||
var buf = new flatbuffers.ByteBuffer(fbb.asUint8Array());
|
||||
var scalarStuff = ScalarStuff.getRootAsScalarStuff(buf);
|
||||
|
||||
testScalarStuffBuf(scalarStuff);
|
||||
|
||||
testScalarStuffUnpack(scalarStuff.unpack());
|
||||
|
||||
var scalarStuff_to = new ScalarStuffT();
|
||||
scalarStuff.unpackTo(scalarStuff_to);
|
||||
|
||||
testScalarStuffUnpack(scalarStuff_to);
|
||||
|
||||
fbb.clear();
|
||||
ScalarStuff.finishScalarStuffBuffer(fbb, scalarStuff_to.pack(fbb));
|
||||
var unpackBuf = new flatbuffers.ByteBuffer(fbb.asUint8Array());
|
||||
|
||||
testScalarStuffBuf(ScalarStuff.getRootAsScalarStuff(unpackBuf));
|
||||
|
||||
console.log('FlatBuffers --ts-undefined-for-optionals test: completed successfully');
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -99,20 +99,6 @@ flatc(
|
||||
schema="../non_zero_enum.fbs",
|
||||
)
|
||||
|
||||
flatc(
|
||||
options=[
|
||||
"--ts",
|
||||
"--gen-object-api",
|
||||
"--ts-undefined-for-optionals",
|
||||
],
|
||||
schema="../optional_scalars.fbs",
|
||||
prefix="ts-undefined-for-optionals",
|
||||
)
|
||||
esbuild(
|
||||
"ts-undefined-for-optionals/optional_scalars.ts",
|
||||
"ts-undefined-for-optionals/optional_scalars_generated.cjs",
|
||||
)
|
||||
|
||||
flatc(
|
||||
options=[
|
||||
"--ts",
|
||||
@@ -215,7 +201,6 @@ check_call(NODE_CMD + ["JavaScriptUnionVectorTest"])
|
||||
check_call(NODE_CMD + ["JavaScriptFlexBuffersTest"])
|
||||
check_call(NODE_CMD + ["JavaScriptComplexArraysTest"])
|
||||
check_call(NODE_CMD + ["JavaScriptUnionUnderlyingTypeTest"])
|
||||
check_call(NODE_CMD + ["JavaScriptUndefinedForOptionals"])
|
||||
|
||||
print("Running old v1 TypeScript Tests...")
|
||||
check_call(NODE_CMD + ["JavaScriptTestv1.cjs", "./monster_test_generated.cjs"])
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
export { OptionalByte } from './optional-scalars/optional-byte.js';
|
||||
export { ScalarStuff, ScalarStuffT } from './optional-scalars/scalar-stuff.js';
|
||||
@@ -1,9 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
export enum OptionalByte {
|
||||
None = 0,
|
||||
One = 1,
|
||||
Two = 2
|
||||
}
|
||||
@@ -1,589 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { OptionalByte } from '../optional-scalars/optional-byte.js';
|
||||
|
||||
|
||||
export class ScalarStuff implements flatbuffers.IUnpackableObject<ScalarStuffT> {
|
||||
bb: flatbuffers.ByteBuffer|undefined = undefined;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):ScalarStuff {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsScalarStuff(bb:flatbuffers.ByteBuffer, obj?:ScalarStuff):ScalarStuff {
|
||||
return (obj || new ScalarStuff()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsScalarStuff(bb:flatbuffers.ByteBuffer, obj?:ScalarStuff):ScalarStuff {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new ScalarStuff()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean {
|
||||
return bb.__has_identifier('NULL');
|
||||
}
|
||||
|
||||
justI8():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt8(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
maybeI8():number|undefined {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt8(this.bb_pos + offset) : undefined;
|
||||
}
|
||||
|
||||
defaultI8():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt8(this.bb_pos + offset) : 42;
|
||||
}
|
||||
|
||||
justU8():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.readUint8(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
maybeU8():number|undefined {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset ? this.bb!.readUint8(this.bb_pos + offset) : undefined;
|
||||
}
|
||||
|
||||
defaultU8():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 14);
|
||||
return offset ? this.bb!.readUint8(this.bb_pos + offset) : 42;
|
||||
}
|
||||
|
||||
justI16():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 16);
|
||||
return offset ? this.bb!.readInt16(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
maybeI16():number|undefined {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 18);
|
||||
return offset ? this.bb!.readInt16(this.bb_pos + offset) : undefined;
|
||||
}
|
||||
|
||||
defaultI16():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 20);
|
||||
return offset ? this.bb!.readInt16(this.bb_pos + offset) : 42;
|
||||
}
|
||||
|
||||
justU16():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 22);
|
||||
return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
maybeU16():number|undefined {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 24);
|
||||
return offset ? this.bb!.readUint16(this.bb_pos + offset) : undefined;
|
||||
}
|
||||
|
||||
defaultU16():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 26);
|
||||
return offset ? this.bb!.readUint16(this.bb_pos + offset) : 42;
|
||||
}
|
||||
|
||||
justI32():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 28);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
maybeI32():number|undefined {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 30);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : undefined;
|
||||
}
|
||||
|
||||
defaultI32():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 32);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 42;
|
||||
}
|
||||
|
||||
justU32():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 34);
|
||||
return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
maybeU32():number|undefined {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 36);
|
||||
return offset ? this.bb!.readUint32(this.bb_pos + offset) : undefined;
|
||||
}
|
||||
|
||||
defaultU32():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 38);
|
||||
return offset ? this.bb!.readUint32(this.bb_pos + offset) : 42;
|
||||
}
|
||||
|
||||
justI64():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 40);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
maybeI64():bigint|undefined {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 42);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : undefined;
|
||||
}
|
||||
|
||||
defaultI64():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 44);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('42');
|
||||
}
|
||||
|
||||
justU64():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 46);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
maybeU64():bigint|undefined {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 48);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : undefined;
|
||||
}
|
||||
|
||||
defaultU64():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 50);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('42');
|
||||
}
|
||||
|
||||
justF32():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 52);
|
||||
return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
|
||||
}
|
||||
|
||||
maybeF32():number|undefined {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 54);
|
||||
return offset ? this.bb!.readFloat32(this.bb_pos + offset) : undefined;
|
||||
}
|
||||
|
||||
defaultF32():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 56);
|
||||
return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 42.0;
|
||||
}
|
||||
|
||||
justF64():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 58);
|
||||
return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
|
||||
}
|
||||
|
||||
maybeF64():number|undefined {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 60);
|
||||
return offset ? this.bb!.readFloat64(this.bb_pos + offset) : undefined;
|
||||
}
|
||||
|
||||
defaultF64():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 62);
|
||||
return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 42.0;
|
||||
}
|
||||
|
||||
justBool():boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 64);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
maybeBool():boolean|undefined {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 66);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : undefined;
|
||||
}
|
||||
|
||||
defaultBool():boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 68);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : true;
|
||||
}
|
||||
|
||||
justEnum():OptionalByte {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 70);
|
||||
return offset ? this.bb!.readInt8(this.bb_pos + offset) : OptionalByte.None;
|
||||
}
|
||||
|
||||
maybeEnum():OptionalByte|undefined {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 72);
|
||||
return offset ? this.bb!.readInt8(this.bb_pos + offset) : undefined;
|
||||
}
|
||||
|
||||
defaultEnum():OptionalByte {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 74);
|
||||
return offset ? this.bb!.readInt8(this.bb_pos + offset) : OptionalByte.One;
|
||||
}
|
||||
|
||||
static startScalarStuff(builder:flatbuffers.Builder) {
|
||||
builder.startObject(36);
|
||||
}
|
||||
|
||||
static addJustI8(builder:flatbuffers.Builder, justI8:number) {
|
||||
builder.addFieldInt8(0, justI8, 0);
|
||||
}
|
||||
|
||||
static addMaybeI8(builder:flatbuffers.Builder, maybeI8:number) {
|
||||
builder.addFieldInt8(1, maybeI8, undefined);
|
||||
}
|
||||
|
||||
static addDefaultI8(builder:flatbuffers.Builder, defaultI8:number) {
|
||||
builder.addFieldInt8(2, defaultI8, 42);
|
||||
}
|
||||
|
||||
static addJustU8(builder:flatbuffers.Builder, justU8:number) {
|
||||
builder.addFieldInt8(3, justU8, 0);
|
||||
}
|
||||
|
||||
static addMaybeU8(builder:flatbuffers.Builder, maybeU8:number) {
|
||||
builder.addFieldInt8(4, maybeU8, undefined);
|
||||
}
|
||||
|
||||
static addDefaultU8(builder:flatbuffers.Builder, defaultU8:number) {
|
||||
builder.addFieldInt8(5, defaultU8, 42);
|
||||
}
|
||||
|
||||
static addJustI16(builder:flatbuffers.Builder, justI16:number) {
|
||||
builder.addFieldInt16(6, justI16, 0);
|
||||
}
|
||||
|
||||
static addMaybeI16(builder:flatbuffers.Builder, maybeI16:number) {
|
||||
builder.addFieldInt16(7, maybeI16, undefined);
|
||||
}
|
||||
|
||||
static addDefaultI16(builder:flatbuffers.Builder, defaultI16:number) {
|
||||
builder.addFieldInt16(8, defaultI16, 42);
|
||||
}
|
||||
|
||||
static addJustU16(builder:flatbuffers.Builder, justU16:number) {
|
||||
builder.addFieldInt16(9, justU16, 0);
|
||||
}
|
||||
|
||||
static addMaybeU16(builder:flatbuffers.Builder, maybeU16:number) {
|
||||
builder.addFieldInt16(10, maybeU16, undefined);
|
||||
}
|
||||
|
||||
static addDefaultU16(builder:flatbuffers.Builder, defaultU16:number) {
|
||||
builder.addFieldInt16(11, defaultU16, 42);
|
||||
}
|
||||
|
||||
static addJustI32(builder:flatbuffers.Builder, justI32:number) {
|
||||
builder.addFieldInt32(12, justI32, 0);
|
||||
}
|
||||
|
||||
static addMaybeI32(builder:flatbuffers.Builder, maybeI32:number) {
|
||||
builder.addFieldInt32(13, maybeI32, undefined);
|
||||
}
|
||||
|
||||
static addDefaultI32(builder:flatbuffers.Builder, defaultI32:number) {
|
||||
builder.addFieldInt32(14, defaultI32, 42);
|
||||
}
|
||||
|
||||
static addJustU32(builder:flatbuffers.Builder, justU32:number) {
|
||||
builder.addFieldInt32(15, justU32, 0);
|
||||
}
|
||||
|
||||
static addMaybeU32(builder:flatbuffers.Builder, maybeU32:number) {
|
||||
builder.addFieldInt32(16, maybeU32, undefined);
|
||||
}
|
||||
|
||||
static addDefaultU32(builder:flatbuffers.Builder, defaultU32:number) {
|
||||
builder.addFieldInt32(17, defaultU32, 42);
|
||||
}
|
||||
|
||||
static addJustI64(builder:flatbuffers.Builder, justI64:bigint) {
|
||||
builder.addFieldInt64(18, justI64, BigInt('0'));
|
||||
}
|
||||
|
||||
static addMaybeI64(builder:flatbuffers.Builder, maybeI64:bigint) {
|
||||
builder.addFieldInt64(19, maybeI64, undefined);
|
||||
}
|
||||
|
||||
static addDefaultI64(builder:flatbuffers.Builder, defaultI64:bigint) {
|
||||
builder.addFieldInt64(20, defaultI64, BigInt('42'));
|
||||
}
|
||||
|
||||
static addJustU64(builder:flatbuffers.Builder, justU64:bigint) {
|
||||
builder.addFieldInt64(21, justU64, BigInt('0'));
|
||||
}
|
||||
|
||||
static addMaybeU64(builder:flatbuffers.Builder, maybeU64:bigint) {
|
||||
builder.addFieldInt64(22, maybeU64, undefined);
|
||||
}
|
||||
|
||||
static addDefaultU64(builder:flatbuffers.Builder, defaultU64:bigint) {
|
||||
builder.addFieldInt64(23, defaultU64, BigInt('42'));
|
||||
}
|
||||
|
||||
static addJustF32(builder:flatbuffers.Builder, justF32:number) {
|
||||
builder.addFieldFloat32(24, justF32, 0.0);
|
||||
}
|
||||
|
||||
static addMaybeF32(builder:flatbuffers.Builder, maybeF32:number) {
|
||||
builder.addFieldFloat32(25, maybeF32, undefined);
|
||||
}
|
||||
|
||||
static addDefaultF32(builder:flatbuffers.Builder, defaultF32:number) {
|
||||
builder.addFieldFloat32(26, defaultF32, 42.0);
|
||||
}
|
||||
|
||||
static addJustF64(builder:flatbuffers.Builder, justF64:number) {
|
||||
builder.addFieldFloat64(27, justF64, 0.0);
|
||||
}
|
||||
|
||||
static addMaybeF64(builder:flatbuffers.Builder, maybeF64:number) {
|
||||
builder.addFieldFloat64(28, maybeF64, undefined);
|
||||
}
|
||||
|
||||
static addDefaultF64(builder:flatbuffers.Builder, defaultF64:number) {
|
||||
builder.addFieldFloat64(29, defaultF64, 42.0);
|
||||
}
|
||||
|
||||
static addJustBool(builder:flatbuffers.Builder, justBool:boolean) {
|
||||
builder.addFieldInt8(30, +justBool, +false);
|
||||
}
|
||||
|
||||
static addMaybeBool(builder:flatbuffers.Builder, maybeBool:boolean) {
|
||||
builder.addFieldInt8(31, +maybeBool, undefined);
|
||||
}
|
||||
|
||||
static addDefaultBool(builder:flatbuffers.Builder, defaultBool:boolean) {
|
||||
builder.addFieldInt8(32, +defaultBool, +true);
|
||||
}
|
||||
|
||||
static addJustEnum(builder:flatbuffers.Builder, justEnum:OptionalByte) {
|
||||
builder.addFieldInt8(33, justEnum, OptionalByte.None);
|
||||
}
|
||||
|
||||
static addMaybeEnum(builder:flatbuffers.Builder, maybeEnum:OptionalByte) {
|
||||
builder.addFieldInt8(34, maybeEnum, undefined);
|
||||
}
|
||||
|
||||
static addDefaultEnum(builder:flatbuffers.Builder, defaultEnum:OptionalByte) {
|
||||
builder.addFieldInt8(35, defaultEnum, OptionalByte.One);
|
||||
}
|
||||
|
||||
static endScalarStuff(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static finishScalarStuffBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
|
||||
builder.finish(offset, 'NULL');
|
||||
}
|
||||
|
||||
static finishSizePrefixedScalarStuffBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
|
||||
builder.finish(offset, 'NULL', true);
|
||||
}
|
||||
|
||||
static createScalarStuff(builder:flatbuffers.Builder, justI8:number, maybeI8:number|undefined, defaultI8:number, justU8:number, maybeU8:number|undefined, defaultU8:number, justI16:number, maybeI16:number|undefined, defaultI16:number, justU16:number, maybeU16:number|undefined, defaultU16:number, justI32:number, maybeI32:number|undefined, defaultI32:number, justU32:number, maybeU32:number|undefined, defaultU32:number, justI64:bigint, maybeI64:bigint|undefined, defaultI64:bigint, justU64:bigint, maybeU64:bigint|undefined, defaultU64:bigint, justF32:number, maybeF32:number|undefined, defaultF32:number, justF64:number, maybeF64:number|undefined, defaultF64:number, justBool:boolean, maybeBool:boolean|undefined, defaultBool:boolean, justEnum:OptionalByte, maybeEnum:OptionalByte|undefined, defaultEnum:OptionalByte):flatbuffers.Offset {
|
||||
ScalarStuff.startScalarStuff(builder);
|
||||
ScalarStuff.addJustI8(builder, justI8);
|
||||
if (maybeI8 !== undefined)
|
||||
ScalarStuff.addMaybeI8(builder, maybeI8);
|
||||
ScalarStuff.addDefaultI8(builder, defaultI8);
|
||||
ScalarStuff.addJustU8(builder, justU8);
|
||||
if (maybeU8 !== undefined)
|
||||
ScalarStuff.addMaybeU8(builder, maybeU8);
|
||||
ScalarStuff.addDefaultU8(builder, defaultU8);
|
||||
ScalarStuff.addJustI16(builder, justI16);
|
||||
if (maybeI16 !== undefined)
|
||||
ScalarStuff.addMaybeI16(builder, maybeI16);
|
||||
ScalarStuff.addDefaultI16(builder, defaultI16);
|
||||
ScalarStuff.addJustU16(builder, justU16);
|
||||
if (maybeU16 !== undefined)
|
||||
ScalarStuff.addMaybeU16(builder, maybeU16);
|
||||
ScalarStuff.addDefaultU16(builder, defaultU16);
|
||||
ScalarStuff.addJustI32(builder, justI32);
|
||||
if (maybeI32 !== undefined)
|
||||
ScalarStuff.addMaybeI32(builder, maybeI32);
|
||||
ScalarStuff.addDefaultI32(builder, defaultI32);
|
||||
ScalarStuff.addJustU32(builder, justU32);
|
||||
if (maybeU32 !== undefined)
|
||||
ScalarStuff.addMaybeU32(builder, maybeU32);
|
||||
ScalarStuff.addDefaultU32(builder, defaultU32);
|
||||
ScalarStuff.addJustI64(builder, justI64);
|
||||
if (maybeI64 !== undefined)
|
||||
ScalarStuff.addMaybeI64(builder, maybeI64);
|
||||
ScalarStuff.addDefaultI64(builder, defaultI64);
|
||||
ScalarStuff.addJustU64(builder, justU64);
|
||||
if (maybeU64 !== undefined)
|
||||
ScalarStuff.addMaybeU64(builder, maybeU64);
|
||||
ScalarStuff.addDefaultU64(builder, defaultU64);
|
||||
ScalarStuff.addJustF32(builder, justF32);
|
||||
if (maybeF32 !== undefined)
|
||||
ScalarStuff.addMaybeF32(builder, maybeF32);
|
||||
ScalarStuff.addDefaultF32(builder, defaultF32);
|
||||
ScalarStuff.addJustF64(builder, justF64);
|
||||
if (maybeF64 !== undefined)
|
||||
ScalarStuff.addMaybeF64(builder, maybeF64);
|
||||
ScalarStuff.addDefaultF64(builder, defaultF64);
|
||||
ScalarStuff.addJustBool(builder, justBool);
|
||||
if (maybeBool !== undefined)
|
||||
ScalarStuff.addMaybeBool(builder, maybeBool);
|
||||
ScalarStuff.addDefaultBool(builder, defaultBool);
|
||||
ScalarStuff.addJustEnum(builder, justEnum);
|
||||
if (maybeEnum !== undefined)
|
||||
ScalarStuff.addMaybeEnum(builder, maybeEnum);
|
||||
ScalarStuff.addDefaultEnum(builder, defaultEnum);
|
||||
return ScalarStuff.endScalarStuff(builder);
|
||||
}
|
||||
|
||||
unpack(): ScalarStuffT {
|
||||
return new ScalarStuffT(
|
||||
this.justI8(),
|
||||
this.maybeI8(),
|
||||
this.defaultI8(),
|
||||
this.justU8(),
|
||||
this.maybeU8(),
|
||||
this.defaultU8(),
|
||||
this.justI16(),
|
||||
this.maybeI16(),
|
||||
this.defaultI16(),
|
||||
this.justU16(),
|
||||
this.maybeU16(),
|
||||
this.defaultU16(),
|
||||
this.justI32(),
|
||||
this.maybeI32(),
|
||||
this.defaultI32(),
|
||||
this.justU32(),
|
||||
this.maybeU32(),
|
||||
this.defaultU32(),
|
||||
this.justI64(),
|
||||
this.maybeI64(),
|
||||
this.defaultI64(),
|
||||
this.justU64(),
|
||||
this.maybeU64(),
|
||||
this.defaultU64(),
|
||||
this.justF32(),
|
||||
this.maybeF32(),
|
||||
this.defaultF32(),
|
||||
this.justF64(),
|
||||
this.maybeF64(),
|
||||
this.defaultF64(),
|
||||
this.justBool(),
|
||||
this.maybeBool(),
|
||||
this.defaultBool(),
|
||||
this.justEnum(),
|
||||
this.maybeEnum(),
|
||||
this.defaultEnum()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: ScalarStuffT): void {
|
||||
_o.justI8 = this.justI8();
|
||||
_o.maybeI8 = this.maybeI8();
|
||||
_o.defaultI8 = this.defaultI8();
|
||||
_o.justU8 = this.justU8();
|
||||
_o.maybeU8 = this.maybeU8();
|
||||
_o.defaultU8 = this.defaultU8();
|
||||
_o.justI16 = this.justI16();
|
||||
_o.maybeI16 = this.maybeI16();
|
||||
_o.defaultI16 = this.defaultI16();
|
||||
_o.justU16 = this.justU16();
|
||||
_o.maybeU16 = this.maybeU16();
|
||||
_o.defaultU16 = this.defaultU16();
|
||||
_o.justI32 = this.justI32();
|
||||
_o.maybeI32 = this.maybeI32();
|
||||
_o.defaultI32 = this.defaultI32();
|
||||
_o.justU32 = this.justU32();
|
||||
_o.maybeU32 = this.maybeU32();
|
||||
_o.defaultU32 = this.defaultU32();
|
||||
_o.justI64 = this.justI64();
|
||||
_o.maybeI64 = this.maybeI64();
|
||||
_o.defaultI64 = this.defaultI64();
|
||||
_o.justU64 = this.justU64();
|
||||
_o.maybeU64 = this.maybeU64();
|
||||
_o.defaultU64 = this.defaultU64();
|
||||
_o.justF32 = this.justF32();
|
||||
_o.maybeF32 = this.maybeF32();
|
||||
_o.defaultF32 = this.defaultF32();
|
||||
_o.justF64 = this.justF64();
|
||||
_o.maybeF64 = this.maybeF64();
|
||||
_o.defaultF64 = this.defaultF64();
|
||||
_o.justBool = this.justBool();
|
||||
_o.maybeBool = this.maybeBool();
|
||||
_o.defaultBool = this.defaultBool();
|
||||
_o.justEnum = this.justEnum();
|
||||
_o.maybeEnum = this.maybeEnum();
|
||||
_o.defaultEnum = this.defaultEnum();
|
||||
}
|
||||
}
|
||||
|
||||
export class ScalarStuffT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public justI8: number = 0,
|
||||
public maybeI8: number|undefined = undefined,
|
||||
public defaultI8: number = 42,
|
||||
public justU8: number = 0,
|
||||
public maybeU8: number|undefined = undefined,
|
||||
public defaultU8: number = 42,
|
||||
public justI16: number = 0,
|
||||
public maybeI16: number|undefined = undefined,
|
||||
public defaultI16: number = 42,
|
||||
public justU16: number = 0,
|
||||
public maybeU16: number|undefined = undefined,
|
||||
public defaultU16: number = 42,
|
||||
public justI32: number = 0,
|
||||
public maybeI32: number|undefined = undefined,
|
||||
public defaultI32: number = 42,
|
||||
public justU32: number = 0,
|
||||
public maybeU32: number|undefined = undefined,
|
||||
public defaultU32: number = 42,
|
||||
public justI64: bigint = BigInt('0'),
|
||||
public maybeI64: bigint|undefined = undefined,
|
||||
public defaultI64: bigint = BigInt('42'),
|
||||
public justU64: bigint = BigInt('0'),
|
||||
public maybeU64: bigint|undefined = undefined,
|
||||
public defaultU64: bigint = BigInt('42'),
|
||||
public justF32: number = 0.0,
|
||||
public maybeF32: number|undefined = undefined,
|
||||
public defaultF32: number = 42.0,
|
||||
public justF64: number = 0.0,
|
||||
public maybeF64: number|undefined = undefined,
|
||||
public defaultF64: number = 42.0,
|
||||
public justBool: boolean = false,
|
||||
public maybeBool: boolean|undefined = undefined,
|
||||
public defaultBool: boolean = true,
|
||||
public justEnum: OptionalByte = OptionalByte.None,
|
||||
public maybeEnum: OptionalByte|undefined = undefined,
|
||||
public defaultEnum: OptionalByte = OptionalByte.One
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return ScalarStuff.createScalarStuff(builder,
|
||||
this.justI8,
|
||||
this.maybeI8,
|
||||
this.defaultI8,
|
||||
this.justU8,
|
||||
this.maybeU8,
|
||||
this.defaultU8,
|
||||
this.justI16,
|
||||
this.maybeI16,
|
||||
this.defaultI16,
|
||||
this.justU16,
|
||||
this.maybeU16,
|
||||
this.defaultU16,
|
||||
this.justI32,
|
||||
this.maybeI32,
|
||||
this.defaultI32,
|
||||
this.justU32,
|
||||
this.maybeU32,
|
||||
this.defaultU32,
|
||||
this.justI64,
|
||||
this.maybeI64,
|
||||
this.defaultI64,
|
||||
this.justU64,
|
||||
this.maybeU64,
|
||||
this.defaultU64,
|
||||
this.justF32,
|
||||
this.maybeF32,
|
||||
this.defaultF32,
|
||||
this.justF64,
|
||||
this.maybeF64,
|
||||
this.defaultF64,
|
||||
this.justBool,
|
||||
this.maybeBool,
|
||||
this.defaultBool,
|
||||
this.justEnum,
|
||||
this.maybeEnum,
|
||||
this.defaultEnum
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
export * as optional_scalars from './optional-scalars.js';
|
||||
@@ -1,551 +0,0 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// ts-undefined-for-optionals/optional_scalars.ts
|
||||
var optional_scalars_exports2 = {};
|
||||
__export(optional_scalars_exports2, {
|
||||
optional_scalars: () => optional_scalars_exports
|
||||
});
|
||||
module.exports = __toCommonJS(optional_scalars_exports2);
|
||||
|
||||
// ts-undefined-for-optionals/optional-scalars.ts
|
||||
var optional_scalars_exports = {};
|
||||
__export(optional_scalars_exports, {
|
||||
OptionalByte: () => OptionalByte,
|
||||
ScalarStuff: () => ScalarStuff,
|
||||
ScalarStuffT: () => ScalarStuffT
|
||||
});
|
||||
|
||||
// ts-undefined-for-optionals/optional-scalars/optional-byte.ts
|
||||
var OptionalByte = /* @__PURE__ */ ((OptionalByte2) => {
|
||||
OptionalByte2[OptionalByte2["None"] = 0] = "None";
|
||||
OptionalByte2[OptionalByte2["One"] = 1] = "One";
|
||||
OptionalByte2[OptionalByte2["Two"] = 2] = "Two";
|
||||
return OptionalByte2;
|
||||
})(OptionalByte || {});
|
||||
|
||||
// ts-undefined-for-optionals/optional-scalars/scalar-stuff.ts
|
||||
var flatbuffers = __toESM(require("flatbuffers"), 1);
|
||||
var ScalarStuff = class _ScalarStuff {
|
||||
constructor() {
|
||||
this.bb = void 0;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
static getRootAsScalarStuff(bb, obj) {
|
||||
return (obj || new _ScalarStuff()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static getSizePrefixedRootAsScalarStuff(bb, obj) {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new _ScalarStuff()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static bufferHasIdentifier(bb) {
|
||||
return bb.__has_identifier("NULL");
|
||||
}
|
||||
justI8() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb.readInt8(this.bb_pos + offset) : 0;
|
||||
}
|
||||
maybeI8() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb.readInt8(this.bb_pos + offset) : void 0;
|
||||
}
|
||||
defaultI8() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb.readInt8(this.bb_pos + offset) : 42;
|
||||
}
|
||||
justU8() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb.readUint8(this.bb_pos + offset) : 0;
|
||||
}
|
||||
maybeU8() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 12);
|
||||
return offset ? this.bb.readUint8(this.bb_pos + offset) : void 0;
|
||||
}
|
||||
defaultU8() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 14);
|
||||
return offset ? this.bb.readUint8(this.bb_pos + offset) : 42;
|
||||
}
|
||||
justI16() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 16);
|
||||
return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
|
||||
}
|
||||
maybeI16() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 18);
|
||||
return offset ? this.bb.readInt16(this.bb_pos + offset) : void 0;
|
||||
}
|
||||
defaultI16() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 20);
|
||||
return offset ? this.bb.readInt16(this.bb_pos + offset) : 42;
|
||||
}
|
||||
justU16() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 22);
|
||||
return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
|
||||
}
|
||||
maybeU16() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 24);
|
||||
return offset ? this.bb.readUint16(this.bb_pos + offset) : void 0;
|
||||
}
|
||||
defaultU16() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 26);
|
||||
return offset ? this.bb.readUint16(this.bb_pos + offset) : 42;
|
||||
}
|
||||
justI32() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 28);
|
||||
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
maybeI32() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 30);
|
||||
return offset ? this.bb.readInt32(this.bb_pos + offset) : void 0;
|
||||
}
|
||||
defaultI32() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 32);
|
||||
return offset ? this.bb.readInt32(this.bb_pos + offset) : 42;
|
||||
}
|
||||
justU32() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 34);
|
||||
return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
maybeU32() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 36);
|
||||
return offset ? this.bb.readUint32(this.bb_pos + offset) : void 0;
|
||||
}
|
||||
defaultU32() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 38);
|
||||
return offset ? this.bb.readUint32(this.bb_pos + offset) : 42;
|
||||
}
|
||||
justI64() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 40);
|
||||
return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt("0");
|
||||
}
|
||||
maybeI64() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 42);
|
||||
return offset ? this.bb.readInt64(this.bb_pos + offset) : void 0;
|
||||
}
|
||||
defaultI64() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 44);
|
||||
return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt("42");
|
||||
}
|
||||
justU64() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 46);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt("0");
|
||||
}
|
||||
maybeU64() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 48);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : void 0;
|
||||
}
|
||||
defaultU64() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 50);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt("42");
|
||||
}
|
||||
justF32() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 52);
|
||||
return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
maybeF32() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 54);
|
||||
return offset ? this.bb.readFloat32(this.bb_pos + offset) : void 0;
|
||||
}
|
||||
defaultF32() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 56);
|
||||
return offset ? this.bb.readFloat32(this.bb_pos + offset) : 42;
|
||||
}
|
||||
justF64() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 58);
|
||||
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0;
|
||||
}
|
||||
maybeF64() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 60);
|
||||
return offset ? this.bb.readFloat64(this.bb_pos + offset) : void 0;
|
||||
}
|
||||
defaultF64() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 62);
|
||||
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 42;
|
||||
}
|
||||
justBool() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 64);
|
||||
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
maybeBool() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 66);
|
||||
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : void 0;
|
||||
}
|
||||
defaultBool() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 68);
|
||||
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : true;
|
||||
}
|
||||
justEnum() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 70);
|
||||
return offset ? this.bb.readInt8(this.bb_pos + offset) : 0 /* None */;
|
||||
}
|
||||
maybeEnum() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 72);
|
||||
return offset ? this.bb.readInt8(this.bb_pos + offset) : void 0;
|
||||
}
|
||||
defaultEnum() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 74);
|
||||
return offset ? this.bb.readInt8(this.bb_pos + offset) : 1 /* One */;
|
||||
}
|
||||
static startScalarStuff(builder) {
|
||||
builder.startObject(36);
|
||||
}
|
||||
static addJustI8(builder, justI8) {
|
||||
builder.addFieldInt8(0, justI8, 0);
|
||||
}
|
||||
static addMaybeI8(builder, maybeI8) {
|
||||
builder.addFieldInt8(1, maybeI8, void 0);
|
||||
}
|
||||
static addDefaultI8(builder, defaultI8) {
|
||||
builder.addFieldInt8(2, defaultI8, 42);
|
||||
}
|
||||
static addJustU8(builder, justU8) {
|
||||
builder.addFieldInt8(3, justU8, 0);
|
||||
}
|
||||
static addMaybeU8(builder, maybeU8) {
|
||||
builder.addFieldInt8(4, maybeU8, void 0);
|
||||
}
|
||||
static addDefaultU8(builder, defaultU8) {
|
||||
builder.addFieldInt8(5, defaultU8, 42);
|
||||
}
|
||||
static addJustI16(builder, justI16) {
|
||||
builder.addFieldInt16(6, justI16, 0);
|
||||
}
|
||||
static addMaybeI16(builder, maybeI16) {
|
||||
builder.addFieldInt16(7, maybeI16, void 0);
|
||||
}
|
||||
static addDefaultI16(builder, defaultI16) {
|
||||
builder.addFieldInt16(8, defaultI16, 42);
|
||||
}
|
||||
static addJustU16(builder, justU16) {
|
||||
builder.addFieldInt16(9, justU16, 0);
|
||||
}
|
||||
static addMaybeU16(builder, maybeU16) {
|
||||
builder.addFieldInt16(10, maybeU16, void 0);
|
||||
}
|
||||
static addDefaultU16(builder, defaultU16) {
|
||||
builder.addFieldInt16(11, defaultU16, 42);
|
||||
}
|
||||
static addJustI32(builder, justI32) {
|
||||
builder.addFieldInt32(12, justI32, 0);
|
||||
}
|
||||
static addMaybeI32(builder, maybeI32) {
|
||||
builder.addFieldInt32(13, maybeI32, void 0);
|
||||
}
|
||||
static addDefaultI32(builder, defaultI32) {
|
||||
builder.addFieldInt32(14, defaultI32, 42);
|
||||
}
|
||||
static addJustU32(builder, justU32) {
|
||||
builder.addFieldInt32(15, justU32, 0);
|
||||
}
|
||||
static addMaybeU32(builder, maybeU32) {
|
||||
builder.addFieldInt32(16, maybeU32, void 0);
|
||||
}
|
||||
static addDefaultU32(builder, defaultU32) {
|
||||
builder.addFieldInt32(17, defaultU32, 42);
|
||||
}
|
||||
static addJustI64(builder, justI64) {
|
||||
builder.addFieldInt64(18, justI64, BigInt("0"));
|
||||
}
|
||||
static addMaybeI64(builder, maybeI64) {
|
||||
builder.addFieldInt64(19, maybeI64, void 0);
|
||||
}
|
||||
static addDefaultI64(builder, defaultI64) {
|
||||
builder.addFieldInt64(20, defaultI64, BigInt("42"));
|
||||
}
|
||||
static addJustU64(builder, justU64) {
|
||||
builder.addFieldInt64(21, justU64, BigInt("0"));
|
||||
}
|
||||
static addMaybeU64(builder, maybeU64) {
|
||||
builder.addFieldInt64(22, maybeU64, void 0);
|
||||
}
|
||||
static addDefaultU64(builder, defaultU64) {
|
||||
builder.addFieldInt64(23, defaultU64, BigInt("42"));
|
||||
}
|
||||
static addJustF32(builder, justF32) {
|
||||
builder.addFieldFloat32(24, justF32, 0);
|
||||
}
|
||||
static addMaybeF32(builder, maybeF32) {
|
||||
builder.addFieldFloat32(25, maybeF32, void 0);
|
||||
}
|
||||
static addDefaultF32(builder, defaultF32) {
|
||||
builder.addFieldFloat32(26, defaultF32, 42);
|
||||
}
|
||||
static addJustF64(builder, justF64) {
|
||||
builder.addFieldFloat64(27, justF64, 0);
|
||||
}
|
||||
static addMaybeF64(builder, maybeF64) {
|
||||
builder.addFieldFloat64(28, maybeF64, void 0);
|
||||
}
|
||||
static addDefaultF64(builder, defaultF64) {
|
||||
builder.addFieldFloat64(29, defaultF64, 42);
|
||||
}
|
||||
static addJustBool(builder, justBool) {
|
||||
builder.addFieldInt8(30, +justBool, 0);
|
||||
}
|
||||
static addMaybeBool(builder, maybeBool) {
|
||||
builder.addFieldInt8(31, +maybeBool, void 0);
|
||||
}
|
||||
static addDefaultBool(builder, defaultBool) {
|
||||
builder.addFieldInt8(32, +defaultBool, 1);
|
||||
}
|
||||
static addJustEnum(builder, justEnum) {
|
||||
builder.addFieldInt8(33, justEnum, 0 /* None */);
|
||||
}
|
||||
static addMaybeEnum(builder, maybeEnum) {
|
||||
builder.addFieldInt8(34, maybeEnum, void 0);
|
||||
}
|
||||
static addDefaultEnum(builder, defaultEnum) {
|
||||
builder.addFieldInt8(35, defaultEnum, 1 /* One */);
|
||||
}
|
||||
static endScalarStuff(builder) {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
static finishScalarStuffBuffer(builder, offset) {
|
||||
builder.finish(offset, "NULL");
|
||||
}
|
||||
static finishSizePrefixedScalarStuffBuffer(builder, offset) {
|
||||
builder.finish(offset, "NULL", true);
|
||||
}
|
||||
static createScalarStuff(builder, justI8, maybeI8, defaultI8, justU8, maybeU8, defaultU8, justI16, maybeI16, defaultI16, justU16, maybeU16, defaultU16, justI32, maybeI32, defaultI32, justU32, maybeU32, defaultU32, justI64, maybeI64, defaultI64, justU64, maybeU64, defaultU64, justF32, maybeF32, defaultF32, justF64, maybeF64, defaultF64, justBool, maybeBool, defaultBool, justEnum, maybeEnum, defaultEnum) {
|
||||
_ScalarStuff.startScalarStuff(builder);
|
||||
_ScalarStuff.addJustI8(builder, justI8);
|
||||
if (maybeI8 !== void 0)
|
||||
_ScalarStuff.addMaybeI8(builder, maybeI8);
|
||||
_ScalarStuff.addDefaultI8(builder, defaultI8);
|
||||
_ScalarStuff.addJustU8(builder, justU8);
|
||||
if (maybeU8 !== void 0)
|
||||
_ScalarStuff.addMaybeU8(builder, maybeU8);
|
||||
_ScalarStuff.addDefaultU8(builder, defaultU8);
|
||||
_ScalarStuff.addJustI16(builder, justI16);
|
||||
if (maybeI16 !== void 0)
|
||||
_ScalarStuff.addMaybeI16(builder, maybeI16);
|
||||
_ScalarStuff.addDefaultI16(builder, defaultI16);
|
||||
_ScalarStuff.addJustU16(builder, justU16);
|
||||
if (maybeU16 !== void 0)
|
||||
_ScalarStuff.addMaybeU16(builder, maybeU16);
|
||||
_ScalarStuff.addDefaultU16(builder, defaultU16);
|
||||
_ScalarStuff.addJustI32(builder, justI32);
|
||||
if (maybeI32 !== void 0)
|
||||
_ScalarStuff.addMaybeI32(builder, maybeI32);
|
||||
_ScalarStuff.addDefaultI32(builder, defaultI32);
|
||||
_ScalarStuff.addJustU32(builder, justU32);
|
||||
if (maybeU32 !== void 0)
|
||||
_ScalarStuff.addMaybeU32(builder, maybeU32);
|
||||
_ScalarStuff.addDefaultU32(builder, defaultU32);
|
||||
_ScalarStuff.addJustI64(builder, justI64);
|
||||
if (maybeI64 !== void 0)
|
||||
_ScalarStuff.addMaybeI64(builder, maybeI64);
|
||||
_ScalarStuff.addDefaultI64(builder, defaultI64);
|
||||
_ScalarStuff.addJustU64(builder, justU64);
|
||||
if (maybeU64 !== void 0)
|
||||
_ScalarStuff.addMaybeU64(builder, maybeU64);
|
||||
_ScalarStuff.addDefaultU64(builder, defaultU64);
|
||||
_ScalarStuff.addJustF32(builder, justF32);
|
||||
if (maybeF32 !== void 0)
|
||||
_ScalarStuff.addMaybeF32(builder, maybeF32);
|
||||
_ScalarStuff.addDefaultF32(builder, defaultF32);
|
||||
_ScalarStuff.addJustF64(builder, justF64);
|
||||
if (maybeF64 !== void 0)
|
||||
_ScalarStuff.addMaybeF64(builder, maybeF64);
|
||||
_ScalarStuff.addDefaultF64(builder, defaultF64);
|
||||
_ScalarStuff.addJustBool(builder, justBool);
|
||||
if (maybeBool !== void 0)
|
||||
_ScalarStuff.addMaybeBool(builder, maybeBool);
|
||||
_ScalarStuff.addDefaultBool(builder, defaultBool);
|
||||
_ScalarStuff.addJustEnum(builder, justEnum);
|
||||
if (maybeEnum !== void 0)
|
||||
_ScalarStuff.addMaybeEnum(builder, maybeEnum);
|
||||
_ScalarStuff.addDefaultEnum(builder, defaultEnum);
|
||||
return _ScalarStuff.endScalarStuff(builder);
|
||||
}
|
||||
unpack() {
|
||||
return new ScalarStuffT(
|
||||
this.justI8(),
|
||||
this.maybeI8(),
|
||||
this.defaultI8(),
|
||||
this.justU8(),
|
||||
this.maybeU8(),
|
||||
this.defaultU8(),
|
||||
this.justI16(),
|
||||
this.maybeI16(),
|
||||
this.defaultI16(),
|
||||
this.justU16(),
|
||||
this.maybeU16(),
|
||||
this.defaultU16(),
|
||||
this.justI32(),
|
||||
this.maybeI32(),
|
||||
this.defaultI32(),
|
||||
this.justU32(),
|
||||
this.maybeU32(),
|
||||
this.defaultU32(),
|
||||
this.justI64(),
|
||||
this.maybeI64(),
|
||||
this.defaultI64(),
|
||||
this.justU64(),
|
||||
this.maybeU64(),
|
||||
this.defaultU64(),
|
||||
this.justF32(),
|
||||
this.maybeF32(),
|
||||
this.defaultF32(),
|
||||
this.justF64(),
|
||||
this.maybeF64(),
|
||||
this.defaultF64(),
|
||||
this.justBool(),
|
||||
this.maybeBool(),
|
||||
this.defaultBool(),
|
||||
this.justEnum(),
|
||||
this.maybeEnum(),
|
||||
this.defaultEnum()
|
||||
);
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.justI8 = this.justI8();
|
||||
_o.maybeI8 = this.maybeI8();
|
||||
_o.defaultI8 = this.defaultI8();
|
||||
_o.justU8 = this.justU8();
|
||||
_o.maybeU8 = this.maybeU8();
|
||||
_o.defaultU8 = this.defaultU8();
|
||||
_o.justI16 = this.justI16();
|
||||
_o.maybeI16 = this.maybeI16();
|
||||
_o.defaultI16 = this.defaultI16();
|
||||
_o.justU16 = this.justU16();
|
||||
_o.maybeU16 = this.maybeU16();
|
||||
_o.defaultU16 = this.defaultU16();
|
||||
_o.justI32 = this.justI32();
|
||||
_o.maybeI32 = this.maybeI32();
|
||||
_o.defaultI32 = this.defaultI32();
|
||||
_o.justU32 = this.justU32();
|
||||
_o.maybeU32 = this.maybeU32();
|
||||
_o.defaultU32 = this.defaultU32();
|
||||
_o.justI64 = this.justI64();
|
||||
_o.maybeI64 = this.maybeI64();
|
||||
_o.defaultI64 = this.defaultI64();
|
||||
_o.justU64 = this.justU64();
|
||||
_o.maybeU64 = this.maybeU64();
|
||||
_o.defaultU64 = this.defaultU64();
|
||||
_o.justF32 = this.justF32();
|
||||
_o.maybeF32 = this.maybeF32();
|
||||
_o.defaultF32 = this.defaultF32();
|
||||
_o.justF64 = this.justF64();
|
||||
_o.maybeF64 = this.maybeF64();
|
||||
_o.defaultF64 = this.defaultF64();
|
||||
_o.justBool = this.justBool();
|
||||
_o.maybeBool = this.maybeBool();
|
||||
_o.defaultBool = this.defaultBool();
|
||||
_o.justEnum = this.justEnum();
|
||||
_o.maybeEnum = this.maybeEnum();
|
||||
_o.defaultEnum = this.defaultEnum();
|
||||
}
|
||||
};
|
||||
var ScalarStuffT = class {
|
||||
constructor(justI8 = 0, maybeI8 = void 0, defaultI8 = 42, justU8 = 0, maybeU8 = void 0, defaultU8 = 42, justI16 = 0, maybeI16 = void 0, defaultI16 = 42, justU16 = 0, maybeU16 = void 0, defaultU16 = 42, justI32 = 0, maybeI32 = void 0, defaultI32 = 42, justU32 = 0, maybeU32 = void 0, defaultU32 = 42, justI64 = BigInt("0"), maybeI64 = void 0, defaultI64 = BigInt("42"), justU64 = BigInt("0"), maybeU64 = void 0, defaultU64 = BigInt("42"), justF32 = 0, maybeF32 = void 0, defaultF32 = 42, justF64 = 0, maybeF64 = void 0, defaultF64 = 42, justBool = false, maybeBool = void 0, defaultBool = true, justEnum = 0 /* None */, maybeEnum = void 0, defaultEnum = 1 /* One */) {
|
||||
this.justI8 = justI8;
|
||||
this.maybeI8 = maybeI8;
|
||||
this.defaultI8 = defaultI8;
|
||||
this.justU8 = justU8;
|
||||
this.maybeU8 = maybeU8;
|
||||
this.defaultU8 = defaultU8;
|
||||
this.justI16 = justI16;
|
||||
this.maybeI16 = maybeI16;
|
||||
this.defaultI16 = defaultI16;
|
||||
this.justU16 = justU16;
|
||||
this.maybeU16 = maybeU16;
|
||||
this.defaultU16 = defaultU16;
|
||||
this.justI32 = justI32;
|
||||
this.maybeI32 = maybeI32;
|
||||
this.defaultI32 = defaultI32;
|
||||
this.justU32 = justU32;
|
||||
this.maybeU32 = maybeU32;
|
||||
this.defaultU32 = defaultU32;
|
||||
this.justI64 = justI64;
|
||||
this.maybeI64 = maybeI64;
|
||||
this.defaultI64 = defaultI64;
|
||||
this.justU64 = justU64;
|
||||
this.maybeU64 = maybeU64;
|
||||
this.defaultU64 = defaultU64;
|
||||
this.justF32 = justF32;
|
||||
this.maybeF32 = maybeF32;
|
||||
this.defaultF32 = defaultF32;
|
||||
this.justF64 = justF64;
|
||||
this.maybeF64 = maybeF64;
|
||||
this.defaultF64 = defaultF64;
|
||||
this.justBool = justBool;
|
||||
this.maybeBool = maybeBool;
|
||||
this.defaultBool = defaultBool;
|
||||
this.justEnum = justEnum;
|
||||
this.maybeEnum = maybeEnum;
|
||||
this.defaultEnum = defaultEnum;
|
||||
}
|
||||
pack(builder) {
|
||||
return ScalarStuff.createScalarStuff(
|
||||
builder,
|
||||
this.justI8,
|
||||
this.maybeI8,
|
||||
this.defaultI8,
|
||||
this.justU8,
|
||||
this.maybeU8,
|
||||
this.defaultU8,
|
||||
this.justI16,
|
||||
this.maybeI16,
|
||||
this.defaultI16,
|
||||
this.justU16,
|
||||
this.maybeU16,
|
||||
this.defaultU16,
|
||||
this.justI32,
|
||||
this.maybeI32,
|
||||
this.defaultI32,
|
||||
this.justU32,
|
||||
this.maybeU32,
|
||||
this.defaultU32,
|
||||
this.justI64,
|
||||
this.maybeI64,
|
||||
this.defaultI64,
|
||||
this.justU64,
|
||||
this.maybeU64,
|
||||
this.defaultU64,
|
||||
this.justF32,
|
||||
this.maybeF32,
|
||||
this.defaultF32,
|
||||
this.justF64,
|
||||
this.maybeF64,
|
||||
this.defaultF64,
|
||||
this.justBool,
|
||||
this.maybeBool,
|
||||
this.defaultBool,
|
||||
this.justEnum,
|
||||
this.maybeEnum,
|
||||
this.defaultEnum
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -1,910 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_UNIONUNDERLYINGTYPETEST_UNIONUNDERLYINGTYPE_H_
|
||||
#define FLATBUFFERS_GENERATED_UNIONUNDERLYINGTYPETEST_UNIONUNDERLYINGTYPE_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 12 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
namespace UnionUnderlyingType {
|
||||
|
||||
struct A;
|
||||
struct ABuilder;
|
||||
struct AT;
|
||||
|
||||
struct B;
|
||||
struct BBuilder;
|
||||
struct BT;
|
||||
|
||||
struct C;
|
||||
struct CBuilder;
|
||||
struct CT;
|
||||
|
||||
struct D;
|
||||
struct DBuilder;
|
||||
struct DT;
|
||||
|
||||
bool operator==(const AT &lhs, const AT &rhs);
|
||||
bool operator!=(const AT &lhs, const AT &rhs);
|
||||
bool operator==(const BT &lhs, const BT &rhs);
|
||||
bool operator!=(const BT &lhs, const BT &rhs);
|
||||
bool operator==(const CT &lhs, const CT &rhs);
|
||||
bool operator!=(const CT &lhs, const CT &rhs);
|
||||
bool operator==(const DT &lhs, const DT &rhs);
|
||||
bool operator!=(const DT &lhs, const DT &rhs);
|
||||
|
||||
inline const ::flatbuffers::TypeTable *ATypeTable();
|
||||
|
||||
inline const ::flatbuffers::TypeTable *BTypeTable();
|
||||
|
||||
inline const ::flatbuffers::TypeTable *CTypeTable();
|
||||
|
||||
inline const ::flatbuffers::TypeTable *DTypeTable();
|
||||
|
||||
enum class ABC : int32_t {
|
||||
NONE = 0,
|
||||
A = 555,
|
||||
B = 666,
|
||||
C = 777,
|
||||
MIN = NONE,
|
||||
MAX = C
|
||||
};
|
||||
|
||||
inline const ABC (&EnumValuesABC())[4] {
|
||||
static const ABC values[] = {
|
||||
ABC::NONE,
|
||||
ABC::A,
|
||||
ABC::B,
|
||||
ABC::C
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char *EnumNameABC(ABC e) {
|
||||
switch (e) {
|
||||
case ABC::NONE: return "NONE";
|
||||
case ABC::A: return "A";
|
||||
case ABC::B: return "B";
|
||||
case ABC::C: return "C";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T> struct ABCTraits {
|
||||
static const ABC enum_value = ABC::NONE;
|
||||
};
|
||||
|
||||
template<> struct ABCTraits<UnionUnderlyingType::A> {
|
||||
static const ABC enum_value = ABC::A;
|
||||
};
|
||||
|
||||
template<> struct ABCTraits<UnionUnderlyingType::B> {
|
||||
static const ABC enum_value = ABC::B;
|
||||
};
|
||||
|
||||
template<> struct ABCTraits<UnionUnderlyingType::C> {
|
||||
static const ABC enum_value = ABC::C;
|
||||
};
|
||||
|
||||
template<typename T> struct ABCUnionTraits {
|
||||
static const ABC enum_value = ABC::NONE;
|
||||
};
|
||||
|
||||
template<> struct ABCUnionTraits<UnionUnderlyingType::AT> {
|
||||
static const ABC enum_value = ABC::A;
|
||||
};
|
||||
|
||||
template<> struct ABCUnionTraits<UnionUnderlyingType::BT> {
|
||||
static const ABC enum_value = ABC::B;
|
||||
};
|
||||
|
||||
template<> struct ABCUnionTraits<UnionUnderlyingType::CT> {
|
||||
static const ABC enum_value = ABC::C;
|
||||
};
|
||||
|
||||
struct ABCUnion {
|
||||
ABC type;
|
||||
void *value;
|
||||
|
||||
ABCUnion() : type(ABC::NONE), value(nullptr) {}
|
||||
ABCUnion(ABCUnion&& u) FLATBUFFERS_NOEXCEPT :
|
||||
type(ABC::NONE), value(nullptr)
|
||||
{ std::swap(type, u.type); std::swap(value, u.value); }
|
||||
ABCUnion(const ABCUnion &);
|
||||
ABCUnion &operator=(const ABCUnion &u)
|
||||
{ ABCUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
|
||||
ABCUnion &operator=(ABCUnion &&u) FLATBUFFERS_NOEXCEPT
|
||||
{ std::swap(type, u.type); std::swap(value, u.value); return *this; }
|
||||
~ABCUnion() { Reset(); }
|
||||
|
||||
void Reset();
|
||||
|
||||
template <typename T>
|
||||
void Set(T&& val) {
|
||||
typedef typename std::remove_reference<T>::type RT;
|
||||
Reset();
|
||||
type = ABCUnionTraits<RT>::enum_value;
|
||||
if (type != ABC::NONE) {
|
||||
value = new RT(std::forward<T>(val));
|
||||
}
|
||||
}
|
||||
|
||||
static void *UnPack(const void *obj, ABC type, const ::flatbuffers::resolver_function_t *resolver);
|
||||
::flatbuffers::Offset<void> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
|
||||
|
||||
UnionUnderlyingType::AT *AsA() {
|
||||
return type == ABC::A ?
|
||||
reinterpret_cast<UnionUnderlyingType::AT *>(value) : nullptr;
|
||||
}
|
||||
const UnionUnderlyingType::AT *AsA() const {
|
||||
return type == ABC::A ?
|
||||
reinterpret_cast<const UnionUnderlyingType::AT *>(value) : nullptr;
|
||||
}
|
||||
UnionUnderlyingType::BT *AsB() {
|
||||
return type == ABC::B ?
|
||||
reinterpret_cast<UnionUnderlyingType::BT *>(value) : nullptr;
|
||||
}
|
||||
const UnionUnderlyingType::BT *AsB() const {
|
||||
return type == ABC::B ?
|
||||
reinterpret_cast<const UnionUnderlyingType::BT *>(value) : nullptr;
|
||||
}
|
||||
UnionUnderlyingType::CT *AsC() {
|
||||
return type == ABC::C ?
|
||||
reinterpret_cast<UnionUnderlyingType::CT *>(value) : nullptr;
|
||||
}
|
||||
const UnionUnderlyingType::CT *AsC() const {
|
||||
return type == ABC::C ?
|
||||
reinterpret_cast<const UnionUnderlyingType::CT *>(value) : nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
inline bool operator==(const ABCUnion &lhs, const ABCUnion &rhs) {
|
||||
if (lhs.type != rhs.type) return false;
|
||||
switch (lhs.type) {
|
||||
case ABC::NONE: {
|
||||
return true;
|
||||
}
|
||||
case ABC::A: {
|
||||
return *(reinterpret_cast<const UnionUnderlyingType::AT *>(lhs.value)) ==
|
||||
*(reinterpret_cast<const UnionUnderlyingType::AT *>(rhs.value));
|
||||
}
|
||||
case ABC::B: {
|
||||
return *(reinterpret_cast<const UnionUnderlyingType::BT *>(lhs.value)) ==
|
||||
*(reinterpret_cast<const UnionUnderlyingType::BT *>(rhs.value));
|
||||
}
|
||||
case ABC::C: {
|
||||
return *(reinterpret_cast<const UnionUnderlyingType::CT *>(lhs.value)) ==
|
||||
*(reinterpret_cast<const UnionUnderlyingType::CT *>(rhs.value));
|
||||
}
|
||||
default: {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline bool operator!=(const ABCUnion &lhs, const ABCUnion &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
bool VerifyABC(::flatbuffers::VerifierTemplate<B> &verifier, const void *obj, ABC type);
|
||||
template <bool B = false>
|
||||
bool VerifyABCVector(::flatbuffers::VerifierTemplate<B> &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset<void>> *values, const ::flatbuffers::Vector<ABC> *types);
|
||||
|
||||
struct AT : public ::flatbuffers::NativeTable {
|
||||
typedef A TableType;
|
||||
int32_t a = 0;
|
||||
};
|
||||
|
||||
struct A FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef AT NativeTableType;
|
||||
typedef ABuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return ATypeTable();
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_A = 4
|
||||
};
|
||||
int32_t a() const {
|
||||
return GetField<int32_t>(VT_A, 0);
|
||||
}
|
||||
bool mutate_a(int32_t _a = 0) {
|
||||
return SetField<int32_t>(VT_A, _a, 0);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int32_t>(verifier, VT_A, 4) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
AT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(AT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<A> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const AT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct ABuilder {
|
||||
typedef A Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_a(int32_t a) {
|
||||
fbb_.AddElement<int32_t>(A::VT_A, a, 0);
|
||||
}
|
||||
explicit ABuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<A> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<A>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<A> CreateA(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int32_t a = 0) {
|
||||
ABuilder builder_(_fbb);
|
||||
builder_.add_a(a);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<A> CreateA(::flatbuffers::FlatBufferBuilder &_fbb, const AT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
struct BT : public ::flatbuffers::NativeTable {
|
||||
typedef B TableType;
|
||||
std::string b{};
|
||||
};
|
||||
|
||||
struct B FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef BT NativeTableType;
|
||||
typedef BBuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return BTypeTable();
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_B = 4
|
||||
};
|
||||
const ::flatbuffers::String *b() const {
|
||||
return GetPointer<const ::flatbuffers::String *>(VT_B);
|
||||
}
|
||||
::flatbuffers::String *mutable_b() {
|
||||
return GetPointer<::flatbuffers::String *>(VT_B);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset(verifier, VT_B) &&
|
||||
verifier.VerifyString(b()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
BT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(BT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<B> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const BT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct BBuilder {
|
||||
typedef B Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_b(::flatbuffers::Offset<::flatbuffers::String> b) {
|
||||
fbb_.AddOffset(B::VT_B, b);
|
||||
}
|
||||
explicit BBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<B> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<B>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<B> CreateB(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
::flatbuffers::Offset<::flatbuffers::String> b = 0) {
|
||||
BBuilder builder_(_fbb);
|
||||
builder_.add_b(b);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<B> CreateBDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
const char *b = nullptr) {
|
||||
auto b__ = b ? _fbb.CreateString(b) : 0;
|
||||
return UnionUnderlyingType::CreateB(
|
||||
_fbb,
|
||||
b__);
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<B> CreateB(::flatbuffers::FlatBufferBuilder &_fbb, const BT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
struct CT : public ::flatbuffers::NativeTable {
|
||||
typedef C TableType;
|
||||
bool c = false;
|
||||
};
|
||||
|
||||
struct C FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef CT NativeTableType;
|
||||
typedef CBuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return CTypeTable();
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_C = 4
|
||||
};
|
||||
bool c() const {
|
||||
return GetField<uint8_t>(VT_C, 0) != 0;
|
||||
}
|
||||
bool mutate_c(bool _c = 0) {
|
||||
return SetField<uint8_t>(VT_C, static_cast<uint8_t>(_c), 0);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<uint8_t>(verifier, VT_C, 1) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
CT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(CT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<C> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const CT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct CBuilder {
|
||||
typedef C Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_c(bool c) {
|
||||
fbb_.AddElement<uint8_t>(C::VT_C, static_cast<uint8_t>(c), 0);
|
||||
}
|
||||
explicit CBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<C> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<C>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<C> CreateC(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
bool c = false) {
|
||||
CBuilder builder_(_fbb);
|
||||
builder_.add_c(c);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<C> CreateC(::flatbuffers::FlatBufferBuilder &_fbb, const CT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
struct DT : public ::flatbuffers::NativeTable {
|
||||
typedef D TableType;
|
||||
UnionUnderlyingType::ABCUnion test_union{};
|
||||
std::vector<UnionUnderlyingType::ABCUnion> test_vector_of_union{};
|
||||
};
|
||||
|
||||
struct D FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef DT NativeTableType;
|
||||
typedef DBuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return DTypeTable();
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_TEST_UNION_TYPE = 4,
|
||||
VT_TEST_UNION = 6,
|
||||
VT_TEST_VECTOR_OF_UNION_TYPE = 8,
|
||||
VT_TEST_VECTOR_OF_UNION = 10
|
||||
};
|
||||
UnionUnderlyingType::ABC test_union_type() const {
|
||||
return static_cast<UnionUnderlyingType::ABC>(GetField<int32_t>(VT_TEST_UNION_TYPE, 0));
|
||||
}
|
||||
const void *test_union() const {
|
||||
return GetPointer<const void *>(VT_TEST_UNION);
|
||||
}
|
||||
template<typename T> const T *test_union_as() const;
|
||||
const UnionUnderlyingType::A *test_union_as_A() const {
|
||||
return test_union_type() == UnionUnderlyingType::ABC::A ? static_cast<const UnionUnderlyingType::A *>(test_union()) : nullptr;
|
||||
}
|
||||
const UnionUnderlyingType::B *test_union_as_B() const {
|
||||
return test_union_type() == UnionUnderlyingType::ABC::B ? static_cast<const UnionUnderlyingType::B *>(test_union()) : nullptr;
|
||||
}
|
||||
const UnionUnderlyingType::C *test_union_as_C() const {
|
||||
return test_union_type() == UnionUnderlyingType::ABC::C ? static_cast<const UnionUnderlyingType::C *>(test_union()) : nullptr;
|
||||
}
|
||||
template<typename T> T *mutable_test_union_as();
|
||||
UnionUnderlyingType::A *mutable_test_union_as_A() {
|
||||
return test_union_type() == UnionUnderlyingType::ABC::A ? static_cast<UnionUnderlyingType::A *>(mutable_test_union()) : nullptr;
|
||||
}
|
||||
UnionUnderlyingType::B *mutable_test_union_as_B() {
|
||||
return test_union_type() == UnionUnderlyingType::ABC::B ? static_cast<UnionUnderlyingType::B *>(mutable_test_union()) : nullptr;
|
||||
}
|
||||
UnionUnderlyingType::C *mutable_test_union_as_C() {
|
||||
return test_union_type() == UnionUnderlyingType::ABC::C ? static_cast<UnionUnderlyingType::C *>(mutable_test_union()) : nullptr;
|
||||
}
|
||||
void *mutable_test_union() {
|
||||
return GetPointer<void *>(VT_TEST_UNION);
|
||||
}
|
||||
const ::flatbuffers::Vector<UnionUnderlyingType::ABC> *test_vector_of_union_type() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<UnionUnderlyingType::ABC> *>(VT_TEST_VECTOR_OF_UNION_TYPE);
|
||||
}
|
||||
::flatbuffers::Vector<UnionUnderlyingType::ABC> *mutable_test_vector_of_union_type() {
|
||||
return GetPointer<::flatbuffers::Vector<UnionUnderlyingType::ABC> *>(VT_TEST_VECTOR_OF_UNION_TYPE);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<void>> *test_vector_of_union() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<void>> *>(VT_TEST_VECTOR_OF_UNION);
|
||||
}
|
||||
::flatbuffers::Vector<::flatbuffers::Offset<void>> *mutable_test_vector_of_union() {
|
||||
return GetPointer<::flatbuffers::Vector<::flatbuffers::Offset<void>> *>(VT_TEST_VECTOR_OF_UNION);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int32_t>(verifier, VT_TEST_UNION_TYPE, 1) &&
|
||||
VerifyOffset(verifier, VT_TEST_UNION) &&
|
||||
VerifyABC(verifier, test_union(), test_union_type()) &&
|
||||
VerifyOffset(verifier, VT_TEST_VECTOR_OF_UNION_TYPE) &&
|
||||
verifier.VerifyVector(test_vector_of_union_type()) &&
|
||||
VerifyOffset(verifier, VT_TEST_VECTOR_OF_UNION) &&
|
||||
verifier.VerifyVector(test_vector_of_union()) &&
|
||||
VerifyABCVector(verifier, test_vector_of_union(), test_vector_of_union_type()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
DT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(DT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<D> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const DT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
template<> inline const UnionUnderlyingType::A *D::test_union_as<UnionUnderlyingType::A>() const {
|
||||
return test_union_as_A();
|
||||
}
|
||||
|
||||
template<> inline UnionUnderlyingType::A *D::mutable_test_union_as<UnionUnderlyingType::A>() {
|
||||
return mutable_test_union_as_A();
|
||||
}
|
||||
|
||||
template<> inline const UnionUnderlyingType::B *D::test_union_as<UnionUnderlyingType::B>() const {
|
||||
return test_union_as_B();
|
||||
}
|
||||
|
||||
template<> inline UnionUnderlyingType::B *D::mutable_test_union_as<UnionUnderlyingType::B>() {
|
||||
return mutable_test_union_as_B();
|
||||
}
|
||||
|
||||
template<> inline const UnionUnderlyingType::C *D::test_union_as<UnionUnderlyingType::C>() const {
|
||||
return test_union_as_C();
|
||||
}
|
||||
|
||||
template<> inline UnionUnderlyingType::C *D::mutable_test_union_as<UnionUnderlyingType::C>() {
|
||||
return mutable_test_union_as_C();
|
||||
}
|
||||
|
||||
struct DBuilder {
|
||||
typedef D Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_test_union_type(UnionUnderlyingType::ABC test_union_type) {
|
||||
fbb_.AddElement<int32_t>(D::VT_TEST_UNION_TYPE, static_cast<int32_t>(test_union_type), 0);
|
||||
}
|
||||
void add_test_union(::flatbuffers::Offset<void> test_union) {
|
||||
fbb_.AddOffset(D::VT_TEST_UNION, test_union);
|
||||
}
|
||||
void add_test_vector_of_union_type(::flatbuffers::Offset<::flatbuffers::Vector<UnionUnderlyingType::ABC>> test_vector_of_union_type) {
|
||||
fbb_.AddOffset(D::VT_TEST_VECTOR_OF_UNION_TYPE, test_vector_of_union_type);
|
||||
}
|
||||
void add_test_vector_of_union(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<void>>> test_vector_of_union) {
|
||||
fbb_.AddOffset(D::VT_TEST_VECTOR_OF_UNION, test_vector_of_union);
|
||||
}
|
||||
explicit DBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<D> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<D>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<D> CreateD(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
UnionUnderlyingType::ABC test_union_type = UnionUnderlyingType::ABC::NONE,
|
||||
::flatbuffers::Offset<void> test_union = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<UnionUnderlyingType::ABC>> test_vector_of_union_type = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<void>>> test_vector_of_union = 0) {
|
||||
DBuilder builder_(_fbb);
|
||||
builder_.add_test_vector_of_union(test_vector_of_union);
|
||||
builder_.add_test_vector_of_union_type(test_vector_of_union_type);
|
||||
builder_.add_test_union(test_union);
|
||||
builder_.add_test_union_type(test_union_type);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<D> CreateDDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
UnionUnderlyingType::ABC test_union_type = UnionUnderlyingType::ABC::NONE,
|
||||
::flatbuffers::Offset<void> test_union = 0,
|
||||
const std::vector<UnionUnderlyingType::ABC> *test_vector_of_union_type = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<void>> *test_vector_of_union = nullptr) {
|
||||
auto test_vector_of_union_type__ = test_vector_of_union_type ? _fbb.CreateVector<UnionUnderlyingType::ABC>(*test_vector_of_union_type) : 0;
|
||||
auto test_vector_of_union__ = test_vector_of_union ? _fbb.CreateVector<::flatbuffers::Offset<void>>(*test_vector_of_union) : 0;
|
||||
return UnionUnderlyingType::CreateD(
|
||||
_fbb,
|
||||
test_union_type,
|
||||
test_union,
|
||||
test_vector_of_union_type__,
|
||||
test_vector_of_union__);
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<D> CreateD(::flatbuffers::FlatBufferBuilder &_fbb, const DT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
|
||||
inline bool operator==(const AT &lhs, const AT &rhs) {
|
||||
return
|
||||
(lhs.a == rhs.a);
|
||||
}
|
||||
|
||||
inline bool operator!=(const AT &lhs, const AT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline AT *A::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<AT>(new AT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void A::UnPackTo(AT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = a(); _o->a = _e; }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<A> CreateA(::flatbuffers::FlatBufferBuilder &_fbb, const AT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return A::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<A> A::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const AT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const AT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _a = _o->a;
|
||||
return UnionUnderlyingType::CreateA(
|
||||
_fbb,
|
||||
_a);
|
||||
}
|
||||
|
||||
|
||||
inline bool operator==(const BT &lhs, const BT &rhs) {
|
||||
return
|
||||
(lhs.b == rhs.b);
|
||||
}
|
||||
|
||||
inline bool operator!=(const BT &lhs, const BT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline BT *B::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<BT>(new BT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void B::UnPackTo(BT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = b(); if (_e) _o->b = _e->str(); }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<B> CreateB(::flatbuffers::FlatBufferBuilder &_fbb, const BT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return B::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<B> B::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const BT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const BT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _b = _o->b.empty() ? 0 : _fbb.CreateString(_o->b);
|
||||
return UnionUnderlyingType::CreateB(
|
||||
_fbb,
|
||||
_b);
|
||||
}
|
||||
|
||||
|
||||
inline bool operator==(const CT &lhs, const CT &rhs) {
|
||||
return
|
||||
(lhs.c == rhs.c);
|
||||
}
|
||||
|
||||
inline bool operator!=(const CT &lhs, const CT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline CT *C::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<CT>(new CT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void C::UnPackTo(CT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = c(); _o->c = _e; }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<C> CreateC(::flatbuffers::FlatBufferBuilder &_fbb, const CT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return C::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<C> C::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const CT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const CT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _c = _o->c;
|
||||
return UnionUnderlyingType::CreateC(
|
||||
_fbb,
|
||||
_c);
|
||||
}
|
||||
|
||||
|
||||
inline bool operator==(const DT &lhs, const DT &rhs) {
|
||||
return
|
||||
(lhs.test_union == rhs.test_union) &&
|
||||
(lhs.test_vector_of_union == rhs.test_vector_of_union);
|
||||
}
|
||||
|
||||
inline bool operator!=(const DT &lhs, const DT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline DT *D::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<DT>(new DT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void D::UnPackTo(DT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = test_union_type(); _o->test_union.type = _e; }
|
||||
{ auto _e = test_union(); if (_e) _o->test_union.value = UnionUnderlyingType::ABCUnion::UnPack(_e, test_union_type(), _resolver); }
|
||||
{ auto _e = test_vector_of_union_type(); if (_e) { _o->test_vector_of_union.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test_vector_of_union[_i].type = static_cast<UnionUnderlyingType::ABC>(_e->Get(_i)); } } else { _o->test_vector_of_union.resize(0); } }
|
||||
{ auto _e = test_vector_of_union(); if (_e) { _o->test_vector_of_union.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test_vector_of_union[_i].value = UnionUnderlyingType::ABCUnion::UnPack(_e->Get(_i), test_vector_of_union_type()->GetEnum<ABC>(_i), _resolver); } } else { _o->test_vector_of_union.resize(0); } }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<D> CreateD(::flatbuffers::FlatBufferBuilder &_fbb, const DT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return D::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<D> D::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const DT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const DT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _test_union_type = _o->test_union.type;
|
||||
auto _test_union = _o->test_union.Pack(_fbb);
|
||||
auto _test_vector_of_union_type = _o->test_vector_of_union.size() ? _fbb.CreateVector<ABC>(_o->test_vector_of_union.size(), [](size_t i, _VectorArgs *__va) { return __va->__o->test_vector_of_union[i].type; }, &_va) : 0;
|
||||
auto _test_vector_of_union = _o->test_vector_of_union.size() ? _fbb.CreateVector<::flatbuffers::Offset<void>>(_o->test_vector_of_union.size(), [](size_t i, _VectorArgs *__va) { return __va->__o->test_vector_of_union[i].Pack(*__va->__fbb, __va->__rehasher); }, &_va) : 0;
|
||||
return UnionUnderlyingType::CreateD(
|
||||
_fbb,
|
||||
_test_union_type,
|
||||
_test_union,
|
||||
_test_vector_of_union_type,
|
||||
_test_vector_of_union);
|
||||
}
|
||||
|
||||
template <bool B>
|
||||
inline bool VerifyABC(::flatbuffers::VerifierTemplate<B> &verifier, const void *obj, ABC type) {
|
||||
switch (type) {
|
||||
case ABC::NONE: {
|
||||
return true;
|
||||
}
|
||||
case ABC::A: {
|
||||
auto ptr = reinterpret_cast<const UnionUnderlyingType::A *>(obj);
|
||||
return verifier.VerifyTable(ptr);
|
||||
}
|
||||
case ABC::B: {
|
||||
auto ptr = reinterpret_cast<const UnionUnderlyingType::B *>(obj);
|
||||
return verifier.VerifyTable(ptr);
|
||||
}
|
||||
case ABC::C: {
|
||||
auto ptr = reinterpret_cast<const UnionUnderlyingType::C *>(obj);
|
||||
return verifier.VerifyTable(ptr);
|
||||
}
|
||||
default: return true;
|
||||
}
|
||||
}
|
||||
|
||||
template <bool B>
|
||||
inline bool VerifyABCVector(::flatbuffers::VerifierTemplate<B> &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset<void>> *values, const ::flatbuffers::Vector<ABC> *types) {
|
||||
if (!values || !types) return !values && !types;
|
||||
if (values->size() != types->size()) return false;
|
||||
for (::flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
|
||||
if (!VerifyABC(
|
||||
verifier, values->Get(i), types->GetEnum<ABC>(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void *ABCUnion::UnPack(const void *obj, ABC type, const ::flatbuffers::resolver_function_t *resolver) {
|
||||
(void)resolver;
|
||||
switch (type) {
|
||||
case ABC::A: {
|
||||
auto ptr = reinterpret_cast<const UnionUnderlyingType::A *>(obj);
|
||||
return ptr->UnPack(resolver);
|
||||
}
|
||||
case ABC::B: {
|
||||
auto ptr = reinterpret_cast<const UnionUnderlyingType::B *>(obj);
|
||||
return ptr->UnPack(resolver);
|
||||
}
|
||||
case ABC::C: {
|
||||
auto ptr = reinterpret_cast<const UnionUnderlyingType::C *>(obj);
|
||||
return ptr->UnPack(resolver);
|
||||
}
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<void> ABCUnion::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const ::flatbuffers::rehasher_function_t *_rehasher) const {
|
||||
(void)_rehasher;
|
||||
switch (type) {
|
||||
case ABC::A: {
|
||||
auto ptr = reinterpret_cast<const UnionUnderlyingType::AT *>(value);
|
||||
return CreateA(_fbb, ptr, _rehasher).Union();
|
||||
}
|
||||
case ABC::B: {
|
||||
auto ptr = reinterpret_cast<const UnionUnderlyingType::BT *>(value);
|
||||
return CreateB(_fbb, ptr, _rehasher).Union();
|
||||
}
|
||||
case ABC::C: {
|
||||
auto ptr = reinterpret_cast<const UnionUnderlyingType::CT *>(value);
|
||||
return CreateC(_fbb, ptr, _rehasher).Union();
|
||||
}
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
inline ABCUnion::ABCUnion(const ABCUnion &u) : type(u.type), value(nullptr) {
|
||||
switch (type) {
|
||||
case ABC::A: {
|
||||
value = new UnionUnderlyingType::AT(*reinterpret_cast<UnionUnderlyingType::AT *>(u.value));
|
||||
break;
|
||||
}
|
||||
case ABC::B: {
|
||||
value = new UnionUnderlyingType::BT(*reinterpret_cast<UnionUnderlyingType::BT *>(u.value));
|
||||
break;
|
||||
}
|
||||
case ABC::C: {
|
||||
value = new UnionUnderlyingType::CT(*reinterpret_cast<UnionUnderlyingType::CT *>(u.value));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inline void ABCUnion::Reset() {
|
||||
switch (type) {
|
||||
case ABC::A: {
|
||||
auto ptr = reinterpret_cast<UnionUnderlyingType::AT *>(value);
|
||||
delete ptr;
|
||||
break;
|
||||
}
|
||||
case ABC::B: {
|
||||
auto ptr = reinterpret_cast<UnionUnderlyingType::BT *>(value);
|
||||
delete ptr;
|
||||
break;
|
||||
}
|
||||
case ABC::C: {
|
||||
auto ptr = reinterpret_cast<UnionUnderlyingType::CT *>(value);
|
||||
delete ptr;
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
value = nullptr;
|
||||
type = ABC::NONE;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *ABCTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, -1 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 1 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 2 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
UnionUnderlyingType::ATypeTable,
|
||||
UnionUnderlyingType::BTypeTable,
|
||||
UnionUnderlyingType::CTypeTable
|
||||
};
|
||||
static const int64_t values[] = { 0, 555, 666, 777 };
|
||||
static const char * const names[] = {
|
||||
"NONE",
|
||||
"A",
|
||||
"B",
|
||||
"C"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_UNION, 4, type_codes, type_refs, nullptr, values, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *ATypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_INT, 0, -1 }
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"a"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 1, type_codes, nullptr, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *BTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_STRING, 0, -1 }
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"b"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 1, type_codes, nullptr, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *CTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_BOOL, 0, -1 }
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"c"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 1, type_codes, nullptr, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *DTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_UTYPE, 0, 0 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 },
|
||||
{ ::flatbuffers::ET_UTYPE, 1, 0 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 1, 0 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
UnionUnderlyingType::ABCTypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"test_union_type",
|
||||
"test_union",
|
||||
"test_vector_of_union_type",
|
||||
"test_vector_of_union"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 4, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
} // namespace UnionUnderlyingType
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_UNIONUNDERLYINGTYPETEST_UNIONUNDERLYINGTYPE_H_
|
||||
25
tests/union_vector/BUILD.bazel
Normal file
25
tests/union_vector/BUILD.bazel
Normal file
@@ -0,0 +1,25 @@
|
||||
load("//:build_defs.bzl", "flatbuffer_cc_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "union_vector_cc_fbs",
|
||||
srcs = ["union_vector.fbs"],
|
||||
filename_suffix = ".fbs",
|
||||
flatc_args = [
|
||||
"--gen-compare",
|
||||
"--gen-mutable",
|
||||
"--gen-object-api",
|
||||
"--reflect-names",
|
||||
"--filename-suffix .fbs",
|
||||
],
|
||||
)
|
||||
|
||||
# Data needed by the tests at runtime
|
||||
filegroup(
|
||||
name = "test_data",
|
||||
srcs = [
|
||||
"union_vector.fbs",
|
||||
"union_vector.json",
|
||||
],
|
||||
)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user