dirac::OneDArray< T > Class Template Reference

A template class for one-dimensional arrays. More...

#include <arrays.h>

List of all members.

Public Member Functions

 OneDArray ()
 Default constructor.
 OneDArray (const int len)
 'Length' constructor.
 OneDArray (const Range &r)
 Range constructor.
 ~OneDArray ()
 Destructor.
 OneDArray (const OneDArray< T > &cpy)
 Copy constructor.
OneDArray< T > & operator= (const OneDArray< T > &rhs)
 Assignment=.
void Resize (int l)
 Resize the array, throwing away the current data.
T & operator[] (const int pos)
 Element access.
const T & operator[] (const int pos) const
 Element access.
int Length () const
 Returns the length of the array.
int First () const
 Returns the index of the first element.
int Last () const
 Returns the index of the last element.


Detailed Description

template<class T>
class dirac::OneDArray< T >

A template class for one-dimensional arrays.

A template class for one-D arrays. Can be used wherever built-in arrays are used, and eliminates the need for explicit memory (de-)allocation. Also supports arrays not based at zero.

Definition at line 88 of file arrays.h.


Constructor & Destructor Documentation

template<class T>
dirac::OneDArray< T >::OneDArray  ) 
 

Default constructor.

Default constructor produces an empty array.

Definition at line 166 of file arrays.h.

template<class T>
dirac::OneDArray< T >::OneDArray const int  len  ) 
 

'Length' constructor.

Length constructor produces a zero-based array.

Definition at line 172 of file arrays.h.

template<class T>
dirac::OneDArray< T >::OneDArray const Range r  ) 
 

Range constructor.

Range constructor produces an array with values indexed within the range parameters.

Parameters:
r a range of indexing values.

Definition at line 178 of file arrays.h.

template<class T>
dirac::OneDArray< T >::~OneDArray  )  [inline]
 

Destructor.

Destructor frees the data allocated in the constructors.

Definition at line 115 of file arrays.h.

template<class T>
dirac::OneDArray< T >::OneDArray const OneDArray< T > &  cpy  ) 
 

Copy constructor.

Copy constructor copies both data and metadata.

Definition at line 184 of file arrays.h.

References dirac::OneDArray< T >::m_first, dirac::OneDArray< T >::m_last, and dirac::OneDArray< T >::m_ptr.


Member Function Documentation

template<class T>
OneDArray< T > & dirac::OneDArray< T >::operator= const OneDArray< T > &  rhs  ) 
 

Assignment=.

Assignment= assigns both data and metadata.

Definition at line 199 of file arrays.h.

References dirac::OneDArray< T >::m_first, dirac::OneDArray< T >::m_last, dirac::OneDArray< T >::m_length, and dirac::OneDArray< T >::m_ptr.


The documentation for this class was generated from the following file:
Generated on Tue Dec 13 14:49:18 2005 for guliverkli by  doxygen 1.4.5