dirac::TwoDArray< T > Class Template Reference

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

#include <arrays.h>

List of all members.

Public Member Functions

 TwoDArray ()
 Default constructor.
 TwoDArray (const int height, const int width)
 Constructor.
 TwoDArray (const int height, const int width, T val)
 Constructor.
virtual ~TwoDArray ()
 Destructor.
 TwoDArray (const TwoDArray< T > &Cpy)
 Copy constructor.
TwoDArray< T > & operator= (const TwoDArray< T > &rhs)
 Assignment =.
void Resize (const int height, const int width)
 Resizes the array, deleting the current data.
element_type & operator[] (const int pos)
 Element access.
const element_type & operator[] (const int pos) const
 Element access.
const int LengthX () const
 Returns the width.
const int LengthY () const
 Returns the height.
const int FirstX () const
 Returns the index of the first element of a row.
const int FirstY () const
 Returns the index of the first element of a column.
const int LastX () const
 Returns the index of the last element of a row.
const int LastY () const
 Returns the index of the first element of a column.


Detailed Description

template<class T>
class dirac::TwoDArray< T >

A template class for two-dimensional arrays.

A template class to do two-d arrays, so that explicit memory (de-)allocation is not required. Only zero-based arrays are currently supported so that access is fast. The array is viewed as a (vertical) array of (horizontal) arrays. Accessing elements along a row is therefore much faster than accessing them along a column.

Definition at line 278 of file arrays.h.


Constructor & Destructor Documentation

template<class T>
dirac::TwoDArray< T >::TwoDArray  )  [inline]
 

Default constructor.

Default constructor creates an empty array.

Definition at line 288 of file arrays.h.

template<class T>
dirac::TwoDArray< T >::TwoDArray const int  height,
const int  width
[inline]
 

Constructor.

The constructor creates an array of given width height.

Definition at line 294 of file arrays.h.

template<class T>
dirac::TwoDArray< T >::TwoDArray const int  height,
const int  width,
val
 

Constructor.

The constructor creates an array of given width and length height and initialises it to a value

Definition at line 381 of file arrays.h.

template<class T>
virtual dirac::TwoDArray< T >::~TwoDArray  )  [inline, virtual]
 

Destructor.

Destructor frees the data allocated in the constructor.

Definition at line 307 of file arrays.h.

template<class T>
dirac::TwoDArray< T >::TwoDArray const TwoDArray< T > &  Cpy  ) 
 

Copy constructor.

Copy constructor copies data and metadata.

Definition at line 389 of file arrays.h.

References dirac::TwoDArray< T >::m_array_of_rows, dirac::TwoDArray< T >::m_first_x, dirac::TwoDArray< T >::m_first_y, dirac::TwoDArray< T >::m_last_x, and dirac::TwoDArray< T >::m_last_y.


Member Function Documentation

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

Assignment =.

Assignement = assigns both data and metadata.

Definition at line 410 of file arrays.h.

References dirac::TwoDArray< T >::m_array_of_rows, dirac::TwoDArray< T >::m_first_x, dirac::TwoDArray< T >::m_first_y, dirac::TwoDArray< T >::m_last_x, and dirac::TwoDArray< T >::m_last_y.

template<class T>
const element_type& dirac::TwoDArray< T >::operator[] const int  pos  )  const [inline]
 

Element access.

Accesses the rows of the arrays, which are returned in the form of pointers to the row data NOT OneDArray objects.

Definition at line 338 of file arrays.h.

template<class T>
element_type& dirac::TwoDArray< T >::operator[] const int  pos  )  [inline]
 

Element access.

Accesses the rows of the arrays, which are returned in the form of pointers to the row data NOT OneDArray objects.

Definition at line 331 of file arrays.h.


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