partition  0.1.1
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Friends | List of all members
partition::Group< M, V >::Iterator Class Reference

A bidirectional iterator for traversing the Entry objects of a Group. More...

#include <partition.hpp>

Public Member Functions

 Iterator ()
 Constructs a Iterator with a NULL Group association. More...
 
 Iterator (const Iterator &i)
 Copy constructor. More...
 
Iteratoroperator= (const Iterator &i)
 Copy assignment. More...
 
Iteratoroperator++ ()
 Increments the iterator to the next list position and returns a reference to itself. More...
 
Iteratoroperator-- ()
 Decrements the iterator to the previous list position and returns a reference to itself. More...
 
Iterator operator++ (int)
 Increments the iterator to the next list position and returns a copy of the value of this iterator before the increment. More...
 
Iterator operator-- (int)
 Decrements the iterator to the previous list position and returns a copy of the value of this iterator before the decrement. More...
 
bool isBeforeFront () const
 Returns true if this iterator is pointing one logical position before the first Entry in the list, and false if it is pointing to any list Entry. More...
 
bool isAfterBack () const
 Returns true if this iterator is pointing one logical position after the last Entry in the list, and false if it is pointing to any list Entry. More...
 
bool isAtFront () const
 Returns true if this iterator points to the first Entry of a non-empty list, or to the afterBack position of an empty list; and false otherwise. More...
 
bool isAtBack () const
 Returns true if this iterator points to the last Entry of a non-empty list, or to the beforeFront position of an empty list; and false otherwise. More...
 
Entryoperator* () const
 Returns a reference to the Entry pointed to by this iterator. More...
 
Entryoperator-> () const
 Returns a pointer to the Entry pointed to by this iterator. More...
 
GroupgetContainer () const
 Returns a pointer to the Group associated with this Iterator. More...
 
bool operator== (const Iterator &i) const
 Returns true if this Iterator and i point to the same Entry in the same Group list, and false otherwise. More...
 
bool operator== (const ConstIterator &i) const
 Returns true if this Iterator and i point to the same Entry in the same Group list, and false otherwise. More...
 
bool operator!= (const Iterator &i) const
 Returns false if this Iterator and i point to the same Entry in the same Group list and true otherwise. More...
 
bool operator!= (const ConstIterator &i) const
 Returns false if this Iterator and i point to the same Entry in the same Group list and true otherwise. More...
 
void addBefore (int id) const
 Removes the Entry with the given id from the Group with which it was previously a member (if any), and adds it into this Iterator's Group immediately before the position pointed to by this Iterator. More...
 
void addAfter (int id) const
 Removes the Entry with the given id from the Group with which it was previously a member (if any), and adds it into this Iterator's Group immediately after the position pointed to by this Iterator. More...
 
EntryremoveAndInc ()
 Removes and returns a reference to the Entry pointed to by this Iterator from its Group's list, and updates this Iterator to point to the next Entry in the list. More...
 
EntryremoveAndDec ()
 Removes and returns a reference to the Entry pointed to by this Iterator from this Group's list, and updates this Iterator to point to the previous Entry in the list. More...
 

Friends

class Group
 

Detailed Description

template<typename M, typename V>
class partition::Group< M, V >::Iterator

A bidirectional iterator for traversing the Entry objects of a Group.

Notes on Iterator invalidation:

An Iterator is invalidated if either of the following occur:

Constructor & Destructor Documentation

template<typename M , typename V >
partition::Group< M, V >::Iterator::Iterator ( )
inline

Constructs a Iterator with a NULL Group association.

Few operations on an Iterator constructed in this Way are permitted until the Iterator is assigned a value.

template<typename M , typename V >
partition::Group< M, V >::Iterator::Iterator ( const Iterator i)
inline

Copy constructor.

Member Function Documentation

template<typename M, typename V>
Group< M, V >::Iterator & partition::Group< M, V >::Iterator::operator= ( const Iterator i)
inline

Copy assignment.

template<typename M , typename V >
Group< M, V >::Iterator & partition::Group< M, V >::Iterator::operator++ ( )
inline

Increments the iterator to the next list position and returns a reference to itself.

Exceptions
PartitionExceptionif this Iterator has no Group association.

