ACF $AcfVersion:0$
Public Types | Public Member Functions | Friends | List of all members
istd::CVarIndex Class Reference

Multidimensional index used to addressing index. More...

#include <CVarIndex.h>

Inheritance diagram for istd::CVarIndex:
istd::TVarArray< Element >::Iterator

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
 
CVarIndexoperator= (const CVarIndex &index)
 
CVarIndexoperator+= (const CVarIndex &index)
 
CVarIndexoperator-= (const CVarIndex &index)
 

Friends

uint qHash (const CVarIndex &index, uint seed)
 

Detailed Description

Multidimensional index used to addressing index.

Definition at line 22 of file CVarIndex.h.

Member Typedef Documentation

◆ Elements

typedef QVector<int> istd::CVarIndex::Elements

Definition at line 26 of file CVarIndex.h.

◆ IndexType

Definition at line 25 of file CVarIndex.h.

◆ Iterator

typedef Elements::iterator istd::CVarIndex::Iterator

Definition at line 27 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 429 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 ACF iterators, STL iterators or Qt iterators concept.

Definition at line 330 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 281 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 ACF iterators, STL iterators or Qt iterators concept.

Definition at line 336 of file CVarIndex.h.

◆ GetAt()

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

Get element stored at specified index.

Definition at line 252 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 320 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 306 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 292 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 270 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 226 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 358 of file CVarIndex.h.

◆ operator<=()

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

Definition at line 392 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 375 of file CVarIndex.h.

◆ operator>=()

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

Definition at line 409 of file CVarIndex.h.

◆ operator[]() [1/2]

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

Get access to single index components.

Definition at line 348 of file CVarIndex.h.

◆ operator[]() [2/2]

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

Get access to single index components.

Definition at line 342 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 261 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 238 of file CVarIndex.h.

◆ ToStdVector()

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

Definition at line 60 of file CVarIndex.h.

Friends And Related Symbol Documentation

◆ qHash

uint qHash ( const CVarIndex index,
uint  seed 
)
friend

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