#include <arrays.h>
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. |
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.
|
Default constructor. Default constructor creates an empty array. |
|
Constructor. The constructor creates an array of given width height. |
|
Constructor. The constructor creates an array of given width and length height and initialises it to a value |
|
Destructor. Destructor frees the data allocated in the constructor. |
|
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. |
|
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. |
|
Element access. Accesses the rows of the arrays, which are returned in the form of pointers to the row data NOT OneDArray objects. |
|
Element access. Accesses the rows of the arrays, which are returned in the form of pointers to the row data NOT OneDArray objects. |