Main Page   Class Hierarchy   Compound List   File List   Compound Members  

TPtrVectorT< T > Class Template Reference

Template class holding an array of pointers. More...

#include <TPtrVectorT.hh>

List of all members.

Public Methods

 TPtrVectorT ()
 Constructs an empty vector.

 TPtrVectorT (int n, T *a=NULL)
 Constructs an vector of the specified size.

 TPtrVectorT (TPtrVectorT< T > &vec)
 Copy constructor.

 ~TPtrVectorT ()
 Destructor.

void Append (T *a)
 Adds an item to the end of the vector.

void Apply (void(*fn)(T *, void *), void *d)
 Applies the user defined function to every entry in the vector.

void Clear ()
 Removes all items from self.

void ClearAndDestroy ()
 Removes all items from self and calls delete on them.

int Entries () const
 Query number of entries in self.

void Resize (int n, T *a=NULL)
 Resize vector to the specified size.

void Sort (bool reverse=false)
 Sort all entries in self with the less than operator (<).

T *& operator[] (int i) const
 Index operator.

TPtrVectorT< T > & operator= (const TPtrVectorT< T > &vec)
 Assignment operator.


Detailed Description

template<class T>
class TPtrVectorT< T >

Template class holding an array of pointers.

Author:
Johan Bolmsjo <johan@nocrew.org>


Constructor & Destructor Documentation

template<class T>
TPtrVectorT< T >::TPtrVectorT int    n,
T *    a = NULL
 

Constructs an vector of the specified size.

Parameters:
n Size of vector.
a Initial value of entries.


Member Function Documentation

template<class T>
void TPtrVectorT< T >::Append T *    a
 

Adds an item to the end of the vector.

Parameters:
a Item to add.

template<class T>
void TPtrVectorT< T >::Apply void(*    fn)(T *, void *),
void *    d
 

Applies the user defined function to every entry in the vector.

Parameters:
fn Function pointer to your function.
d Client data to pass to your function.

template<class T>
void TPtrVectorT< T >::ClearAndDestroy  
 

Removes all items from self and calls delete on them.

Don't use if multiple pointers to the same object are stored.

template<class T>
int TPtrVectorT< T >::Entries   const [inline]
 

Query number of entries in self.

Returns:
Number of entries.

template<class T>
T *& TPtrVectorT< T >::operator[] int    i const [inline]
 

Index operator.

Can be used for assignment.

Parameters:
i Index
Returns:
Reference to element

template<class T>
void TPtrVectorT< T >::Resize int    n,
T *    a = NULL
 

Resize vector to the specified size.

New entries are initialised to NULL.

Parameters:
n New size.
a Initial value of new entries.

template<class T>
void TPtrVectorT< T >::Sort bool    reverse = false
 

Sort all entries in self with the less than operator (<).

Parameters:
reverse Sort backwards if true.


The documentation for this class was generated from the following file:
Generated on Sat Feb 15 18:37:16 2003 for Tools by doxygen1.3-rc2