ONE - On-device Neural Engine
Loading...
Searching...
No Matches
flatbuffers::Array< T, length > Class Template Reference

#include <flatbuffers.h>

Public Types

typedef uint16_t size_type
 
typedef IndirectHelper< IndirectHelperType >::return_type return_type
 
typedef VectorIterator< T, return_typeconst_iterator
 
typedef VectorReverseIterator< const_iteratorconst_reverse_iterator
 

Public Member Functions

FLATBUFFERS_CONSTEXPR uint16_t size () const
 
return_type Get (uoffset_t i) const
 
return_type operator[] (uoffset_t i) const
 
template<typename E >
GetEnum (uoffset_t i) const
 
const_iterator begin () const
 
const_iterator end () const
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 
flatbuffers::conditional< scalar_tag::value, void, T * >::type GetMutablePointer (uoffset_t i) const
 
void Mutate (uoffset_t i, const T &val)
 
const uint8_t * Data () const
 
uint8_t * Data ()
 
const T * data () const
 
T * data ()
 
void CopyFromSpan (flatbuffers::span< const T, length > src)
 

Protected Member Functions

void MutateImpl (flatbuffers::integral_constant< bool, true >, uoffset_t i, const T &val)
 
void MutateImpl (flatbuffers::integral_constant< bool, false >, uoffset_t i, const T &val)
 
void CopyFromSpanImpl (flatbuffers::integral_constant< bool, true >, flatbuffers::span< const T, length > src)
 
void CopyFromSpanImpl (flatbuffers::integral_constant< bool, false >, flatbuffers::span< const T, length > src)
 
 Array ()
 

Protected Attributes

uint8_t data_ [length *sizeof(T)]
 

Detailed Description

template<typename T, uint16_t length>
class flatbuffers::Array< T, length >

Definition at line 451 of file flatbuffers.h.

Member Typedef Documentation

◆ const_iterator

template<typename T , uint16_t length>
typedef VectorIterator<T, return_type> flatbuffers::Array< T, length >::const_iterator

Definition at line 461 of file flatbuffers.h.

◆ const_reverse_iterator

template<typename T , uint16_t length>
typedef VectorReverseIterator<const_iterator> flatbuffers::Array< T, length >::const_reverse_iterator

Definition at line 462 of file flatbuffers.h.

◆ return_type

template<typename T , uint16_t length>
typedef IndirectHelper<IndirectHelperType>::return_type flatbuffers::Array< T, length >::return_type

Definition at line 460 of file flatbuffers.h.

◆ size_type

template<typename T , uint16_t length>
typedef uint16_t flatbuffers::Array< T, length >::size_type

Definition at line 459 of file flatbuffers.h.

Constructor & Destructor Documentation

◆ Array()

template<typename T , uint16_t length>
flatbuffers::Array< T, length >::Array ( )
protected

Member Function Documentation

◆ begin()

template<typename T , uint16_t length>
const_iterator flatbuffers::Array< T, length >::begin ( ) const
inline

Definition at line 479 of file flatbuffers.h.

479{ return const_iterator(Data(), 0); }
VectorIterator< T, return_type > const_iterator
const uint8_t * Data() const

References flatbuffers::Array< T, length >::Data().

Referenced by flatbuffers::Array< T, length >::cbegin(), and flatbuffers::Array< T, length >::rend().

◆ cbegin()

template<typename T , uint16_t length>
const_iterator flatbuffers::Array< T, length >::cbegin ( ) const
inline

Definition at line 485 of file flatbuffers.h.

485{ return begin(); }
const_iterator begin() const

References flatbuffers::Array< T, length >::begin().

◆ cend()

template<typename T , uint16_t length>
const_iterator flatbuffers::Array< T, length >::cend ( ) const
inline

Definition at line 486 of file flatbuffers.h.

486{ return end(); }
const_iterator end() const

References flatbuffers::Array< T, length >::end().

