Main Page   Class Hierarchy   Compound List   File List   Compound Members  

TValVectorT< T > Class Template Reference

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

#include <TValVectorT.hh>

List of all members.

Public Methods

 TValVectorT ()
 Constructs an empty vector.

 TValVectorT (int n)
 Constructs an vector of the specified size.

 TValVectorT (int n, const T &a)
 Constructs an vector of the specified size.

 TValVectorT (const TValVectorT< T > &vec)
 Copy constructor.

 ~TValVectorT ()
 Destructor.

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

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

void Clear ()
 Removes all items from self.

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

void Resize (int n)
 Resize vector to the specified size.

void Resize (int n, const T &a)
 Resize vector to the specified size.

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

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

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


Detailed Description

template<class T>
class TValVectorT< T >

Template class holding an array of values.

Author:
Johan Bolmsjo <johan@nocrew.org>


Constructor & Destructor Documentation

template<class T>
TValVectorT< T >::TValVectorT int    n
 

Constructs an vector of the specified size.

Parameters:
n Size of vector.

template<class T>
TValVectorT< T >::TValVectorT int    n,
const T &    a
 

Constructs an vector of the specified size.

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


Member Function Documentation

template<class T>
void TValVectorT< T >::Append const T &    a
 

Adds an item to the end of the vector.

Parameters:
a Item to add.

template<class T>
void TValVectorT< T >::Apply void(*    fn)(T *, void *),
void *    d = 0
 

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>
int TValVectorT< T >::Entries   const [inline]
 

Query number of entries in self.

Returns:
Number of entries.

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

Index operator.

Can be used for assignment.

Parameters:
i Index
Returns:
Reference to element

template<class T>
void TValVectorT< T >::Resize int    n,
const T &    a
 

Resize vector to the specified size.

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

template<class T>
void TValVectorT< T >::Resize int    n [inline]
 

Resize vector to the specified size.

Parameters:
n New size.

template<class T>
void TValVectorT< T >::Sort bool    ascending = true
 

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

Parameters:
ascending Sort ascending 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