BALL 1.5.0
Loading...
Searching...
No Matches
BALL::EnumeratorIndex Class Reference

#include <BALL/CONCEPT/enumerator.h>

Inheritance diagram for BALL::EnumeratorIndex:

Classes

class  IncompatibleIndex
 

Public Member Functions

Constructors and Destructors
 EnumeratorIndex ()
 
template<typename Variant , typename VariantIterator >
 EnumeratorIndex (const std::list< std::pair< VariantIterator, std::vector< Variant > > > &variant_list)
 
 ~EnumeratorIndex ()
 
Assignment
const EnumeratorIndexoperator= (const EnumeratorIndex &rhs)
 
const EnumeratorIndexoperator= (Position index)
 
template<typename Variant , typename VariantIterator >
const EnumeratorIndexoperator= (const std::list< std::pair< VariantIterator, std::vector< Variant > > > &variant_list)
 
Accessors
const std::vector< Size > & getModulus () const
 
Size getModulus (Position pos) const
 
EnumeratorIndexoperator++ ()
 
EnumeratorIndexoperator-- ()
 
Position operator[] (Position pos) const
 
Positionoperator[] (Position pos)
 
Size getSize () const
 
EnumeratorIndexoperator<< (Size modulus)
 

Predicates for EnumeratorIndex class

bool operator== (const EnumeratorIndex &rhs) const
 
bool operator!= (const EnumeratorIndex &rhs) const
 
bool operator> (const EnumeratorIndex &rhs) const
 
bool operator< (const EnumeratorIndex &rhs) const
 
bool operator>= (const EnumeratorIndex &rhs) const
 
bool operator<= (const EnumeratorIndex &rhs) const
 

Detailed Description

EnumeratorIndex class. The Enumerator class provides a means for enumerating all possible combinations of objects. The counting is hereby done by the EnumeratorIndex class. This class is derived from vector and additionally contains two vectors of the same size which hold the modulus and the base for each digit. The values of the EnumeratorIndex vector itself are interpreted as an inhomogenous number consisting of digits that have different bases. The bases are the numbers of possibilities for each variant in the list. Most significant component is operator [] (0), so incrementing starts at operator [] (size() - 1)

Definition at line 45 of file enumerator.h.

Constructor & Destructor Documentation

◆ EnumeratorIndex() [1/2]

BALL::EnumeratorIndex::EnumeratorIndex ( )

Default Constructor

◆ EnumeratorIndex() [2/2]

template<typename Variant , typename VariantIterator >
BALL::EnumeratorIndex::EnumeratorIndex ( const std::list< std::pair< VariantIterator, std::vector< Variant > > > & variant_list)

Detailed Constructor

Parameters
variant_listthe list of variants to be applied

Definition at line 210 of file enumerator.h.

◆ ~EnumeratorIndex()

BALL::EnumeratorIndex::~EnumeratorIndex ( )

Destructor

Member Function Documentation

◆ getModulus() [1/2]

const std::vector< Size > & BALL::EnumeratorIndex::getModulus ( ) const

Access the modulus part of the enumerator

◆ getModulus() [2/2]

Size BALL::EnumeratorIndex::getModulus ( Position pos) const

Access the modulus of a specific position

◆ getSize()

Size BALL::EnumeratorIndex::getSize ( ) const

Return the size of the array.

◆ operator!=()

bool BALL::EnumeratorIndex::operator!= ( const EnumeratorIndex & rhs) const

Inequality operator.

Parameters
rhs
Returns
true, if rhs is not equal to this instance

◆ operator++()

EnumeratorIndex & BALL::EnumeratorIndex::operator++ ( )

Increment an instance of EnumeratorIndex. Increment the least significant component and apply any overflow to more signficant components.

Exceptions
Exception::IndexOverflow

◆ operator--()

EnumeratorIndex & BALL::EnumeratorIndex::operator-- ( )

Decrement an instance of EnumeratorIndex. Decrement the least significant component and apply any underflow to more signficant components.

Exceptions
Exception::IndexUnderflow

◆ operator<()

bool BALL::EnumeratorIndex::operator< ( const EnumeratorIndex & rhs) const

Lesser than operator.

Parameters
rhs
Returns
true, if rhs is lesser than this instance
Exceptions
EnumeratorIndex::Incompatibleindex if the modulus vector differs, i.e. the two indices aren't comparable

◆ operator<<()

EnumeratorIndex & BALL::EnumeratorIndex::operator<< ( Size modulus)

Add a new digit.
Push the modulus to the ack of the modulus array and initialize the corresponding digit with zero.

Example: To construct a hex counter with three digits, you can use something like: EnumerationIndex counter;
counter << 16 << 16 << 16;
The counter will be initialized with all zeros.
Exceptions
OutOfRangeif the modulus is less than 2

◆ operator<=()

bool BALL::EnumeratorIndex::operator<= ( const EnumeratorIndex & rhs) const

Lesser or equal operator.

Parameters
rhs
Returns
true, if rhs is lesser than or equal to this instance
Exceptions
EnumeratorIndex::Incompatibleindex if the modulus vector differs, i.e. the two indices aren't comparable

◆ operator=() [1/3]

const EnumeratorIndex & BALL::EnumeratorIndex::operator= ( const EnumeratorIndex & rhs)

Assignment operator.

◆ operator=() [2/3]

template<typename Variant , typename VariantIterator >
const EnumeratorIndex & BALL::EnumeratorIndex::operator= ( const std::list< std::pair< VariantIterator, std::vector< Variant > > > & variant_list)

Assignment operator for a variant list.

Definition at line 220 of file enumerator.h.

◆ operator=() [3/3]

const EnumeratorIndex & BALL::EnumeratorIndex::operator= ( Position index)

Assignment operator for Position.

Exceptions
Exception::IndexOverflow

◆ operator==()

bool BALL::EnumeratorIndex::operator== ( const EnumeratorIndex & rhs) const

Equality operator.

Parameters
rhs
Returns
true, if rhs is equal to this instance

◆ operator>()

bool BALL::EnumeratorIndex::operator> ( const EnumeratorIndex & rhs) const

Greater than operator.

Parameters
rhs
Returns
true, if rhs is greater than this instance
Exceptions
EnumeratorIndex::Incompatibleindex if the modulus vector differs, i.e. the two indices aren't comparable

◆ operator>=()

bool BALL::EnumeratorIndex::operator>= ( const EnumeratorIndex & rhs) const

Greater or equal operator.

Parameters
rhs
Returns
true, if rhs is greater than or equal to this instance
Exceptions
EnumeratorIndex::Incompatibleindex if the modulus vector differs, i.e. the two indices aren't comparable

◆ operator[]() [1/2]

Position & BALL::EnumeratorIndex::operator[] ( Position pos)

Random access operator

◆ operator[]() [2/2]

Position BALL::EnumeratorIndex::operator[] ( Position pos) const

Random access operator