HepAListIterator is a template based list iterator class to be
used with the HepAList list class.
An iterator will sequentially
go through each element of the associated list, starting with the first
element. It is also possible to explicitly rewind the iterator, or to move
forward or backward in the list.
Do not insert or remove elements in a list that is being iterated.
This result in elements being skipped or iterated several times.
HepAlistIterator was developed from an original (non-template)
list iterator class written by Dag Bruck.
Author
Leif Lonnblad
See also
HepAListBase,
HepAList,
HepCList,
HepConstAList,
HepAListIteratorBase,
HepCListIterator,
HepConstAListIterator
Declaration
#include "CLHEP/Alist/AIterator.h"
template <class T>
class HepAListIterator : public HepAListIteratorBase
Public Member Functions
- Constructor
- inline HepAListIterator(const HepAList<T> &)
- Constructor taking a corresponding list as argument.
Starting at the first element.
- Copy constructor
- inline HepAListIterator(const HepAListIterator<T> &)
- Destructor
- inline ~HepAListIterator()
- ()
- inline T * operator () ()
- Returns a pointer to the current object in the associated list,
moving forward to the next.
- Returns 0 if all objects are done.
- current
- inline T * current() const
- Returns a pointer to the current object in the associated list,
without incrementing the index.
- next
- inline T * next()
- Returns a pointer to the current object in the associated list,
moving forward to the next.
- Returns 0 if all objects are done.
- prev
- inline T * prev()
- Moves backward one step in the list and returns the object found there.
- If current object is the first in the list, no stepping is done and
0 is returned.
Example
CLHEP/test/testAList.cc
24 September 1997
EVC