Chombo + EB + MF  3.2
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
ListIterator< T > Class Template Reference

Iterator over a List. More...

#include <List.H>

Public Member Functions

 ListIterator (const List< T > &aList)
 Construct a ListIterator<T> to first element of aList. More...
 
 ListIterator (const ListIterator< T > &rhs)
 The copy constructor. More...
 
void rewind ()
 Reset this ListIterator<T> to point to the first element in the List<T>. More...
 
void begin ()
 Reset this ListIterator<T> to point to the first element in the List<T>. More...
 
const T & operator() () const
 Return a constant reference to the object in the List<T> currently pointed to by this ListIterator<T>. More...
 
T & operator() ()
 
const T & operator* () const
 Return a constant reference to the object in the List<T> currently pointed to by this ListIterator<T>. More...
 
 operator bool () const
 This is a conversion operator to makes the iterator look like a pointer. More...
 
bool ok () const
 Return true if the iterator is not past the end of the list. More...
 
bool operator! () const
 Returns true if ListIterator<T> doesn't point to any element on the List<T>. More...
 
const T & value () const
 Return a constant reference to the object in the List<T> currently pointed to by the iterator. More...
 
const T & value ()
 Return a constant reference to the object in the List<T> currently pointed to by the iterator. More...
 
ListIterator< T > & operator++ ()
 The prefix auto-increment operator. More...
 
ListIterator< T > & operator-- ()
 The prefix auto-decrement operator. More...
 
ListIterator< T > operator-- (int)
 The postfix auto-decrement operator. More...
 
ListIterator< T > operator++ (int)
 The postfix auto-increment operator. More...
 
bool operator== (const ListIterator< T > &) const
 Equality test for two ListIterator<T>s. More...
 
bool operator!= (const ListIterator< T > &) const
 Are the ListIterator<T>s not equal? More...
 

Protected Member Functions

 ListIterator (const List< T > &_list, ListLink< T > *_p)
 

Protected Attributes

const List< T > & list
 
ListLink< T > * p
 

Private Member Functions

 ListIterator ()
 
ListIterator< T > & operator= (const ListIterator< T > &)
 

Friends

class List< T >
 

Detailed Description

template<class T>
class ListIterator< T >

Iterator over a List.

The class ListIterator<T> is an iterator over class List<T>. This class does NOT provide a default constructor or an assignment operator.

Constructor & Destructor Documentation

◆ ListIterator() [1/4]

template<class T >
ListIterator< T >::ListIterator ( const List< T > &  aList)
inline

Construct a ListIterator<T> to first element of aList.

References ListIterator< T >::list, and ListIterator< T >::p.

◆ ListIterator() [2/4]

template<class T >
ListIterator< T >::ListIterator ( const ListIterator< T > &  rhs)
inline

The copy constructor.

◆ ListIterator() [3/4]

template<class T >
ListIterator< T >::ListIterator ( const List< T > &  _list,
ListLink< T > *  _p 
)
inlineprotected

Construct a ListIterator<T> to a List<T> and object in that List<T>.

◆ ListIterator() [4/4]

template<class T>
ListIterator< T >::ListIterator ( )
private

Member Function Documentation

◆ rewind()

template<class T >
void ListIterator< T >::rewind ( )
inline

Reset this ListIterator<T> to point to the first element in the List<T>.

References ListIterator< T >::list, and ListIterator< T >::p.

Referenced by BinFab< T >::addItems(), and BinFab< T >::addItemsDestructive().

◆ begin()

template<class T >
void ListIterator< T >::begin ( )
inline

Reset this ListIterator<T> to point to the first element in the List<T>.

Same as rewind(), but included to be consistent with other iterators.

References ListIterator< T >::list, and ListIterator< T >::p.

◆ operator()() [1/2]

template<class T >
const T & ListIterator< T >::operator() ( ) const
inline

Return a constant reference to the object in the List<T> currently pointed to by this ListIterator<T>.

References CH_assert, and ListIterator< T >::p.

◆ operator()() [2/2]

template<class T >
T & ListIterator< T >::operator() ( )
inline

References CH_assert, and ListIterator< T >::p.

◆ operator*()

template<class T >
const T & ListIterator< T >::operator* ( ) const
inline

Return a constant reference to the object in the List<T> currently pointed to by this ListIterator<T>.

References CH_assert, and ListIterator< T >::p.

◆ operator bool()

template<class T >
ListIterator< T >::operator bool ( ) const
inline

This is a conversion operator to makes the iterator look like a pointer.

This operator makes it easy to check if the iterator is pointing to an element on the List<T>. If the iterator has been moved off the List<T> or if the List<T> is empty, this conversion returns the NULL pointer.

References ListIterator< T >::ok().

◆ ok()

template<class T >
bool ListIterator< T >::ok ( ) const
inline

◆ operator!()

template<class T >
bool ListIterator< T >::operator! ( ) const
inline

Returns true if ListIterator<T> doesn't point to any element on the List<T>.

References ListIterator< T >::p.

◆ value() [1/2]

template<class T >
const T & ListIterator< T >::value ( ) const
inline

Return a constant reference to the object in the List<T> currently pointed to by the iterator.

References CH_assert, and ListIterator< T >::p.

◆ value() [2/2]

template<class T>
const T& ListIterator< T >::value ( )

Return a constant reference to the object in the List<T> currently pointed to by the iterator.

◆ operator++() [1/2]

template<class T >
ListIterator< T > & ListIterator< T >::operator++ ( )
inline

The prefix auto-increment operator.

Advances the ListIterator<T> to point to the next element on the List<T>. It then returns a reference to itself to allow for chaining with other operators.

References ListIterator< T >::p.

◆ operator--() [1/2]

template<class T >
ListIterator< T > & ListIterator< T >::operator-- ( )
inline

The prefix auto-decrement operator.

Moves theListIterator<T> to point to the previous element on the List<T>. It then returns a reference to itself to allow for chaining with other operators.

References ListIterator< T >::p.

◆ operator--() [2/2]

template<class T >
ListIterator< T > ListIterator< T >::operator-- ( int  )
inline

The postfix auto-decrement operator.

Moves the ListIterator<T> to point to the previous element on the List<T>. It then returns a ListIterator<T> that points to the old element to allow for chaining with other operators.

◆ operator++() [2/2]

template<class T >
ListIterator< T > ListIterator< T >::operator++ ( int  )
inline

The postfix auto-increment operator.

This advances the ListIterator<T> to point to the next element on the List<T>. It then returns a ListIterator<T> that points to the old element to allow for chaining with other operators.

◆ operator==()

template<class T >
bool ListIterator< T >::operator== ( const ListIterator< T > &  _li) const
inline

Equality test for two ListIterator<T>s.

Do the two ListIterator<T>s point to the same List<T> and the same element within the List<T>?

References ListIterator< T >::list, and ListIterator< T >::p.

Referenced by ListIterator< T >::operator!=().

◆ operator!=()

template<class T >
bool ListIterator< T >::operator!= ( const ListIterator< T > &  _li) const
inline

Are the ListIterator<T>s not equal?

References ListIterator< T >::operator==().

◆ operator=()

template<class T>
ListIterator<T>& ListIterator< T >::operator= ( const ListIterator< T > &  )
private

Friends And Related Function Documentation

◆ List< T >

template<class T>
friend class List< T >
friend

Member Data Documentation

◆ list

template<class T>
const List<T>& ListIterator< T >::list
protected

◆ p

template<class T>
ListLink<T>* ListIterator< T >::p
protected

The documentation for this class was generated from the following file: