ICF 3.1.1.10
Technical documentation of ICF Libraries
istd::CVarIndex Class Reference

Multidimensional index used to addressing index. More...

#include <CVarIndex.h>

Inheritance diagram for istd::CVarIndex:
Collaboration diagram for istd::CVarIndex:

Public Types

typedef int IndexType
 
typedef QVector< int > Elements
 
typedef Elements::iterator iterator
 

Public Member Functions

 CVarIndex ()
 Default constructor without member initialization.
 
 CVarIndex (int size, int value=0)
 Constructor initializing all member to specified value.
 
 CVarIndex (const CVarIndex &index)
 Copy constructor.
 
 CVarIndex (const std::vector< IndexType > &values)
 Construct index from std::vector.
 
 CVarIndex (const Elements &values)
 Construct index from QVector.
 
template<int Dimensions>
 CVarIndex (const TIndex< Dimensions > index)
 Convert fixed-size index to this object.
 
std::vector< int > ToStdVector () const
 
bool IsValid () const
 Check if tihs 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, int value=0)
 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 CVarIndex &boundaries) const
 Check if index is inside boundaries.
 
bool Increase (const CVarIndex &boundaries)
 Increase this index inside the boundaries.
 
bool Decrease (const CVarIndex &boundaries)
 Decrese this index inside the boundaries.
 
int GetProductVolume () const
 Get total number of elements if this index is treated as size.
 
int GetIterationIndex (const CVarIndex &boundaries) const
 Get index of iteration from zero to current index inside some boundaries.
 
int GetMinDimensionsCount () const
 Get minimal number of dimensions needed to to represent this index.
 
istd::CVarIndex GetExpanded (const istd::CVarIndex &other) const
 Get the index expanded by another index.
 
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
 Get access to single index components.
 
int & operator[] (int index)
 Get access to single index components.
 
bool operator== (const CVarIndex &index) const
 
bool operator!= (const CVarIndex &index) const
 
bool operator< (const CVarIndex &index) const
 
bool operator> (const CVarIndex &index) const
 
bool operator<= (const CVarIndex &index) const
 
bool operator>= (const CVarIndex &index) const
 
CVarIndex & operator= (const CVarIndex &index)
 
CVarIndex & operator+= (const CVarIndex &index)
 
CVarIndex & operator-= (const CVarIndex &index)
 

Detailed Description

Multidimensional index used to addressing index.

Definition at line 26 of file CVarIndex.h.

Member Typedef Documentation

◆ Elements

Definition at line 30 of file CVarIndex.h.

◆ IndexType

Definition at line 29 of file CVarIndex.h.

◆ iterator

Elements::iterator istd::CVarIndex::iterator

Definition at line 31 of file CVarIndex.h.

Constructor & Destructor Documentation

◆ CVarIndex() [1/6]

istd::CVarIndex::CVarIndex ( )

Default constructor without member initialization.

◆ CVarIndex() [2/6]

istd::CVarIndex::CVarIndex ( int size,
int value = 0 )
explicit

Constructor initializing all member to specified value.

◆ CVarIndex() [3/6]

istd::CVarIndex::CVarIndex ( const CVarIndex & index)

Copy constructor.

◆ CVarIndex() [4/6]

istd::CVarIndex::CVarIndex ( const std::vector< IndexType > & values)

Construct index from std::vector.

◆ CVarIndex() [5/6]

istd::CVarIndex::CVarIndex ( const Elements & values)

Construct index from QVector.

◆ CVarIndex() [6/6]

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

Convert fixed-size index to this object.

Definition at line 433 of file CVarIndex.h.

Member Function Documentation

◆ Begin()

CVarIndex::iterator istd::CVarIndex::Begin ( ) const
inline

Get begin value of element access iterator.

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

Definition at line 334 of file CVarIndex.h.

◆ Clear()

void istd::CVarIndex::Clear ( )

Set all components to 0.

◆ Decrease()

bool istd::CVarIndex::Decrease ( const CVarIndex & boundaries)

Decrese this index inside the boundaries.

Please note, that the number of dimensions for this index will not be changed and this operation can be unclear when number of dimensions differs from boundaries number of dimensions.

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

◆ DecreaseAt()

bool istd::CVarIndex::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 285 of file CVarIndex.h.

◆ End()

CVarIndex::iterator istd::CVarIndex::End ( ) const
inline

Get end value of element access iterator.

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

Definition at line 340 of file CVarIndex.h.

◆ GetAt()

int istd::CVarIndex::GetAt ( int index) const
inline

Get element stored at specified index.

Definition at line 256 of file CVarIndex.h.

Referenced by GetMinDimensionsCount(), GetProductVolume(), and operator[]().

