Variable dimension array, an array whose dimensions can be specified at runtime. More...
#include <datatypedef.h>
Public Member Functions | |
VariableDimensionArray () | |
Default constructor that initializes values to default. More... | |
~VariableDimensionArray () | |
Destructor. More... | |
VariableDimensionArray (const VariableDimensionArray &vda) | |
Deep copy. More... | |
VariableDimensionArray & | operator= (const VariableDimensionArray &vda) |
Equals operator deep copy. More... | |
void | initArray (std::vector< int > dim_sizes) |
Initialize the array with the specified dimensions. More... | |
int | translate_coord_to_index (std::vector< int > vals) |
Translate coordinates to the flat index actually used for storage. More... | |
std::vector< int > | translate_index_to_coords (int index) |
Translate index to coordinates. More... | |
int | getValue (std::vector< int > rLoc) |
Get the value specified by the loc coordinates. More... | |
void | setValue (std::vector< int > rLoc, int rVal) |
Set the value at the given coordinates. More... | |
Public Attributes | |
int * | index |
Flat storage of values. More... | |
int | index_size |
std::vector< int > | sizes |
Variable dimension array, an array whose dimensions can be specified at runtime.
Values are stored in a flat array (an array with 1 dimension), and arithmetic is used to translate between coordinates (with the array's dimensionality) to flat indices.
Definition at line 133 of file datatypedef.h.
|
inline |
Default constructor that initializes values to default.
Definition at line 138 of file datatypedef.h.
References index, and index_size.
|
inline |
|
inline |
Deep copy.
vda | Array to copy |
Definition at line 154 of file datatypedef.h.
References i, index, index_size, and sizes.
|
inline |
Get the value specified by the loc coordinates.
rLoc | Coordinates for the value to retrieve |
Definition at line 272 of file datatypedef.h.
References index, sizes, and translate_coord_to_index().
Referenced by indexed_points::get_indexed_point().
|
inline |
Initialize the array with the specified dimensions.
dim_sizes | The size of each dimension of the array |
Definition at line 194 of file datatypedef.h.
References i, index, index_size, and sizes.
Referenced by manual_index_pts::set_layout().
|
inline |
Equals operator deep copy.
vda | Array to copy |
Definition at line 171 of file datatypedef.h.
References i, index, index_size, and sizes.
|
inline |
Set the value at the given coordinates.
rLoc | Location of the value to set |
rVal | Value to set |
Definition at line 286 of file datatypedef.h.
References index, sizes, and translate_coord_to_index().
Referenced by manual_index_pts::set_index().
|
inline |
Translate coordinates to the flat index actually used for storage.
vals | Coordinates to translate |
Definition at line 220 of file datatypedef.h.
Referenced by indexed_points::get_connected_points(), getValue(), and setValue().
|
inline |
Translate index to coordinates.
index | Flat index value |
Definition at line 245 of file datatypedef.h.
References i, index_size, and sizes.
Referenced by indexed_points::get_connected_points().
int* index |
Flat storage of values.
Definition at line 296 of file datatypedef.h.
Referenced by getValue(), initArray(), operator=(), setValue(), VariableDimensionArray(), and ~VariableDimensionArray().
int index_size |
Definition at line 297 of file datatypedef.h.
Referenced by initArray(), operator=(), translate_index_to_coords(), and VariableDimensionArray().
std::vector<int> sizes |
Definition at line 300 of file datatypedef.h.
Referenced by getValue(), initArray(), operator=(), setValue(), translate_coord_to_index(), translate_index_to_coords(), and VariableDimensionArray().