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

CTBtreeListHead Class Template Reference

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

#include <CTBtreeList.hxx>

Inheritance diagram for CTBtreeListHead:

Inheritance graph
[legend]
Collaboration diagram for CTBtreeListHead:

Collaboration graph
[legend]
List of all members.

Public Methods

 CTBtreeListHead ()
 ~CTBtreeListHead ()
TCFirst () const
TCLast () const
bool operator! () const
 operator bool () const

Private Methods

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

Private Attributes

TCmp_first
TCmp_last

Friends

class CTBtreeListLink< TP, TC >

Detailed Description

template<class TP, class TC>
class CTBtreeListHead< TP, TC >

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

For a detailed description see class CTBtreeListLink .

Definition at line 72 of file CTBtreeList.hxx.


Constructor & Destructor Documentation

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

Default constructor, results in empty list.

Definition at line 324 of file CTBtreeList.icc.

template<class TP, class TC>
CTBtreeListHead< TP, TC >::~CTBtreeListHead [inline]
 

Destructor.

The list must be empty by the time the destructor is executed. It is the responsibility of the destructor of the class embedding the CTBtreeListHead object to remove all elements from the list and decide about ownership and live time of those objects.

If the embedding class does not control the live time of the list objects a typical cleanup code look like

  hd::~hd() {
    while (m_head) m_head.First()->Remove(&el::m_link, &hd::m_head);
  }

If the embedding class owns the linked objects and is therefore obliged to delete them a typical cleanup code look like

  hd::~hd() {
    while (m_head) delete m_head.First();
  }

Definition at line 358 of file CTBtreeList.icc.

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


Member Function Documentation

template<class TP, class TC>
TC * CTBtreeListHead< TP, TC >::First const [inline]
 

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

A typical head-to-tail traversal of a list is implemented like

    for (el* p = m_head.First(); p; p = p->m_link.Next()) {...}

Definition at line 373 of file CTBtreeList.icc.

Referenced by CTBcallbackTargetBase::Disconnect(), and CTBcallbackTargetBase::NConnect().

template<class TP, class TC>
TC * CTBtreeListHead< TP, TC >::Last const [inline]
 

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

A typical tail-to-head traversal of a list is implemented like

    for (el* p = m_head.Last(); p; p = p->m_link.Prev()) {...}

Definition at line 388 of file CTBtreeList.icc.

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

Returns true if list is empty.

Definition at line 397 of file CTBtreeList.icc.

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

Returns true if at least one element in list.

Definition at line 406 of file CTBtreeList.icc.

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


Friends And Related Function Documentation

template<class TP, class TC>
friend class CTBtreeListLink< TP, TC > [friend]
 

Definition at line 74 of file CTBtreeList.hxx.


Member Data Documentation

template<class TP, class TC>
TC* CTBtreeListHead::mp_first [private]
 

Definition at line 97 of file CTBtreeList.hxx.

template<class TP, class TC>
TC* CTBtreeListHead::mp_last [private]
 

Definition at line 98 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