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

#include <FullLinkedList.hh>

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

Public Member Functions

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 ()
 

Protected Member Functions

 ReadIterator (FullLinkedList *controlledList)
 

Protected Attributes

FullLinkedListlinkedList
 
Node * currentNode
 
bool noReadRelease
 

Friends

class FullLinkedList
 

Detailed Description

template<class T>
class FullLinkedList< T >::ReadIterator

Allows readaccess to the linked list. Several readers can exist parallel, but no writer will disturb the reading. The iterators lock on the list will be removed when the iterator is deleted.

Constructor & Destructor Documentation

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

Releases all locks that this mutex has acquired. If the internal variable noReadRelease is set to true, the readLock is not releases. This allows the reduceWriteIterator in the FullLinkedList to delete an Iterator without loosing the readLock.

template<class T>
FullLinkedList< T >::ReadIterator::ReadIterator ( FullLinkedList controlledList)
explicitprotected

Creates a new ReadIterator. Can only be invoked by functions of FullLinkedList. Assumes the readMutex is already locked. Does not lock the readMutex itself

Member Function Documentation

template<class T>
T* FullLinkedList< T >::ReadIterator::getCurrent ( )
inline

Gets the current element. Return NULL if there is no current element. A copy of the current element is returned.

template<class T>
T* FullLinkedList< T >::ReadIterator::getCurrentRef ( )
inline

Gets the current element. Return NULL if there is no current element. A reference of the current element is returned. This reference is only valid while the iterator exists. !! Be very carrefull when using this method !!

template<class T>
bool FullLinkedList< T >::ReadIterator::hasCurrent ( )
inline

returns true if there is a current element

template<class T>
bool FullLinkedList< T >::ReadIterator::hasNext ( )
inline

returns true if there is a next element. If the current element does not exist, false is returned.

template<class T>
bool FullLinkedList< T >::ReadIterator::hasPrevious ( )
inline

returns true if there is a previous element. If the current element does not exist, false is returned.

template<class T>
unsigned int FullLinkedList< T >::ReadIterator::length ( )
inline

Gets the current length of the list.

template<class T>
T* FullLinkedList< T >::ReadIterator::next ( )
inline

Iterates to the next element if the possible. A copy of the current element is returned.

template<class T>
T* FullLinkedList< T >::ReadIterator::nextRef ( )
inline

Iterates to the next element if the possible. A reference of the current element is returned. !! Be very carrefull when using this method !!

template<class T>
T* FullLinkedList< T >::ReadIterator::previous ( )
inline

Iterates to the previous element if the possible. A copy of the current element is returned.

template<class T>
T* FullLinkedList< T >::ReadIterator::previousRef ( )
inline

Iterates to the previous element if the possible. A reference of the current element is returned. !! Be very carrefull when using this method !!

template<class T>
void FullLinkedList< T >::ReadIterator::reset ( )
inline

Set the currentElement of the iterator to the first element of the list

template<class T>
void FullLinkedList< T >::ReadIterator::resetToLast ( )
inline

Set the currentElement of the iterator to the last element of the list

Member Data Documentation

template<class T>
Node* FullLinkedList< T >::ReadIterator::currentNode
protected

the current Node of the iterator

template<class T>
FullLinkedList* FullLinkedList< T >::ReadIterator::linkedList
protected

contains the linked list this iterator controlls

template<class T>
bool FullLinkedList< T >::ReadIterator::noReadRelease
protected

Controlls the behaviour of unlocking the blocked mutexes when releaseLocks() is called. This is initialized to false, as usually all locks should be released. This value is set to true by the reduceWriteIterator() to allow the creation of a new Iterator without releasing the readlock


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