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

Static Public Member Functions

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

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

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

Definition at line 20 of file TIndex.h.

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

Definition at line 21 of file TIndex.h.

Member Enumeration Documentation

template<int Dimensions>
anonymous enum
Enumerator
DIMENSIONS 

Definition at line 23 of file TIndex.h.

Constructor & Destructor Documentation

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

Default constructor with initialization of member to 0.

Definition at line 429 of file TIndex.h.

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

Constructor initializing all member to specified value.

Definition at line 422 of file TIndex.h.

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

Copy constructor.

Definition at line 438 of file TIndex.h.

Member Function Documentation

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 312 of file TIndex.h.

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

Set all components to 0.

Definition at line 261 of file TIndex.h.

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 493 of file TIndex.h.

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 300 of file TIndex.h.

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 319 of file TIndex.h.

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

Get element stored at specified index.

Definition at line 268 of file TIndex.h.

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

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

Get global instance of invalid index.

Definition at line 556 of file TIndex.h.

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 531 of file TIndex.h.

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 518 of file TIndex.h.

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

Get global instance of zero index.

Definition at line 549 of file TIndex.h.

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 471 of file TIndex.h.

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 288 of file TIndex.h.

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 194 of file TIndex.h.

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 456 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().

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 241 of file TIndex.h.

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 215 of file TIndex.h.

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 228 of file TIndex.h.

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

Definition at line 356 of file TIndex.h.

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

Definition at line 363 of file TIndex.h.

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

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

Definition at line 378 of file TIndex.h.

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

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

Definition at line 391 of file TIndex.h.

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

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

Definition at line 406 of file TIndex.h.

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

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

Definition at line 343 of file TIndex.h.

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

Definition at line 326 of file TIndex.h.

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

Definition at line 333 of file TIndex.h.

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 254 of file TIndex.h.

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

Set all components to specified value.

Definition at line 447 of file TIndex.h.

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

Set element at specified index.

Definition at line 278 of file TIndex.h.

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 208 of file TIndex.h.


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

© 2007-2017 Witold Gantzke and Kirill Lepskiy