BALL
1.4.79
|
#include <BALL/CONCEPT/baseIterator.h>
Public Types | |
Typedefs. | |
The names of these typedefs deviate from the usual BALL class names due to restrictions imposed by STL compliance. | |
typedef DataType | value_type |
typedef Position | difference_type |
typedef const DataType * | pointer |
typedef const DataType & | reference |
typedef std::input_iterator_tag | iterator_category |
Public Member Functions | |
Constructors and Destructors | |
BALL_INLINE | BaseIterator () |
Default constructor. More... | |
BALL_INLINE | BaseIterator (const BaseIterator &iterator) |
Copy constructor. More... | |
BALL_INLINE | ~BaseIterator () |
Destructor. More... | |
Assignment | |
BALL_INLINE BaseIterator & | operator= (const BaseIterator &iterator) |
BALL_INLINE void | swap (BaseIterator &iterator) |
Swap two iterators. More... | |
Accessors | |
BALL_INLINE void | invalidate () |
Invalidate the iterator. More... | |
BALL_INLINE void | setTraits (const Traits &traits) |
Set the traits. More... | |
BALL_INLINE const Traits & | getTraits () const |
Get a constant reference to the traits of this iterator. More... | |
BALL_INLINE Traits & | getTraits () |
Get a constant reference to the traits of this iterator. More... | |
BALL_INLINE const Container * | getContainer () const |
Get a constant pointer to the container of this iterator. More... | |
Converters | |
BALL_INLINE | operator const Position & () const |
BALL_INLINE reference | operator* () const |
Convert an iterator to its Datatype by returning a reference to the current data. More... | |
BALL_INLINE pointer | operator-> () const |
Return a pointer to the current data. More... | |
Predicates | |
BALL_INLINE bool | operator== (const BaseIterator &iterator) const |
Equality operator. More... | |
BALL_INLINE bool | operator!= (const BaseIterator &iterator) const |
Inequality operator. More... | |
BALL_INLINE bool | isSingular () const |
BALL_INLINE bool | isValid () const |
BALL_INLINE bool | operator+ () const |
Validity predicate. More... | |
BALL_INLINE bool | operator- () const |
Invalidity perdicate. More... | |
Protected Member Functions | |
BALL_INLINE | BaseIterator (const Container &container) |
Generic Iterator Class. This template class implements the basic behaviour of an iterator. Iterators are basically STL-like iterators. They provide the full STL iterator interface, but also offer additional features.
BaseIterator itself is a base class to the other iterator classes only and should not be used by itself.
An important difference exists for the iterators of the kernel objects. For most kernel objects, multiple iterators exist. Therefore, we could not simply use begin()
and end()
like in STL, but we introduced specialized methods like AtomContainer::beginAtom and AtomContainer::endAtom . For similar reasons, the iterators for kernel classes are not implemented as nested classes of the respective kernel classes, but as independent classes to avoid code replication. An exception is Atom::BondIterator , which is relevant to Atom alone.
Each BALL iterator can be bound to a container, so once the iteration has started, it "knows" about the end() of the container. Therefore, BALL iterators additionally implement the unary plus operator to check for the validity of the iterator. this allows the convenient implementation of for loops, e.g. as follows:
Definition at line 64 of file baseIterator.h.
typedef Position BALL::BaseIterator< Container, DataType, Position, Traits >::difference_type |
Definition at line 76 of file baseIterator.h.
typedef std::input_iterator_tag BALL::BaseIterator< Container, DataType, Position, Traits >::iterator_category |
Definition at line 82 of file baseIterator.h.
typedef const DataType* BALL::BaseIterator< Container, DataType, Position, Traits >::pointer |
Definition at line 78 of file baseIterator.h.
typedef const DataType& BALL::BaseIterator< Container, DataType, Position, Traits >::reference |
Definition at line 80 of file baseIterator.h.
typedef DataType BALL::BaseIterator< Container, DataType, Position, Traits >::value_type |
Definition at line 74 of file baseIterator.h.
|
inline |
Default constructor.
Definition at line 89 of file baseIterator.h.
|
inline |
Copy constructor.
Definition at line 92 of file baseIterator.h.
|
inline |
Destructor.
Definition at line 98 of file baseIterator.h.
|
inlineprotected |
Constructor. Protected to allow instantiation and use in derived classes only.
Definition at line 189 of file baseIterator.h.
|
inline |
Get a constant pointer to the container of this iterator.
Definition at line 136 of file baseIterator.h.
|
inline |
Get a constant reference to the traits of this iterator.
Definition at line 130 of file baseIterator.h.
|
inline |
Get a constant reference to the traits of this iterator.
Definition at line 133 of file baseIterator.h.
|
inline |
Invalidate the iterator.
Definition at line 124 of file baseIterator.h.
|
inline |
Singularity predicate. This method returns true if the iterator is singular, i.e., not associated with a container.
Definition at line 170 of file baseIterator.h.
|
inline |
Validity predicate
Definition at line 175 of file baseIterator.h.
|
inline |
Convert an iterator to Position. This method returns the position of the iterator. Note that Position is a template within this context and not the BALL datatype.
Definition at line 147 of file baseIterator.h.
|
inline |
Inequality operator.
Definition at line 164 of file baseIterator.h.
|
inline |
Convert an iterator to its Datatype by returning a reference to the current data.
Definition at line 150 of file baseIterator.h.
|
inline |
Validity predicate.
Definition at line 178 of file baseIterator.h.
|
inline |
Invalidity perdicate.
Definition at line 181 of file baseIterator.h.
|
inline |
Return a pointer to the current data.
Definition at line 153 of file baseIterator.h.
|
inline |
Assignment operator. Assigns the contents of an iterator to another iterator.
iterator | the iterator to be copied |
Definition at line 109 of file baseIterator.h.
|
inline |
Equality operator.
Definition at line 161 of file baseIterator.h.
|
inline |
Set the traits.
Definition at line 127 of file baseIterator.h.
|
inline |
Swap two iterators.
Definition at line 116 of file baseIterator.h.