This validation is only included if the following preprocessor directive evaluates to true during compilation:
#if PARTITION_SL >= PARTITION_ST_ITERATOR_INC
template<typename M , typename V >
Group< M, V >::Iterator & partition::Group< M, V >::Iterator::operator-- ( )
inline

Decrements the iterator to the previous list position and returns a reference to itself.

Exceptions
PartitionExceptionif this Iterator has no Group association.

This validation is only included if the following preprocessor directive evaluates to true during compilation:
#if PARTITION_SL >= PARTITION_ST_ITERATOR_INC
template<typename M , typename V >
Group< M, V >::Iterator partition::Group< M, V >::Iterator::operator++ ( int  )
inline

Increments the iterator to the next list position and returns a copy of the value of this iterator before the increment.

Exceptions
PartitionExceptionif this Iterator has no Group association.

This validation is only included if the following preprocessor directive evaluates to true during compilation:
#if PARTITION_SL >= PARTITION_ST_ITERATOR_INC
template<typename M , typename V >
Group< M, V >::Iterator partition::Group< M, V >::Iterator::operator-- ( int  )
inline

Decrements the iterator to the previous list position and returns a copy of the value of this iterator before the decrement.

Exceptions
PartitionExceptionif this Iterator has no Group association.

This validation is only included if the following preprocessor directive evaluates to true during compilation:
#if PARTITION_SL >= PARTITION_ST_ITERATOR_INC
template<typename M , typename V >
bool partition::Group< M, V >::Iterator::isBeforeFront ( ) const
inline

Returns true if this iterator is pointing one logical position before the first Entry in the list, and false if it is pointing to any list Entry.

Exceptions
PartitionExceptionif this Iterator has no Group association.

This validation is only included if the following preprocessor directive evaluates to true during compilation:
#if PARTITION_SL >= PARTITION_ST_ITERATOR_DEREF
template<typename M , typename V >
bool partition::Group< M, V >::Iterator::isAfterBack ( ) const
inline

Returns true if this iterator is pointing one logical position after the last Entry in the list, and false if it is pointing to any list Entry.

Exceptions
PartitionExceptionif this Iterator has no Group association.

This validation is only included if the following preprocessor directive evaluates to true during compilation:
#if PARTITION_SL >= PARTITION_ST_ITERATOR_DEREF
template<typename M , typename V >
bool partition::Group< M, V >::Iterator::isAtFront ( ) const
inline

Returns true if this iterator points to the first Entry of a non-empty list, or to the afterBack position of an empty list; and false otherwise.

Exceptions
PartitionExceptionif this Iterator has no Group association.

This validation is only included if the following preprocessor directive evaluates to true during compilation:
#if PARTITION_SL >= PARTITION_ST_ITERATOR_DEREF
template<typename M , typename V >
bool partition::Group< M, V >::Iterator::isAtBack ( ) const
inline

Returns true if this iterator points to the last Entry of a non-empty list, or to the beforeFront position of an empty list; and false otherwise.

Exceptions
PartitionExceptionif this Iterator has no Group association.

This validation is only included if the following preprocessor directive evaluates to true during compilation:
#if PARTITION_SL >= PARTITION_ST_ITERATOR_DEREF
template<typename M , typename V >
Domain< M, V >::Entry & partition::Group< M, V >::Iterator::operator* ( ) const
inline

Returns a reference to the Entry pointed to by this iterator.

Exceptions
PartitionExceptionif this Iterator isBeforeFront() or isAfterBack().

This validation is only included if the following preprocessor directive evaluates to true during compilation:
#if PARTITION_SL >= PARTITION_ST_ITERATOR_DEREF
template<typename M , typename V >
Domain< M, V >::Entry * partition::Group< M, V >::Iterator::operator-> ( ) const
inline

Returns a pointer to the Entry pointed to by this iterator.

Exceptions
PartitionExceptionif this Iterator isBeforeFront() or isAfterBack().

This validation is only included if the following preprocessor directive evaluates to true during compilation:
#if PARTITION_SL >= PARTITION_ST_ITERATOR_DEREF
template<typename M , typename V >
Group< M, V > * partition::Group< M, V >::Iterator::getContainer ( ) const
inline

