Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

CTBbasicListLink Class Template Reference

Linkage in a doubly linked list (no header pointer in element). More...

#include <CTBbasicList.hxx>

Collaboration diagram for CTBbasicListLink:

Collaboration graph
[legend]
List of all members.

Public Methods

 CTBbasicListLink ()
 ~CTBbasicListLink ()
TCPrev () const
TCNext () const
void InsertHead (TC *p_this, CTBbasicListLink< TC > TC::*o_link, CTBbasicListHead< TC > &head)
void InsertTail (TC *p_this, CTBbasicListLink< TC > TC::*o_link, CTBbasicListHead< TC > &head)
void InsertBefore (TC *p_this, CTBbasicListLink< TC > TC::*o_link, CTBbasicListHead< TC > &head, TC &elem)
void InsertAfter (TC *p_this, CTBbasicListLink< TC > TC::*o_link, CTBbasicListHead< TC > &head, TC &elem)
void Remove (CTBbasicListLink< TC > TC::*o_link, CTBbasicListHead< TC > &head)

Private Methods

 CTBbasicListLink (const CTBbasicListLink< TC > &rhs)
CTBbasicListLink< TC > & operator= (const CTBbasicListLink< TC > &rhs)

Private Attributes

TCmp_prev
TCmp_next

Detailed Description

template<class TC>
class CTBbasicListLink< TC >

Linkage in a doubly linked list (no header pointer in element).

The pair of classes CTBbasicListHead<TC> and CTBbasicListLink<TC> allows to implement a doubly linked list of objects of type TC. The class CTBbasicListHead<TC> represents the list head. An object of type CTBbasicListLink<TC> implements the list linkage and must be embedded in class TC as a member.

See Doubly Linked Lists.

The class TC may contain more than one member of type CTBbasicListLink<TC> and can thus simultaneously be part of multiple lists. All list insert and remove operations are controlled by CTBbasicListLink methods.

All the coding examples given with the methods assume a class containing the list header and an element class like

  class hd {
    CTBbasicListHead<el>  m_head;
    ...
  };

  class el {
    CTBbasicListLink<el>  m_link;
    ...
  };

Definition at line 20 of file CTBbasicList.hxx.


Constructor & Destructor Documentation

template<class TC>
CTBbasicListLink< TC >::CTBbasicListLink [inline]
 

Default constructor.

Definition at line 54 of file CTBbasicList.icc.

template<class TC>
CTBbasicListLink< TC >::~CTBbasicListLink [inline]
 

Destructor.

The object must be already unlinked when the destructor is executed. It is the responsibility of the destructor of the object containing the CTBbasicListLink object to call Remove() if necessary.

Definition at line 68 of file CTBbasicList.icc.

template<class TC>
CTBbasicListLink< TC >::CTBbasicListLink const CTBbasicListLink< TC > & rhs [private]
 


Member Function Documentation

template<class TC>
TC * CTBbasicListLink< TC >::Prev const [inline]
 

Returns a pointer to previous list element, or null if first.

Definition at line 77 of file CTBbasicList.icc.

template<class TC>
TC * CTBbasicListLink< TC >::Next const [inline]
 

Returns a pointer to next list element, or null if last.

Definition at line 86 of file CTBbasicList.icc.

template<class TC>
void CTBbasicListLink< TC >::InsertHead TC * p_this,
CTBbasicListLink< TC > TC::* o_link,
CTBbasicListHead< TC > & head
[inline]
 

Insert element at head of list.

The object embedding the CTBbasicListLink object is inserted at the head of the list given by the header head.

p_this must refer to the embedding object. o_link must be the pointer to the CTBbasicListLink member in p_this for which this method is currently called.

InsertHead() is usually called from methods of class TC, typical code looks like

    m_link.InsertHead(this, &el::m_link, ...);

Definition at line 110 of file CTBbasicList.icc.

template<class TC>
void CTBbasicListLink< TC >::InsertTail TC * p_this,
CTBbasicListLink< TC > TC::* o_link,
CTBbasicListHead< TC > & head
[inline]
 

Insert element at tail of list.

see above ...

Definition at line 140 of file CTBbasicList.icc.

template<class TC>
void CTBbasicListLink< TC >::InsertBefore TC * p_this,
CTBbasicListLink< TC > TC::* o_link,
CTBbasicListHead< TC > & head,
TC & elem
[inline]
 

Insert element before list element elem.

The object embedding the CTBbasicListLink object is inserted after the object elem in the list given by the header head.

p_this must refer to the embedding object. o_link must be the pointer to the CTBbasicListLink member in p_this for which this method is currently called.

elem must already be linked into the list head.

Definition at line 177 of file CTBbasicList.icc.

template<class TC>
void CTBbasicListLink< TC >::InsertAfter TC * p_this,
CTBbasicListLink< TC > TC::* o_link,
CTBbasicListHead< TC > & head,
TC & elem
[inline]
 

Insert element after list element elem.

see above ...

Definition at line 211 of file CTBbasicList.icc.

template<class TC>
void CTBbasicListLink< TC >::Remove CTBbasicListLink< TC > TC::* o_link,
CTBbasicListHead< TC > & head
[inline]
 

Remove element.

The object embedding the CTBbasicListLink object is removed from the list given by the header head. The must object must be linked to this list. o_link must be the pointer to the CTBbasicListLink member in the embedding object for which this method is currently called.

Definition at line 248 of file CTBbasicList.icc.

template<class TC>
CTBbasicListLink<TC>& CTBbasicListLink< TC >::operator= const CTBbasicListLink< TC > & rhs [private]
 


Member Data Documentation

template<class TC>
TC* CTBbasicListLink::mp_prev [private]
 

Definition at line 58 of file CTBbasicList.hxx.

template<class TC>
TC* CTBbasicListLink::mp_next [private]
 

Definition at line 59 of file CTBbasicList.hxx.


The documentation for this class was generated from the following files:
Generated at Fri Oct 24 18:13:09 2003 for CTBbase by doxygen1.2.9-20010812 written by Dimitri van Heesch, © 1997-2001