BALL::BaseIterator< Container, DataType, Position, Traits > Class Template Reference
[Iterators]

#include <BALL/CONCEPT/baseIterator.h>

Inheritance diagram for BALL::BaseIterator< Container, DataType, Position, Traits >:
Inheritance graph
[legend]

List of all members.

Public Types

Typedefs.

The names of these typedefs deviate from the usual 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
typedef DataType value_type
typedef Position difference_type
typedef const DataType * pointer
typedef const DataType & reference
typedef Container container_type
typedef Traits traits_type
typedef std::input_iterator_tag iterator_category

Public Member Functions

Constructors and Destructors

BALL_INLINE BaseIterator ()
 Default constructor.
BALL_INLINE BaseIterator (const BaseIterator &iterator)
 Copy constructor.
BALL_INLINE ~BaseIterator ()
 Destructor.
 BaseIterator ()
 Default constructor.
 BaseIterator (const BaseIterator &iterator)
 Copy constructor.
 ~BaseIterator ()
 Destructor.
Assignment

BALL_INLINE BaseIteratoroperator= (const BaseIterator &iterator)
BALL_INLINE void swap (BaseIterator &iterator)
 Swap two iterators.
BaseIteratoroperator= (const BaseIterator &iterator)
void swap (BaseIterator &iterator)
 Swap two iterators.
Accessors

BALL_INLINE void invalidate ()
 Invalidate the iterator.
BALL_INLINE void setTraits (const Traits &traits)
 Set the traits.
BALL_INLINE const Traits & getTraits () const
 Get a constant reference to the traits of this iterator.
BALL_INLINE Traits & getTraits ()
 Get a constant reference to the traits of this iterator.
BALL_INLINE const Container * getContainer () const
 Get a constant pointer to the container of this iterator.
void invalidate ()
 Invalidate the iterator.
void setTraits (const Traits &traits)
 Set the traits.
const Traits & getTraits () const
 Get a constant reference to the traits of this iterator.
Traits & getTraits ()
 Get a constant reference to the traits of this iterator.
const Container * getContainer () const
 Get a constant pointer to the container of this iterator.
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.
BALL_INLINE pointer operator-> () const
 Return a pointer to the current data.
 operator const Position & () const
reference operator* () const
 Convert an iterator to its Datatype by returning a reference to the current data.
pointer operator-> () const
 Return a pointer to the current data.
Predicates

BALL_INLINE bool operator== (const BaseIterator &iterator) const
 Equality operator.
BALL_INLINE bool operator!= (const BaseIterator &iterator) const
 Inequality operator.
BALL_INLINE bool isSingular () const
BALL_INLINE bool isValid () const
BALL_INLINE bool operator+ () const
 Validity predicate.
BALL_INLINE bool operator- () const
 Invalidity perdicate.
bool operator== (const BaseIterator &iterator) const
 Equality operator.
bool operator!= (const BaseIterator &iterator) const
 Inequality operator.
bool isSingular () const
bool isValid () const
bool operator+ () const
 Validity predicate.
bool operator- () const
 Invalidity predicate.

Protected Member Functions

BALL_INLINE BaseIterator (const Container &container)
 BaseIterator (const Container &container)

Private Attributes

Traits traits_
 The instance of the iterator's traits.

Detailed Description

template<typename Container, typename DataType, typename Position, typename Traits>
class BALL::BaseIterator< Container, DataType, Position, Traits >

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:

        AtomIterator atom_it = system.beginAtom();
        for (; +atom_it; ++atom_it)
        {
          ....
        }

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.

Definition at line 64 of file CONCEPT/baseIterator.h.


Member Typedef Documentation

template<typename Container, typename DataType, typename Position, typename Traits>
typedef Container BALL::BaseIterator< Container, DataType, Position, Traits >::container_type

Definition at line 35 of file MATHS/LINALG/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
typedef Position BALL::BaseIterator< Container, DataType, Position, Traits >::difference_type

Definition at line 29 of file MATHS/LINALG/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
typedef Position BALL::BaseIterator< Container, DataType, Position, Traits >::difference_type

Definition at line 76 of file CONCEPT/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
typedef std::input_iterator_tag BALL::BaseIterator< Container, DataType, Position, Traits >::iterator_category
template<typename Container, typename DataType, typename Position, typename Traits>
typedef std::input_iterator_tag BALL::BaseIterator< Container, DataType, Position, Traits >::iterator_category
template<typename Container, typename DataType, typename Position, typename Traits>
typedef const DataType* BALL::BaseIterator< Container, DataType, Position, Traits >::pointer
template<typename Container, typename DataType, typename Position, typename Traits>
typedef const DataType* BALL::BaseIterator< Container, DataType, Position, Traits >::pointer
template<typename Container, typename DataType, typename Position, typename Traits>
typedef const DataType& BALL::BaseIterator< Container, DataType, Position, Traits >::reference
template<typename Container, typename DataType, typename Position, typename Traits>
typedef const DataType& BALL::BaseIterator< Container, DataType, Position, Traits >::reference
template<typename Container, typename DataType, typename Position, typename Traits>
typedef Traits BALL::BaseIterator< Container, DataType, Position, Traits >::traits_type

