ADTF
|
Multi dimensional array class template. More...
Public Member Functions | |
cMultiArray () | |
Constructor that initializes the array to an invalid state (0 dimensions) | |
cMultiArray (const cMultiArrayDimensions &oDimensions) | |
Constructor that initializes the array to the dimensions specified in the parameter. More... | |
virtual | ~cMultiArray () |
Virtual destructor. | |
tBool | IsValid () const |
Check if the array is in a valid state and initialized correctly. More... | |
tSize | NumElements () const |
Get the total number of stored elements in the array across all dimensions. More... | |
const cMultiArrayDimensions & | Dimensions () const |
Get the dimensions of the array. More... | |
tResult | Set (const cMultiArrayIndex &oIndex, T value) |
Set the element at the specified array index. More... | |
tResult | Get (const cMultiArrayIndex &oIndex, T &value) const |
Get the element at the specified array index. More... | |
Protected Member Functions | |
tResult | InitializeDataStore () |
Initializes the data vector to the correct size (specified by the dimensions of the array) More... | |
tBool | ContainsIndex (const cMultiArrayIndex &oIndex) const |
Check if an index is in bound of the arrays dimensions. More... | |
tResult | CalculateInternIndex (const cMultiArrayIndex &oIndex, tUInt &nInternIndex) const |
Calculate the internal flat index that matches the multi dimensional index specified. More... | |
Protected Attributes | |
cMultiArrayDimensions | m_oDimensions |
Stores the arrays dimension object. | |
std::vector< T > | m_oData |
Stores the arrays actual data (in a flat vector) | |
Multi dimensional array class template.
Usage: Specify the arrays dimensions during construction time:
Definition at line 198 of file multiarray.h.
|
inlineexplicit |
Constructor that initializes the array to the dimensions specified in the parameter.
If the dimensions object is invalid the array will be invalid as well. All values will be default constructed
oDimensions | [in] The dimensions of the array |
Definition at line 361 of file multiarray.h.
References IS_FAILED.
|
inlineprotected |
Calculate the internal flat index that matches the multi dimensional index specified.
oIndex | [in] The index to base the calculation on |
nInternIndex | [out] Destination value for the calculated intern index |
Definition at line 302 of file multiarray.h.
References cMultiArrayIndex::GetDimensionValue(), IS_FAILED, cMultiArrayIndex::IsValid(), and cMultiArrayIndex::NumDimensions().
|
inlineprotected |
Check if an index is in bound of the arrays dimensions.
oIndex | [in] The index to check |
Definition at line 260 of file multiarray.h.
References cMultiArrayIndex::GetDimensionValue(), IS_FAILED, cMultiArrayIndex::IsValid(), and cMultiArrayIndex::NumDimensions().
|
inline |
Get the dimensions of the array.
Definition at line 412 of file multiarray.h.
|
inline |
Get the element at the specified array index.
oIndex | [in] The multi dimension index |
value | [out] The found element value (set by the getter if successful) |
Definition at line 453 of file multiarray.h.
References IS_FAILED, cMultiArrayIndex::IsValid(), and RETURN_NOERROR.
|
inlineprotected |
Initializes the data vector to the correct size (specified by the dimensions of the array)
Definition at line 224 of file multiarray.h.
References cMultiArrayIndex::GetDimensionValue(), IS_FAILED, cMultiArrayIndex::NumDimensions(), and RETURN_NOERROR.
|
inline |
Check if the array is in a valid state and initialized correctly.
Definition at line 387 of file multiarray.h.
References cMultiArrayIndex::IsValid().
|
inline |
Get the total number of stored elements in the array across all dimensions.
Definition at line 399 of file multiarray.h.
|
inline |
Set the element at the specified array index.
oIndex | [in] The multi dimension index |
value | [in] The new element value |
Definition at line 426 of file multiarray.h.
References IS_FAILED, cMultiArrayIndex::IsValid(), and RETURN_NOERROR.