Main Page   Compound List   File List   Compound Members  

List< T > Class Template Reference

#include <list.h>

List of all members.

Public Member Functions

 List ()
 ~List ()
void clear ()
bool empty () const
void push_back (const T &) throw ( bad_alloc )
void push_front (const T &) throw ( bad_alloc )
pop_front () throw ( ListEmpty )
pop_back () throw ( ListEmpty )
getFront () const throw ( ListEmpty )
getCurrent () const throw ( ListEmpty )
getBack () const throw ( ListEmpty )
void insertBeforeCurrent (const T &) throw ( ListEmpty, bad_alloc )
void insertAfterCurrent (const T &) throw ( ListEmpty, bad_alloc )
removeCurrent () throw ( ListEmpty )
void setToFront () throw ( ListEmpty )
void setToBack () throw ( ListEmpty )
void moveForward () throw ( ListEmpty )
void moveBackward () throw ( ListEmpty )
bool atFront () const throw ( ListEmpty )
bool atBack () const throw ( ListEmpty )


Detailed Description

template<typename T>
class List< T >

Implementation of a List ADT using a doubly-linked list.

Author:
Mark Maloof

Version:
1.0 3/1/04


Constructor & Destructor Documentation

template<typename T>
List< T >::List  ) 
 

Default class constructor.

template<typename T>
List< T >::~List  ) 
 

Class destructor.


Member Function Documentation

template<typename T>
bool List< T >::atBack  )  const throw ( ListEmpty )
 

Returns true if current is at the back of the list; Returns false otherwise.

Returns:
true if at the back of the list; false otherwise.
Exceptions:
ListEmpty if the list is empty.

template<typename T>
bool List< T >::atFront  )  const throw ( ListEmpty )
 

Returns true if current is at the front of the list; Returns false otherwise.

Returns:
true if at the front of the list; false otherwise.
Exceptions:
ListEmpty if the list is empty.

template<typename T>
void List< T >::clear  ) 
 

Removes the elements in the list.

template<typename T>
bool List< T >::empty  )  const
 

Returns true if the list is empty.; return false otherwise.

Returns:
true if empty; false otherwise.

template<typename T>
T List< T >::getBack  )  const throw ( ListEmpty )
 

Gets, but does not remove, the object at the back of the list. Current is left unchanged.

Returns:
the object at the back of the list.
Exceptions:
ListEmpty if the list is empty.

template<typename T>
T List< T >::getCurrent  )  const throw ( ListEmpty )
 

Gets, but does not remove, the object pointed to by current.

Returns:
the object pointed to by current.
Exceptions:
ListEmpty if the list is empty.

template<typename T>
T List< T >::getFront  )  const throw ( ListEmpty )
 

Gets, but does not remove, the object at the front of the list. Current is left unchanged.

Returns:
the object at the front of the list.
Exceptions:
ListEmpty if the list is empty.

template<typename T>
void List< T >::insertAfterCurrent const T &  object  )  throw ( ListEmpty, bad_alloc )
 

Inserts the object after the node pointed to by current. Sets current to point to the new node.

Parameters:
object the object to be inserted after the current node.
Exceptions:
bad_alloc if memory cannot be allocated.
ListEmpty if the list is empty.

template<typename T>
void List< T >::insertBeforeCurrent const T &  object  )  throw ( ListEmpty, bad_alloc )
 

Inserts the object before the node pointed to by current. Sets current to point to the new node.

Parameters:
object the object to be inserted before the current node.
Exceptions:
bad_alloc if memory cannot be allocated.
ListEmpty if the list is empty.

template<typename T>
void List< T >::moveBackward  )  throw ( ListEmpty )
 

Move current to the previous node in the list. If current points to the front of the list, then current is left unchanged.

Exceptions:
ListEmpty if the list is empty.

template<typename T>
void List< T >::moveForward  )  throw ( ListEmpty )
 

Moves current to the next node in the list. If current points to the end of the list, then current is left unchanged.

Exceptions:
ListEmpty if the list is empty.

template<typename T>
T List< T >::pop_back  )  throw ( ListEmpty )
 

Removes and returns the object at the back of the list. If current points to the back of the list, then sets current to point to the new back of the list. Otherwise, current is left unchanged.

Returns:
the object at the back of the list.
Exceptions:
ListEmpty if the list is empty.

template<typename T>
T List< T >::pop_front  )  throw ( ListEmpty )
 

Removes and returns the object at the front of the list. If current points to the front of the list, then sets current to point to the new front of the list. Otherwise, current is left unchanged.

Returns:
the object at the front of the list.
Exceptions:
ListEmpty if the list is empty.

template<typename T>
void List< T >::push_back const T &  object  )  throw ( bad_alloc )
 

Adds the object to the back of the list. After adding, sets current to the new node.

Parameters:
object the object to be added to the back of the list.
Exceptions:
bad_alloc if memory cannot be allocated.

template<typename T>
void List< T >::push_front const T &  object  )  throw ( bad_alloc )
 

Adds the object to the front of the list. After adding, sets current to the new node.

Parameters:
object the object to be added to the front of the list.
Exceptions:
bad_alloc if memory cannot be allocated.

template<typename T>
T List< T >::removeCurrent  )  throw ( ListEmpty )
 

Removes and returns the object in the node pointed to by current. Sets current to the next node, if possible. Otherwise, it sets current to the previous node.

Returns:
the object in the current node.
Exceptions:
ListEmpty if the list is empty.

template<typename T>
void List< T >::setToBack  )  throw ( ListEmpty )
 

Sets current to the last node in the list.

Exceptions:
ListEmpty if the list is empty.

template<typename T>
void List< T >::setToFront  )  throw ( ListEmpty )
 

Sets current to the first node in the list.

Exceptions:
ListEmpty if the list is empty.


The documentation for this class was generated from the following file:
Generated on Mon Feb 23 14:19:06 2004 by doxygen1.3