ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
onert::util::Index< T, DummyTag > Class Template Reference

A wrapper class for unsigned integral Index NOTE : Max value of the underlying type is used as the invalid value. More...

#include <Index.h>

Public Member Functions

 Index (void)
 Construct a new Index object.
 
 Index (const T o)
 Construct a new Index object with a value in the underlying type.
 
 Index (const Index &o)=default
 Copy Constructor.
 
Indexoperator= (const T o)
 Assign a value in the underlying time.
 
Indexoperator= (const Index &o)=default
 Copy assignment operator.
 
bool operator== (T o) const
 Equality operator.
 
bool operator== (const Index &o) const
 Equality operator.
 
bool operator!= (T o) const
 Inquality operator.
 
bool operator!= (const Index &o) const
 Inquality operator.
 
Index operator++ (int)
 Post increment operator.
 
bool valid () const
 Check whether the value is valid or not.
 
bool undefined () const
 Check whether the value is undefined.
 
value () const
 Return underlying value.
 
bool operator< (const Index &I) const
 

Static Public Member Functions

static T max ()
 Return max index value.
 

Detailed Description

template<typename T, typename DummyTag>
class onert::util::Index< T, DummyTag >

A wrapper class for unsigned integral Index NOTE : Max value of the underlying type is used as the invalid value.

Template Parameters
TUnderlying type. Must be unsigned integral type otherwise its behavior is undefined.
DummyTagDummy type to distinguish types with a same underlying type. Using an opaque type is recommended.

Definition at line 36 of file Index.h.

Constructor & Destructor Documentation

◆ Index() [1/3]

template<typename T , typename DummyTag >
onert::util::Index< T, DummyTag >::Index ( void  )
inlineexplicit

Construct a new Index object.

Definition at line 45 of file Index.h.

45: _index{UNDEFINED} {}

◆ Index() [2/3]

template<typename T , typename DummyTag >
onert::util::Index< T, DummyTag >::Index ( const T  o)
inlineexplicit

Construct a new Index object with a value in the underlying type.

Parameters
oValue in the underlying type

Definition at line 51 of file Index.h.

51: _index{o} {}

◆ Index() [3/3]

template<typename T , typename DummyTag >
onert::util::Index< T, DummyTag >::Index ( const Index< T, DummyTag > &  o)
default

Copy Constructor.

Parameters
oObject to be copied

Member Function Documentation

◆ max()

template<typename T , typename DummyTag >
static T onert::util::Index< T, DummyTag >::max ( )
inlinestatic

Return max index value.

Returns
Maximum valid index value

Definition at line 146 of file Index.h.

146{ return UNDEFINED - 1; }

◆ operator!=() [1/2]

template<typename T , typename DummyTag >
bool onert::util::Index< T, DummyTag >::operator!= ( const Index< T, DummyTag > &  o) const
inline

Inquality operator.

Parameters
oThe other object to compare
Returns
true if underlying value is different, false otherwise

Definition at line 106 of file Index.h.

106{ return !(*this == o); }

◆ operator!=() [2/2]

template<typename T , typename DummyTag >
bool onert::util::Index< T, DummyTag >::operator!= ( o) const
inline

Inquality operator.

Parameters
oThe other value in the underlying type to compare
Returns
true if underlying value is different, false otherwise

Definition at line 99 of file Index.h.

99{ return !(*this == o); }

◆ operator++()

template<typename T , typename DummyTag >
Index onert::util::Index< T, DummyTag >::operator++ ( int  )
inline

Post increment operator.

Returns
Index Index before increment

Definition at line 113 of file Index.h.

114 {
115 Index temp = *this;
116 _index++;
117 return temp;
118 }
Index(void)
Construct a new Index object.
Definition Index.h:45

◆ operator<()

template<typename T , typename DummyTag >
bool onert::util::Index< T, DummyTag >::operator< ( const Index< T, DummyTag > &  I) const
inline

Definition at line 139 of file Index.h.

139{ return value() < I.value(); }
T value() const
Return underlying value.
Definition Index.h:137

References onert::util::Index< T, DummyTag >::value().