◆ CopyFromSpan()

template<typename T , uint16_t length>
void flatbuffers::Array< T, length >::CopyFromSpan ( flatbuffers::span< const T, length >  src)
inline

Definition at line 517 of file flatbuffers.h.

518 {
519 const auto p1 = reinterpret_cast<const uint8_t *>(src.data());
520 const auto p2 = Data();
521 FLATBUFFERS_ASSERT(!(p1 >= p2 && p1 < (p2 + length)) && !(p2 >= p1 && p2 < (p1 + length)));
522 (void)p1;
523 (void)p2;
524
526 !scalar_tag::value || sizeof(T) == 1 || FLATBUFFERS_LITTLEENDIAN > (), src);
527 }
#define FLATBUFFERS_ASSERT
Definition base.h:37
void CopyFromSpanImpl(flatbuffers::integral_constant< bool, true >, flatbuffers::span< const T, length > src)

References flatbuffers::Array< T, length >::CopyFromSpanImpl(), flatbuffers::Array< T, length >::Data(), and FLATBUFFERS_ASSERT.

◆ CopyFromSpanImpl() [1/2]

template<typename T , uint16_t length>
void flatbuffers::Array< T, length >::CopyFromSpanImpl ( flatbuffers::integral_constant< bool, false >  ,
flatbuffers::span< const T, length >  src 
)
inlineprotected

Definition at line 551 of file flatbuffers.h.

553 {
554 for (size_type k = 0; k < length; k++)
555 {
556 Mutate(k, src[k]);
557 }
558 }
void Mutate(uoffset_t i, const T &val)

References flatbuffers::Array< T, length >::Mutate().

◆ CopyFromSpanImpl() [2/2]

template<typename T , uint16_t length>
void flatbuffers::Array< T, length >::CopyFromSpanImpl ( flatbuffers::integral_constant< bool, true >  ,
flatbuffers::span< const T, length >  src 
)
inlineprotected

Definition at line 541 of file flatbuffers.h.

543 {
544 // Use std::memcpy() instead of std::copy() to avoid preformance degradation
545 // due to aliasing if T is char or unsigned char.
546 // The size is known at compile time, so memcpy would be inlined.
547 std::memcpy(data(), src.data(), length * sizeof(T));
548 }
const T * data() const

References flatbuffers::Array< T, length >::data().

Referenced by flatbuffers::Array< T, length >::CopyFromSpan().

◆ crbegin()

template<typename T , uint16_t length>
const_reverse_iterator flatbuffers::Array< T, length >::crbegin ( ) const
inline

Definition at line 488 of file flatbuffers.h.

488{ return rbegin(); }
const_reverse_iterator rbegin() const

References flatbuffers::Array< T, length >::rbegin().

◆ crend()

template<typename T , uint16_t length>
const_reverse_iterator flatbuffers::Array< T, length >::crend ( ) const
inline

Definition at line 489 of file flatbuffers.h.

489{ return rend(); }
const_reverse_iterator rend() const

References flatbuffers::Array< T, length >::rend().

◆ Data() [1/2]

template<typename T , uint16_t length>
uint8_t * flatbuffers::Array< T, length >::Data ( )
inline

Definition at line 509 of file flatbuffers.h.

509{ return data_; }
uint8_t data_[length *sizeof(T)]

References flatbuffers::Array< T, length >::data_.

◆ data() [1/2]

template<typename T , uint16_t length>
T * flatbuffers::Array< T, length >::data ( )
inline

Definition at line 513 of file flatbuffers.h.

513{ return reinterpret_cast<T *>(Data()); }

References flatbuffers::Array< T, length >::Data().

◆ Data() [2/2]

◆ data() [2/2]

template<typename T , uint16_t length>
const T * flatbuffers::Array< T, length >::data ( ) const
inline

◆ end()

template<typename T , uint16_t length>
const_iterator flatbuffers::Array< T, length >::end ( ) const
inline

