LogService
libdadi: utility tools for distributed applications
Public Member Functions | Protected Member Functions | Protected Attributes | Friends
FullLinkedList::ReadIterator Class Reference

#include <FullLinkedList.hh>

Inheritance diagram for FullLinkedList::ReadIterator:
FullLinkedList::Iterator

List of all members.

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
NodecurrentNode
bool noReadRelease

Friends

class FullLinkedList

Detailed Description

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

virtual FullLinkedList::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.

FullLinkedList::ReadIterator::ReadIterator ( FullLinkedList controlledList) [explicit, protected]

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

T* FullLinkedList::ReadIterator::getCurrent ( ) [inline]

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

T* FullLinkedList::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 !!

bool FullLinkedList::ReadIterator::hasCurrent ( ) [inline]

returns true if there is a current element

bool FullLinkedList::ReadIterator::hasNext ( ) [inline]

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

bool FullLinkedList::ReadIterator::hasPrevious ( ) [inline]

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

unsigned int FullLinkedList::ReadIterator::length ( ) [inline]

Gets the current length of the list.

T* FullLinkedList::ReadIterator::next ( ) [inline]

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

T* FullLinkedList::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 !!

T* FullLinkedList::ReadIterator::previous ( ) [inline]

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

T* FullLinkedList::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 !!

void FullLinkedList::ReadIterator::reset ( ) [inline]

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

void FullLinkedList::ReadIterator::resetToLast ( ) [inline]

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


Member Data Documentation

the current Node of the iterator

contains the linked list this iterator controlls

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:
 All Classes Functions Variables