|
Developer Documentation |
|
Centre for Vision, Speech & Signal Processing |
Comments:
The BodyDListC class represents double-linked list of elements
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.
The class serves as a base class for refernce counted double-linked list.
Implementation notes:
The class BaseDListC must be defined as a base class of the class
BodyDListC to make a cast from the head structure to the whole
list structure possible.
Parent Classes:
Derived Classes:
Methods:
- BodyDListC()
-
An empty list.
- BodyDListC(const BodyDListC<DataC> & li)
-
Copy constructor. The physical copy of the list 'li' is created.
- BodyDListC<DataC> Copy() const
-
Create a copy of this list.
- const BodyDListC<DataC> & operator=(const BodyDListC<DataC> & list)
-
An assigment of a list. This list will contain a new copy
of the 'list'. At first the list is emptied. At second
copies of all elements of the 'list' are inserted to this
list.
- const BodyDListC<DataC> & List() const
-
- ~BodyDListC()
-
The destructor of the list, each list element is destroyed.
---------- Status information ---------------------------------
- BooleanT operator==(const BodyDListC<DataC> & list) const
-
Returns TRUE if both lists represent the same list.
- BooleanT operator!=(const BodyDListC<DataC> & list) const
-
Returns TRUE if both lists are independent.
---------- 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 -------------
- BodyDListC<DataC> & InsFirst(const DataC & data)
-
Inserts the new element at the beginning of the list.
Returns the reference to the changed list.
- BodyDListC<DataC> & InsLast(const DataC & data)
-
Inserts the new element at the end of the list.
Returns the pointer to the list.
- BodyDListC<DataC> & DelFirst()
-
Deletes the first element of the list.
Returns the reference to the list.
- BodyDListC<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.
- BodyDListC<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.
- BodyDListC<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.
- BodyDListC<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.
- BodyDListC<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 -----------------------------
- BodyDListC<DataC> & MoveFirst(BodyDListC<DataC> & list)
-
Moves the whole 'list' to the beginning of this list. The 'list'
will be empty after the operation. Returns this list.
- BodyDListC<DataC> & MoveLast(BodyDListC<DataC> & list)
-
Moves the whole 'list' to the end of this list. The 'list'
will be empty after the operation. Returns this list.
- const BodyDListC<DataC> & operator+=(const BodyDListC<DataC> & list)
-
Concatenation. The operator adds the copy of the 'list to the end
of this list.
Returns this list.
- BodyDListC<DataC> & Reverse()
-
Reverses the list. Returns the list.
- BodyDListC<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'.
- BodyDListC<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.
- BodyDListC<DataC> & Empty()
-
All elements of the list will be destroyed.
- void MergeSort(ScopePath (*)(FuncArgList) LessOrEqual)
-
Sorts the list according to order defined by the function 'LessOrEqual'.
- void BubbleSort(ScopePath (*)(FuncArgList) LessOrEqual)
-
Sorts the list according to order defined by
the function 'LessOrEqual'. NOT READY !!!
- BodyDListC(int,BaseBodyConstDLIterC<DataC> & ptr)
-
Constructor. The tail list is passed.
- BodyDListC(BaseBodyConstDLIterC<DataC> & ptr,int)
-
Constructor. The head list is passed.
- void SetCopy(const BodyDListC<DataC> & list)
-
Copies all elements from the 'list' into this list.
- const DataC & Data(const DChainC & elm) const
-
Casts the link 'elm' to the structure containing data and returns
the data.
- DataC & Data(DChainC & elm)
-
Casts the link 'elm' to the structure containing data and returns
the data.
- ostream & operator<<(ostream & s,const BodyDListC<DataC> & list)
-
- BaseDListC Copy() const
-
Create a copy of this list.
- const BaseDListC & operator=(const BaseDListC & list)
-
- ListSizeT Size() const
-
Returns the length of a list. It does not check the counter overflow.
- BooleanT operator==(const BaseDListC & list) const
-
Returns TRUE if both lists represent the same list.
- BooleanT operator!=(const BaseDListC & list) const
-
Returns TRUE if both lists are independent.
- BooleanT IsEmpty() const
-
Returns TRUE if the list is empty.
Access to the elements
----------------------
- const DChainC & First() const
-
Returns the first element of the constant list.
- DChainC & First()
-
Returns the first element of the list.
- const DChainC & Last() const
-
Returns the last element of the constant list.
- DChainC & Last()
-
Returns the last element of the constant list.
- const DChainC & operator[](ListIndexT i) const
-
Returns the (i+1)-th element of the constant list. The first element has
index 0.
- DChainC & operator[](ListIndexT i)
-
Returns the (i+1)-th element of the list. The first element has
index 0.
Elementary changes in the list
------------------------------
- BaseDListC & LinkFirst(DChainC * elm)
-
Links in the new element at the beginning of the list.
Returns the reference to the changed list.
- BaseDListC & LinkLast(DChainC * elm)
-
Links in the new element at the end of the list.
Returns the pointer to the list.
- DChainC * UnlinkFirst()
-
Removes the first element from the list.
Returns that removed element.
- DChainC * UnlinkLast()
-
Removes the last element from the list.
Returns that removed element.
- BaseDListC & MakeFirst(DChainC & elm)
-
Moves the head of the list to be the predeccessor of the element 'elm'.
The element 'elm' must belong to this list.
Returns the reference to the list.
- BaseDListC & MakeLast(DChainC & elm)
-
Moves the head of the list to be the successor of the element 'elm'.
The element 'elm' must belong to this list.
Returns the reference to the list.
- BaseDListC & MoveFirst(DChainC & elm)
-
Moves the list element 'elm' 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.
- BaseDListC & MoveLast(DChainC & elm)
-
Moves the list element, which 'elm' 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.
- BaseDListC & MakeFirst(BaseConstDLIterC & elm)
-
Moves the head of the list to be the predeccessor of the element 'elm'.
The element 'elm' must belong to this list.
Returns the reference to the list.
- BaseDListC & MakeLast(BaseConstDLIterC & elm)
-
Moves the head of the list to be the successor of the element 'elm'.
The element 'elm' must belong to this list.
Returns the reference to the list.
- BaseDListC & MoveFirst(BaseConstDLIterC & elm)
-
Moves the list element 'elm' 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.
- BaseDListC & MoveLast(BaseConstDLIterC & elm)
-
Moves the list element, which 'elm' 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
------------------------
- BaseDListC & MoveFirst(BaseDListC & list)
-
Moves the whole 'list' to the beginning of this list. The 'list'
will be empty after the operation. Returns this list.
- BaseDListC & MoveLast(BaseDListC & list)
-
Moves the whole 'list' to the end of this list. The 'list'
will be empty after the operation. Returns this list.
- const BaseDListC & operator+=(BaseDListC & list)
-
Concatenation. The operator moves the whole 'list to the end
of this list. The 'list' will be empty after the operation.
Returns this list.
- BaseDListC & Reverse()
-
Reverses the list. Returns the list.
- BaseDListC Tail(DChainC & elm)
-
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 'elm'.
- BaseDListC Head(DChainC & elm)
-
Splits the list into two parts. This list will contain the second part
of the original list including the element 'elm'.
The function returns the list containing the beginning of the original
list.
- BaseDListC Tail(BaseConstDLIterC & elm)
-
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 'elm'.
- BaseDListC Head(BaseConstDLIterC & elm)
-
Splits the list into two parts. This list will contain the second part
of the original list including the element 'elm'.
The function returns the list containing the beginning of the original
list.
- void ConsistencyCheck(ListSizeT 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.
- BaseConstDLIterC Iter() const
-
Creates an iterator of the list. The iterator will point to the
first element if there is any.
- const DChainC * ListHead() const
-
Returns the pointer to the head of the list.
The function is used to avoid bugs in GNU C++ 2.4.5.
- BaseDListC & Empty()
-
All elements are deleted from the list.
- ostream & operator<<(ostream & s,const BaseDListC & list)
-
|
Programmer:Radek Marik, Documentation by CxxDoc: Tue Mar 20 10:49:27 2001
|