Guiliani  Version 2.6 revision 7293 (documentation build 12)
eC_TListDoubleLinked< T > Class Template Reference

Represents a double linked list template with header and tail node. More...

#include <eC_TList_doubleLinked.h>

Public Types

typedef bool(* compare) (T lhs, T rhs)
 compare-function
 
typedef eC_TIterator< T > Iterator
 Iterator is typedef'd as eC_TIterator ot type T.
 
typedef eC_TSafeIterator< T > SafeIterator
 SafeIterator is typedef'd as eC_TSafeIterator ot type T.
 

Public Member Functions

 eC_TListDoubleLinked ()
 
 eC_TListDoubleLinked (const eC_TListDoubleLinked< T > &copy)
 
 ~eC_TListDoubleLinked ()
 
void Add (const T &tValue)
 
void AddAfter (const T &tValue2Add, Iterator &kIter)
 
void AddAtEnd (const T &tValue)
 
void AddBefore (const T &tValue2Add, Iterator &kIter)
 
void AddSorted (const T &tValue)
 
eC_Bool AddUnique (const T &tValue)
 
eC_Bool AddUniqueAtEnd (const T &tValue)
 
eC_Bool AddUniqueSorted (const T &tValue)
 
eC_Bool Contains (const T &tValue) const
 
eC_Bool Empty () const
 
eC_TIterator< T > GetAt (eC_UInt uiPos) const
 
eC_TSafeIterator< T > GetAtSafe (eC_UInt uiPos)
 
eC_TIterator< T > GetBegin () const
 
eC_TSafeIterator< T > GetBeginSafe ()
 
eC_TIterator< T > GetEnd () const
 
eC_TSafeIterator< T > GetEndSafe ()
 
eC_TIterator< T > GetFind (const T &tValue) const
 
eC_TSafeIterator< T > GetFindSafe (const T &tValue)
 
eC_Bool GetFirst (T &rtValue) const
 
eC_Bool GetNext (T &rtValue) const
 
eC_UInt GetQuantity () const
 
eC_Bool IsEmpty () const
 
eC_Bool MoveAfter (Iterator &kIter1, Iterator &kIter2)
 
eC_Bool MoveAfter (Iterator &kStartIter, Iterator &kEndIter, Iterator &kIter)
 
eC_Bool MoveBefore (Iterator &kIter1, Iterator &kIter2)
 
eC_Bool MoveBefore (Iterator &kStartIter, Iterator &kEndIter, Iterator &kIter)
 
eC_TListDoubleLinked< T > & operator= (const eC_TListDoubleLinked< T > &copy)
 
eC_Bool Remove (const T &tValue)
 
eC_Bool Remove (SafeIterator &kIter)
 
void RemoveAll ()
 
void RemoveAll (const T &tValue)
 
eC_Bool RemoveEnd (T &rtValue)
 
eC_Bool RemoveFront (T &rtValue)
 
void ReverseOrder ()
 
void Sort (eC_Bool bIsQuicksort=true, compare comp=NULL)
 
eC_Bool Swap (Iterator &kIter1, Iterator &kIter2)
 

Friends

class eC_TSafeIterator< T >
 for private access
 

Detailed Description

template<class T>
class eC_TListDoubleLinked< T >

Represents a double linked list template with header and tail node.

The list is not cyclic, i.e. the next element of the last element is NULL and the previous of the front element is NULL.

If the list values were dynamically allocated by the application, it is the application's responsibility to delete those values. This can be done by iterating over the list using the eC_TIterator class and explicitly deleting the values. Use eC_TSafeIterator to delete elements while iterating through the list.

See also
eC_TSafeIterator

Constructor & Destructor Documentation

◆ eC_TListDoubleLinked() [1/2]

Constructor

◆ eC_TListDoubleLinked() [2/2]

template<class T >
eC_TListDoubleLinked< T >::eC_TListDoubleLinked ( const eC_TListDoubleLinked< T > &  copy)

