fesa-core
4.2.0
|
#include <Array2D.h>
Public Member Functions | |
Array2D (const T *data, std::size_t nRows, std::size_t nCols) | |
Array2D (std::size_t nRows, std::size_t nCols) | |
template<typename S > | |
Array2DRow< T, runtimeCheck > | operator[] (S index) |
T & | get (std::size_t row, std::size_t column) |
Public Member Functions inherited from fesa::ImmutableArray2D< T, runtimeCheck > | |
ImmutableArray2D (const boost::shared_array< T > &data, std::size_t nRows, std::size_t nCols) | |
ImmutableArray2D (const T *data, std::size_t nRows, std::size_t nCols) | |
ImmutableArray2D (const ImmutableArray2D< T, runtimeCheck > &other) | |
ImmutableArray2D< T > & | operator= (const ImmutableArray2D< T > &other) |
Array2D< T, runtimeCheck > | getMutable () const |
std::size_t | getNumberOfRows () const |
std::size_t | getNumberOfColumns () const |
std::size_t | getNumberOfElements () const |
bool | hasOwnData () const |
template<typename S > | |
const Array2DRow< T, runtimeCheck > | operator[] (S index) const |
const T & | get (std::size_t row, std::size_t column) const |
operator const T * () const | |
operator const void * () const | |
Additional Inherited Members | |
Protected Member Functions inherited from fesa::ImmutableArray2D< T, runtimeCheck > | |
ImmutableArray2D (std::size_t nRows, std::size_t nCols) | |
void | doRuntimeCheck (std::size_t row) const |
void | doRuntimeCheck (std::size_t row, std::size_t column) const |
Protected Attributes inherited from fesa::ImmutableArray2D< T, runtimeCheck > | |
std::size_t | nRows_ |
std::size_t | nCols_ |
boost::container::vector< T > | ownData_ |
const boost::shared_array< T > | sharedData_ |
const T * | data_ |
A wrapper class for 2-dimensional arrays. An Array2D has always its own copy of the data. Consequently, the data passed to its constructor can be safely destroyed. An Array2D also provides a subscript operator which allows modification of the data.
T | Type of the elements |
runtimeCheck | whether to check index boundaries at runtime |
fesa::Array2D< T, runtimeCheck >::Array2D | ( | const T * | data, |
std::size_t | nRows, | ||
std::size_t | nCols | ||
) |
Constructor. Performs a copy of elements pointed to by data.
data | pointer to elements to copy. There must be at least nRows * nCols elements pointed. |
nRows | number of rows of this array |
nCols | number of columns of this array |
fesa::Array2D< T, runtimeCheck >::Array2D | ( | std::size_t | nRows, |
std::size_t | nCols | ||
) |
Constructor. Initializes nRows * nCols elements.
nRows | |
nCols |
T & fesa::Array2D< T, runtimeCheck >::get | ( | std::size_t | row, |
std::size_t | column | ||
) |
Returns a reference to the element at the given row, column. This method has the best performance. It shoud be favored over operator[], especially when iterating over the whole array.
Array2DRow< T, runtimeCheck > fesa::Array2D< T, runtimeCheck >::operator[] | ( | S | index | ) |
Returns a reference to the row at the given index (read-write).
index | the row index |