Definition at line 37 of file MATHS/LINALG/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
typedef DataType BALL::BaseIterator< Container, DataType, Position, Traits >::value_type

Definition at line 27 of file MATHS/LINALG/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
typedef DataType BALL::BaseIterator< Container, DataType, Position, Traits >::value_type

Definition at line 74 of file CONCEPT/baseIterator.h.


Constructor & Destructor Documentation

template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE BALL::BaseIterator< Container, DataType, Position, Traits >::BaseIterator (  )  [inline]

Default constructor.

Definition at line 89 of file CONCEPT/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE BALL::BaseIterator< Container, DataType, Position, Traits >::BaseIterator ( const BaseIterator< Container, DataType, Position, Traits > &  iterator  )  [inline]

Copy constructor.

Definition at line 92 of file CONCEPT/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE BALL::BaseIterator< Container, DataType, Position, Traits >::~BaseIterator (  )  [inline]

Destructor.

Definition at line 98 of file CONCEPT/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE BALL::BaseIterator< Container, DataType, Position, Traits >::BaseIterator ( const Container &  container  )  [inline, protected]

Constructor. Protected to allow instantiation and use in derived classes only.

Definition at line 189 of file CONCEPT/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL::BaseIterator< Container, DataType, Position, Traits >::BaseIterator (  )  [inline]

Default constructor.

Definition at line 46 of file MATHS/LINALG/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL::BaseIterator< Container, DataType, Position, Traits >::BaseIterator ( const BaseIterator< Container, DataType, Position, Traits > &  iterator  )  [inline]

Copy constructor.

Definition at line 49 of file MATHS/LINALG/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL::BaseIterator< Container, DataType, Position, Traits >::~BaseIterator (  )  [inline]

Destructor.

Definition at line 55 of file MATHS/LINALG/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL::BaseIterator< Container, DataType, Position, Traits >::BaseIterator ( const Container &  container  )  [inline, protected]

Constructor. Protected to allow instantiation and use in derived classes only.

Definition at line 146 of file MATHS/LINALG/baseIterator.h.


Member Function Documentation

template<typename Container, typename DataType, typename Position, typename Traits>
const Container* BALL::BaseIterator< Container, DataType, Position, Traits >::getContainer (  )  const [inline]

Get a constant pointer to the container of this iterator.

Definition at line 93 of file MATHS/LINALG/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE const Container* BALL::BaseIterator< Container, DataType, Position, Traits >::getContainer (  )  const [inline]

Get a constant pointer to the container of this iterator.

Definition at line 136 of file CONCEPT/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
Traits& BALL::BaseIterator< Container, DataType, Position, Traits >::getTraits (  )  [inline]

Get a constant reference to the traits of this iterator.

Definition at line 90 of file MATHS/LINALG/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
const Traits& BALL::BaseIterator< Container, DataType, Position, Traits >::getTraits (  )  const [inline]

Get a constant reference to the traits of this iterator.

Definition at line 87 of file MATHS/LINALG/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE Traits& BALL::BaseIterator< Container, DataType, Position, Traits >::getTraits (  )  [inline]

Get a constant reference to the traits of this iterator.

Definition at line 133 of file CONCEPT/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE const Traits& BALL::BaseIterator< Container, DataType, Position, Traits >::getTraits (  )  const [inline]

Get a constant reference to the traits of this iterator.

Definition at line 130 of file CONCEPT/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
void BALL::BaseIterator< Container, DataType, Position, Traits >::invalidate (  )  [inline]

Invalidate the iterator.

Definition at line 81 of file MATHS/LINALG/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE void BALL::BaseIterator< Container, DataType, Position, Traits >::invalidate (  )  [inline]

Invalidate the iterator.

Definition at line 124 of file CONCEPT/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
bool BALL::BaseIterator< Container, DataType, Position, Traits >::isSingular (  )  const [inline]

Singularity predicate. This method returns true if the iterator is singular, i.e., not associated with a container.