Copy constructor.

Parameters
copyWhere to copy from.

◆ ~eC_TListDoubleLinked()

template<class T >
eC_TListDoubleLinked< T >::~eC_TListDoubleLinked

Destructor

Member Function Documentation

◆ Add()

template<class T >
void eC_TListDoubleLinked< T >::Add ( const T &  tValue)

Adds element at front of list

Parameters
tValueThe value of the node which will be added.

◆ AddAfter()

template<class T >
void eC_TListDoubleLinked< T >::AddAfter ( const T &  tValue2Add,
Iterator kIter 
)

Adds element after the Node.

Parameters
tValue2AddThe value of the node which will be added.
kIterPoint of the node in the list.

◆ AddAtEnd()

template<class T >
void eC_TListDoubleLinked< T >::AddAtEnd ( const T &  tValue)

Adds element at end of list

Parameters
tValueThe value of the node which will be added.

◆ AddBefore()

template<class T >
void eC_TListDoubleLinked< T >::AddBefore ( const T &  tValue2Add,
Iterator kIter 
)

Adds element at front of the Node.

Parameters
tValue2AddThe value of the node which will be added.
kIterPoint of the node in the list.

◆ AddSorted()

template<class T >
void eC_TListDoubleLinked< T >::AddSorted ( const T &  tValue)

Adds element sorted into list. Only works useful if existing elements in list are sorted. This function uses operator== and operator>.

Parameters
tValueThe value of the node which will be added.

◆ AddUnique()

template<class T >
eC_Bool eC_TListDoubleLinked< T >::AddUnique ( const T &  tValue)

Adds element at front of list, if list does not already contain this value. This function uses operator==.

Parameters
tValueThe value of the node which will be added.
Returns
returns True if element was added, False if it was not.

◆ AddUniqueAtEnd()

template<class T >
eC_Bool eC_TListDoubleLinked< T >::AddUniqueAtEnd ( const T &  tValue)

Adds element at end of list, if list does not already contain this value. This function uses operator==.

Parameters
tValueThe value of the node which will be added.
Returns
True if element was added, False if it was not.

◆ AddUniqueSorted()

template<class T >
eC_Bool eC_TListDoubleLinked< T >::AddUniqueSorted ( const T &  tValue)

Adds element sorted into list, if value does not alredy exist in list. Only works useful if existing elements in list are sorted. This function uses operator== and operator>.

Parameters
tValueThe value of the node which will be added.
Returns
returns True if element was added, False if it was not.

◆ Contains()

template<class T >
eC_Bool eC_TListDoubleLinked< T >::Contains ( const T &  tValue) const

Checks if list does contain value of parameter 1 This function uses operator==.

See also
eC_TListDoubleLinked()
Parameters
tValueto be tested for
Returns
True if list does contain value, False if not

◆ Empty()

template<class T >
eC_Bool eC_TListDoubleLinked< T >::Empty

Checks if list is empty

Returns
True if list is empty, False if not

◆ GetAt()

template<class T >
eC_TIterator< T > eC_TListDoubleLinked< T >::GetAt ( eC_UInt  uiPos) const
inline

Returns an iterator pointing to the element at the specified index.

Parameters
uiPosThe position index in the list.
Returns
Iterator pointing to the uiPos-th element. If uiPos is greater than the length of the list, the returned iterator is invalid.

◆ GetAtSafe()

template<class T >
eC_TSafeIterator< T > eC_TListDoubleLinked< T >::GetAtSafe ( eC_UInt  uiPos)
inline

Returns a safe iterator pointing to the element at the specified index.

Parameters
uiPosThe position index in the list.
Returns
Safe iterator pointing to the uiPos-th element. If uiPos is greater than the length of the list, the returned iterator is invalid.

◆ GetBegin()

template<class T >
eC_TIterator< T > eC_TListDoubleLinked< T >::GetBegin ( ) const
inline