◆ Get()

template<typename T , uint16_t length>
return_type flatbuffers::Array< T, length >::Get ( uoffset_t  i) const
inline

◆ GetEnum()

template<typename T , uint16_t length>
template<typename E >
E flatbuffers::Array< T, length >::GetEnum ( uoffset_t  i) const
inline

Definition at line 477 of file flatbuffers.h.

477{ return static_cast<E>(Get(i)); }
return_type Get(uoffset_t i) const

References flatbuffers::Array< T, length >::Get().

◆ GetMutablePointer()

template<typename T , uint16_t length>
flatbuffers::conditional< scalar_tag::value, void, T * >::type flatbuffers::Array< T, length >::GetMutablePointer ( uoffset_t  i) const
inline

Definition at line 497 of file flatbuffers.h.

498 {
500 return const_cast<T *>(&data()[i]);
501 }

References flatbuffers::Array< T, length >::data(), FLATBUFFERS_ASSERT, and flatbuffers::Array< T, length >::size().

Referenced by flatbuffers::Array< T, length >::MutateImpl().

◆ Mutate()

template<typename T , uint16_t length>
void flatbuffers::Array< T, length >::Mutate ( uoffset_t  i,
const T &  val 
)
inline

Definition at line 504 of file flatbuffers.h.

504{ MutateImpl(scalar_tag(), i, val); }
void MutateImpl(flatbuffers::integral_constant< bool, true >, uoffset_t i, const T &val)

References flatbuffers::Array< T, length >::MutateImpl().

Referenced by flatbuffers::Array< T, length >::CopyFromSpanImpl().

◆ MutateImpl() [1/2]

template<typename T , uint16_t length>
void flatbuffers::Array< T, length >::MutateImpl ( flatbuffers::integral_constant< bool, false >  ,
uoffset_t  i,
const T &  val 
)
inlineprotected

Definition at line 536 of file flatbuffers.h.

537 {
538 *(GetMutablePointer(i)) = val;
539 }
flatbuffers::conditional< scalar_tag::value, void, T * >::type GetMutablePointer(uoffset_t i) const

References flatbuffers::Array< T, length >::GetMutablePointer().

◆ MutateImpl() [2/2]

template<typename T , uint16_t length>
void flatbuffers::Array< T, length >::MutateImpl ( flatbuffers::integral_constant< bool, true >  ,
uoffset_t  i,
const T &  val 
)
inlineprotected

Definition at line 530 of file flatbuffers.h.

531 {
533 WriteScalar(data() + i, val);
534 }

References flatbuffers::Array< T, length >::data(), FLATBUFFERS_ASSERT, and flatbuffers::Array< T, length >::size().

Referenced by flatbuffers::Array< T, length >::Mutate().

◆ operator[]()

template<typename T , uint16_t length>
return_type flatbuffers::Array< T, length >::operator[] ( uoffset_t  i) const
inline

Definition at line 472 of file flatbuffers.h.

472{ return Get(i); }

References flatbuffers::Array< T, length >::Get().

◆ rbegin()

template<typename T , uint16_t length>
const_reverse_iterator flatbuffers::Array< T, length >::rbegin ( ) const
inline

Definition at line 482 of file flatbuffers.h.

482{ return const_reverse_iterator(end()); }
VectorReverseIterator< const_iterator > const_reverse_iterator

References flatbuffers::Array< T, length >::end().

Referenced by flatbuffers::Array< T, length >::crbegin().

◆ rend()

template<typename T , uint16_t length>
const_reverse_iterator flatbuffers::Array< T, length >::rend ( ) const
inline

◆ size()

template<typename T , uint16_t length>
FLATBUFFERS_CONSTEXPR uint16_t flatbuffers::Array< T, length >::size ( ) const
inline

Field Documentation

◆ data_

template<typename T , uint16_t length>
uint8_t flatbuffers::Array< T, length >::data_[length *sizeof(T)]
protected

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