Developer Documentation
Centre for Vision, Speech & Signal Processing
USER IN NAMESPACE AMMA TREE ROOT AMMA SEARCH AMMA HOME
 

  PUBLIC
DListC::DListC(void)
DListC::DListC(const DListC &)
DListC::Copy(void) const
DListC::operator=(const DListC &)
DListC::Body(void)
DListC::~DListC(void)
DListC::Tail(BaseBodyConstDLIterC &)
DListC::Head(BaseBodyConstDLIterC &)
DListC::Size(void) const
DListC::operator==(const DListC &) const
DListC::operator!=(const DListC &) const
DListC::IsEmpty(void) const
DListC::ConsistencyCheck(LongIntT) const
DListC::First(void) const
DListC::First(void)
DListC::Last(void) const
DListC::Last(void)
DListC::operator[](IndexT) const
DListC::operator[](IndexT)
DListC::InsFirst(const DataC &)
DListC::InsLast(const DataC &)
DListC::DelFirst(void)
DListC::DelLast(void)
DListC::GetFirst(void)
DListC::GetLast(void)
DListC::MakeFirst(BaseBodyConstDLIterC &)
DListC::MakeLast(BaseBodyConstDLIterC &)
DListC::MoveFirst(BaseBodyConstDLIterC &)
DListC::MoveLast(BaseBodyConstDLIterC &)
DListC::MoveFirst(DListC &)
DListC::MoveLast(DListC &)
DListC::operator+=(const DListC &)
DListC::operator+=(const DataC &)
DListC::Reverse(void)
DListC::Empty(void)
DListC::LessOrEqualDefault(const DataC &,const DataC &)
DListC::MergeSort(DListC::LessOrEqualFuncT)
DListC::BubbleSort(DListC::LessOrEqualFuncT)
DListC::Hash(void) const
DListC::DListC(RefBodyDListC *)
DListC<class DataC>
 
The DListC class represents double-linked list of elements
 
include "amma/DList.hh"
User Level:Default
Library:Mlist
Example:exDList.cc
Section:Containers.Lists
In Scope:std

Comments:
The list contains a head element and a chain of elements. Empty list contains just its head element. Because of efficiency references to elements of a list are not checked if they are proper elements of a list or its head. Checking can be switched on by the macro CHECK. The class serves as a base class for reference counted double-linked list.

To iterate through a list efficiently, you need to use on of the list iterator classes DLIterC or ConstDLIterC.

Implementation notes: The class BaseDListC must be defined as a base class of the class DListC to make a cast from the head structure to the whole list structure possible.

Derived Classes: Typedefs:
typedef DataC ElementT;
Allow function templates access to data type.

typedef DLIterC<DataC> IteratorT;
Interator for this container.

typedef ScopePath (*)(FuncArgList) LessOrEqualFuncT;

Variables:
RefBodyDListC * body;
handle to the body of the list

Methods:
DListC()
An empty list.

DListC(const DListC<DataC> & li)
Copy constructor.
The new handle of the list is created. !!!!!! BE CAREFUL. The proper solution would be 2 classes: one of constant list and another of non-constant list. In fact, this constructor with 'const' parameter breaks the whole structure of keeping constant lists.

DListC<DataC> Copy() const
Create a copy of this list.

const DListC<DataC> & operator=(const DListC<DataC> & l)
Both this list and the list 'l' will be the same list.
The old list will be emptied if there is no other references to it.

BodyDListC<DataC> & Body()

~DListC()
The destructor of the list, each list element is destroyed.
Constructors of derived lists -----------------------------

DListC<DataC> Tail(BaseBodyConstDLIterC<DataC> & ptr)
Splits the list into two parts.
This list will contain the beginning of the original list. The function returns the second part of the original list including the element 'ptr'.

DListC<DataC> Head(BaseBodyConstDLIterC<DataC> & ptr)
Splits the list into two parts.
This list will contain the second part of the original list including the element 'ptr'. The function returns the list containing the beginning of the original list. Status functions ----------------

BaseDListC::ListSizeT Size() const
Returns the length of a list. It does not check the counter overflow.

BooleanT operator==(const DListC<DataC> & list) const
Returns TRUE if both lists represent the same list.

