Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# List< T > Class Template Reference

The class implements double linked lists for arbitrary data types. More...

`#include <List.h>`

Collaboration diagram for List< T >:

[legend]
List of all members.

## Public Member Functions
void | clear ()
| The functions empties the list.
| List ()
| Constructor of an empty list.
List & | operator= (const List &l)
| The operator copies another list into this list.
| List (const List &l)
| Copy constuctor.
| ~List ()
| Destructor.
Pos | getFirst () const
| The function returns an iterator pointing to the first element of the list.
Pos | getLast () const
| The function returns an iterator pointing to the last element of the list.
const T & | operator[] (Pos p) const
| The operator implements read-only access to individual elements of the list.
T & | operator[] (Pos p)
| The operator implements read/write access to individual elements of the list.
List< T > & | operator+= (const List< T > &l)
| The operator concatenates another list to this list.
List< T > | operator+ (const List< T > &l) const
| The operator concatenates two lists.
int | getSize () const
| The function returns the number of elements in the list.
Pos | insert (T *t, Pos p=Pos())
| Wrong description, the new entry is not inserted AFTER, but BEFORE the iterator p.
Pos | insert (const T &t, Pos p=Pos())
| The function inserts a new element into the list.
Pos | insertAfter (T *t, Pos p=Pos())
| The function inserts a new element into the list.
Pos | insertAfter (const T &t, Pos p=Pos())
| The function inserts a new element into the list.
void | remove (Pos &p)
| The function removes an element from the list.
## Private Attributes
Data * | first
| A pointer to the first list node.
Data * | last
| A pointer to the last list node.
int | size
| The number of entries in the list.

## Detailed Description

### template<class T>
class List< T >

The class implements double linked lists for arbitrary data types.

Definition at line 27 of file List.h.

## Constructor & Destructor Documentation

template<class T>
List< T >::List | ( |  | ) | `[inline]`

| Constructor of an empty list. Definition at line 141 of file List.h.

template<class T>
List< T >::List | ( | const List< T > & | l | ) | `[inline]`

  | Copy constuctor. Parameters:
  l | The list from which this list will be copied.
Definition at line 165 of file List.h.

template<class T>
List< T >::~List | ( |  | ) | `[inline]`

| Destructor. All list elements are destructed. Definition at line 171 of file List.h.

## Member Function Documentation

template<class T>
void List< T >::clear | ( |  | ) | `[inline]`

| The functions empties the list. All list elements are destructed. Definition at line 131 of file List.h. Referenced by List< ImageViewBase * >::operator=(), operator>>(), and List< ImageViewBase * >::~List().

template<class T>
List& List< T >::operator= | ( | const List< T > & | l | ) | `[inline]`

  | The operator copies another list into this list. The previous entries in this list are destroyed. Parameters:
  l | The other list.
Returns: A reference to this list after the operation took place. Definition at line 149 of file List.h.

template<class T>
Pos List< T >::getFirst | ( |  | ) | const`[inline]`

| The function returns an iterator pointing to the first element of the list. Returns: The iterator. Definition at line 177 of file List.h. Referenced by List< ImageViewBase * >::clear(), List< ImageViewBase * >::operator+=(), and List< ImageViewBase * >::operator=().

template<class T>
Pos List< T >::getLast | ( |  | ) | const`[inline]`

| The function returns an iterator pointing to the last element of the list. Returns: The iterator. Definition at line 183 of file List.h.

template<class T>
const T& List< T >::operator[] | ( | Pos | p | ) | const`[inline]`

  | The operator implements read-only access to individual elements of the list. Parameters:
  p | The iterator pointing to the element to be accessed.
Returns: A reference to the selected list element. Definition at line 190 of file List.h.

template<class T>
T& List< T >::operator[] | ( | Pos | p | ) | `[inline]`

  | The operator implements read/write access to individual elements of the list. Parameters:
  p | The iterator pointing to the element to be accessed.
Returns: A reference to the selected list element. Definition at line 197 of file List.h.

template<class T>
List<T>& List< T >::operator+= | ( | const List< T > & | l | ) | `[inline]`

  | The operator concatenates another list to this list. Parameters:
  l | The other list.
Returns: A reference to this list after the operation took place. Definition at line 204 of file List.h.

template<class T>
List<T> List< T >::operator+ | ( | const List< T > & | l | ) | const`[inline]`

  | The operator concatenates two lists. Parameters:
  l | The other list.
Returns: The concatenation of this list and the other list. Definition at line 216 of file List.h.

template<class T>
int List< T >::getSize | ( |  | ) | const`[inline]`

| The function returns the number of elements in the list. Returns: The length of the list. Definition at line 222 of file List.h.

template<class T>
Pos List< T >::insert | ( | T * | t,
|  | Pos | p = Pos()
| ) | `[inline]`

| Wrong description, the new entry is not inserted AFTER, but BEFORE the iterator p. Definition at line 236 of file List.h. Referenced by List< ImageViewBase * >::insert(), List< ImageViewBase * >::operator+=(), List< ImageViewBase * >::operator=(), and operator>>().

template<class T>
Pos List< T >::insert | ( | const T & | t,
|  | Pos | p = Pos()
| ) | `[inline]`

  | The function inserts a new element into the list. Parameters:
  t | The new element. A copy will be inserted into the list. Therefore, the class of the element must provide a copy constuctor.
  p | An iterator pointing to the element after which the new one is inserted. If the operator points nowhere, the element will be appended to the list. This is also the default case.
Returns: An iterator pointing to the new list element. Definition at line 278 of file List.h.

template<class T>
Pos List< T >::insertAfter | ( | T * | t,
|  | Pos | p = Pos()
| ) | `[inline]`

  | The function inserts a new element into the list. Parameters:
  t | The new element. It will not be copied, and it will be destructed when it is removed from the list.
  p | An iterator pointing to the element after which the new one is inserted. If the operator points nowhere, the element will be appended to the list. This is also the default case.
Returns: An iterator pointing to the new list element. UNTESTED Definition at line 291 of file List.h. Referenced by List< ImageViewBase * >::insertAfter().

template<class T>
Pos List< T >::insertAfter | ( | const T & | t,
|  | Pos | p = Pos()
| ) | `[inline]`

  | The function inserts a new element into the list. Parameters:
  t | The new element. A copy will be inserted into the list. Therefore, the class of the element must provide a copy constuctor.
  p | An iterator pointing to the element after which the new one is inserted. If the operator points nowhere, the element will be appended to the list. This is also the default case.
Returns: An iterator pointing to the new list element. Definition at line 333 of file List.h.

template<class T>
void List< T >::remove | ( | Pos & | p | ) | `[inline]`

  | The function removes an element from the list. The element will be destructed. Parameters:
  p | An iterator pointing to the element that shall be removed.
Definition at line 340 of file List.h. Referenced by List< ImageViewBase * >::clear().

## Member Data Documentation

template<class T>
Data* List< T >::first`[private]`

| A pointer to the first list node. Definition at line 40 of file List.h.

template<class T>
Data* List< T >::last`[private]`

| A pointer to the last list node. Definition at line 41 of file List.h.

template<class T>
int List< T >::size`[private]`

| The number of entries in the list. Definition at line 42 of file List.h.

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

- Tools/List.h