5 #ifndef BALL_KERNEL_ITERATOR_H 6 #define BALL_KERNEL_ITERATOR_H 8 #ifndef BALL_CONCEPT_BIDIRECTIONALITERATOR_H 12 #ifndef BALL_CONCEPT_COMPOSITE_H 25 #define BALL_KERNEL_DEFINE_ITERATOR_CREATORS(Type) \ 29 return Type##Iterator::begin(*this); \ 35 return Type##Iterator::end(*this); \ 38 Type##ReverseIterator \ 41 return Type##ReverseIterator(end##Type ()); \ 44 Type##ReverseIterator \ 47 return Type##ReverseIterator(begin##Type ()); \ 51 begin##Type () const \ 53 return Type##ConstIterator::begin(*this); \ 59 return Type##ConstIterator::end(*this); \ 62 Type##ConstReverseIterator \ 63 rbegin##Type () const \ 65 return Type##ConstReverseIterator(end##Type ()); \ 68 Type##ConstReverseIterator \ 71 return Type##ConstReverseIterator(begin##Type ()); \ 141 inline bool isValid()
const {
return ((bound_ != 0) && composite_iterator_.isValid()); }
149 inline bool isBegin()
const;
157 return composite_iterator_.isEnd();
164 inline bool isRBegin()
const;
170 inline bool isREnd()
const;
183 inline void invalidate();
189 inline void toBegin();
204 inline void forward();
207 inline void backward();
212 inline void toRBegin();
217 inline void toREnd();
240 composite_iterator_(),
303 while (+sub_iterator && (
predicate_->operator () (*sub_iterator) ==
false))
323 return const_cast<Composite&
>(*composite_iterator_);
358 while (+sub_iterator && (
predicate_->operator () (*sub_iterator) ==
false))
389 #endif // BALL_KERNEL_ITERATOR_H BALL_INLINE void invalidate()
Invalidate the iterator.
const Composite * getContainer() const
Return a const pointer to the container the iterator is bound to.
CompositeIteratorTraits()
Default constructor.
#define BALL_PRECONDITION_EXCEPTION(condition, message)
void forward()
Increment the iterator by one element.
Composite::CompositeIterator composite_iterator_
The internal iterator to iterate over the current node's children.
bool operator==(const CompositeIteratorTraits &traits) const
Equality operator.
CompositeIterator beginComposite()
BALL_EXPORT bool operator!=(const String &s1, const String &s2)
Composite * bound_
The pointer to the container.
Composite * getContainer()
Return a pointer to the container the iterator is bound to.
const UnaryPredicate< Composite > * getPredicate() const
Return the current predicate associated with the iterator.
bool isSingular() const
Check whether the iterator is bound to a container.
const UnaryPredicate< Composite > * predicate_
The predicate.
CompositeIteratorTraits & operator=(const CompositeIteratorTraits &traits)
Assignment operator.
BALL_EXPORT bool operator==(const String &s1, const String &s2)
void setPredicate(const UnaryPredicate< Composite > &predicate)
Assign the current predicate associated with the iterator.
Composite::CompositeIterator & getPosition()
Return the current iterator position.
-*- Mode: C++; tab-width: 2; -*-
~CompositeIteratorTraits()
Destructor.
const Composite::CompositeIterator & getPosition() const
Return the current iterator posittion (const method)
CompositeIterator endComposite()
BALL_INLINE bool isREnd() const
Test wheter the iterator points to the position before the first element.
void backward()
Decrement the iterator one element.
Composite & getData()
Return a reference to the current element.
bool operator!=(const CompositeIteratorTraits &traits) const
Inequality operator.