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

CTBtreeListLink Class Template Reference

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

#include <CTBtreeList.hxx>

Inheritance diagram for CTBtreeListLink:

Inheritance graph
[legend]
Collaboration diagram for CTBtreeListLink:

Collaboration graph
[legend]
List of all members.

Public Methods

 CTBtreeListLink ()
 ~CTBtreeListLink ()
TPParent () const
TCPrev () const
TCNext () const
void InsertHead (TC *p_this, CTBtreeListLink< TP, TC > TC::*o_link, TP &parent, CTBtreeListHead< TP, TC > TP::*o_head)
void InsertTail (TC *p_this, CTBtreeListLink< TP, TC > TC::*o_link, TP &parent, CTBtreeListHead< TP, TC > TP::*o_head)
void InsertBefore (TC *p_this, CTBtreeListLink< TP, TC > TC::*o_link, CTBtreeListHead< TP, TC > TP::*o_head, TC &elem)
void InsertAfter (TC *p_this, CTBtreeListLink< TP, TC > TC::*o_link, CTBtreeListHead< TP, TC > TP::*o_head, TC &elem)
void Remove (CTBtreeListLink< TP, TC > TC::*o_link, CTBtreeListHead< TP, TC > TP::*o_head)
bool operator! () const
 operator bool () const

Private Methods

 CTBtreeListLink (const CTBtreeListLink< TP, TC > &rhs)
CTBtreeListLink< TP, TC > & operator= (const CTBtreeListLink< TP, TC > &rhs)

Private Attributes

TPmp_parent
TCmp_prev
TCmp_next

Detailed Description

template<class TP, class TC>
class CTBtreeListLink< TP, TC >

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

The pair of classes CTBtreeListHead<TP,TC> and CTBtreeListLink<TP,TC> allows to implement a doubly linked list of objects of type TC with a list head embedded in an object of type TP. The class CTBtreeListHead<TP,TC> represents the list head. An object of type CTBtreeListLink<TP,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 CTBtreeListLink<TP,TC> and can thus simultaneously be part of multiple lists. All list insert and remove operations are controlled by CTBtreeListLink methods.

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

  class hd {
    CTBtreeListHead<hd,el>  m_head;
    ...
  };

  class el {
    CTBtreeListLink<hd,el>  m_link;
    ...
  };

Definition at line 20 of file CTBtreeList.hxx.


Constructor & Destructor Documentation

template<class TP, class TC>
CTBtreeListLink< TP, TC >::CTBtreeListLink [inline]
 

Default constructor.

Definition at line 51 of file CTBtreeList.icc.

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

Definition at line 66 of file CTBtreeList.icc.

template<class TP, class TC>
CTBtreeListLink< TP, TC >::CTBtreeListLink const CTBtreeListLink< TP, TC > & rhs [private]
 


Member Function Documentation

template<class TP, class TC>
TP * CTBtreeListLink< TP, TC >::Parent const [inline]
 

Returns a pointer to parent object, or null if not connected.

Definition at line 75 of file CTBtreeList.icc.

template<class TP, class TC>
TC * CTBtreeListLink< TP, TC >::Prev const [inline]
 

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

Definition at line 84 of file CTBtreeList.icc.

template<class TP, class TC>
TC * CTBtreeListLink< TP, TC >::Next const [inline]
 

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

Definition at line 93 of file CTBtreeList.icc.

template<class TP, class TC>
void CTBtreeListLink< TP, TC >::InsertHead TC * p_this,
CTBtreeListLink< TP, TC > TC::* o_link,
TP & parent,
CTBtreeListHead< TP, TC > TP::* o_head
[inline]
 

Insert element at head of list.

The object embedding the CTBtreeListLink 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 CTBtreeListLink 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 CTBtreeList.icc.

template<class TP, class TC>
void CTBtreeListLink< TP, TC >::InsertTail TC * p_this,
CTBtreeListLink< TP, TC > TC::* o_link,
TP & parent,
CTBtreeListHead< TP, TC > TP::* o_head
[inline]
 

Insert element at tail of list.

see above ...

Definition at line 150 of file CTBtreeList.icc.

Referenced by CTBcallbackLink::CTBcallbackLink().

template<class TP, class TC>
void CTBtreeListLink< TP, TC >::InsertBefore TC * p_this,
CTBtreeListLink< TP, TC > TC::* o_link,
CTBtreeListHead< TP, TC > TP::* o_head,
TC & elem
[inline]
 

Insert element before list element elem.

The object embedding the CTBtreeListLink 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 CTBtreeListLink member in p_this for which this method is currently called.

elem must already be linked into the list head.

Definition at line 190 of file CTBtreeList.icc.

template<class TP, class TC>
void CTBtreeListLink< TP, TC >::InsertAfter TC * p_this,
CTBtreeListLink< TP, TC > TC::* o_link,
CTBtreeListHead< TP, TC > TP::* o_head,
TC & elem
[inline]
 

Insert element after list element elem.

see above ...

Definition at line 226 of file CTBtreeList.icc.

template<class TP, class TC>
void CTBtreeListLink< TP, TC >::Remove CTBtreeListLink< TP, TC > TC::* o_link,
CTBtreeListHead< TP, TC > TP::* o_head
[inline]
 

Remove element.

The object embedding the CTBtreeListLink 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 CTBtreeListLink member in the embedding object for which this method is currently called.

Definition at line 265 of file CTBtreeList.icc.

Referenced by CTBcallbackLink::UnlinkTarget().

template<class TP, class TC>
bool CTBtreeListLink< TP, TC >::operator! const [inline]
 

Returns true object not connected to a list.

Definition at line 297 of file CTBtreeList.icc.

template<class TP, class TC>
CTBtreeListLink< TP, TC >::operator bool const [inline]
 

Returns true if object connected to a list.

Definition at line 306 of file CTBtreeList.icc.

template<class TP, class TC>
CTBtreeListLink<TP,TC>& CTBtreeListLink< TP, TC >::operator= const CTBtreeListLink< TP, TC > & rhs [private]
 


Member Data Documentation

template<class TP, class TC>
TP* CTBtreeListLink::mp_parent [private]
 

Definition at line 65 of file CTBtreeList.hxx.

template<class TP, class TC>
TC* CTBtreeListLink::mp_prev [private]
 

Definition at line 66 of file CTBtreeList.hxx.

template<class TP, class TC>
TC* CTBtreeListLink::mp_next [private]
 

Definition at line 67 of file CTBtreeList.hxx.


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