ONE - On-device Neural Engine
Loading...
Searching...
No Matches
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 38 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 47 of file Index.h.

47: _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 53 of file Index.h.

53: _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 148 of file Index.h.

148{ 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 108 of file Index.h.

108{ 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 101 of file Index.h.

101{ 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 115 of file Index.h.

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

◆ operator<()

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

Definition at line 141 of file Index.h.

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

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 67 of file Index.h.

68 {
69 _index = o;
70 return *this;
71 }

◆ 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 94 of file Index.h.

94{ 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 87 of file Index.h.

87{ 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 133 of file Index.h.

133{ 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 127 of file Index.h.

127{ 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 139 of file Index.h.

139{ 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: