Created by the British Broadcasting Corporation.
A template class for two-dimensional arrays. More...
#include <arrays.h>
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. Accessing elements along a row is therefore much faster than accessing them along a column. Rows are contiguous in memory, so array[y][x] is equivalent to array[0][x+y*LengthX()].
typedef T* dirac::TwoDArray< T >::element_type [private] |
dirac::TwoDArray< T >::TwoDArray | ( | ) | [inline] |
Default constructor creates an empty array.
dirac::TwoDArray< T >::TwoDArray | ( | const int | height, |
const int | width | ||
) | [inline] |
The constructor creates an array of given width height.
dirac::TwoDArray< T >::TwoDArray | ( | const int | height, |
const int | width, | ||
T | val | ||
) |
The constructor creates an array of given width and length height and initialises it to a value
virtual dirac::TwoDArray< T >::~TwoDArray | ( | ) | [inline, virtual] |
Destructor frees the data allocated in the constructor.
dirac::TwoDArray< T >::TwoDArray | ( | const TwoDArray< T > & | Cpy | ) |
Copy constructor copies data and metadata.
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.
bool dirac::TwoDArray< T >::CopyContents | ( | TwoDArray< T > & | out | ) | const |
Copy contents of array into output array retaining the dimensions of the output array. If output array is larger that array then pad with last true value. Return true is copy was successful
References dirac::TwoDArray< T >::m_array_of_rows, dirac::TwoDArray< T >::m_length_x, and dirac::TwoDArray< T >::m_length_y.
void dirac::TwoDArray< T >::Fill | ( | T | val | ) |
Initialise the array with the val provided.
int dirac::TwoDArray< T >::FirstX | ( | ) | const [inline] |
int dirac::TwoDArray< T >::FirstY | ( | ) | const [inline] |
void dirac::TwoDArray< T >::FreeData | ( | ) | [private] |
Referenced by dirac::TwoDArray< CodeBlock >::~TwoDArray().
void dirac::TwoDArray< T >::Init | ( | const int | height, |
const int | width | ||
) | [private] |
Referenced by dirac::TwoDArray< CodeBlock >::TwoDArray().
int dirac::TwoDArray< T >::LastX | ( | ) | const [inline] |
int dirac::TwoDArray< T >::LastY | ( | ) | const [inline] |
int dirac::TwoDArray< T >::LengthX | ( | ) | const [inline] |
Referenced by dirac::operator>>().
int dirac::TwoDArray< T >::LengthY | ( | ) | const [inline] |
Referenced by dirac::operator>>().
TwoDArray< T > & dirac::TwoDArray< T >::operator= | ( | const TwoDArray< T > & | rhs | ) |
Assignement = assigns both data and metadata.
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.
const element_type& dirac::TwoDArray< T >::operator[] | ( | const int | pos | ) | const [inline] |
Accesses the rows of the arrays, which are returned in the form of pointers to the row data NOT OneDArray objects.
element_type& dirac::TwoDArray< T >::operator[] | ( | const int | pos | ) | [inline] |
Accesses the rows of the arrays, which are returned in the form of pointers to the row data NOT OneDArray objects.
void dirac::TwoDArray< T >::Resize | ( | const int | height, |
const int | width | ||
) |
element_type* dirac::TwoDArray< T >::m_array_of_rows [private] |
int dirac::TwoDArray< T >::m_first_x [private] |
int dirac::TwoDArray< T >::m_first_y [private] |
int dirac::TwoDArray< T >::m_last_x [private] |
int dirac::TwoDArray< T >::m_last_y [private] |
int dirac::TwoDArray< T >::m_length_x [private] |
Referenced by dirac::TwoDArray< T >::CopyContents(), and dirac::TwoDArray< CodeBlock >::LengthX().
int dirac::TwoDArray< T >::m_length_y [private] |
Referenced by dirac::TwoDArray< T >::CopyContents(), and dirac::TwoDArray< CodeBlock >::LengthY().
© 2004 British Broadcasting Corporation.
Dirac code licensed under the Mozilla Public License (MPL) Version 1.1.
HTML documentation generated by Dimitri van Heesch's
excellent Doxygen tool.