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

CTBbasicListHead Class Template Reference

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

#include <CTBbasicList.hxx>

Collaboration diagram for CTBbasicListHead:

Collaboration graph
[legend]
List of all members.

Public Methods

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

Private Methods

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

Private Attributes

TCmp_first
TCmp_last

Friends

class CTBbasicListLink< TC >

Detailed Description

template<class TC>
class CTBbasicListHead< TC >

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

For a detailed description see class CTBbasicListLink .

Definition at line 64 of file CTBbasicList.hxx.


Constructor & Destructor Documentation

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

Default constructor, results in empty list.

Definition at line 286 of file CTBbasicList.icc.

template<class TC>
CTBbasicListHead< TC >::~CTBbasicListHead [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 CTBbasicListHead 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,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 320 of file CTBbasicList.icc.

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


Member Function Documentation

template<class TC>
TC * CTBbasicListHead< 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 335 of file CTBbasicList.icc.

template<class TC>
TC * CTBbasicListHead< 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 350 of file CTBbasicList.icc.

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

Returns true if list is empty.

Definition at line 359 of file CTBbasicList.icc.

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

Returns true if at least one element in list.

Definition at line 368 of file CTBbasicList.icc.

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


Friends And Related Function Documentation

template<class TC>
friend class CTBbasicListLink< TC > [friend]
 

Definition at line 66 of file CTBbasicList.hxx.


Member Data Documentation

template<class TC>
TC* CTBbasicListHead::mp_first [private]
 

Definition at line 89 of file CTBbasicList.hxx.

template<class TC>
TC* CTBbasicListHead::mp_last [private]
 

Definition at line 90 of file CTBbasicList.hxx.


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