BooleanT operator!=(const DListC<DataC> & list) const
Returns TRUE if both lists are independent.

BooleanT IsEmpty() const
Returns TRUE if the list is empty.

void ConsistencyCheck(LongIntT stopSize = 30000) const
Checks the list if all links are valid.
If the counter of elements during the checking overflows the number 'stopSize', the function exits with error. Access to the elements ----------------------

const DataC & First() const
Returns the first element of the constant list.

DataC & First()
Returns the first element of the list.

const DataC & Last() const
Returns the last element of the constant list.

DataC & Last()
Returns the last element of the constant list.

const DataC & operator[](IndexT i) const
Returns the i-th element of the constant list.
The first element has the index 0.

DataC & operator[](IndexT i)
Returns the i-th element of the list.
The first element has the index 0. Elementary changes in the list ------------------------------

DListC<DataC> & InsFirst(const DataC & data)
Inserts the new element at the beginning of the list.
Returns the reference to the changed list.

DListC<DataC> & InsLast(const DataC & data)
Inserts the new element at the end of the list.
Returns the pointer to the list.

DListC<DataC> & DelFirst()
Deletes the first element of the list.
Returns the reference to the list.

DListC<DataC> & DelLast()
Deletes the last element of the list.
Returns the reference to the list.

DataC GetFirst()
Removes the first element from the list.
Returns that removed element.

DataC GetLast()
Removes the last element from the list.
Returns that removed element.

DListC<DataC> & MakeFirst(BaseBodyConstDLIterC<DataC> & ptr)
Moves the head of the list to be the predeccessor of the element pointed to be 'ptr'.
The iterator 'ptr' must belong to this list. Returns the reference to the list.

DListC<DataC> & MakeLast(BaseBodyConstDLIterC<DataC> & ptr)
Moves the head of the list to be the successor of the element pointed to by 'ptr'.
The iterator 'ptr' must belong to this list. Returns the reference to the list.

DListC<DataC> & MoveFirst(BaseBodyConstDLIterC<DataC> & ptr)
Moves the list element pointed to by 'ptr' into the list as the first element.
The pointed list element need not to be the element of this list, but it cannot be the head of any list. Returns this list.

DListC<DataC> & MoveLast(BaseBodyConstDLIterC<DataC> & ptr)
Moves the list element, which 'ptr' points to, into the list as the last element.
The pointed list element need not to be the element of this list, but it cannot be the head of any list. Returns this list. Transformations of lists ------------------------

DListC<DataC> & MoveFirst(DListC<DataC> & list)
Moves the whole 'list' to the beginning of this list.
The 'list' will be empty after the operation. Returns this list.

DListC<DataC> & MoveLast(DListC<DataC> & list)
Moves the whole 'list' to the end of this list.
The 'list' will be empty after the operation. Returns this list.

const DListC<DataC> & operator+=(const DListC<DataC> & list)
Concatenation.
The operator moves the whole 'list to the end of this list. The 'list' will be EMPTY after the operation.

The arg is only constant so that 'list' may be a tempory without causing warnings.

Returns this list.


const DListC<DataC> & operator+=(const DataC & list)
Concatenation an element.
This is just an alias for InsLast(). Returns this list.

DListC<DataC> & Reverse()
Reverses the list. Returns the list.

DListC<DataC> & Empty()
All elements of the list will be destroyed.

int LessOrEqualDefault(const DataC & el1,const DataC & el2)

void MergeSort(DListC<DataC>::LessOrEqualFuncT func)
Sorts the list according to order defined by the comparing function 'LessOrEqual'.
The default function uses the > operator of the class to do the sort. If no such operator exists one will be created that prints an error message then aborts the code.

void BubbleSort(DListC<DataC>::LessOrEqualFuncT func)
Sorts the list according to order defined by the comparing function 'LessOrEqual'.
The default function uses the > operator of the class to do the sort. If no such operator exists one will be created that prints an error message then aborts the code.

UIntT Hash() const
Get a hash value unique to this list.
it does not depend in anyway on the contents of the list.

DListC(RefBodyDListC<DataC> * list)
Creates a handle to the body of the list.


Programmer:Radek Marik, Documentation by CxxDoc: Tue Mar 20 10:49:27 2001