Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

CList Class Template Reference

List class. More...

#include <CList.h>

List of all members.

Public Methods

 CList ()
 CList (const CList &cSource)
 ~CList ()
CListContainer< ObjectType > * getFirst () const
CListContainer< ObjectType > * getLast () const
int getNumObjects () const
int insertAsFirst (ObjectType *pObj)
int insertAsLast (ObjectType *pObj)
int insertAfter (CListContainer< ObjectType > *pThere, ObjectType *pObject)
CListContainer< ObjectType > * find (ObjectType *pObj) const
int remove (CListContainer< ObjectType > *pRemove)
int remove (ObjectType *pObj)
CList< ObjectType > * getFullDuplicate () const
void clear (int nFlag=0)
ObjectType & operator[] (int nIndex) const
CListContainer< ObjectType > * operator() (int nIndex) const
const CList & operator+ (const CList &cSource)
CList & operator= (const CList &cSource)

Protected Methods

void init ()
void setFirst (CListContainer< ObjectType > *pTmp)
void setLast (CListContainer< ObjectType > *pTmp)
void setNumObjects (int nTmp)
void increaseNumObjects ()
void decreaseNumObjects ()

Protected Attributes

int m_nNumObjects
CListContainer< ObjectType > * m_pFirst
CListContainer< ObjectType > * m_pLast


Detailed Description

template<class ObjectType>
class CList< ObjectType >

List class.

This class provides functionality of a double linked list. You can add and remove objects to the list and have sequential or random access to the objects in the list.

NOTE: The list only keeps the pointer to the objects
so all memory management of the objects itself belongs to you.
Author:
Michael Meissner, Markus Janich


Constructor & Destructor Documentation

template<class ObjectType>
CList< ObjectType >::CList  
 

Default constructor.

template<class ObjectType>
CList< ObjectType >::CList const CList< ObjectType > &   list
 

Copy constructor.

template<class ObjectType>
CList< ObjectType >::~CList  
 

Destructor.


Member Function Documentation

template<class ObjectType>
void CList< ObjectType >::clear int   nFlag = 0
 

Removes all containers from the list if 'nFlag' = 0 (default). If 'nFlag' = 1 then also the objects are deleted from the heap.

template<class ObjectType>
void CList< ObjectType >::decreaseNumObjects   [inline, protected]
 

template<class ObjectType>
CListContainer< ObjectType > * CList< ObjectType >::find ObjectType *   pObj const
 

Searches for the element 'pObj' in the list and returns the pointer to the container which holds the element.

template<class ObjectType>
CListContainer<ObjectType>* CList< ObjectType >::getFirst   const [inline]
 

Returns pointer to the first container of the list.

template<class ObjectType>
CList< ObjectType > * CList< ObjectType >::getFullDuplicate   const
 

Returns a copy of the list. But this method NOT only copies the the pointer of the objects as the '=' operator does. No, this method makes a real memcpy of the list.

template<class ObjectType>
CListContainer<ObjectType>* CList< ObjectType >::getLast   const [inline]
 

Returns pointer to the last container of the list.

template<class ObjectType>
int CList< ObjectType >::getNumObjects   const [inline]
 

Returns the number of container in the list.

template<class ObjectType>
void CList< ObjectType >::increaseNumObjects   [inline, protected]
 

template<class ObjectType>
void CList< ObjectType >::init   [inline, protected]
 

template<class ObjectType>
int CList< ObjectType >::insertAfter CListContainer< ObjectType > *   pThere,
ObjectType *   pObject
 

Inserts the object 'pObject' after the container 'pThere' in the list.

template<class ObjectType>
int CList< ObjectType >::insertAsFirst ObjectType *   pObj
 

Inserts new object at the beginning of the list.

template<class ObjectType>
int CList< ObjectType >::insertAsLast ObjectType *   pObj
 

Appends the object 'pObj' to the end of the list.

template<class ObjectType>
CListContainer< ObjectType > * CList< ObjectType >::operator() int   index const
 

template<class ObjectType>
const CList< ObjectType > & CList< ObjectType >::operator+ const CList< ObjectType > &   cSource
 

concatenates one list with another by appending one to another.

template<class ObjectType>
CList< ObjectType > & CList< ObjectType >::operator= const CList< ObjectType > &   cSource
 

Copies one list to another.

NOTE: The objects itself will not be duplicated on the heap.

template<class ObjectType>
ObjectType & CList< ObjectType >::operator[] int   index const
 

template<class ObjectType>
int CList< ObjectType >::remove ObjectType *   pObj
 

Same as before but with different type of parameter.

template<class ObjectType>
int CList< ObjectType >::remove CListContainer< ObjectType > *   pRemove
 

Removes the container 'pRemove' from the list.

template<class ObjectType>
void CList< ObjectType >::setFirst CListContainer< ObjectType > *   pTmp [inline, protected]
 

template<class ObjectType>
void CList< ObjectType >::setLast CListContainer< ObjectType > *   pTmp [inline, protected]
 

template<class ObjectType>
void CList< ObjectType >::setNumObjects int   nTmp [inline, protected]
 


Member Data Documentation

template<class ObjectType>
int CList::m_nNumObjects [protected]
 

template<class ObjectType>
CListContainer<ObjectType>* CList::m_pFirst [protected]
 

template<class ObjectType>
CListContainer<ObjectType>* CList::m_pLast [protected]
 


The documentation for this class was generated from the following files:
Generated at Thu Oct 4 17:17:29 2001 for QGLViewer by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001