ONE - On-device Neural Engine
Loading...
Searching...
No Matches
flexbuffers::Vector Class Reference

#include <flexbuffers.h>

Collaboration diagram for flexbuffers::Vector:

Public Member Functions

 Vector (const uint8_t *data, uint8_t byte_width)
 
Reference operator[] (size_t i) const
 
bool IsTheEmptyVector () const
 
- Public Member Functions inherited from flexbuffers::Sized
 Sized (const uint8_t *data, uint8_t byte_width)
 
 Sized (const uint8_t *data, uint8_t byte_width, size_t sz)
 
size_t size () const
 
size_t read_size () const
 
- Public Member Functions inherited from flexbuffers::Object
 Object (const uint8_t *data, uint8_t byte_width)
 

Static Public Member Functions

static Vector EmptyVector ()
 

Additional Inherited Members

- Protected Attributes inherited from flexbuffers::Sized
size_t size_
 
- Protected Attributes inherited from flexbuffers::Object
const uint8_t * data_
 
uint8_t byte_width_
 

Detailed Description

Definition at line 277 of file flexbuffers.h.

Constructor & Destructor Documentation

◆ Vector()

flexbuffers::Vector::Vector ( const uint8_t *  data,
uint8_t  byte_width 
)
inline

Definition at line 280 of file flexbuffers.h.

280: Sized(data, byte_width) {}
Sized(const uint8_t *data, uint8_t byte_width)

Member Function Documentation

◆ EmptyVector()

static Vector flexbuffers::Vector::EmptyVector ( )
inlinestatic

Definition at line 284 of file flexbuffers.h.

285 {
286 static const uint8_t empty_vector[] = {0 /*len*/};
287 return Vector(empty_vector + 1, 1);
288 }

Referenced by IsTheEmptyVector().

◆ IsTheEmptyVector()

bool flexbuffers::Vector::IsTheEmptyVector ( ) const
inline

Definition at line 289 of file flexbuffers.h.

289{ return data_ == EmptyVector().data_; }
const uint8_t * data_
static Vector EmptyVector()

References flexbuffers::Object::data_, and EmptyVector().

◆ operator[]()

Reference Vector::operator[] ( size_t  i) const
inline

Definition at line 942 of file flexbuffers.h.

943{
944 auto len = size();
945 if (i >= len)
946 return Reference(nullptr, 1, NullPackedType());
947 auto packed_type = (data_ + len * byte_width_)[i];
948 auto elem = data_ + i * byte_width_;
949 return Reference(elem, byte_width_, packed_type);
950}
size_t size() const
uint8_t NullPackedType()

References flexbuffers::Object::byte_width_, flexbuffers::Object::data_, flexbuffers::NullPackedType(), and flexbuffers::Sized::size().


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