#include <Arrays.h>
Public Member Functions | |
Array2 (int width, int height) | |
Allocate a two-dimensional array. | |
Array2 (int width, int height, T *data) | |
Bind to an existing two-dimensional array. | |
~Array2 () | |
If previously allocated a two-dimensional array, free it. | |
T & | operator() (int col, int row) |
Return m_data[row * m_width + col]. | |
const T & | operator() (int col, int row) const |
Return m_data[row * m_width + col]. | |
int | getWidth () const |
Retrieve the array width. | |
int | getHeight () const |
Retrieve the array height. | |
const T * | getData () const |
Retrieve the array contents. | |
Private Attributes | |
T * | m_data |
The one-dimensional array of data. | |
int | m_width |
Dimension of the one-dimensional array. | |
int | m_height |
Dimension of the one-dimensional array. | |
bool | m_managed |
Was the array of data allocated inside this class? |
|
Was the array of data allocated inside this class? If true, the data should be deleted when this class is deleted; otherwise, do nothing: the lifetime of the array of data is governed externally. |