◆ operator=() [1/2]

template<typename T , typename DummyTag >
Index & onert::util::Index< T, DummyTag >::operator= ( const Index< T, DummyTag > &  o)
default

Copy assignment operator.

Parameters
oObject to be copied
Returns
Index& Reference of this pointer

◆ operator=() [2/2]

template<typename T , typename DummyTag >
Index & onert::util::Index< T, DummyTag >::operator= ( const T  o)
inline

Assign a value in the underlying time.

Parameters
oValue in the underlying type
Returns
Index& Reference of this pointer

Definition at line 65 of file Index.h.

66 {
67 _index = o;
68 return *this;
69 }

◆ operator==() [1/2]

template<typename T , typename DummyTag >
bool onert::util::Index< T, DummyTag >::operator== ( const Index< T, DummyTag > &  o) const
inline

Equality operator.

Parameters
oThe other object to compare
Returns
true if underlying value is the same, false otherwise

Definition at line 92 of file Index.h.

92{ return _index == o._index; }

◆ operator==() [2/2]

template<typename T , typename DummyTag >
bool onert::util::Index< T, DummyTag >::operator== ( o) const
inline

Equality operator.

Parameters
oThe other value in the underlying type to compare
Returns
true if underlying value is the same, false otherwise

Definition at line 85 of file Index.h.

85{ return _index == o; }

◆ undefined()

template<typename T , typename DummyTag >
bool onert::util::Index< T, DummyTag >::undefined ( ) const
inline

Check whether the value is undefined.

Returns
true if undefined, false otherwise

Definition at line 131 of file Index.h.

131{ return _index == UNDEFINED; }

◆ valid()

template<typename T , typename DummyTag >
bool onert::util::Index< T, DummyTag >::valid ( ) const
inline

Check whether the value is valid or not.

Returns
true if valid, false otherwise

Definition at line 125 of file Index.h.

125{ return _index != UNDEFINED; }

Referenced by onert::backend::cl_common::createLifetimeMap(), onert::backend::train::DisposableTensorIndex::DisposableTensorIndex(), onert::backend::train::LayerScopeTensorIndex::LayerScopeTensorIndex(), and onert::exporter::CircleExporter::updateWeight().

◆ value()

template<typename T , typename DummyTag >
T onert::util::Index< T, DummyTag >::value ( ) const
inline

Return underlying value.

Returns
T Underlying value

Definition at line 137 of file Index.h.

137{ return _index; }

Referenced by onert::ir::OperandIndexSequence::at(), onert::compiler::Compiler::compile(), onert::compiler::MultiModelCompiler::compile(), onert::compiler::train::TrainingCompiler::compile(), onert::backend::train::DisposableTensorIndex::DisposableTensorIndex(), onert::exec::MultiModelExecutors::execute(), onert::exec::Execution::getInputBuffer(), onert::exec::Execution::getInputShape(), onert::exec::Execution::getInputTotalSize(), onert::exec::Execution::getOutputBuffer(), onert::exec::Execution::getOutputShape(), onert::exec::Execution::getOutputTotalSize(), onert::exec::TracingObserver::handleJobBegin(), onert::exec::TracingObserver::handleJobEnd(), onert::exec::TracingObserver::handleSubgraphBegin(), onert::exec::TracingObserver::handleSubgraphEnd(), onert::exec::MultiModelExecutors::inputInfo(), onert::util::Index< T, DummyTag >::operator<(), onert::exec::MultiModelExecutors::outputInfo(), onert::backend::basic::FirstFitPlanner::release(), onert::exporter::CircleExporter::updateWeight(), onert::ir::OperationDumper::visit(), onert::ir::OperationDumper::visit(), onert::ir::OperationDumper::visit(), onert::ir::OperationDumper::visit(), onert::ir::OperationDumper::visit(), onert::ir::OperationDumper::visit(), onert::ir::OperationDumper::visit(), onert::ir::OperationDumper::visit(), onert::ir::OperationDumper::visit(), onert::ir::OperationDumper::visit(), and onert::ir::OperationDumper::visit().


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