ONE - On-device Neural Engine
|
Helper class to hold data needed in creation of a FlatBuffer. To serialize data, you typically call one of the Create*()
functions in the generated code, which in turn call a sequence of StartTable
/ PushElement
/AddElement
/EndTable
, or the builtin CreateString
/ CreateVector
functions. Do this is depth-first order to build up a tree to the root. Finish()
wraps up the buffer ready for transport.
More...
#include <flatbuffers.h>
Data Structures | |
struct | FieldLoc |
struct | StringOffsetCompare |
Public Member Functions | |
FlatBufferBuilder (size_t initial_size=1024, Allocator *allocator=nullptr, bool own_allocator=false, size_t buffer_minalign=AlignOf< largest_scalar_t >()) | |
Default constructor for FlatBufferBuilder. | |
FlatBufferBuilder (FlatBufferBuilder &&other) | |
Move constructor for FlatBufferBuilder. | |
FlatBufferBuilder & | operator= (FlatBufferBuilder &&other) |
Move assignment operator for FlatBufferBuilder. | |
void | Swap (FlatBufferBuilder &other) |
~FlatBufferBuilder () | |
void | Reset () |
void | Clear () |
Reset all the state in this FlatBufferBuilder so it can be reused to construct another buffer. | |
uoffset_t | GetSize () const |
The current size of the serialized buffer, counting from the end. | |
uint8_t * | GetBufferPointer () const |
Get the serialized buffer (after you call Finish() ). | |
flatbuffers::span< uint8_t > | GetBufferSpan () const |
Get the serialized buffer (after you call Finish() ) as a span. | |
uint8_t * | GetCurrentBufferPointer () const |
Get a pointer to an unfinished buffer. | |
FLATBUFFERS_ATTRIBUTE (deprecated("use Release() instead")) DetachedBuffer ReleaseBufferPointer() | |
Get the released pointer to the serialized buffer. | |
DetachedBuffer | Release () |
Get the released DetachedBuffer. | |
uint8_t * | ReleaseRaw (size_t &size, size_t &offset) |
Get the released pointer to the serialized buffer. | |
size_t | GetBufferMinAlignment () const |
get the minimum alignment this buffer needs to be accessed properly. This is only known once all elements have been written (after you call Finish()). You can use this information if you need to embed a FlatBuffer in some other buffer, such that you can later read it without first having to copy it into its own buffer. | |
void | ForceDefaults (bool fd) |
In order to save space, fields that are set to their default value don't get serialized into the buffer. | |
void | DedupVtables (bool dedup) |
By default vtables are deduped in order to save space. | |
Offset< String > | CreateString (const char *str, size_t len) |
Store a string in the buffer, which can contain any binary data. | |
Offset< String > | CreateString (const char *str) |
Store a string in the buffer, which is null-terminated. | |
Offset< String > | CreateString (char *str) |
Store a string in the buffer, which is null-terminated. | |
Offset< String > | CreateString (const std::string &str) |
Store a string in the buffer, which can contain any binary data. | |
Offset< String > | CreateString (const String *str) |
Store a string in the buffer, which can contain any binary data. | |
template<typename T > | |
Offset< String > | CreateString (const T &str) |
Store a string in the buffer, which can contain any binary data. | |
Offset< String > | CreateSharedString (const char *str, size_t len) |
Store a string in the buffer, which can contain any binary data. If a string with this exact contents has already been serialized before, instead simply returns the offset of the existing string. | |
Offset< String > | CreateSharedString (const char *str) |
Store a string in the buffer, which null-terminated. If a string with this exact contents has already been serialized before, instead simply returns the offset of the existing string. | |
Offset< String > | CreateSharedString (const std::string &str) |
Store a string in the buffer, which can contain any binary data. If a string with this exact contents has already been serialized before, instead simply returns the offset of the existing string. | |
Offset< String > | CreateSharedString (const String *str) |
Store a string in the buffer, which can contain any binary data. If a string with this exact contents has already been serialized before, instead simply returns the offset of the existing string. | |
template<typename T > | |
Offset< Vector< T > > | CreateVector (const T *v, size_t len) |
Serialize an array into a FlatBuffer vector . | |
template<typename T > | |
Offset< Vector< Offset< T > > > | CreateVector (const Offset< T > *v, size_t len) |
template<typename T > | |
Offset< Vector< T > > | CreateVector (const std::vector< T > &v) |
Serialize a std::vector into a FlatBuffer vector . | |
Offset< Vector< uint8_t > > | CreateVector (const std::vector< bool > &v) |
template<typename T > | |
Offset< Vector< T > > | CreateVector (size_t vector_size, const std::function< T(size_t i)> &f) |
Serialize values returned by a function into a FlatBuffer vector . This is a convenience function that takes care of iteration for you. | |
template<typename T , typename F , typename S > | |
Offset< Vector< T > > | CreateVector (size_t vector_size, F f, S *state) |
Serialize values returned by a function into a FlatBuffer vector . This is a convenience function that takes care of iteration for you. | |
Offset< Vector< Offset< String > > > | CreateVectorOfStrings (const std::vector< std::string > &v) |
Serialize a std::vector<std::string> into a FlatBuffer vector . This is a convenience function for a common case. | |
template<typename T > | |
Offset< Vector< const T * > > | CreateVectorOfStructs (const T *v, size_t len) |
Serialize an array of structs into a FlatBuffer vector . | |
template<typename T , typename S > | |
Offset< Vector< const T * > > | CreateVectorOfNativeStructs (const S *v, size_t len, T((*const pack_func)(const S &))) |
Serialize an array of native structs into a FlatBuffer vector . | |
template<typename T , typename S > | |
Offset< Vector< const T * > > | CreateVectorOfNativeStructs (const S *v, size_t len) |
Serialize an array of native structs into a FlatBuffer vector . | |
template<typename T > | |
Offset< Vector< const T * > > | CreateVectorOfStructs (size_t vector_size, const std::function< void(size_t i, T *)> &filler) |
Serialize an array of structs into a FlatBuffer vector . | |
template<typename T , typename F , typename S > | |
Offset< Vector< const T * > > | CreateVectorOfStructs (size_t vector_size, F f, S *state) |
Serialize an array of structs into a FlatBuffer vector . | |
template<typename T , typename Alloc > | |
Offset< Vector< const T * > > | CreateVectorOfStructs (const std::vector< T, Alloc > &v) |
Serialize a std::vector of structs into a FlatBuffer vector . | |
template<typename T , typename S > | |
Offset< Vector< const T * > > | CreateVectorOfNativeStructs (const std::vector< S > &v, T((*const pack_func)(const S &))) |
Serialize a std::vector of native structs into a FlatBuffer vector . | |
template<typename T , typename S > | |
Offset< Vector< const T * > > | CreateVectorOfNativeStructs (const std::vector< S > &v) |
Serialize a std::vector of native structs into a FlatBuffer vector . | |
template<typename T > | |
Offset< Vector< const T * > > | CreateVectorOfSortedStructs (std::vector< T > *v) |
Serialize a std::vector of structs into a FlatBuffer vector in sorted order. | |
template<typename T , typename S > | |
Offset< Vector< const T * > > | CreateVectorOfSortedNativeStructs (std::vector< S > *v) |
Serialize a std::vector of native structs into a FlatBuffer vector in sorted order. | |
template<typename T > | |
Offset< Vector< const T * > > | CreateVectorOfSortedStructs (T *v, size_t len) |
Serialize an array of structs into a FlatBuffer vector in sorted order. | |
template<typename T , typename S > | |
Offset< Vector< const T * > > | CreateVectorOfSortedNativeStructs (S *v, size_t len) |
Serialize an array of native structs into a FlatBuffer vector in sorted order. | |
template<typename T > | |
Offset< Vector< Offset< T > > > | CreateVectorOfSortedTables (Offset< T > *v, size_t len) |
Serialize an array of table offsets as a vector in the buffer in sorted order. | |
template<typename T > | |
Offset< Vector< Offset< T > > > | CreateVectorOfSortedTables (std::vector< Offset< T > > *v) |
Serialize an array of table offsets as a vector in the buffer in sorted order. | |
uoffset_t | CreateUninitializedVector (size_t len, size_t elemsize, uint8_t **buf) |
Specialized version of CreateVector for non-copying use cases. Write the data any time later to the returned buffer pointer buf . | |
template<typename T > | |
Offset< Vector< T > > | CreateUninitializedVector (size_t len, T **buf) |
Specialized version of CreateVector for non-copying use cases. Write the data any time later to the returned buffer pointer buf . | |
template<typename T > | |
Offset< Vector< const T * > > | CreateUninitializedVectorOfStructs (size_t len, T **buf) |
template<typename T , typename U > | |
Offset< Vector< T > > | CreateVectorScalarCast (const U *v, size_t len) |
template<typename T > | |
Offset< const T * > | CreateStruct (const T &structobj) |
Write a struct by itself, typically to be part of a union. | |
template<typename T > | |
void | Finish (Offset< T > root, const char *file_identifier=nullptr) |
Finish serializing a buffer by writing the root offset. | |
template<typename T > | |
void | FinishSizePrefixed (Offset< T > root, const char *file_identifier=nullptr) |
Finish a buffer with a 32 bit size field pre-fixed (size of the buffer following the size field). These buffers are NOT compatible with standard buffers created by Finish, i.e. you can't call GetRoot on them, you have to use GetSizePrefixedRoot instead. All >32 bit quantities in this buffer will be aligned when the whole size pre-fixed buffer is aligned. These kinds of buffers are useful for creating a stream of FlatBuffers. | |
void | SwapBufAllocator (FlatBufferBuilder &other) |
Static Public Attributes | |
static const size_t | kFileIdentifierLength = 4 |
The length of a FlatBuffer file header. | |
Protected Types | |
typedef std::set< Offset< String >, StringOffsetCompare > | StringOffsetMap |
Protected Member Functions | |
FlatBufferBuilder (const FlatBufferBuilder &) | |
FlatBufferBuilder & | operator= (const FlatBufferBuilder &) |
void | Finish (uoffset_t root, const char *file_identifier, bool size_prefix) |
Protected Attributes | |
vector_downward | buf_ |
uoffset_t | num_field_loc |
voffset_t | max_voffset_ |
bool | nested |
bool | finished |
size_t | minalign_ |
bool | force_defaults_ |
bool | dedup_vtables_ |
StringOffsetMap * | string_pool |
Helper class to hold data needed in creation of a FlatBuffer. To serialize data, you typically call one of the Create*()
functions in the generated code, which in turn call a sequence of StartTable
/ PushElement
/AddElement
/EndTable
, or the builtin CreateString
/ CreateVector
functions. Do this is depth-first order to build up a tree to the root. Finish()
wraps up the buffer ready for transport.
Definition at line 1171 of file flatbuffers.h.
|
protected |
Definition at line 2282 of file flatbuffers.h.
|
inlineexplicit |
Default constructor for FlatBufferBuilder.
[in] | initial_size | The initial size of the buffer, in bytes. Defaults to 1024 . |
[in] | allocator | An Allocator to use. If null will use DefaultAllocator . |
[in] | own_allocator | Whether the builder/vector should own the allocator. Defaults to / false . |
[in] | buffer_minalign | Force the buffer to be aligned to the given minimum alignment upon reallocation. Only needed if you intend to store types with custom alignment AND you wish to read the buffer in-place directly after creation. |
Definition at line 1185 of file flatbuffers.h.
References flatbuffers::EndianCheck().
|
inline |
Move constructor for FlatBufferBuilder.
Definition at line 1197 of file flatbuffers.h.
References flatbuffers::EndianCheck(), and Swap().
|
inline |
Definition at line 1238 of file flatbuffers.h.
References string_pool.
|
protected |
|
inline |
Reset all the state in this FlatBufferBuilder so it can be reused to construct another buffer.
Definition at line 1252 of file flatbuffers.h.
References buf_, flatbuffers::vector_downward::clear(), finished, minalign_, nested, and string_pool.
Referenced by Reset().
Store a string in the buffer, which null-terminated. If a string with this exact contents has already been serialized before, instead simply returns the offset of the existing string.
[in] | str | A const char pointer to a C-string to add to the buffer. |
Definition at line 1693 of file flatbuffers.h.
References CreateSharedString(), and flatbuffers::str.
|
inline |
Store a string in the buffer, which can contain any binary data. If a string with this exact contents has already been serialized before, instead simply returns the offset of the existing string.
[in] | str | A const char pointer to the data to be stored as a string. |
[in] | len | The number of bytes that should be stored from str . |
Definition at line 1656 of file flatbuffers.h.
References buf_, CreateString(), flatbuffers::vector_downward::pop(), flatbuffers::vector_downward::size(), flatbuffers::str, and string_pool.
Referenced by CreateSharedString(), CreateSharedString(), and CreateSharedString().
|
inline |
Store a string in the buffer, which can contain any binary data. If a string with this exact contents has already been serialized before, instead simply returns the offset of the existing string.
[in] | str | A const reference to a std::string to store in the buffer. |
Definition at line 1703 of file flatbuffers.h.
References CreateSharedString(), and flatbuffers::str.
Store a string in the buffer, which can contain any binary data. If a string with this exact contents has already been serialized before, instead simply returns the offset of the existing string.
[in] | str | A const pointer to a String struct to add to the buffer. |
Definition at line 1714 of file flatbuffers.h.
References CreateSharedString(), and flatbuffers::str.
Store a string in the buffer, which is null-terminated.
[in] | str | A char pointer to a C-string to add to the buffer. |
Definition at line 1613 of file flatbuffers.h.
References CreateString(), and flatbuffers::str.
Referenced by CreateString().
Store a string in the buffer, which is null-terminated.
[in] | str | A const char pointer to a C-string to add to the buffer. |
Definition at line 1608 of file flatbuffers.h.
References CreateString(), and flatbuffers::str.
Referenced by CreateString().
|
inline |
Store a string in the buffer, which can contain any binary data.
[in] | str | A const char pointer to the data to be stored as a string. |
[in] | len | The number of bytes that should be stored from str . |
Definition at line 1595 of file flatbuffers.h.
References buf_, flatbuffers::vector_downward::fill(), GetSize(), and flatbuffers::str.
Referenced by CreateSharedString(), CreateString(), CreateString(), CreateString(), CreateVectorOfStrings(), exo::circle_detail::exportOpDefinedTensor(), and exo::tflite_detail::exportOpDefinedTensor().
Store a string in the buffer, which can contain any binary data.
[in] | str | A const reference to a std::string to store in the buffer. |
Definition at line 1618 of file flatbuffers.h.
References CreateString(), and flatbuffers::str.
Store a string in the buffer, which can contain any binary data.
[in] | str | A const pointer to a String struct to add to the buffer. |
Definition at line 1636 of file flatbuffers.h.
References CreateString(), and flatbuffers::str.
|
inline |
Store a string in the buffer, which can contain any binary data.
[in] | str | A const reference to a std::string like type with support of T::c_str() and T::length() to store in the buffer. |
Definition at line 1645 of file flatbuffers.h.
References CreateString(), and flatbuffers::str.
|
inline |
Write a struct by itself, typically to be part of a union.
Definition at line 2182 of file flatbuffers.h.
References buf_, GetSize(), and flatbuffers::vector_downward::push_small().
|
inline |
Specialized version of CreateVector
for non-copying use cases. Write the data any time later to the returned buffer pointer buf
.
[in] | len | The number of elements to store in the vector . |
[in] | elemsize | The size of each element in the vector . |
[out] | buf | A pointer to a uint8_t pointer that can be written to at a later time to serialize the data into a vector in the buffer. |
Definition at line 2135 of file flatbuffers.h.
References buf_, flatbuffers::vector_downward::data_at(), GetSize(), and flatbuffers::vector_downward::make_space().
Referenced by CreateUninitializedVector(), and CreateUninitializedVectorOfStructs().
|
inline |
Specialized version of CreateVector
for non-copying use cases. Write the data any time later to the returned buffer pointer buf
.
T | The data type of the data that will be stored in the buffer as a vector . |
[in] | len | The number of elements to store in the vector . |
[out] | buf | A pointer to a pointer of type T that can be written to at a later time to serialize the data into a vector in the buffer. |
Definition at line 2154 of file flatbuffers.h.
References CreateUninitializedVector().
|
inline |
Definition at line 2161 of file flatbuffers.h.
References CreateUninitializedVector().
|
inline |
Definition at line 1792 of file flatbuffers.h.
|
inline |
Definition at line 1816 of file flatbuffers.h.
|
inline |
Serialize a std::vector
into a FlatBuffer vector
.
T | The data type of the std::vector elements. |
v | A const reference to the std::vector to serialize into the buffer as a vector . |
Offset
into the serialized data indicating where the vector is stored. Definition at line 1808 of file flatbuffers.h.
References CreateVector(), and flatbuffers::data().
|
inline |
Serialize an array into a FlatBuffer vector
.
T | The data type of the array elements. |
[in] | v | A pointer to the array of type T to serialize into the buffer as a vector . |
[in] | len | The number of elements to serialize. |
Offset
into the serialized data indicating where the vector is stored. Definition at line 1762 of file flatbuffers.h.
Referenced by as_tflite_sparse_index_vec(), tflite2circle::build_circle_ReshapeOptions(), tflite2circle::build_circle_SqueezeOptions(), luci::circle_custom_options(), CreateVector(), CreateVector(), CreateVector(), CreateVectorOfSortedTables(), CreateVectorOfStrings(), AddV2Chef::custom_value(), AllChef::custom_value(), BatchMatMulV2Chef::custom_value(), BroadcastToChef::custom_value(), ErfChef::custom_value(), MatMulChef::custom_value(), MatrixBandPartChef::custom_value(), MaxPoolWithArgmaxChef::custom_value(), tflite2circle::get_circle_sparse_index_vector(), ReshapeChef::value(), SqueezeChef::value(), luci::OperationExporterRule::visit(), luci::BuiltinOptionsExtractor::visit(), and luci::BuiltinOptionsExtractor::visit().
|
inline |
Serialize values returned by a function into a FlatBuffer vector
. This is a convenience function that takes care of iteration for you.
T | The data type of the std::vector elements. |
f | A function that takes the current iteration 0..vector_size-1 and returns any type that you can construct a FlatBuffers vector out of. |
Offset
into the serialized data indicating where the vector is stored. Definition at line 1835 of file flatbuffers.h.
References CreateVector().
|
inline |
Serialize values returned by a function into a FlatBuffer vector
. This is a convenience function that takes care of iteration for you.
T | The data type of the std::vector elements. |
f | A function that takes the current iteration 0..vector_size-1, and the state parameter returning any type that you can construct a FlatBuffers vector out of. |
state | State passed to f. |
Offset
into the serialized data indicating where the vector is stored. Definition at line 1855 of file flatbuffers.h.
References CreateVector().
|
inline |
Serialize an array of native structs into a FlatBuffer vector
.
T | The data type of the struct array elements. |
S | The data type of the native struct array elements. |
[in] | v | A pointer to the array of type S to serialize into the buffer as a vector . |
[in] | len | The number of elements to serialize. |
Offset
into the serialized data indicating where the vector is stored. Definition at line 1920 of file flatbuffers.h.
References CreateVectorOfNativeStructs(), and S.
|
inline |
Serialize an array of native structs into a FlatBuffer vector
.
T | The data type of the struct array elements. |
S | The data type of the native struct array elements. |
[in] | v | A pointer to the array of type S to serialize into the buffer as a vector . |
[in] | len | The number of elements to serialize. |
[in] | pack_func | Pointer to a function to convert the native struct to the FlatBuffer struct. |
Offset
into the serialized data indicating where the vector is stored. Definition at line 1902 of file flatbuffers.h.
References flatbuffers::data(), and FLATBUFFERS_ASSERT.
Referenced by CreateVectorOfNativeStructs().
|
inline |
Serialize a std::vector
of native structs into a FlatBuffer vector
.
T | The data type of the std::vector struct elements. |
S | The data type of the std::vector native struct elements. |
[in] | v | A const reference to the std::vector of structs to serialize into the buffer as a vector . |
Offset
into the serialized data indicating where the vector is stored. Definition at line 2009 of file flatbuffers.h.
References flatbuffers::data().
|
inline |
Serialize a std::vector
of native structs into a FlatBuffer vector
.
T | The data type of the std::vector struct elements. |
S | The data type of the std::vector native struct elements. |
[in] | v | A const reference to the std::vector of structs to serialize into the buffer as a vector . |
[in] | pack_func | Pointer to a function to convert the native struct to the FlatBuffer struct. |
Offset
into the serialized data indicating where the vector is stored. Definition at line 1994 of file flatbuffers.h.
References flatbuffers::data().
|
inline |
Serialize an array of native structs into a FlatBuffer vector
in sorted order.
T | The data type of the struct array elements. |
S | The data type of the native struct array elements. |
[in] | v | A pointer to the array of type S to serialize into the buffer as a vector . |
[in] | len | The number of elements to serialize. |
Offset
into the serialized data indicating where the vector is stored. Definition at line 2073 of file flatbuffers.h.
References S.
|
inline |
Serialize a std::vector
of native structs into a FlatBuffer vector
in sorted order.
T | The data type of the std::vector struct elements. |
S | The data type of the std::vector native struct elements. |
[in] | v | A const reference to the std::vector of structs to serialize into the buffer as a vector . |
Offset
into the serialized data indicating where the vector is stored. Definition at line 2044 of file flatbuffers.h.
References flatbuffers::data().
|
inline |
Serialize a std::vector
of structs into a FlatBuffer vector
in sorted order.
T | The data type of the std::vector struct elements. |
[in] | v | A const reference to the std::vector of structs to serialize into the buffer as a vector . |
Offset
into the serialized data indicating where the vector is stored. Definition at line 2030 of file flatbuffers.h.
References CreateVectorOfSortedStructs(), and flatbuffers::data().
Referenced by CreateVectorOfSortedStructs().
|
inline |
Serialize an array of structs into a FlatBuffer vector
in sorted order.
T | The data type of the struct array elements. |
[in] | v | A pointer to the array of type T to serialize into the buffer as a vector . |
[in] | len | The number of elements to serialize. |
Offset
into the serialized data indicating where the vector is stored. Definition at line 2057 of file flatbuffers.h.
References CreateVectorOfStructs().
|
inline |
Serialize an array of table
offsets as a vector
in the buffer in sorted order.
T | The data type that the offset refers to. |
[in] | v | An array of type Offset<T> that contains the table offsets to store in the buffer in sorted order. |
[in] | len | The number of elements to store in the vector . |
Offset
into the serialized data indicating where the vector is stored. Definition at line 2109 of file flatbuffers.h.
References buf_, and CreateVector().
Referenced by CreateVectorOfSortedTables().
|
inline |
Serialize an array of table
offsets as a vector
in the buffer in sorted order.
T | The data type that the offset refers to. |
[in] | v | An array of type Offset<T> that contains the table offsets to store in the buffer in sorted order. |
Offset
into the serialized data indicating where the vector is stored. Definition at line 2123 of file flatbuffers.h.
References CreateVectorOfSortedTables(), and flatbuffers::data().
|
inline |
Serialize a std::vector<std::string>
into a FlatBuffer vector
. This is a convenience function for a common case.
v | A const reference to the std::vector to serialize into the buffer as a vector . |
Offset
into the serialized data indicating where the vector is stored. Definition at line 1869 of file flatbuffers.h.
References CreateString(), and CreateVector().
|
inline |
Serialize a std::vector
of structs into a FlatBuffer vector
.
T | The data type of the std::vector struct elements. |
[in] | v | A const reference to the std::vector of structs to serialize into the buffer as a vector . |
Offset
into the serialized data indicating where the vector is stored. Definition at line 1978 of file flatbuffers.h.
References CreateVectorOfStructs(), and flatbuffers::data().
|
inline |
Serialize an array of structs into a FlatBuffer vector
.
T | The data type of the struct array elements. |
[in] | v | A pointer to the array of type T to serialize into the buffer as a vector . |
[in] | len | The number of elements to serialize. |
Offset
into the serialized data indicating where the vector is stored. Definition at line 1884 of file flatbuffers.h.
Referenced by CreateVectorOfSortedStructs(), and CreateVectorOfStructs().
|
inline |
Serialize an array of structs into a FlatBuffer vector
.
T | The data type of the struct array elements. |
[in] | filler | A function that takes the current iteration 0..vector_size-1 and a pointer to the struct that must be filled. |
Offset
into the serialized data indicating where the vector is stored. This is mostly useful when flatbuffers are generated with mutation accessors. Definition at line 1936 of file flatbuffers.h.
|
inline |
Serialize an array of structs into a FlatBuffer vector
.
T | The data type of the struct array elements. |
[in] | f | A function that takes the current iteration 0..vector_size-1, a pointer to the struct that must be filled and the state argument. |
[in] | state | Arbitrary state to pass to f. |
Offset
into the serialized data indicating where the vector is stored. This is mostly useful when flatbuffers are generated with mutation accessors. Definition at line 1960 of file flatbuffers.h.
|
inline |
Definition at line 2169 of file flatbuffers.h.
|
inline |
By default vtables are deduped in order to save space.
[in] | dedup | When set to true , dedup vtables. |
Definition at line 1355 of file flatbuffers.h.
References dedup_vtables_.
|
inline |
Finish serializing a buffer by writing the root offset.
[in] | file_identifier | If a file_identifier is given, the buffer will be prefixed with a standard FlatBuffers file header. |
Definition at line 2196 of file flatbuffers.h.
References Finish().
Referenced by tflite2circle::build_circle_AbsOptions(), tflite2circle::build_circle_AddNOptions(), tflite2circle::build_circle_AddOptions(), tflite2circle::build_circle_ArgMaxOptions(), tflite2circle::build_circle_ArgMinOptions(), tflite2circle::build_circle_BatchMatMulOptions(), tflite2circle::build_circle_BatchToSpaceNDOptions(), tflite2circle::build_circle_BidirectionalSequenceLSTMOptions(), tflite2circle::build_circle_BroadcastToOptions(), tflite2circle::build_circle_CastOptions(), tflite2circle::build_circle_ConcatenationOptions(), tflite2circle::build_circle_Conv2DOptions(), tflite2circle::build_circle_CosOptions(), tflite2circle::build_circle_CumsumOptions(), tflite2circle::build_circle_DensifyOptions(), tflite2circle::build_circle_DepthToSpaceOptions(), tflite2circle::build_circle_DepthwiseConv2DOptions(), tflite2circle::build_circle_DequantizeOptions(), tflite2circle::build_circle_DivOptions(), tflite2circle::build_circle_EqualOptions(), tflite2circle::build_circle_ExpandDimsOptions(), tflite2circle::build_circle_ExpOptions(), tflite2circle::build_circle_FakeQuantOptions(), tflite2circle::build_circle_FillOptions(), tflite2circle::build_circle_FloorDivOptions(), tflite2circle::build_circle_FloorModOptions(), tflite2circle::build_circle_FullyConnectedOptions(), tflite2circle::build_circle_GatherNdOptions(), tflite2circle::build_circle_GatherOptions(), tflite2circle::build_circle_GeluOptions(), tflite2circle::build_circle_GreaterEqualOptions(), tflite2circle::build_circle_GreaterOptions(), tflite2circle::build_circle_IfOptions(), tflite2circle::build_circle_L2NormOptions(), tflite2circle::build_circle_LeakyReluOptions(), tflite2circle::build_circle_LessEqualOptions(), tflite2circle::build_circle_LessOptions(), tflite2circle::build_circle_LocalResponseNormalizationOptions(), tflite2circle::build_circle_LogicalAndOptions(), tflite2circle::build_circle_LogicalNotOptions(), tflite2circle::build_circle_LogicalOrOptions(), tflite2circle::build_circle_LogSoftmaxOptions(), tflite2circle::build_circle_MatrixDiagOptions(), tflite2circle::build_circle_MatrixSetDiagOptions(), tflite2circle::build_circle_MaximumMinimumOptions(), tflite2circle::build_circle_MirrorPadOptions(), tflite2circle::build_circle_MulOptions(), tflite2circle::build_circle_NegOptions(), tflite2circle::build_circle_NonMaxSuppressionV4Options(), tflite2circle::build_circle_NonMaxSuppressionV5Options(), tflite2circle::build_circle_NotEqualOptions(), tflite2circle::build_circle_OneHotOptions(), tflite2circle::build_circle_PackOptions(), tflite2circle::build_circle_PadOptions(), tflite2circle::build_circle_PadV2Options(), tflite2circle::build_circle_Pool2DOptions(), tflite2circle::build_circle_PowOptions(), tflite2circle::build_circle_RangeOptions(), tflite2circle::build_circle_RankOptions(), tflite2circle::build_circle_ReducerOptions(), tflite2circle::build_circle_ReshapeOptions(), tflite2circle::build_circle_ResizeBilinearOptions(), tflite2circle::build_circle_ResizeNearestNeighborOptions(), tflite2circle::build_circle_ReverseSequenceOptions(), tflite2circle::build_circle_ReverseV2Options(), tflite2circle::build_circle_ScatterNdOptions(), tflite2circle::build_circle_SegmentSumOptions(), tflite2circle::build_circle_SelectOptions(), tflite2circle::build_circle_SelectV2Options(), tflite2circle::build_circle_ShapeOptions(), tflite2circle::build_circle_SliceOptions(), tflite2circle::build_circle_SoftmaxOptions(), tflite2circle::build_circle_SpaceToBatchNDOptions(), tflite2circle::build_circle_SpaceToDepthOptions(), tflite2circle::build_circle_SparseToDenseOptions(), tflite2circle::build_circle_SplitOptions(), tflite2circle::build_circle_SplitVOptions(), tflite2circle::build_circle_SquaredDifferenceOptions(), tflite2circle::build_circle_SquareOptions(), tflite2circle::build_circle_SqueezeOptions(), tflite2circle::build_circle_StridedSliceOptions(), tflite2circle::build_circle_SubOptions(), tflite2circle::build_circle_SVDFOptions(), tflite2circle::build_circle_TileOptions(), tflite2circle::build_circle_TopKV2Options(), tflite2circle::build_circle_TransposeConvOptions(), tflite2circle::build_circle_TransposeOptions(), tflite2circle::build_circle_UnidirectionalSequenceLSTMOptions(), tflite2circle::build_circle_UniqueOptions(), tflite2circle::build_circle_UnpackOptions(), tflite2circle::build_circle_WhereOptions(), tflite2circle::build_circle_WhileOptions(), tflite2circle::build_circle_ZerosLikeOptions(), Finish(), FinishSizePrefixed(), tflite2circle::get_circle_sparse_index_vector(), onert::exporter::TrainInfoBuilder::TrainInfoBuilder(), BatchMatMulChef::value(), BCQFullyConnectedChef::value(), BCQGatherChef::value(), FullyConnectedChef::value(), GRUChef::value(), InstanceNormChef::value(), RmsNormChef::value(), RoPEChef::value(), AbsChef::value(), AddChef::value(), AddNChef::value(), ArgMaxChef::value(), ArgMinChef::value(), AveragePool2DChef::value(), BatchToSpaceNDChef::value(), CastChef::value(), ConcatenationChef::value(), Conv2DChef::value(), CosChef::value(), CumSumChef::value(), DensifyChef::value(), DepthToSpaceChef::value(), DepthwiseConv2DChef::value(), DivChef::value(), EqualChef::value(), ExpChef::value(), ExpandDimsChef::value(), FakeQuantChef::value(), FillChef::value(), FloorDivChef::value(), FloorModChef::value(), GatherChef::value(), GatherNdChef::value(), GeluChef::value(), GreaterChef::value(), GreaterEqualChef::value(), IfChef::value(), L2Pool2DChef::value(), LeakyReluChef::value(), LessChef::value(), LessEqualChef::value(), LocalResponseNormalizationChef::value(), LogicalAndChef::value(), LogicalNotChef::value(), LogicalOrChef::value(), LogSoftmaxChef::value(), MatrixDiagChef::value(), MatrixSetDiagChef::value(), MaximumChef::value(), MaxPool2DChef::value(), MeanChef::value(), MinimumChef::value(), MirrorPadChef::value(), MulChef::value(), NegChef::value(), NonMaxSuppressionV4Chef::value(), NonMaxSuppressionV5Chef::value(), NotEqualChef::value(), OneHotChef::value(), PackChef::value(), PadChef::value(), PadV2Chef::value(), PowChef::value(), RangeChef::value(), RankChef::value(), ReduceAnyChef::value(), ReduceMaxChef::value(), ReduceMinChef::value(), ReduceProdChef::value(), ReshapeChef::value(), ResizeBilinearChef::value(), ResizeNearestNeighborChef::value(), ReverseSequenceChef::value(), ReverseV2Chef::value(), ScatterNdChef::value(), SegmentSumChef::value(), SelectChef::value(), SelectV2Chef::value(), ShapeChef::value(), SliceChef::value(), SoftmaxChef::value(), SpaceToBatchNDChef::value(), SpaceToDepthChef::value(), SplitChef::value(), SplitVChef::value(), SquareChef::value(), SquaredDifferenceChef::value(), StridedSliceChef::value(), SubChef::value(), SumChef::value(), SVDFChef::value(), TileChef::value(), TopKV2Chef::value(), TransposeChef::value(), UniqueChef::value(), UnpackChef::value(), WhereChef::value(), WhileChef::value(), and ZerosLikeChef::value().
|
inlineprotected |
Definition at line 2221 of file flatbuffers.h.
References buf_, flatbuffers::vector_downward::clear_scratch(), finished, FLATBUFFERS_ASSERT, GetSize(), kFileIdentifierLength, and minalign_.
|
inline |
Finish a buffer with a 32 bit size field pre-fixed (size of the buffer following the size field). These buffers are NOT compatible with standard buffers created by Finish, i.e. you can't call GetRoot on them, you have to use GetSizePrefixedRoot instead. All >32 bit quantities in this buffer will be aligned when the whole size pre-fixed buffer is aligned. These kinds of buffers are useful for creating a stream of FlatBuffers.
Definition at line 2209 of file flatbuffers.h.
References Finish().
|
inline |
Get the released pointer to the serialized buffer.
FlatBuffer
that owns the buffer and its allocator and behaves similar to a unique_ptr
with a deleter. Definition at line 1293 of file flatbuffers.h.
References buf_, and flatbuffers::vector_downward::release().
|
inline |
In order to save space, fields that are set to their default value don't get serialized into the buffer.
[in] | fd | When set to true , always serializes default values that are set. Optional fields which are not set explicitly, will still not be serialized. |
Definition at line 1351 of file flatbuffers.h.
References force_defaults_.
Referenced by flatbuffers::Parser::Parser().
|
inline |
get the minimum alignment this buffer needs to be accessed properly. This is only known once all elements have been written (after you call Finish()). You can use this information if you need to embed a FlatBuffer in some other buffer, such that you can later read it without first having to copy it into its own buffer.
Definition at line 1328 of file flatbuffers.h.
References minalign_.
|
inline |
Get the serialized buffer (after you call Finish()
).
uint8_t
pointer to the FlatBuffer data inside the buffer. Definition at line 1270 of file flatbuffers.h.
References buf_, and flatbuffers::vector_downward::data().
Referenced by onert::exporter::TrainInfoBuilder::get(), luci::CircleExporterImpl::getBufferPointer(), and onert::exporter::TrainInfoBuilder::TrainInfoBuilder().
|
inline |
Get the serialized buffer (after you call Finish()
) as a span.
Definition at line 1279 of file flatbuffers.h.
References buf_, flatbuffers::vector_downward::data(), and flatbuffers::vector_downward::size().
|
inline |
Get a pointer to an unfinished buffer.
uint8_t
pointer to the unfinished buffer. Definition at line 1287 of file flatbuffers.h.
References buf_, and flatbuffers::vector_downward::data().
|
inline |
The current size of the serialized buffer, counting from the end.
uoffset_t
with the current size of the buffer. Definition at line 1265 of file flatbuffers.h.
References buf_, and flatbuffers::vector_downward::size().
Referenced by luci::check_size_limit(), CreateString(), CreateStruct(), CreateUninitializedVector(), Finish(), luci::CircleExporterImpl::getBufferSize(), onert::exporter::TrainInfoBuilder::size(), and onert::exporter::TrainInfoBuilder::TrainInfoBuilder().
|
protected |
|
inline |
Move assignment operator for FlatBufferBuilder.
Definition at line 1214 of file flatbuffers.h.
References Swap().
|
inline |
Get the released DetachedBuffer.
DetachedBuffer
that owns the buffer and its allocator. Definition at line 1302 of file flatbuffers.h.
References buf_, and flatbuffers::vector_downward::release().
|
inline |
Get the released pointer to the serialized buffer.
size | The size of the memory block containing the serialized FlatBuffer . |
offset | The offset from the released pointer where the finished FlatBuffer starts. |
FlatBuffer
. Definition at line 1317 of file flatbuffers.h.
References buf_, offset(), flatbuffers::vector_downward::release_raw(), and size.
Referenced by flatbuffers::grpc::MessageBuilder::ReleaseRaw().
|
inline |
Definition at line 1244 of file flatbuffers.h.
References buf_, Clear(), and flatbuffers::vector_downward::reset().
Referenced by flatbuffers::grpc::MessageBuilder::ReleaseMessage().
|
inline |
Definition at line 1224 of file flatbuffers.h.
References buf_, dedup_vtables_, finished, force_defaults_, max_voffset_, minalign_, nested, num_field_loc, string_pool, and flatbuffers::vector_downward::swap().
Referenced by FlatBufferBuilder(), flatbuffers::grpc::MessageBuilder::MessageBuilder(), operator=(), and flatbuffers::grpc::MessageBuilder::Swap().
|
inline |
Definition at line 2214 of file flatbuffers.h.
References buf_, and flatbuffers::vector_downward::swap_allocator().
|
protected |
Definition at line 2248 of file flatbuffers.h.
Referenced by Clear(), CreateSharedString(), CreateString(), CreateStruct(), CreateUninitializedVector(), CreateVectorOfSortedTables(), Finish(), FLATBUFFERS_ATTRIBUTE(), GetBufferPointer(), GetBufferSpan(), GetCurrentBufferPointer(), flatbuffers::grpc::MessageBuilder::GetMessage(), GetSize(), flatbuffers::grpc::MessageBuilder::MessageBuilder(), Release(), ReleaseRaw(), Reset(), Swap(), flatbuffers::grpc::MessageBuilder::Swap(), and SwapBufAllocator().
|
protected |
Definition at line 2267 of file flatbuffers.h.
Referenced by DedupVtables(), and Swap().
|
protected |
Definition at line 2261 of file flatbuffers.h.
|
protected |
Definition at line 2265 of file flatbuffers.h.
Referenced by ForceDefaults(), and Swap().
|
static |
The length of a FlatBuffer file header.
Definition at line 2191 of file flatbuffers.h.
Referenced by Finish(), and flatbuffers::Registry::FlatBufferToText().
|
protected |
Definition at line 2255 of file flatbuffers.h.
Referenced by Swap().
|
protected |
Definition at line 2263 of file flatbuffers.h.
Referenced by Clear(), Finish(), GetBufferMinAlignment(), and Swap().
|
protected |
Definition at line 2258 of file flatbuffers.h.
|
protected |
Definition at line 2252 of file flatbuffers.h.
Referenced by Swap().
|
protected |
Definition at line 2283 of file flatbuffers.h.
Referenced by Clear(), CreateSharedString(), Swap(), and ~FlatBufferBuilder().