text cover

Data Abstraction and Problem Solving with C++

Walls and Mirrors

by Frank M. Carrano

Addison Wesley Logo

List Class Reference

#include <ListP.h>

List of all members.


Detailed Description

ADT list - Pointer-based implementation.

Definition at line 23 of file ListP.h.

Public Member Functions

 List ()
 List (const List &aList)
 ~List ()
bool isEmpty () const
int getLength () const
void insert (int index, const ListItemType &newItem) throw (ListIndexOutOfRangeException, ListException)
void remove (int index) throw (ListIndexOutOfRangeException)
void retrieve (int index, ListItemType &dataItem) const throw (ListIndexOutOfRangeException)

Private Member Functions

ListNodefind (int index) const

Private Attributes

int size
ListNodehead

Classes

struct  ListNode


Constructor & Destructor Documentation

List::List  ) 
 

Default constructor.

List::List const List aList  ) 
 

Copy constructor.

Parameters:
aList The list to copy.

Definition at line 27 of file ListP.cpp.

References head, List::ListNode::item, and List::ListNode::next.

List::~List  ) 
 

Destructor.

Definition at line 54 of file ListP.cpp.

References isEmpty(), and remove().


Member Function Documentation

bool List::isEmpty  )  const
 

Definition at line 60 of file ListP.cpp.

References size.

Referenced by Stack::isEmpty(), and ~List().

int List::getLength  )  const
 

Definition at line 65 of file ListP.cpp.

References size.

Referenced by find().

void List::insert int  index,
const ListItemType newItem
throw (ListIndexOutOfRangeException, ListException)
 

Definition at line 97 of file ListP.cpp.

References List::ListNode::item, and List::ListNode::next.

void List::remove int  index  )  throw (ListIndexOutOfRangeException)
 

Definition at line 135 of file ListP.cpp.

References List::ListNode::next.

Referenced by Stack::pop(), and ~List().

void List::retrieve int  index,
ListItemType dataItem
const throw (ListIndexOutOfRangeException)
 

Definition at line 83 of file ListP.cpp.

References List::ListNode::item.

List::ListNode * List::find int  index  )  const [private]
 

Locates a specified node in a linked list.

Precondition:
index is the number of the desired node.
Postcondition:
None.
Parameters:
index The index of the node to locate.
Returns:
A pointer to the index-th node. If index < 1 or index > the number of nodes in the list, returns NULL.

Definition at line 70 of file ListP.cpp.

References getLength(), head, and List::ListNode::next.


Member Data Documentation

int List::size [private]
 

Number of items in list.

Definition at line 59 of file ListP.h.

Referenced by getLength(), and isEmpty().

ListNode* List::head [private]
 

Pointer to linked list of items.

Definition at line 61 of file ListP.h.

Referenced by find(), and List().


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

Generated on Sun Aug 27 16:41:19 2006 for AWLogo by  doxygen 1.4.6