List< T > Class Template Reference

Template for lists. More...

#include <List.hpp>

Inheritance diagram for List< T >:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 List ()
 List (int l)
int Reset (int newlength)
int Expand ()
int Delete ()
int GetLength () const
int Length () const
int MaxLength () const
int Append (const T &newDat)
int Prepend (const T &newDat)
int GetElem (T &el) const
int SetElem (const T &el)
int DeleteElem ()
 Deletes the element at the currently set position.
int MoveForw ()
 Moves to next position.
int MoveBack ()
 Moves to prev position.
int GoToHead ()
int GoToTail ()
bool IsIn (const T &el) const
bool GoTo (const T &el)
std::ostream & Print (std::ostream &o) const
std::ostream & PrintBackwards (std::ostream &o) const

Protected Attributes

Array< T > data
Array< int > prev
Array< int > next
int head
int tail
int position
int length
int maxLength

Static Protected Attributes

static const int OUT_OF_RANGE = -1
static const double RESIZE_FACTOR = std::sqrt(2.)

Detailed Description

template<typename T>
class List< T >

Template for lists.

Double linked list, stored in an array. The elements are always stored compact in the first positions could be optimized for speed, but for the current applications this more readable version is OK.

Date:
December 8, 2004
Bug:
No implementation for int SetZero().


Constructor & Destructor Documentation

template<typename T>
List< T >::List (  )  [inline]

template<typename T>
List< T >::List ( int  l  )  [inline]


Member Function Documentation

template<typename T>
int List< T >::Reset ( int  newlength  )  [inline]

template<typename T>
int List< T >::Expand (  )  [inline]

template<typename T>
int List< T >::Delete (  )  [inline]

template<typename T>
int List< T >::GetLength (  )  const [inline]

template<typename T>
int List< T >::Length (  )  const [inline]

template<typename T>
int List< T >::MaxLength (  )  const [inline]

template<typename T>
int List< T >::Append ( const T &  newDat  )  [inline]

template<typename T>
int List< T >::Prepend ( const T &  newDat  )  [inline]

template<typename T>
int List< T >::GetElem ( T &  el  )  const [inline]

template<typename T>
int List< T >::SetElem ( const T &  el  )  [inline]

template<typename T>
int List< T >::DeleteElem (  )  [inline]

Deletes the element at the currently set position.

To avoid "holes" in the array, the element from the end is moved forward.

template<typename T>
int List< T >::MoveForw (  )  [inline]

Moves to next position.

Returns:
0... already at end, 1... otherwise

template<typename T>
int List< T >::MoveBack (  )  [inline]

Moves to prev position.

Returns:
0... already at start, 1... otherwise

template<typename T>
int List< T >::GoToHead (  )  [inline]

template<typename T>
int List< T >::GoToTail (  )  [inline]

template<typename T>
bool List< T >::IsIn ( const T &  el  )  const [inline]

template<typename T>
bool List< T >::GoTo ( const T &  el  )  [inline]

template<typename T>
std::ostream & List< T >::Print ( std::ostream &  o  )  const [inline]

template<typename T>
std::ostream & List< T >::PrintBackwards ( std::ostream &  o  )  const [inline]


Member Data Documentation

template<typename T>
Array<T> List< T >::data [protected]

template<typename T>
Array<int> List< T >::prev [protected]

template<typename T>
Array<int> List< T >::next [protected]

template<typename T>
int List< T >::head [protected]

template<typename T>
int List< T >::tail [protected]

template<typename T>
int List< T >::position [protected]

template<typename T>
int List< T >::length [protected]

template<typename T>
int List< T >::maxLength [protected]

template<typename T>
const int List< T >::OUT_OF_RANGE = -1 [inline, static, protected]

template<typename T>
const double List< T >::RESIZE_FACTOR = std::sqrt(2.) [inline, static, protected]


The documentation for this class was generated from the following file:
Generated on Fri Sep 21 12:34:19 2007 for SG2 by  doxygen 1.5.2