Returns an iterator that points to the first element in the list. Example:

myIterator = myList.GetBegin();
Returns
Interator pointing to the first element

◆ GetBeginSafe()

template<class T >
eC_TSafeIterator< T > eC_TListDoubleLinked< T >::GetBeginSafe ( )
inline

Returns a safe iterator that points to the first element in the list.

Returns
SafeInterator pointing to the first element

◆ GetEnd()

template<class T >
eC_TIterator< T > eC_TListDoubleLinked< T >::GetEnd ( ) const
inline

Returns an iterator that points to the last element in the list. Example:

myIterator = myList.GetEnd();
Returns
Interator pointing to the last element

◆ GetEndSafe()

template<class T >
eC_TSafeIterator< T > eC_TListDoubleLinked< T >::GetEndSafe ( )
inline

Returns a safe iterator that points to the last element in the list.

Returns
SafeInterator pointing to the last element

◆ GetFind()

template<class T >
eC_TIterator< T > eC_TListDoubleLinked< T >::GetFind ( const T &  tValue) const
inline

Returns an iterator that points to a specific value in the list. The list is searched for the first occurrence of the value. An iterator pointing to that list node is returned.

Parameters
tValueValue to be found in the list. Example:
myIterator=myList.GetFind(Value);
Returns
An iterator pointing to the first occurrence of tValue in the list.
See also
eC_TSafeIterator, eC_TIterator, GetFindSafe()

◆ GetFindSafe()

template<class T >
eC_TSafeIterator< T > eC_TListDoubleLinked< T >::GetFindSafe ( const T &  tValue)
inline

Returns a safe iterator that points to a specific value in the list. The list is searched for the first occurrence of the value. A safe iterator pointing to that list node is returned.

Parameters
tValueValue to be found in the list. example: myIterator=myList.GetFindSafe(Value);
Returns
A safe iterator pointing to the first occurrence of tValue in the list.
See also
eC_TSafeIterator, eC_TIterator, GetFind()

◆ GetFirst()

template<class T >
eC_Bool eC_TListDoubleLinked< T >::GetFirst ( T &  rtValue) const

With GetFirst and GetNext you can Iterate throug list without using an iterator. GetFirst sets internal pointer to the beginning of the list and returns reference this element.

Parameters
rtValueto pop found element into
Returns
True if list is not empty, False if list is empty

◆ GetNext()

template<class T >
eC_Bool eC_TListDoubleLinked< T >::GetNext ( T &  rtValue) const

With GetFirst and GetNext you can iterate through a list without using an iterator. GetNext sets internal pointer to the next list element and returns reference to this element.

Parameters
rtValueto pop found element into
Returns
True if iterator is not at the end of list, False if pointing behind last element

◆ GetQuantity()

template<class T >
eC_UInt eC_TListDoubleLinked< T >::GetQuantity

Returns number of elements in list.

Returns
eC_Int Number of elements stored in list

◆ IsEmpty()

template<class T >
eC_Bool eC_TListDoubleLinked< T >::IsEmpty

Test if the list contains no elements.

Returns
eC_Bool True if the list contains no elements

◆ MoveAfter() [1/2]

template<class T >
eC_Bool eC_TListDoubleLinked< T >::MoveAfter ( Iterator kIter1,
Iterator kIter2 
)

Move the element pointed by the first iterator after the second iterator

Parameters
kIter1,kIter2iterators for operation
Returns
True if element was moved, False if one iterator was invalid

◆ MoveAfter() [2/2]

template<class T >
eC_Bool eC_TListDoubleLinked< T >::MoveAfter ( Iterator kStartIter,
Iterator kEndIter,
Iterator kIter 
)

Move the elements pointed by the iterators after the second iterator

Parameters
kStartIterstart of range
kEndIterend of range
kIterthe destination iterator
Returns
True if element was moved, False if one iterator was invalid

◆ MoveBefore() [1/2]

