#include <dlist.h>
Inheritance diagram for ABA_DLIST< Type >:
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_GLOBAL * | glob_ |
ABA_DLISTITEM< Type > * | first_ |
ABA_DLISTITEM< Type > * | last_ |
Friends | |
ostream & | operator<< (ostream &, const ABA_DLIST< Type > &list) |
Definition at line 62 of file dlist.h.
ABA_DLIST< Type >::ABA_DLIST | ( | ABA_GLOBAL * | glob | ) |
The constructor for an empty list.
glob | A pointer to the corresponding global object. |
The destructor deallocates the memory of all items in the list.
void ABA_DLIST< Type >::append | ( | const Type & | elem | ) |
Adds an element at the end of the list.
elem | The element being appended. |
int ABA_DLIST< Type >::extractHead | ( | Type & | elem | ) |
Assigns to elem the first element in the list and removes it from the list.
1 If the list is empty.
elem | If the list is nonemty, the first element is assigned to elem. |
int ABA_DLIST< Type >::removeHead | ( | ) |
If the list is non-empty, the function removeHead() removes the head of the list.
1 otherwise.
void ABA_DLIST< Type >::remove | ( | const Type & | elem | ) |
The function remove() removes item from the list.
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.
elem | The element which should be removed. |
ABA_DLISTITEM<Type>* ABA_DLIST< Type >::first | ( | ) | const |
Returns a pointer to the first item of the list.
ABA_DLISTITEM<Type>* ABA_DLIST< Type >::last | ( | ) | const |
Returns a pointer to the last item of the list.
bool ABA_DLIST< Type >::empty | ( | ) | const |
false otherwise.
int ABA_DLIST< Type >::firstElem | ( | Type & | elem | ) | const |
Retrieves the first element of the list.
1 otherwise.
elem | Stores the first element of the list after the function call if the list is not empty. |
const ABA_DLIST<Type>& ABA_DLIST< Type >::operator= | ( | const ABA_DLIST< Type > & | rhs | ) | [private] |
ostream& operator<< | ( | ostream & | , | |
const ABA_DLIST< Type > & | list | |||
) | [friend] |
The output operator writes all elements of the list on an output stream.
out | The output stream. | |
list | The list being output. |
ABA_GLOBAL* ABA_DLIST< Type >::glob_ [private] |
ABA_DLISTITEM<Type>* ABA_DLIST< Type >::first_ [private] |
ABA_DLISTITEM<Type>* ABA_DLIST< Type >::last_ [private] |