Returns a pointer to the Group associated with this Iterator.

template<typename M , typename V >
bool partition::Group< M, V >::Iterator::operator== ( const Iterator i) const
inline

Returns true if this Iterator and i point to the same Entry in the same Group list, and false otherwise.

Exceptions
PartitionExceptionif this Iterator and Iterator i are not associated with the same Group.

This validation is only included if the following preprocessor directive evaluates to true during compilation:
#if PARTITION_SL >= PARTITION_ST_ITERATOR_COMPARE
template<typename M , typename V >
bool partition::Group< M, V >::Iterator::operator== ( const ConstIterator i) const
inline

Returns true if this Iterator and i point to the same Entry in the same Group list, and false otherwise.

Exceptions
PartitionExceptionif this Iterator and Iterator i are not associated with the same Group.

This validation is only included if the following preprocessor directive evaluates to true during compilation:
#if PARTITION_SL >= PARTITION_ST_ITERATOR_COMPARE
template<typename M , typename V >
bool partition::Group< M, V >::Iterator::operator!= ( const Iterator i) const
inline

Returns false if this Iterator and i point to the same Entry in the same Group list and true otherwise.

Exceptions
PartitionExceptionif this Iterator and Iterator i are not associated with the same Group.

This validation is only included if the following preprocessor directive evaluates to true during compilation:
#if PARTITION_SL >= PARTITION_ST_ITERATOR_COMPARE
template<typename M , typename V >
bool partition::Group< M, V >::Iterator::operator!= ( const ConstIterator i) const
inline

Returns false if this Iterator and i point to the same Entry in the same Group list and true otherwise.

Exceptions
PartitionExceptionif this Iterator and Iterator i are not associated with the same Group.

This validation is only included if the following preprocessor directive evaluates to true during compilation:
#if PARTITION_SL >= PARTITION_ST_ITERATOR_COMPARE
template<typename M , typename V >
void partition::Group< M, V >::Iterator::addBefore ( int  id) const
inline

Removes the Entry with the given id from the Group with which it was previously a member (if any), and adds it into this Iterator's Group immediately before the position pointed to by this Iterator.

Computational Complexity: Constant

Exceptions
PartitionExceptionif this Iterator is not associated with a Group; or
if this Iterator's Group is not associated with a Domain; or
if id is not a member of the associated Domain.

These validations are only included if the following preprocessor directive evaluates to true during compilation:
#if PARTITION_SL >= PARTITION_ST_GROUP_ADD
template<typename M , typename V >
void partition::Group< M, V >::Iterator::addAfter ( int  id) const
inline

Removes the Entry with the given id from the Group with which it was previously a member (if any), and adds it into this Iterator's Group immediately after the position pointed to by this Iterator.

Computational Complexity: Constant

Exceptions
PartitionExceptionif this Iterator is not associated with a Group; or
if this Iterator's Group is not associated with a Domain; or
if id is not a member of the associated Domain.

These validations are only included if the following preprocessor directive evaluates to true during compilation:
#if PARTITION_SL >= PARTITION_ST_GROUP_ADD
template<typename M , typename V >
Domain< M, V >::Entry & partition::Group< M, V >::Iterator::removeAndInc ( )
inline

Removes and returns a reference to the Entry pointed to by this Iterator from its Group's list, and updates this Iterator to point to the next Entry in the list.

Computational Complexity: Constant.

Exceptions
PartitionExceptionif Iterator i isBeforeFront() or isAfterBack().

This validation is only included if the following preprocessor directive evaluates to true during compilation:
#if PARTITION_SL >= PARTITION_ST_GROUP_REMOVE
template<typename M , typename V >
Domain< M, V >::Entry & partition::Group< M, V >::Iterator::removeAndDec ( )
inline

Removes and returns a reference to the Entry pointed to by this Iterator from this Group's list, and updates this Iterator to point to the previous Entry in the list.

Computational Complexity: Constant.

Exceptions
PartitionExceptionif Iterator i isBeforeFront() or isAfterBack().

This validation is only included if the following preprocessor directive evaluates to true during compilation:
#if PARTITION_SL >= PARTITION_ST_GROUP_REMOVE

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