LogService
libdadi: utility tools for distributed applications
Public Member Functions | Friends | List of all members
FullLinkedList< T >::Iterator Class Reference

#include <FullLinkedList.hh>

Inheritance diagram for FullLinkedList< T >::Iterator:
Inheritance graph
[legend]
Collaboration diagram for FullLinkedList< T >::Iterator:
Collaboration graph
[legend]

Public Member Functions

virtual ~Iterator ()
 
void removeCurrent ()
 
T * removeAndGetCurrent ()
 
void insertAfter (T *element)
 
void insertAfterRef (T *element)
 
void insertBefore (T *element)
 
void insertBeforeRef (T *element)
 
- Public Member Functions inherited from FullLinkedList< T >::ReadIterator
virtual ~ReadIterator ()
 
void reset ()
 
void resetToLast ()
 
bool hasCurrent ()
 
bool hasNext ()
 
bool hasPrevious ()
 
T * getCurrent ()
 
T * getCurrentRef ()
 
T * next ()
 
T * nextRef ()
 
T * previous ()
 
T * previousRef ()
 
unsigned int length ()
 

Friends

class FullLinkedList
 

Additional Inherited Members

- Protected Member Functions inherited from FullLinkedList< T >::ReadIterator
 ReadIterator (FullLinkedList *controlledList)
 
- Protected Attributes inherited from FullLinkedList< T >::ReadIterator
FullLinkedListlinkedList
 
Node * currentNode
 
bool noReadRelease
 

Detailed Description

template<class T>
class FullLinkedList< T >::Iterator

Allows full access on the linked list. This includes write access as specified in the parentclass ReadIterator as well as functions to add and remove elements. Can be reduced to a ReadIterator by the FullLinkedList.reduceWriteIterator() to release its writeLock.

Constructor & Destructor Documentation

template<class T>
virtual FullLinkedList< T >::Iterator::~Iterator ( )
virtual

Releases the read- and writeLock of this list. If noReadRelease in the parent class is set to true, only the writeLock is released. This allows the construction of a ReadIterator without loosing synchronisation.

Member Function Documentation

template<class T>
void FullLinkedList< T >::Iterator::insertAfter ( T *  element)

inserts a new element after the current element. The current element is unchanged. If the list is empty, a new list is created. The current element will be the new element. If there is no current element, nothing is done. A copy of the element is done through the copy constructor of the element T.

Parameters
elementA pointer to the element that is added
template<class T>
void FullLinkedList< T >::Iterator::insertAfterRef ( T *  element)

inserts a new element after the current element. The current element is unchanged. If the list is empty, a new list is created. The current element will be the new element. If there is no current element, nothing is done. !! Only a reference is copied, use it with special care !!

Parameters
elementA pointer to the element that is added
template<class T>
void FullLinkedList< T >::Iterator::insertBefore ( T *  element)

inserts a new element before the current element. The current element is unchanged. If the list is empty, a new list is created, the current element is set to the new element. If there is no current element, nothing is done. A copy of the element is done through the copy constructor of the element T.

Parameters
elementA pointer to the element that is added
template<class T>
void FullLinkedList< T >::Iterator::insertBeforeRef ( T *  element)

inserts a new element before the current element. The current element is unchanged. If the list is empty, a new list is created, the current element is set to the new element. If there is no current element, nothing is done. !! Only a reference is copied, use it with special care !!

Parameters
elementA pointer to the element that is added
template<class T>
T* FullLinkedList< T >::Iterator::removeAndGetCurrent ( )

removes the current element from the list and return the current element. If the current element doesn't exist, nothing is done and NULL is return. The new current Element will be the next element in the list, and NULL if the removed element was the last element of the list.

Returns
A pointer to a copy of the element that has been removed
template<class T>
void FullLinkedList< T >::Iterator::removeCurrent ( )

removes the current element from the list. If the current element doesn't exist, nothing is done. The new current Element will be the next element in the list, and NULL if the removed element was the last element of the list.


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