ABA_DLIST< Type > Class Template Reference

class ABA_DLIST implements a doubly linked linear list. The list is implemented by a doubly linked list of ABA_DLISTITEMs. More...

#include <dlist.h>

Inheritance diagram for ABA_DLIST< Type >:

ABA_ABACUSROOT List of all members.

Public Member Functions

 ABA_DLIST (ABA_GLOBAL *glob)
 ~ABA_DLIST ()
void append (const Type &elem)
int extractHead (Type &elem)
int removeHead ()
 If the list is non-empty, the function removeHead() removes the head of the list.
void remove (const Type &elem)
void remove (ABA_DLISTITEM< Type > *item)
 This version of the function remove() scans the list for an item with element elem beginning at the first element of the list.
ABA_DLISTITEM< Type > * first () const
ABA_DLISTITEM< Type > * last () const
bool empty () const
int firstElem (Type &elem) const

Private Member Functions

 ABA_DLIST (const ABA_DLIST &rhs)
const ABA_DLIST< Type > & operator= (const ABA_DLIST< Type > &rhs)

Private Attributes

ABA_GLOBALglob_
ABA_DLISTITEM< Type > * first_
ABA_DLISTITEM< Type > * last_

Friends

ostream & operator<< (ostream &, const ABA_DLIST< Type > &list)

Detailed Description

template<class Type>
class ABA_DLIST< Type >

class ABA_DLIST implements a doubly linked linear list. The list is implemented by a doubly linked list of ABA_DLISTITEMs.

Definition at line 62 of file dlist.h.


Constructor & Destructor Documentation

template<class Type>
ABA_DLIST< Type >::ABA_DLIST ( ABA_GLOBAL glob  ) 

The constructor for an empty list.

Parameters:
glob A pointer to the corresponding global object.

template<class Type>
ABA_DLIST< Type >::~ABA_DLIST (  ) 

The destructor deallocates the memory of all items in the list.

template<class Type>
ABA_DLIST< Type >::ABA_DLIST ( const ABA_DLIST< Type > &  rhs  )  [private]


Member Function Documentation

template<class Type>
void ABA_DLIST< Type >::append ( const Type &  elem  ) 

Adds an element at the end of the list.

Parameters:
elem The element being appended.

template<class Type>
int ABA_DLIST< Type >::extractHead ( Type &  elem  ) 

Assigns to elem the first element in the list and removes it from the list.

Returns:
0 If the operation can be executed successfully.

1 If the list is empty.

Parameters:
elem If the list is nonemty, the first element is assigned to elem.

template<class Type>
int ABA_DLIST< Type >::removeHead (  ) 

If the list is non-empty, the function removeHead() removes the head of the list.

Returns:
0 If the list is non-empty before the function is called,

1 otherwise.

template<class Type>
void ABA_DLIST< Type >::remove ( const Type &  elem  ) 

The function remove() removes item from the list.

template<class Type>
void ABA_DLIST< Type >::remove ( ABA_DLISTITEM< Type > *  item  ) 

This version of the function remove() scans the list for an item with element elem beginning at the first element of the list.

The first matching item is removed from the list.

Parameters:
elem The element which should be removed.

template<class Type>
ABA_DLISTITEM<Type>* ABA_DLIST< Type >::first (  )  const

Returns a pointer to the first item of the list.

template<class Type>
ABA_DLISTITEM<Type>* ABA_DLIST< Type >::last (  )  const

Returns a pointer to the last item of the list.

template<class Type>
bool ABA_DLIST< Type >::empty (  )  const

Returns:
true If no element is contained in the list,

false otherwise.

template<class Type>
int ABA_DLIST< Type >::firstElem ( Type &  elem  )  const

Retrieves the first element of the list.

Returns:
0 If the list is not empty,

1 otherwise.

Parameters:
elem Stores the first element of the list after the function call if the list is not empty.

template<class Type>
const ABA_DLIST<Type>& ABA_DLIST< Type >::operator= ( const ABA_DLIST< Type > &  rhs  )  [private]


Friends And Related Function Documentation

template<class Type>
ostream& operator<< ( ostream &  ,
const ABA_DLIST< Type > &  list 
) [friend]

The output operator writes all elements of the list on an output stream.

Returns:
A reference to the output stream.
Parameters:
out The output stream.
list The list being output.


Member Data Documentation

template<class Type>
ABA_GLOBAL* ABA_DLIST< Type >::glob_ [private]

A pointer to corresponding global object.

Definition at line 162 of file dlist.h.

template<class Type>
ABA_DLISTITEM<Type>* ABA_DLIST< Type >::first_ [private]

A pointer to the first item of the list.

Definition at line 166 of file dlist.h.

template<class Type>
ABA_DLISTITEM<Type>* ABA_DLIST< Type >::last_ [private]

A pointer to the last item in the list.

Definition at line 170 of file dlist.h.


The documentation for this class was generated from the following file:
Generated on Tue Aug 14 18:09:56 2007 for ABACUS by  doxygen 1.5.1