BALL::CompositeIteratorTraits Class Reference

#include <BALL/KERNEL/iterator.h>

Inheritance diagram for BALL::CompositeIteratorTraits:
BALL::AtomContainerIteratorTraits BALL::AtomIteratorTraits BALL::ChainIteratorTraits BALL::FragmentIteratorTraits BALL::MoleculeIteratorTraits BALL::NucleicAcidIteratorTraits BALL::NucleotideIteratorTraits BALL::PDBAtomIteratorTraits BALL::ProteinIteratorTraits BALL::ResidueIteratorTraits BALL::SecondaryStructureIteratorTraits

List of all members.

Public Member Functions

Composite::CompositeIteratorgetPosition ()
 Return the current iterator position.
const
Composite::CompositeIterator
getPosition () const
 Return the current iterator posittion (const method)
void invalidate ()
void toBegin () throw (Exception::Precondition)
void toEnd () throw (Exception::Precondition)
CompositegetData ()
 Return a reference to the current element.
const CompositegetData () const
 Return a const reference to the current element.
void forward ()
 Increment the iterator by one element.
void backward ()
 Decrement the iterator one element.
void toRBegin () throw (Exception::Precondition)
 Reposition the (backward) iterator to the last element of the container.
void toREnd () throw (Exception::Precondition)
 Reposition the (backward) iterator beyond the first element of the container.
void setPredicate (const UnaryPredicate< Composite > &predicate)
 Assign the current predicate associated with the iterator.
const UnaryPredicate< Composite > * getPredicate () const
 Return the current predicate associated with the iterator.
Constructors and Destructor
 CompositeIteratorTraits ()
 Default constructor.
 CompositeIteratorTraits (const Composite &composite)
 Copy constructor.
 CompositeIteratorTraits (const CompositeIteratorTraits &traits)
 Detailed constructor.
 ~CompositeIteratorTraits ()
 Destructor.
Assignment
CompositeIteratorTraitsoperator= (const CompositeIteratorTraits &traits)
 Assignment operator.
Accessors
CompositegetContainer ()
 Return a pointer to the container the iterator is bound to.
const CompositegetContainer () const
 Return a const pointer to the container the iterator is bound to.
Predicates
bool operator== (const CompositeIteratorTraits &traits) const
 Equality operator.
bool operator!= (const CompositeIteratorTraits &traits) const
 Inequality operator.
bool isValid () const
bool isSingular () const
 Check whether the iterator is bound to a container.
bool isBegin () const
bool isEnd () const
bool isRBegin () const
bool isREnd () const

Protected Attributes

Compositebound_
 The pointer to the container.
Composite::CompositeIterator composite_iterator_
 The internal iterator to iterate over the current node's children.
const UnaryPredicate< Composite > * predicate_
 The predicate.

Detailed Description

Composite Iterator Traits This class is used in the implementation of the kernel iterators. It is intended for internal use only.


Constructor & Destructor Documentation

BALL::CompositeIteratorTraits::CompositeIteratorTraits ( ) [inline]

Default constructor.

BALL::CompositeIteratorTraits::CompositeIteratorTraits ( const Composite composite) [inline]

Copy constructor.

BALL::CompositeIteratorTraits::CompositeIteratorTraits ( const CompositeIteratorTraits traits) [inline]

Detailed constructor.

BALL::CompositeIteratorTraits::~CompositeIteratorTraits ( ) [inline]

Destructor.


Member Function Documentation

void BALL::CompositeIteratorTraits::backward ( ) [inline]

Decrement the iterator one element.

References composite_iterator_, and predicate_.

void BALL::CompositeIteratorTraits::forward ( ) [inline]

Increment the iterator by one element.

References composite_iterator_, and predicate_.

Composite* BALL::CompositeIteratorTraits::getContainer ( ) [inline]

Return a pointer to the container the iterator is bound to.

const Composite* BALL::CompositeIteratorTraits::getContainer ( ) const [inline]

Return a const pointer to the container the iterator is bound to.

Composite & BALL::CompositeIteratorTraits::getData ( ) [inline]

Return a reference to the current element.

const Composite & BALL::CompositeIteratorTraits::getData ( ) const [inline]