Definition at line 127 of file MATHS/LINALG/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE bool BALL::BaseIterator< Container, DataType, Position, Traits >::isSingular (  )  const [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 CONCEPT/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
bool BALL::BaseIterator< Container, DataType, Position, Traits >::isValid (  )  const [inline]

Validity predicate

Returns:
true if the iterator is valid (pointing at an element in a container)

Definition at line 132 of file MATHS/LINALG/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE bool BALL::BaseIterator< Container, DataType, Position, Traits >::isValid (  )  const [inline]

Validity predicate

Returns:
true if the iterator is valid (pointing at an element in a container)

Definition at line 175 of file CONCEPT/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL::BaseIterator< Container, DataType, Position, Traits >::operator const Position & (  )  const [inline]

Convert an iterator to Position. This method returns the position of the iterator. Position is a template within this context.

Definition at line 104 of file MATHS/LINALG/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE BALL::BaseIterator< Container, DataType, Position, Traits >::operator const Position & (  )  const [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 CONCEPT/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
bool BALL::BaseIterator< Container, DataType, Position, Traits >::operator!= ( const BaseIterator< Container, DataType, Position, Traits > &  iterator  )  const [inline]

Inequality operator.

Definition at line 121 of file MATHS/LINALG/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE bool BALL::BaseIterator< Container, DataType, Position, Traits >::operator!= ( const BaseIterator< Container, DataType, Position, Traits > &  iterator  )  const [inline]

Inequality operator.

Definition at line 164 of file CONCEPT/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
reference BALL::BaseIterator< Container, DataType, Position, Traits >::operator* (  )  const [inline]
template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE reference BALL::BaseIterator< Container, DataType, Position, Traits >::operator* (  )  const [inline]
template<typename Container, typename DataType, typename Position, typename Traits>
bool BALL::BaseIterator< Container, DataType, Position, Traits >::operator+ (  )  const [inline]
template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE bool BALL::BaseIterator< Container, DataType, Position, Traits >::operator+ (  )  const [inline]
template<typename Container, typename DataType, typename Position, typename Traits>
bool BALL::BaseIterator< Container, DataType, Position, Traits >::operator- (  )  const [inline]
template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE bool BALL::BaseIterator< Container, DataType, Position, Traits >::operator- (  )  const [inline]
template<typename Container, typename DataType, typename Position, typename Traits>
pointer BALL::BaseIterator< Container, DataType, Position, Traits >::operator-> (  )  const [inline]
template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE pointer BALL::BaseIterator< Container, DataType, Position, Traits >::operator-> (  )  const [inline]
template<typename Container, typename DataType, typename Position, typename Traits>
BaseIterator& BALL::BaseIterator< Container, DataType, Position, Traits >::operator= ( const BaseIterator< Container, DataType, Position, Traits > &  iterator  )  [inline]

Assignment operator. Assigns the contents of an iterator to another iterator.

Parameters:
iterator the iterator to be copied

Definition at line 66 of file MATHS/LINALG/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE BaseIterator& BALL::BaseIterator< Container, DataType, Position, Traits >::operator= ( const BaseIterator< Container, DataType, Position, Traits > &  iterator  )  [inline]

Assignment operator. Assigns the contents of an iterator to another iterator.

Parameters:
iterator the iterator to be copied

Definition at line 109 of file CONCEPT/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
bool BALL::BaseIterator< Container, DataType, Position, Traits >::operator== ( const BaseIterator< Container, DataType, Position, Traits > &  iterator  )  const [inline]

Equality operator.

Definition at line 118 of file MATHS/LINALG/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE bool BALL::BaseIterator< Container, DataType, Position, Traits >::operator== ( const BaseIterator< Container, DataType, Position, Traits > &  iterator  )  const [inline]

Equality operator.

Definition at line 161 of file CONCEPT/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
void BALL::BaseIterator< Container, DataType, Position, Traits >::setTraits ( const Traits &  traits  )  [inline]

Set the traits.

Definition at line 84 of file MATHS/LINALG/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE void BALL::BaseIterator< Container, DataType, Position, Traits >::setTraits ( const Traits &  traits  )  [inline]

Set the traits.

Definition at line 127 of file CONCEPT/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
void BALL::BaseIterator< Container, DataType, Position, Traits >::swap ( BaseIterator< Container, DataType, Position, Traits > &  iterator  )  [inline]

Swap two iterators.

Definition at line 73 of file MATHS/LINALG/baseIterator.h.

template<typename Container, typename DataType, typename Position, typename Traits>
BALL_INLINE void BALL::BaseIterator< Container, DataType, Position, Traits >::swap ( BaseIterator< Container, DataType, Position, Traits > &  iterator  )  [inline]

Swap two iterators.

Definition at line 116 of file CONCEPT/baseIterator.h.


Member Data Documentation

template<typename Container, typename DataType, typename Position, typename Traits>
Traits BALL::BaseIterator< Container, DataType, Position, Traits >::traits_ [private]

The instance of the iterator's traits.

Definition at line 197 of file CONCEPT/baseIterator.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Generated by  doxygen 1.6.3