◆ GetDimensionsCount()

int istd::CVarIndex::GetDimensionsCount ( ) const
inline

◆ GetExpanded()

istd::CVarIndex istd::CVarIndex::GetExpanded ( const istd::CVarIndex & other) const
inline

Get the index expanded by another index.

Definition at line 324 of file CVarIndex.h.

◆ GetIterationIndex()

int istd::CVarIndex::GetIterationIndex ( const CVarIndex & boundaries) const

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

◆ GetMinDimensionsCount()

int istd::CVarIndex::GetMinDimensionsCount ( ) const
inline

Get minimal number of dimensions needed to to represent this index.

In other words this is index of last non-zero component + 1.

Definition at line 310 of file CVarIndex.h.

References GetAt(), and GetDimensionsCount().

◆ GetProductVolume()

int istd::CVarIndex::GetProductVolume ( ) const
inline

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

Returns
multiplication of all elements.

Definition at line 296 of file CVarIndex.h.

References GetAt(), and GetDimensionsCount().

◆ Increase()

bool istd::CVarIndex::Increase ( const CVarIndex & boundaries)

Increase this index inside the boundaries.

Please note, that the number of dimensions for this index will not be changed and this operation can be unclear when number of dimensions differs from boundaries number of dimensions.

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

◆ IncreaseAt()

bool istd::CVarIndex::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 274 of file CVarIndex.h.

◆ IsDimensionsCountFixed()

bool istd::CVarIndex::IsDimensionsCountFixed ( ) const
inline

Check, if number dimensions is fixed.

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

Definition at line 230 of file CVarIndex.h.

◆ IsInside()

bool istd::CVarIndex::IsInside ( const CVarIndex & boundaries) const

Check if index is inside boundaries.

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

Referenced by istd::TVarArray< Element >::GetAt(), istd::TVarArray< Element >::iterator::iterator(), and istd::TVarArray< Element >::SetAt().

◆ IsSizeEmpty()

bool istd::CVarIndex::IsSizeEmpty ( ) const

Check if this index interpreted as size is empty.

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

◆ IsValid()

bool istd::CVarIndex::IsValid ( ) const

Check if tihs index is valid.

Index is valid if it has elements and all elements are not negative.

◆ IsZero()

bool istd::CVarIndex::IsZero ( ) const

Check if this index point at zero element.

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

◆ operator!=()

bool istd::CVarIndex::operator!= ( const CVarIndex & index) const

◆ operator+=()

CVarIndex & istd::CVarIndex::operator+= ( const CVarIndex & index)

◆ operator-=()

CVarIndex & istd::CVarIndex::operator-= ( const CVarIndex & index)

◆ operator<()

bool istd::CVarIndex::operator< ( const CVarIndex & index) const
inline

Definition at line 362 of file CVarIndex.h.

◆ operator<=()

bool istd::CVarIndex::operator<= ( const CVarIndex & index) const
inline

Definition at line 396 of file CVarIndex.h.

◆ operator=()

CVarIndex & istd::CVarIndex::operator= ( const CVarIndex & index)

◆ operator==()

bool istd::CVarIndex::operator== ( const CVarIndex & index) const

◆ operator>()

bool istd::CVarIndex::operator> ( const CVarIndex & index) const
inline

Definition at line 379 of file CVarIndex.h.

◆ operator>=()

bool istd::CVarIndex::operator>= ( const CVarIndex & index) const
inline

Definition at line 413 of file CVarIndex.h.

◆ operator[]() [1/2]

int & istd::CVarIndex::operator[] ( int index)
inline

Get access to single index components.

Definition at line 352 of file CVarIndex.h.

◆ operator[]() [2/2]

int istd::CVarIndex::operator[] ( int index) const
inline

Get access to single index components.

Definition at line 346 of file CVarIndex.h.

References GetAt().

◆ Reset()

void istd::CVarIndex::Reset ( )

Reset this object.

For this (variable size) implementation, it set dimension size to 0.

◆ SetAllTo()

void istd::CVarIndex::SetAllTo ( int value)

Set all components to specified value.

◆ SetAt()

void istd::CVarIndex::SetAt ( int index,
int value )
inline

Set element at specified index.

Definition at line 265 of file CVarIndex.h.

◆ SetDimensionsCount()

bool istd::CVarIndex::SetDimensionsCount ( int count,
int value = 0 )
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
always true.

Definition at line 242 of file CVarIndex.h.

◆ ToStdVector()

std::vector< int > istd::CVarIndex::ToStdVector ( ) const
inline

Definition at line 64 of file CVarIndex.h.


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

© Witold Gantzke and Kirill Lepskiy