Return a const reference to the current element.

References composite_iterator_.

Composite::CompositeIterator& BALL::CompositeIteratorTraits::getPosition ( ) [inline]

Return the current iterator position.

const Composite::CompositeIterator& BALL::CompositeIteratorTraits::getPosition ( ) const [inline]

Return the current iterator posittion (const method)

const UnaryPredicate<Composite>* BALL::CompositeIteratorTraits::getPredicate ( ) const [inline]

Return the current predicate associated with the iterator.

void BALL::CompositeIteratorTraits::invalidate ( ) [inline]

Invalidate the iterator. The iterator is separated from its container ( isSingular is true afterwards) and its SubCompositeIterator is invalidated as well.

References bound_, composite_iterator_, and BALL::BaseIterator< Container, DataType, Position, Traits >::invalidate().

bool BALL::CompositeIteratorTraits::isBegin ( ) const [inline]

Return true if the iterator is at the first element of the container.

See also:
isSingular

References BALL::Composite::beginComposite(), bound_, composite_iterator_, isSingular(), and predicate_.

bool BALL::CompositeIteratorTraits::isEnd ( ) const [inline]

Return true if the iterator is beyond the last element of the container.

Exceptions:
InvalidIteratorif the iterator is singular
See also:
isSingular
bool BALL::CompositeIteratorTraits::isRBegin ( ) const [inline]

Return true if the iterator is at the last element of the container.

Exceptions:
InvalidIteratorif the iterator is singular
See also:
isSingular

References bound_, composite_iterator_, BALL::Composite::endComposite(), isSingular(), and predicate_.

bool BALL::CompositeIteratorTraits::isREnd ( ) const [inline]

Return true if the iterator is beyond the first element of the container.

Exceptions:
InvalidIteratorif the iterator is singular
See also:
isSingular

References composite_iterator_, BALL::ConstBidirectionalIterator< Container, DataType, Position, Traits >::isREnd(), and isSingular().

bool BALL::CompositeIteratorTraits::isSingular ( ) const [inline]

Check whether the iterator is bound to a container.

Referenced by isBegin(), isRBegin(), isREnd(), and toRBegin().

bool BALL::CompositeIteratorTraits::isValid ( ) const [inline]

Return the current status of the iterator. If the iterator is bound and its subcomposite iterator is valid, this predicate returns true.

bool BALL::CompositeIteratorTraits::operator!= ( const CompositeIteratorTraits traits) const [inline]

Inequality operator.

References operator==().

bool BALL::CompositeIteratorTraits::operator== ( const CompositeIteratorTraits traits) const [inline]

Equality operator.

References bound_, and composite_iterator_.

Referenced by operator!=().

void BALL::CompositeIteratorTraits::setPredicate ( const UnaryPredicate< Composite > &  predicate) [inline]

Assign the current predicate associated with the iterator.

void BALL::CompositeIteratorTraits::toBegin ( ) throw (Exception::Precondition) [inline]

Reposition the iterator to the first element of the container.

Exceptions:
InvalidIteratorif the iterator is singular .
See also:
isSingular

References BALL_PRECONDITION_EXCEPTION, BALL::Composite::beginComposite(), bound_, composite_iterator_, and predicate_.

void BALL::CompositeIteratorTraits::toEnd ( ) throw (Exception::Precondition) [inline]

Reposition the iterator after the last element of the container.

Exceptions:
InvalidIteratorif the iterator is singular .
See also:
isSingular

References composite_iterator_, and BALL::ConstBidirectionalIterator< Container, DataType, Position, Traits >::toEnd().

void BALL::CompositeIteratorTraits::toRBegin ( ) throw (Exception::Precondition) [inline]

Reposition the (backward) iterator to the last element of the container.

References BALL_PRECONDITION_EXCEPTION, bound_, composite_iterator_, BALL::Composite::endComposite(), isSingular(), and predicate_.

void BALL::CompositeIteratorTraits::toREnd ( ) throw (Exception::Precondition) [inline]

Reposition the (backward) iterator beyond the first element of the container.

References composite_iterator_, and BALL::ConstBidirectionalIterator< Container, DataType, Position, Traits >::toREnd().


Member Data Documentation