#include <list.h>
Inheritance diagram for ABA_LIST< Type >:
Public Member Functions | |
ABA_LIST (const ABA_GLOBAL *glob) | |
~ABA_LIST () | |
void | appendHead (const Type &elem) |
void | appendTail (const Type &elem) |
int | extractHead (Type &elem) |
int | firstElem (Type &elem) const |
Assign elem the first element as the function extractHead() but does not remove this element from the list. | |
bool | empty () const |
Private Member Functions | |
ABA_LISTITEM< Type > * | first () const |
ABA_LISTITEM< Type > * | last () const |
void | appendHead (ABA_LISTITEM< Type > *item) |
This version of the function appendHead() adds item at the front of the list. | |
void | appendTail (ABA_LISTITEM< Type > *item) |
This version of the function appendTail() adds item at the end of the list. | |
ABA_LIST (const ABA_LIST &rhs) | |
const ABA_LIST< Type > & | operator= (const ABA_LIST< Type > &rhs) |
Private Attributes | |
const ABA_GLOBAL * | glob_ |
ABA_LISTITEM< Type > * | first_ |
ABA_LISTITEM< Type > * | last_ |
Friends | |
class | ABA_LISTITEM< Type > |
ostream & | operator<< (ostream &, const ABA_LIST< Type > &list) |
Definition at line 56 of file list.h.
ABA_LIST< Type >::ABA_LIST | ( | const ABA_GLOBAL * | glob | ) |
The constructor initializes the list with the empty list.
This is done by assigning first_ and last_ to the 0-pointer.
glob | A pointer to the corresponding global object. |
The destructor deallocates the memory of all items in the list.
void ABA_LIST< Type >::appendHead | ( | const Type & | elem | ) |
Adds an element at the front of the list.
elem | The element being appended. |
void ABA_LIST< Type >::appendTail | ( | const Type & | elem | ) |
Adds an element at the end of the list.
elem | The element being appended. |
int ABA_LIST< 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_LIST< Type >::firstElem | ( | Type & | elem | ) | const |
Assign elem the first element as the function extractHead() but does not remove this element from the list.
1 If the list is empty.
elem | If the list is nonemty, the first element is assigned to elem. |
bool ABA_LIST< Type >::empty | ( | ) | const |
false otherwise.
ABA_LISTITEM<Type>* ABA_LIST< Type >::first | ( | ) | const [private] |
Returns a pointer to the first item in the list.
ABA_LISTITEM<Type>* ABA_LIST< Type >::last | ( | ) | const [private] |
Returns a pointer to the last item in the list.
void ABA_LIST< Type >::appendHead | ( | ABA_LISTITEM< Type > * | item | ) | [private] |
This version of the function appendHead() adds item at the front of the list.
void ABA_LIST< Type >::appendTail | ( | ABA_LISTITEM< Type > * | item | ) | [private] |
This version of the function appendTail() adds item at the end of the list.
const ABA_LIST<Type>& ABA_LIST< Type >::operator= | ( | const ABA_LIST< Type > & | rhs | ) | [private] |
friend class ABA_LISTITEM< Type > [friend] |
ostream& operator<< | ( | ostream & | , | |
const ABA_LIST< Type > & | list | |||
) | [friend] |
The output operator writes all items of the list on an output stream.
out | The output stream. | |
list | The list being output. |
const ABA_GLOBAL* ABA_LIST< Type >::glob_ [private] |
ABA_LISTITEM<Type>* ABA_LIST< Type >::first_ [private] |
ABA_LISTITEM<Type>* ABA_LIST< Type >::last_ [private] |