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

Classes

class  Iterator
 
class  ReadIterator
 

Public Member Functions

 FullLinkedList ()
 
 FullLinkedList (FullLinkedList< T > &newFLL)
 
 ~FullLinkedList ()
 
FullLinkedList< T > & operator= (FullLinkedList< T > &newFLL)
 
void emptyIt ()
 
void push (T *element)
 
void pushRef (T *element)
 
void shift (T *element)
 
void shiftRef (T *element)
 
T * pop ()
 
T * unshift ()
 
void appendList (FullLinkedList< T > *list)
 
IteratorgetIterator ()
 
ReadIteratorgetReadIterator ()
 
ReadIteratorreduceWriteIterator (Iterator *rwIterator)
 

Constructor & Destructor Documentation

template<class T>
FullLinkedList< T >::FullLinkedList ( )

creates an new empty list.

template<class T>
FullLinkedList< T >::FullLinkedList ( FullLinkedList< T > &  newFLL)
explicit

Copy constructor Element T must be have a copy constructor

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

Destroyes the list. The list will be emptied. All elements will be freed.

Member Function Documentation

template<class T>
void FullLinkedList< T >::appendList ( FullLinkedList< T > *  list)

Append the list given in argument to the end of the list. The list given in argument is copied using the defaut construcotr by copy of its element T.

Parameters
listThe list which is append to the end of the current list. The list will be consumed by the call
template<class T>
void FullLinkedList< T >::emptyIt ( )

destroyes all the element of the list. The list becomes an empty list. The Elements of the nodes are freed. Acquires write lock.

template<class T>
Iterator* FullLinkedList< T >::getIterator ( )

Creates an iterator which controls the linked list. All the access on the list is blocked until the iterator is destroyed. Provides read and write access. Can be reduced to a ReadIterator

Returns
an iterator that exclusively accesses the list until it is destroyed
template<class T>
ReadIterator* FullLinkedList< T >::getReadIterator ( )

Creates a iterator which has only readaccess to the list. All write access to the list is blocked until the iterator is destroyed.

Returns
an iterator that provides readaccess to the list until it is destroyed
template<class T>
FullLinkedList<T>& FullLinkedList< T >::operator= ( FullLinkedList< T > &  newFLL)

For affecting a list

template<class T>
T* FullLinkedList< T >::pop ( )

pop an element from the list. The element is removed from the end of the list and is returned. Returns NULL if the list is empty

Returns
The element that has been removed
template<class T>
void FullLinkedList< T >::push ( T *  element)

Push an element on the list. The Element is stored at the end of the list. A copy of the element is done using the copy constructor

Parameters
elementa pointer on the element to be added
template<class T>
void FullLinkedList< T >::pushRef ( T *  element)

Push an element on the list. The Element is stored at the end of the list. !! Only the reference to the element is stored !! Be very carrefull when using this function !

Parameters
elementa pointer on the element to be added
template<class T>
ReadIterator* FullLinkedList< T >::reduceWriteIterator ( Iterator rwIterator)

Releases the write lock of an readWrite iterator, making it an ReadIterator. The read lock stays all the time. The original iterator will be destroyed and cannot be used any more after this operation.

Parameters
rwIteratorthe iterator to release
Returns
an iterator with readonly access to the list
template<class T>
void FullLinkedList< T >::shift ( T *  element)

Shift an element in the list. The Element is stored at the begin of the list. A copy of the element is done using the copy constructor

Parameters
elementa pointer on the element to be added
template<class T>
void FullLinkedList< T >::shiftRef ( T *  element)

Shift an element in the list. The Element is stored at the begin of the list. !! Only the reference to the element is stored !! Be very carrefull when using this function !

Parameters
elementa pointer on the element to be added
template<class T>
T* FullLinkedList< T >::unshift ( )

unshift an element from the list. The element is removed from the begin of the list and is returned. Returns NULL if the list is empty

Returns
The element that has been removed

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