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

CTBsimpleListHead Class Template Reference

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

#include <CTBsimpleList.hxx>

Inheritance diagram for CTBsimpleListHead:

Inheritance graph
[legend]
Collaboration diagram for CTBsimpleListHead:

Collaboration graph
[legend]
List of all members.

Public Methods

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

Private Methods

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

Private Attributes

TCmp_first
TCmp_last

Friends

class CTBsimpleListLink< TC >

Detailed Description

template<class TC>
class CTBsimpleListHead< TC >

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

For a detailed description see class CTBsimpleListLink .

Definition at line 67 of file CTBsimpleList.hxx.


Constructor & Destructor Documentation

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

Default constructor, results in empty list.

Definition at line 315 of file CTBsimpleList.icc.

template<class TC>
CTBsimpleListHead< TC >::~CTBsimpleListHead [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 CTBsimpleListHead 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);
  }

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 349 of file CTBsimpleList.icc.

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


Member Function Documentation

template<class TC>
TC * CTBsimpleListHead< 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 364 of file CTBsimpleList.icc.

Referenced by CTBcallbackSourceBase::Execute(), CTBcallbackSourceBase::NConnect(), and CTBcallbackSourceBase::~CTBcallbackSourceBase().

template<class TC>
TC * CTBsimpleListHead< 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 379 of file CTBsimpleList.icc.

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

Returns true if list is empty.

Definition at line 388 of file CTBsimpleList.icc.

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

Returns true if at least one element in list.

Definition at line 397 of file CTBsimpleList.icc.

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


Friends And Related Function Documentation

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

Definition at line 69 of file CTBsimpleList.hxx.


Member Data Documentation

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

Definition at line 92 of file CTBsimpleList.hxx.

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

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