#include <iterator.h>
Public Member Functions |
|
Composite::CompositeIterator & | getPosition () |
Return the current iterator
position. |
|
const Composite::CompositeIterator & |
getPosition () const |
Return the current iterator
posittion (const method). |
|
void | invalidate () |
Invalidate the iterator. |
|
void | toBegin () throw (Exception::Precondition) |
Reposition the iterator to the first
element of the container. |
|
void | toEnd () throw (Exception::Precondition) |
Reposition the iterator after the
last element of the container. |
|
Composite & | getData () |
Return a reference to the current
element. |
|
const Composite & | getData () 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
|
|
CompositeIteratorTraits & | operator= (const CompositeIteratorTraits &traits) |
Assignment operator. |
|
Accessors
|
|
Composite * | getContainer () |
Return a pointer to the container
the iterator is bound to. |
|
const Composite * | getContainer () 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. |
|
Predicates
|
|
bool | isValid () const |
Return the current status of the
iterator. |
|
bool | isSingular () const |
Check whether the iterator is bound
to a container. |
|
bool | isBegin () const |
Return true if the iterator is at
the first element of the container. |
|
bool | isEnd () const |
Return true if the iterator is
beyond the last element of the container. |
|
bool | isRBegin () const |
Return true if the iterator is at
the last element of the container. |
|
bool | isREnd () const |
Return true if the iterator is
beyond the first element of the container. |
|
Protected Attributes |
|
Composite * | bound_ |
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. |
It is intended for internal use only.
void BALL::CompositeIteratorTraits::invalidate | ( | ) |
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 |
Return true if the iterator is at the first element of the container.
References BALL::Composite::beginComposite(), bound_, composite_iterator_, isSingular(), and predicate_.
bool BALL::CompositeIteratorTraits::isEnd | ( | ) | const |
Return true if the iterator is beyond the last element of the container.
InvalidIterator | if the iterator is singular |
bool BALL::CompositeIteratorTraits::isRBegin | ( | ) | const |
Return true if the iterator is at the last element of the container.
InvalidIterator | if the iterator is singular |
References bound_, composite_iterator_, BALL::Composite::endComposite(), isSingular(), and predicate_.
bool BALL::CompositeIteratorTraits::isREnd | ( | ) | const |
Return true if the iterator is beyond the first element of the container.
InvalidIterator | if the iterator is singular |
References composite_iterator_, BALL::ConstBidirectionalIterator< Container, DataType, Position, Traits >::isREnd(), and isSingular().
bool BALL::CompositeIteratorTraits::isValid | ( | ) | const |
Return the current status of the iterator.
If the iterator is bound and its subcomposite iterator
is valid, this predicate returns true
.
void BALL::CompositeIteratorTraits::toBegin | ( | ) | throw (Exception::Precondition) |
Reposition the iterator to the first element of the container.
InvalidIterator | if the iterator is singular . |
References BALL::Composite::beginComposite(), bound_, composite_iterator_, and predicate_.
void BALL::CompositeIteratorTraits::toEnd | ( | ) | throw (Exception::Precondition) |
Reposition the iterator after the last element of the container.
InvalidIterator | if the iterator is singular . |
References composite_iterator_, and BALL::ConstBidirectionalIterator< Container, DataType, Position, Traits >::toEnd().