ONE - On-device Neural Engine
Loading...
Searching...
No Matches
flatbuffers::FieldDef Struct Reference

#include <idl.h>

Collaboration diagram for flatbuffers::FieldDef:

Public Types

enum  Presence { kRequired , kOptional , kDefault }
 

Public Member Functions

 FieldDef ()
 
Offset< reflection::Field > Serialize (FlatBufferBuilder *builder, uint16_t id, const Parser &parser) const
 
bool Deserialize (Parser &parser, const reflection::Field *field)
 
bool IsScalarOptional () const
 
bool IsOptional () const
 
bool IsRequired () const
 
bool IsDefault () const
 
- Public Member Functions inherited from flatbuffers::Definition
 Definition ()
 
flatbuffers::Offset< flatbuffers::Vector< flatbuffers::Offset< reflection::KeyValue > > > SerializeAttributes (FlatBufferBuilder *builder, const Parser &parser) const
 
bool DeserializeAttributes (Parser &parser, const Vector< Offset< reflection::KeyValue > > *attrs)
 

Static Public Member Functions

static Presence MakeFieldPresence (bool optional, bool required)
 

Data Fields

Value value
 
bool deprecated
 
bool key
 
bool shared
 
bool native_inline
 
bool flexbuffer
 
Presence presence
 
StructDefnested_flatbuffer
 
size_t padding
 
- Data Fields inherited from flatbuffers::Definition
std::string name
 
std::string file
 
std::vector< std::string > doc_comment
 
SymbolTable< Valueattributes
 
bool generated
 
Namespacedefined_namespace
 
uoffset_t serialized_location
 
int index
 
int refcount
 

Detailed Description

Definition at line 302 of file idl.h.

Member Enumeration Documentation

◆ Presence

Enumerator
kRequired 
kOptional 
kDefault 

Definition at line 330 of file idl.h.

331 {
332 // Field must always be present.
333 kRequired,
334 // Non-presence should be signalled to and controlled by users.
335 kOptional,
336 // Non-presence is hidden from users.
337 // Implementations may omit writing default values.
338 kDefault,
339 };

Constructor & Destructor Documentation

◆ FieldDef()

flatbuffers::FieldDef::FieldDef ( )
inline

Definition at line 304 of file idl.h.

305 : deprecated(false), key(false), shared(false), native_inline(false), flexbuffer(false),
307 {
308 }
StructDef * nested_flatbuffer
Definition idl.h:351
Presence presence
Definition idl.h:349

Member Function Documentation

◆ Deserialize()

bool flatbuffers::FieldDef::Deserialize ( Parser parser,
const reflection::Field *  field 
)

◆ IsDefault()

bool flatbuffers::FieldDef::IsDefault ( ) const
inline

Definition at line 318 of file idl.h.

318{ return presence == kDefault; }

References kDefault, and presence.

◆ IsOptional()

bool flatbuffers::FieldDef::IsOptional ( ) const
inline

Definition at line 316 of file idl.h.

316{ return presence == kOptional; }

References kOptional, and presence.

Referenced by IsScalarOptional().

◆ IsRequired()

bool flatbuffers::FieldDef::IsRequired ( ) const
inline

Definition at line 317 of file idl.h.

317{ return presence == kRequired; }

References kRequired, and presence.

◆ IsScalarOptional()

bool flatbuffers::FieldDef::IsScalarOptional ( ) const
inline

Definition at line 315 of file idl.h.

315{ return IsScalar(value.type.base_type) && IsOptional(); }
bool IsScalar(BaseType t)
Definition idl.h:132
bool IsOptional() const
Definition idl.h:316
BaseType base_type
Definition idl.h:184

References flatbuffers::Type::base_type, IsOptional(), flatbuffers::IsScalar(), flatbuffers::Value::type, and value.

◆ MakeFieldPresence()

static Presence flatbuffers::FieldDef::MakeFieldPresence ( bool  optional,
bool  required 
)
inlinestatic

Definition at line 340 of file idl.h.

341 {
342 FLATBUFFERS_ASSERT(!(required && optional));
343 // clang-format off
347 // clang-format on
348 }
#define FLATBUFFERS_ASSERT
Definition base.h:37
required
Definition infer.py:18
bool optional(bool is_optional)
convert option overview for Option constructor

References FLATBUFFERS_ASSERT, kDefault, kOptional, and kRequired.

◆ Serialize()

Offset< reflection::Field > flatbuffers::FieldDef::Serialize ( FlatBufferBuilder builder,
uint16_t  id,
const Parser parser 
) const

Field Documentation

◆ deprecated

bool flatbuffers::FieldDef::deprecated

Definition at line 321 of file idl.h.

◆ flexbuffer

bool flatbuffers::FieldDef::flexbuffer

Definition at line 328 of file idl.h.

◆ key

bool flatbuffers::FieldDef::key

Definition at line 323 of file idl.h.

◆ native_inline

bool flatbuffers::FieldDef::native_inline

Definition at line 326 of file idl.h.

◆ nested_flatbuffer

StructDef* flatbuffers::FieldDef::nested_flatbuffer

Definition at line 351 of file idl.h.

◆ padding

size_t flatbuffers::FieldDef::padding

Definition at line 352 of file idl.h.

◆ presence

Presence flatbuffers::FieldDef::presence

Definition at line 349 of file idl.h.

Referenced by IsDefault(), IsOptional(), and IsRequired().

◆ shared

bool flatbuffers::FieldDef::shared

Definition at line 324 of file idl.h.

◆ value

Value flatbuffers::FieldDef::value

Definition at line 320 of file idl.h.

Referenced by IsScalarOptional().


The documentation for this struct was generated from the following file: