#include <BALL/CONCEPT/enumerator.h>
Inherits std::vector< Position >.
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 EnumeratorIndex & | operator= (const EnumeratorIndex &rhs) |
const EnumeratorIndex & | operator= (Position index) throw (Exception::IndexOverflow) |
template<typename Variant , typename VariantIterator > | |
const EnumeratorIndex & | operator= (const std::list< std::pair< VariantIterator, std::vector< Variant > > > &variant_list) |
Accessors | |
const std::vector< Size > & | getModulus () const |
Size | getModulus (Position pos) const |
EnumeratorIndex & | operator++ () throw (Exception::IndexOverflow) |
EnumeratorIndex & | operator-- () throw (Exception::IndexUnderflow) |
Position | operator[] (Position pos) const |
Position & | operator[] (Position pos) |
Size | getSize () const |
EnumeratorIndex & | operator<< (Size modulus) throw (Exception::OutOfRange) |
Predicates for EnumeratorIndex class | |
bool | operator== (const EnumeratorIndex &rhs) const |
bool | operator!= (const EnumeratorIndex &rhs) const |
bool | operator> (const EnumeratorIndex &rhs) const throw (EnumeratorIndex::IncompatibleIndex) |
bool | operator< (const EnumeratorIndex &rhs) const throw (EnumeratorIndex::IncompatibleIndex) |
bool | operator>= (const EnumeratorIndex &rhs) const throw (EnumeratorIndex::IncompatibleIndex) |
bool | operator<= (const EnumeratorIndex &rhs) const throw (EnumeratorIndex::IncompatibleIndex) |
Private Attributes | |
std::vector< Size > | modulus_ |
std::vector< Size > | base_multipliers_ |
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)
BALL::EnumeratorIndex::EnumeratorIndex | ( | ) |
Default Constructor
BALL::EnumeratorIndex::EnumeratorIndex | ( | const std::list< std::pair< VariantIterator, std::vector< Variant > > > & | variant_list | ) |
Detailed Constructor
variant_list | the list of variants to be applied |
BALL::EnumeratorIndex::~EnumeratorIndex | ( | ) |
Destructor
const std::vector<Size>& BALL::EnumeratorIndex::getModulus | ( | ) | const |
Access the modulus part of the enumerator
Access the modulus of a specific position
Size BALL::EnumeratorIndex::getSize | ( | ) | const |
Return the size of the array.
bool BALL::EnumeratorIndex::operator!= | ( | const EnumeratorIndex & | rhs | ) | const |
Inequality operator.
rhs |
rhs
is not equal to this
instance EnumeratorIndex& BALL::EnumeratorIndex::operator++ | ( | ) | throw (Exception::IndexOverflow) |
Increment an instance of EnumeratorIndex. Increment the least significant component and apply any overflow to more signficant components.
EnumeratorIndex& BALL::EnumeratorIndex::operator-- | ( | ) | throw (Exception::IndexUnderflow) |
Decrement an instance of EnumeratorIndex. Decrement the least significant component and apply any underflow to more signficant components.
bool BALL::EnumeratorIndex::operator< | ( | const EnumeratorIndex & | rhs | ) | const throw (EnumeratorIndex::IncompatibleIndex) |
Lesser than operator.
rhs |
rhs
is lesser than this
instance EnumeratorIndex::Incompatible | index if the modulus vector differs, i.e. the two indices aren't comparable |
EnumeratorIndex& BALL::EnumeratorIndex::operator<< | ( | Size | modulus | ) | throw (Exception::OutOfRange) |
Add a new digit. Push the modulus to the ack of the modulus array and initialize the corresponding digit with zero.
EnumerationIndex counter;
counter << 16 << 16 << 16;
OutOfRange | if the modulus is less than 2 |
bool BALL::EnumeratorIndex::operator<= | ( | const EnumeratorIndex & | rhs | ) | const throw (EnumeratorIndex::IncompatibleIndex) |
Lesser or equal operator.
rhs |
rhs
is lesser than or equal to this
instance EnumeratorIndex::Incompatible | index if the modulus vector differs, i.e. the two indices aren't comparable |
const EnumeratorIndex& BALL::EnumeratorIndex::operator= | ( | Position | index | ) | throw (Exception::IndexOverflow) |
Assignment operator for Position.
const EnumeratorIndex& BALL::EnumeratorIndex::operator= | ( | const EnumeratorIndex & | rhs | ) |
Assignment operator.
const EnumeratorIndex & BALL::EnumeratorIndex::operator= | ( | const std::list< std::pair< VariantIterator, std::vector< Variant > > > & | variant_list | ) |
Assignment operator for a variant list.
bool BALL::EnumeratorIndex::operator== | ( | const EnumeratorIndex & | rhs | ) | const |
Equality operator.
rhs |
rhs
is equal to this
instance bool BALL::EnumeratorIndex::operator> | ( | const EnumeratorIndex & | rhs | ) | const throw (EnumeratorIndex::IncompatibleIndex) |
Greater than operator.
rhs |
rhs
is greater than this
instance EnumeratorIndex::Incompatible | index if the modulus vector differs, i.e. the two indices aren't comparable |
bool BALL::EnumeratorIndex::operator>= | ( | const EnumeratorIndex & | rhs | ) | const throw (EnumeratorIndex::IncompatibleIndex) |
Greater or equal operator.
rhs |
rhs
is greater than or equal to this
instance EnumeratorIndex::Incompatible | index if the modulus vector differs, i.e. the two indices aren't comparable |
std::vector<Size> BALL::EnumeratorIndex::base_multipliers_ [private] |
std::vector<Size> BALL::EnumeratorIndex::modulus_ [private] |