Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | List of all members
om::util::LinkedList< T >::Iterator Class Reference

Iterator class for a linked list. More...

#include <omLinkedList.h>

Public Member Functions

 Iterator (LinkedList< T > &newList)
 create a new linked list iterator from a reference to a list. More...
 
 operator Bool () const
 Return whether or not the iterator is at the end of the list. More...
 
void operator++ ()
 Prefix increment operator. More...
 
void operator++ (int)
 Postfix increment operator. More...
 
T & operator* ()
 Return a reference to the current iterator element. More...
 
T * operator-> ()
 Access the current iterator element. More...
 
void remove ()
 Remove the current element from the list. More...
 
void insertBefore (const T &data)
 Insert a data element before the current iterator element. More...
 
void insertAfter (const T &data)
 Insert a data element after the current iterator element. More...
 
void reset ()
 Reset the iterator to the beginning of the list. More...
 

Detailed Description

template<typename T>
class om::util::LinkedList< T >::Iterator

Iterator class for a linked list.

It's purpose is to efficiently iterate through all or some of the elements in the linked list, making changes as necessary. It avoids the O(n) time of removing or adding elements to the list under ordinary situations.

Constructor & Destructor Documentation

template<typename T >
om::util::LinkedList< T >::Iterator::Iterator ( LinkedList< T > &  newList)
inline

create a new linked list iterator from a reference to a list.

Member Function Documentation

template<typename T >
om::util::LinkedList< T >::Iterator::operator Bool ( ) const
inline

Return whether or not the iterator is at the end of the list.

If the iterator is at the end of the list, return FALSE. Otherwise, return TRUE.

Returns
FALSE if at the end of list, otherwise TRUE
template<typename T >
void om::util::LinkedList< T >::Iterator::operator++ ( )
inline

Prefix increment operator.

template<typename T >
void om::util::LinkedList< T >::Iterator::operator++ ( int  )
inline

Postfix increment operator.

template<typename T >
T& om::util::LinkedList< T >::Iterator::operator* ( )
inline

Return a reference to the current iterator element.

template<typename T >
T* om::util::LinkedList< T >::Iterator::operator-> ( )
inline

Access the current iterator element.

template<typename T >
void om::util::LinkedList< T >::Iterator::remove ( )
inline

Remove the current element from the list.

This method removes an element in constant time.

template<typename T >
void om::util::LinkedList< T >::Iterator::insertBefore ( const T &  data)
inline

Insert a data element before the current iterator element.

This method inserts an element in constant time.

template<typename T >
void om::util::LinkedList< T >::Iterator::insertAfter ( const T &  data)
inline

Insert a data element after the current iterator element.

This method inserts an element in constant time.

template<typename T >
void om::util::LinkedList< T >::Iterator::reset ( )
inline

Reset the iterator to the beginning of the list.


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