ONE - On-device Neural Engine
Loading...
Searching...
No Matches
luci::VectorWrapper< T > Class Template Reference

Wrapper to use flatbuffers::Vector pointer as std::vector entity. More...

#include <CircleReader.h>

Public Types

using iterator = typename flatbuffers::Vector< T >::const_iterator
 
using value_type = typename flatbuffers::Vector< T >::return_type
 

Public Member Functions

 VectorWrapper (const flatbuffers::Vector< T > *ptr)
 
const T * data () const
 
uint32_t size () const
 
iterator begin () const
 
iterator end () const
 
value_type at (uint32_t i) const
 
value_type operator[] (uint32_t i) const
 
bool null () const
 
bool empty () const
 

Detailed Description

template<typename T>
class luci::VectorWrapper< T >

Wrapper to use flatbuffers::Vector pointer as std::vector entity.

Definition at line 59 of file CircleReader.h.

Member Typedef Documentation

◆ iterator

template<typename T >
using luci::VectorWrapper< T >::iterator = typename flatbuffers::Vector<T>::const_iterator

Definition at line 67 of file CircleReader.h.

◆ value_type

template<typename T >
using luci::VectorWrapper< T >::value_type = typename flatbuffers::Vector<T>::return_type

Definition at line 71 of file CircleReader.h.

Constructor & Destructor Documentation

◆ VectorWrapper()

template<typename T >
luci_interpreter::VectorWrapper< T >::VectorWrapper ( const flatbuffers::Vector< T > *  ptr)
explicit

Definition at line 394 of file CircleReader.cpp.

394 : _vector(ptr)
395{
396 // Do nothing
397}

Member Function Documentation

◆ at()

template<typename T >
VectorWrapper< T >::value_type luci_interpreter::VectorWrapper< T >::at ( uint32_t  i) const

Definition at line 419 of file CircleReader.cpp.

420{
421 if (i >= size())
422 {
423 // TODO find better error message
424 throw std::range_error("Access to prohibited vector element");
425 }
426
427 return _vector->Get(i);
428}
uint32_t size() const

References size.

Referenced by luci_interpreter::GraphLoader::checkInplaceOps(), luci_interpreter::RuntimeGraph::configure(), and luci_interpreter::RuntimeGraph::execute().

◆ begin()

template<typename T >
VectorWrapper< T >::iterator luci_interpreter::VectorWrapper< T >::begin ( ) const

Definition at line 409 of file CircleReader.cpp.

410{
411 return null() ? iterator(nullptr, 0) : _vector->begin();
412}
typename flatbuffers::Vector< T >::const_iterator iterator
iterator begin() const

◆ data()

template<typename T >
const T * luci_interpreter::VectorWrapper< T >::data ( ) const

◆ empty()

template<typename T >
bool luci_interpreter::VectorWrapper< T >::empty ( ) const

Definition at line 437 of file CircleReader.cpp.

437{ return size() == 0; }

References size.

Referenced by luci::CircleConstNodeBuilder::build().

◆ end()

template<typename T >
VectorWrapper< T >::iterator luci_interpreter::VectorWrapper< T >::end ( ) const

Definition at line 414 of file CircleReader.cpp.

415{
416 return null() ? begin() : _vector->end();
417}
iterator end() const

References begin.

◆ null()

template<typename T >
bool luci_interpreter::VectorWrapper< T >::null ( ) const

Definition at line 436 of file CircleReader.cpp.

436{ return _vector == nullptr; }

◆ operator[]()

template<typename T >
VectorWrapper< T >::value_type luci_interpreter::VectorWrapper< T >::operator[] ( uint32_t  i) const

Definition at line 431 of file CircleReader.cpp.

432{
433 return at(i);
434}
value_type at(uint32_t i) const

◆ size()

template<typename T >
uint32_t luci_interpreter::VectorWrapper< T >::size ( ) const

Definition at line 399 of file CircleReader.cpp.

400{
401 return null() ? 0 : _vector->size();
402}

Referenced by luci::CircleImportMetadata::CircleImportMetadata(), and luci_interpreter::RuntimeGraph::execute().


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