ACF $AcfVersion:0$
Public Types | Public Member Functions | Static Public Member Functions | List of all members
istd::TIndex< Dimensions > Class Template Reference

Multidimensional index used to addressing fixed-size array. More...

#include <TIndex.h>

Inheritance diagram for istd::TIndex< Dimensions >:
istd::TArray< Element, Dimensions >::Iterator

Public Types

enum  { DIMENSIONS = Dimensions }
 
typedef int IndexType
 
typedef int * Iterator
 

Public Member Functions

 TIndex ()
 Default constructor with initialization of member to 0.
 
 TIndex (int value)
 Constructor initializing all members to specified value.
 
 TIndex (const TIndex &index)
 Copy constructor.
 
bool IsValid () const
 Check if this index is valid.
 
bool IsZero () const
 Check if this index point at zero element.
 
bool IsSizeEmpty () const
 Check if this index interpreted as size is empty.
 
void Reset ()
 Reset this object.
 
void Clear ()
 Set all components to 0.
 
bool IsDimensionsCountFixed () const
 Check, if number dimensions is fixed.
 
int GetDimensionsCount () const
 Get number of dimensions of this index.
 
bool SetDimensionsCount (int count) const
 Set number of dimensions of this index.
 
int GetAt (int index) const
 Get element stored at specified index.
 
void SetAt (int index, int value)
 Set element at specified index.
 
void SetAllTo (int value)
 Set all components to specified value.
 
bool IncreaseAt (int index)
 Increase single component at specified position.
 
bool DecreaseAt (int index)
 Decrease single component at specified position.
 
bool IsInside (const TIndex &boundaries) const
 Check if index is inside boundaries.
 
bool Increase (const TIndex &boundaries)
 Increase this index inside the boundaries.
 
bool Decrease (const TIndex &boundaries)
 Decrease this index inside the boundaries.
 
int GetProductVolume () const
 Get total number of elements if this index is treated as size.
 
int GetIterationIndex (const TIndex &boundaries) const
 Get index of iteration from zero to current index inside some boundaries.
 
Iterator Begin () const
 Get begin value of element access iterator.
 
Iterator End () const
 Get end value of element access iterator.
 
int operator[] (int index) const
 
int & operator[] (int index)
 
bool operator== (const TIndex &index) const
 
bool operator!= (const TIndex &index) const
 
TIndex operator+ (const TIndex &index) const
 
TIndexoperator+= (const TIndex &index)
 
TIndex operator- (const TIndex &index) const
 
TIndexoperator-= (const TIndex &index)
 
TIndexoperator= (const TIndex &index)=default
 

Static Public Member Functions

static const TIndex< Dimensions > & GetZero ()
 Get global instance of zero index.
 
static const TIndex< Dimensions > & GetInvalid ()
 Get global instance of invalid index.
 

Detailed Description

template<int Dimensions>
class istd::TIndex< Dimensions >

Multidimensional index used to addressing fixed-size array.

Definition at line 17 of file TIndex.h.

Member Typedef Documentation

◆ IndexType

template<int Dimensions>
typedef int istd::TIndex< Dimensions >::IndexType

Definition at line 20 of file TIndex.h.

◆ Iterator

template<int Dimensions>
typedef int* istd::TIndex< Dimensions >::Iterator

Definition at line 21 of file TIndex.h.

Member Enumeration Documentation

◆ anonymous enum

template<int Dimensions>
anonymous enum
Enumerator
DIMENSIONS 

Definition at line 23 of file TIndex.h.

Constructor & Destructor Documentation

◆ TIndex() [1/3]

template<int Dimensions>
istd::TIndex< Dimensions >::TIndex ( )

Default constructor with initialization of member to 0.

Definition at line 430 of file TIndex.h.

◆ TIndex() [2/3]

template<int Dimensions>
istd::TIndex< Dimensions >::TIndex ( int  value)
explicit

Constructor initializing all members to specified value.

Definition at line 423 of file TIndex.h.

◆ TIndex() [3/3]

template<int Dimensions>
istd::TIndex< Dimensions >::TIndex ( const TIndex< Dimensions > &  index)

Copy constructor.

Definition at line 439 of file TIndex.h.

Member Function Documentation

◆ Begin()