template<class T >
eC_Bool eC_TListDoubleLinked< T >::MoveBefore ( Iterator kIter1,
Iterator kIter2 
)

Move the element pointed by the first iterator before the second iterator

Parameters
kIter1,kIter2iterators for operation
Returns
True if element was moved, False if one iterator was invalid

◆ MoveBefore() [2/2]

template<class T >
eC_Bool eC_TListDoubleLinked< T >::MoveBefore ( Iterator kStartIter,
Iterator kEndIter,
Iterator kIter 
)

Move the elements pointed by the iterators before the second iterator

Parameters
kStartIterstart of range
kEndIterend of range
kIterthe destination iterator
Returns
True if element was moved, False if one iterator was invalid

◆ operator=()

template<class T >
eC_TListDoubleLinked< T > & eC_TListDoubleLinked< T >::operator= ( const eC_TListDoubleLinked< T > &  copy)
inline

Copies the contents of another list to this one. After this operation, this->GetQuantity()==copy.GetQuantity().

Parameters
copyThe list to copy from.
Returns
Reference to this list.

◆ Remove() [1/2]

template<class T >
eC_Bool eC_TListDoubleLinked< T >::Remove ( const T &  tValue)

Removes the first element from list, which is identified by value of parameter 1. This function uses or if not set operator==.

Parameters
tValuelist element which should be removed
Returns
True if element was removed, False if element was not found.
See also
void RemoveAll (T tValue)

◆ Remove() [2/2]

template<class T >
eC_Bool eC_TListDoubleLinked< T >::Remove ( SafeIterator kIter)

Removes element which is pointed by SafeIterator.

See also
eC_TSafeIterator. afer removing element iterator is invalid. Anyhow its possible to iterate trough list afer deleting. (Iterator is valid again, after ++,–,operation, or of course if you set it at front or end of list.
Parameters
kIterA SafeIterator pointing to the element to be removed.
Returns
True if element was removed, False if iterator was invalid (0).

◆ RemoveAll() [1/2]

template<class T >
void eC_TListDoubleLinked< T >::RemoveAll

Removes all elements of list.

◆ RemoveAll() [2/2]

template<class T >
void eC_TListDoubleLinked< T >::RemoveAll ( const T &  tValue)

Removes all elements of list wich have the value of parameter1.

Parameters
tValueto be removed

◆ RemoveEnd()

template<class T >
eC_Bool eC_TListDoubleLinked< T >::RemoveEnd ( T &  rtValue)

Removes last element of list.

Parameters
rtValueto pop removed element into
Returns
True if element was removed, False if list was empty

◆ RemoveFront()

template<class T >
eC_Bool eC_TListDoubleLinked< T >::RemoveFront ( T &  rtValue)

Removes first element of list.

Parameters
rtValueto pop removed element into
Returns
True if element was removed, False if list was empty

◆ ReverseOrder()

template<class T >
void eC_TListDoubleLinked< T >::ReverseOrder

Reverses the order of the list. Example: 1-2-3 –> 3-2-1

◆ Sort()

template<class T >
void eC_TListDoubleLinked< T >::Sort ( eC_Bool  bIsQuicksort = true,
compare  comp = NULL 
)

Sorts list in ascending order. It uses the Quicksort algorithm if the boolean variable is true, otherwise the Mergesort algorithm is utilized. Note that Quicksort is an unstable algorithm. On the other hand, Mergesort is a stable algorithm, thus preserving entrance order if the values are equal.

Parameters
bIsQuicksortWhether to use Quicksort
compoptional compare-function This function uses operator== and operator>.

◆ Swap()

template<class T >
eC_Bool eC_TListDoubleLinked< T >::Swap ( Iterator kIter1,
Iterator kIter2 
)

Swappes two elements pointed by iterators or safe iterators.

Parameters
kIter1,kIter2iterators to be swapped
Returns
True if elements where swapped, False if one iterator was invalid

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