- A Logic Circuit Simulation Library in C++

lcs::ListIterator< T > Class Template Reference

#include <list.h>

Inheritance diagram for lcs::ListIterator< T >:

lcs::Iterator< T > List of all members.

Detailed Description

template<class T>
class lcs::ListIterator< T >

An iterator class which can iterate over the elements of a lcs::List object.

Public Member Functions

 ListIterator (void)
 ListIterator (ListNode< T > *node)
 ListIterator (const ListIterator< T > &li)
virtual ~ListIterator ()
virtual bool hasNext (void)
virtual T next (void)
virtual void reset (void)
 Resets the iterator to the first element of the list.
void setRootNode (ListNode< T > *node)

Constructor & Destructor Documentation

template<class T>
lcs::ListIterator< T >::ListIterator ( void   ) 

Default constructor. An empty list is assumed unless a root node of the list is set using the ListIterator::setRootNode is used.

template<class T>
lcs::ListIterator< T >::ListIterator ( ListNode< T > *  node  ) 

The iterator is initialised with the first node of the list as the argument node.

template<class T>
lcs::ListIterator< T >::ListIterator ( const ListIterator< T > &  li  ) 

Copy constructor.

template<class T>
virtual lcs::ListIterator< T >::~ListIterator (  )  [inline, virtual]


Member Function Documentation

template<class T>
bool lcs::ListIterator< T >::hasNext ( void   )  [virtual]

Returns true if the list has further elements at from the current position of the iterator. Returns false if the iterator is at the end of the list.

Implements lcs::Iterator< T >.

template<class T>
T lcs::ListIterator< T >::next ( void   )  [virtual]

Returns the next element of the list if there exists one. Else, returns a dummy object of type T.

Implements lcs::Iterator< T >.

template<class T>
void lcs::ListIterator< T >::setRootNode ( ListNode< T > *  node  ) 

Sets the root node of the list to iterate over. Use this function if you thoroughly understand what you are doing, or if the iterator was initialised through the default constructor.

Copyright © 2006, 2007 Siva Chandra