template<int Dimensions>
TIndex< Dimensions >::Iterator istd::TIndex< Dimensions >::Begin ( ) const
inline

Get begin value of element access iterator.

Please refer to general description of ACF iterators, STL iterators or Qt iterators concept.

Definition at line 313 of file TIndex.h.

Referenced by imath::TMultidimensionalPolynomial< Dimensions, Element >::Serialize().

◆ Clear()

template<int Dimensions>
void istd::TIndex< Dimensions >::Clear ( )
inline

Set all components to 0.

Definition at line 262 of file TIndex.h.

◆ Decrease()

template<int Dimensions>
bool istd::TIndex< Dimensions >::Decrease ( const TIndex< Dimensions > &  boundaries)

Decrease this index inside the boundaries.

Returns
false, if decrease wasn't possible (e.g. overflow).

Definition at line 495 of file TIndex.h.

◆ DecreaseAt()

template<int Dimensions>
bool istd::TIndex< Dimensions >::DecreaseAt ( int  index)
inline

Decrease single component at specified position.

Parameters
indexindex of component should be increased. It must be valid.
Returns
true if success. It is provided for template implementations. In this case it returns always true.

Definition at line 301 of file TIndex.h.

◆ End()

template<int Dimensions>
TIndex< Dimensions >::Iterator istd::TIndex< Dimensions >::End ( ) const
inline

Get end value of element access iterator.

Please refer to general description of ACF iterators, STL iterators or Qt iterators concept.

Definition at line 320 of file TIndex.h.

◆ GetAt()

template<int Dimensions>
int istd::TIndex< Dimensions >::GetAt ( int  index) const
inline

◆ GetDimensionsCount()

template<int Dimensions>
int istd::TIndex< Dimensions >::GetDimensionsCount ( ) const
inline

◆ GetInvalid()

template<int Dimensions>
const TIndex< Dimensions > & istd::TIndex< Dimensions >::GetInvalid ( )
static

Get global instance of invalid index.

Definition at line 559 of file TIndex.h.

◆ GetIterationIndex()

template<int Dimensions>
int istd::TIndex< Dimensions >::GetIterationIndex ( const TIndex< Dimensions > &  boundaries) const

Get index of iteration from zero to current index inside some boundaries.

Definition at line 534 of file TIndex.h.

◆ GetProductVolume()

template<int Dimensions>
int istd::TIndex< Dimensions >::GetProductVolume ( ) const

Get total number of elements if this index is treated as size.

Returns
multiplication of all elements.

Definition at line 521 of file TIndex.h.

Referenced by imath::TMultidimensionalPolynomial< Dimensions, Element >::ApproximateCoefficientsFromFulcrums().

◆ GetZero()

template<int Dimensions>
const TIndex< Dimensions > & istd::TIndex< Dimensions >::GetZero ( )
static

Get global instance of zero index.

Definition at line 552 of file TIndex.h.

◆ Increase()

template<int Dimensions>
bool istd::TIndex< Dimensions >::Increase ( const TIndex< Dimensions > &  boundaries)

Increase this index inside the boundaries.

Returns
false, if increase wasn't possible (e.g. overflow).

Definition at line 472 of file TIndex.h.

Referenced by imath::TMultidimensionalPolynomial< Dimensions, Element >::ApproximateCoefficientsFromFulcrums().

◆ IncreaseAt()

template<int Dimensions>
bool istd::TIndex< Dimensions >::IncreaseAt ( int  index)
inline

Increase single component at specified position.

Parameters
indexindex of component should be increased. It must be valid.
Returns
true if success. It is provided for template implementations. In this case it returns always true.

Definition at line 289 of file TIndex.h.

◆ IsDimensionsCountFixed()

template<int Dimensions>
bool istd::TIndex< Dimensions >::IsDimensionsCountFixed ( ) const
inline

Check, if number dimensions is fixed.

It is provided for template implementations. It returns always true.

Definition at line 195 of file TIndex.h.

◆ IsInside()

template<int Dimensions>
bool istd::TIndex< Dimensions >::IsInside ( const TIndex< Dimensions > &  boundaries) const

Check if index is inside boundaries.

Index is inside boundaries, if all its components are smaller than according boundary components.

Definition at line 457 of file TIndex.h.

Referenced by istd::TArray< Element, Dimensions >::GetAt(), istd::TArray< Element, Dimensions >::GetAtRef(), imath::CSampledFunction2d::GetSampleValue(), istd::TArray< Element, Dimensions >::SetAt(), and imath::CSampledFunction2d::SetSampleValue().

◆ IsSizeEmpty()

template<int Dimensions>
bool istd::TIndex< Dimensions >::IsSizeEmpty ( ) const
inline

Check if this index interpreted as size is empty.

It means, it returns true, is some of components is less or equal 0.

Definition at line 242 of file TIndex.h.

Referenced by imath::TMultidimensionalPolynomial< Dimensions, Element >::ApproximateCoefficientsFromFulcrums(), and istd::TArray< Element, Dimensions >::IsEmpty().

◆ IsValid()

template<int Dimensions>
bool istd::TIndex< Dimensions >::IsValid ( ) const
inline

Check if this index is valid.

Index is valid, if all its components are bigger or equal 0.

Definition at line 216 of file TIndex.h.

◆ IsZero()

template<int Dimensions>
bool istd::TIndex< Dimensions >::IsZero ( ) const
inline

Check if this index point at zero element.

In other words, it checks if all components are 0.

Definition at line 229 of file TIndex.h.

◆ operator!=()

template<int Dimensions>
bool istd::TIndex< Dimensions >::operator!= ( const TIndex< Dimensions > &  index) const

Definition at line 357 of file TIndex.h.

◆ operator+()

template<int Dimensions>
TIndex< Dimensions > istd::TIndex< Dimensions >::operator+ ( const TIndex< Dimensions > &  index) const

Definition at line 364 of file TIndex.h.

References istd::TIndex< Dimensions >::GetDimensionsCount().

◆ operator+=()

template<int Dimensions>
TIndex< Dimensions > & istd::TIndex< Dimensions >::operator+= ( const TIndex< Dimensions > &  index)

Definition at line 379 of file TIndex.h.

References istd::TIndex< Dimensions >::GetDimensionsCount().

◆ operator-()

template<int Dimensions>
TIndex< Dimensions > istd::TIndex< Dimensions >::operator- ( const TIndex< Dimensions > &  index) const

Definition at line 392 of file TIndex.h.

References istd::TIndex< Dimensions >::GetDimensionsCount().

◆ operator-=()

template<int Dimensions>
TIndex< Dimensions > & istd::TIndex< Dimensions >::operator-= ( const TIndex< Dimensions > &  index)

Definition at line 407 of file TIndex.h.

References istd::TIndex< Dimensions >::GetDimensionsCount().

◆ operator=()

template<int Dimensions>
TIndex & istd::TIndex< Dimensions >::operator= ( const TIndex< Dimensions > &  index)
default

◆ operator==()

template<int Dimensions>
bool istd::TIndex< Dimensions >::operator== ( const TIndex< Dimensions > &  index) const

Definition at line 344 of file TIndex.h.

◆ operator[]() [1/2]

template<int Dimensions>
int & istd::TIndex< Dimensions >::operator[] ( int  index)
inline

Definition at line 334 of file TIndex.h.

◆ operator[]() [2/2]

template<int Dimensions>
int istd::TIndex< Dimensions >::operator[] ( int  index) const
inline

Definition at line 327 of file TIndex.h.

◆ Reset()

template<int Dimensions>
void istd::TIndex< Dimensions >::Reset ( )
inline

Reset this object.

For this (fixed-size) implementation, it does the same as clear.

See also
Clear()

Definition at line 255 of file TIndex.h.

◆ SetAllTo()

template<int Dimensions>
void istd::TIndex< Dimensions >::SetAllTo ( int  value)

Set all components to specified value.

Definition at line 448 of file TIndex.h.

◆ SetAt()

template<int Dimensions>
void istd::TIndex< Dimensions >::SetAt ( int  index,
int  value 
)
inline

Set element at specified index.

Definition at line 279 of file TIndex.h.

◆ SetDimensionsCount()

template<int Dimensions>
bool istd::TIndex< Dimensions >::SetDimensionsCount ( int  count) const
inline

Set number of dimensions of this index.

It is provided to allows template implementations to use fixed-size or variable arrays.

Parameters
countnumber of dimensions will be set.
Returns
true, if number of set dimensions equals template parameter or false if isn't.

Definition at line 209 of file TIndex.h.


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