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

CTBsimpleListLink Class Template Reference

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

#include <CTBsimpleList.hxx>

Inheritance diagram for CTBsimpleListLink:

Inheritance graph
[legend]
Collaboration diagram for CTBsimpleListLink:

Collaboration graph
[legend]
List of all members.

Public Methods

 CTBsimpleListLink ()
 ~CTBsimpleListLink ()
CTBsimpleListHead< TC > * Head () const
TCPrev () const
TCNext () const
void InsertHead (TC *p_this, CTBsimpleListLink< TC > TC::*o_link, CTBsimpleListHead< TC > &head)
void InsertTail (TC *p_this, CTBsimpleListLink< TC > TC::*o_link, CTBsimpleListHead< TC > &head)
void InsertBefore (TC *p_this, CTBsimpleListLink< TC > TC::*o_link, TC &elem)
void InsertAfter (TC *p_this, CTBsimpleListLink< TC > TC::*o_link, TC &elem)
void Remove (CTBsimpleListLink< TC > TC::*o_link)
bool operator! () const
 operator bool () const

Private Methods

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

Private Attributes

CTBsimpleListHead< TC > * mp_head
TCmp_prev
TCmp_next

Detailed Description

template<class TC>
class CTBsimpleListLink< TC >

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

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

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

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

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

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

Definition at line 20 of file CTBsimpleList.hxx.


Constructor & Destructor Documentation

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

Default constructor.

Definition at line 51 of file CTBsimpleList.icc.

template<class TC>
CTBsimpleListLink< TC >::~CTBsimpleListLink [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 CTBsimpleListLink object to call Remove() if necessary.

Definition at line 66 of file CTBsimpleList.icc.

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


Member Function Documentation

template<class TC>
CTBsimpleListHead< TC > * CTBsimpleListLink< TC >::Head const [inline]
 

Returns a pointer to list header, or null if not connected.

Definition at line 75 of file CTBsimpleList.icc.

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

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

Definition at line 84 of file CTBsimpleList.icc.

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

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

Definition at line 93 of file CTBsimpleList.icc.

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

Insert element at head of list.

The object embedding the CTBsimpleListLink 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 CTBsimpleListLink 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 117 of file CTBsimpleList.icc.

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

Insert element at tail of list.

see above ...

Definition at line 148 of file CTBsimpleList.icc.

Referenced by CTBcallbackLink::CTBcallbackLink().

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

Insert element before list element elem.

The object embedding the CTBsimpleListLink object is inserted after the object elem, which must be already connected to a list.

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

Definition at line 184 of file CTBsimpleList.icc.

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

Insert element after list element elem.

see above ...

Definition at line 219 of file CTBsimpleList.icc.

template<class TC>
void CTBsimpleListLink< TC >::Remove CTBsimpleListLink< TC > TC::* o_link [inline]
 

Remove element.

The object embedding the CTBsimpleListLink object is removed from the list. The must object must be linked to a list. o_link must be the pointer to the CTBsimpleListLink member in the embedding object for which this method is currently called.

Definition at line 275 of file CTBsimpleList.icc.

Referenced by CTBcallbackLink::UnlinkSource().

template<class TC>
bool CTBsimpleListLink< TC >::operator! const [inline]
 

Returns true if object not connected to a list.

Definition at line 251 of file CTBsimpleList.icc.

template<class TC>
CTBsimpleListLink< TC >::operator bool const [inline]
 

Returns true if object connected to a list.

Definition at line 260 of file CTBsimpleList.icc.

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


Member Data Documentation

template<class TC>
CTBsimpleListHead<TC>* CTBsimpleListLink::mp_head [private]
 

Definition at line 60 of file CTBsimpleList.hxx.

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

Definition at line 61 of file CTBsimpleList.hxx.

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

Definition at line 62 of file CTBsimpleList.hxx.


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