Inherits glv::ReferenceCounter.
Public Types |
enum | Type {
VOID = 0,
BOOL,
INT,
FLOAT,
DOUBLE,
STRING
} |
| Data types.
More...
|
Public Member Functions |
| Data () |
| This sets the data type to void and does not allocate memory.
|
| Data (Data &v) |
| Data (const Data &v) |
| Data (Data::Type type, int size1=1, int size2=1, int size3=1, int size4=1) |
| Constructor that sets internal attributes without allocating memory.
|
template<class T > |
| Data (T &value) |
template<class T > |
| Data (const T &value) |
template<class T > |
| Data (T *data, int size1, int size2=1, int size3=1, int size4=1) |
bool | operator== (const Data &v) const |
| Returns whether elements from each array are equal.
|
bool | operator!= (const Data &v) const |
| Returns whether elements from each array are not equal.
|
template<class T > |
const T | at (int ind) const |
| Get element at 1D index, performing type cast if necessary.
|
template<class T > |
const T | at (int i1, int i2) const |
| Get element at 2D index, performing type cast if necessary.
|
template<class T > |
const T | at (int i1, int i2, int i3) const |
| Get element at 3D index, performing type cast if necessary.
|
template<class T > |
const T | at (int i1, int i2, int i3, int i4) const |
| Get element at 4D index, performing type cast if necessary.
|
template<class T > |
const T & | elem (int i) const |
| Get element at 1D index using pointer casting.
|
bool | hasData () const |
| Returns whether there is valid data that can be accessed.
|
bool | inBounds (int i1, int i2) const |
| Returns whether 2D index is within bounds.
|
bool | inBounds (int i1, int i2, int i3) const |
| Returns whether 3D index is within bounds.
|
bool | inBounds (int i1, int i2, int i3, int i4) const |
| Returns whether 4D index is within bounds.
|
int | indexFlat (int i1, int i2) const |
| Convert 2D index to 1D index.
|
int | indexFlat (int i1, int i2, int i3) const |
| Convert 3D index to 1D index.
|
int | indexFlat (int i1, int i2, int i3, int i4) const |
| Convert 4D index to 1D index.
|
void | indexDim (int &i1, int &i2, const int &i) const |
| Convert 1D index to 2D index.
|
void | indexDim (int &i1, int &i2, int &i3, const int &i) const |
| Convert 1D index to 3D index.
|
void | indexDim (int &i1, int &i2, int &i3, int &i4, const int &i) const |
| Convert 1D index to 4D index.
|
bool | isNumerical () const |
| Returns whether type is numerical, i.e., int, float, or double.
|
int | offset () const |
| Get element offset into source array.
|
int | order () const |
| Get number of dimensions sized larger than 1.
|
Data | reversed () const |
| Returns reversed slice.
|
int | size () const |
| Get total number of elements.
|
const int * | shape () const |
| Get size array.
|
int | sizeType () const |
| Get size, in bytes, of element type.
|
Data | slice (int offset=0) const |
| Returns maximally sized 1D slice at given offset.
|
Data | slice (int offset, int size) const |
| Returns 1D slice with given offset, and size.
|
Data | slice (int offset, int size, int stride) const |
| Returns 1D slice with given offset, size, and stride.
|
int | stride () const |
| Get index stride.
|
const Type & | type () const |
| Get element type.
|
void | print () const |
| Print information to stdout.
|
Data & | operator= (const Data &v) |
| Perform shallow copy from another Data.
|
template<class T > |
Data & | assign (const T &v) |
| Assign value to first element.
|
template<class T > |
Data & | assign (const T &v, int i) |
| Assign value to element at 1D index.
|
template<class T > |
Data & | assign (const T &v, int i1, int i2) |
| Assign value to element at 2D index.
|
template<class T > |
Data & | assign (const T &v, int i1, int i2, int i3) |
| Assign value to element at 3D index.
|
template<class T > |
Data & | assign (const T &v, int i1, int i2, int i3, int i4) |
| Assign value to element at 4D index.
|
template<class T > |
Data & | assign (const T *src, int size, int stride=1) |
| Assign elements from an external array.
|
Data & | assign (const Data &v, int ind1=0, int ind2=0) |
| Assign elements to elements from argument Data.
|
template<class T > |
Data & | assignAll (const T &v) |
| Assign all elements to argument.
|
void | clone () |
| Allocate internal memory and copy over previous data.
|
template<class T > |
T & | elem (int i) |
| Get mutable reference to element at 1D index using pointer casting.
|
template<class T > |
T & | elem (int i1, int i2) |
| Get mutable reference to element at 2D index using pointer casting.
|
template<class T > |
T & | elem (int i1, int i2, int i3) |
| Get mutable reference to element at 3D index using pointer casting.
|
template<class T > |
T & | elem (int i1, int i2, int i3, int i4) |
| Get mutable reference to element at 4D index using pointer casting.
|
template<class T > |
T * | elems () |
| Returns pointer to first element.
|
template<class T > |
const T * | elems () const |
| Get pointer to first element.
|
Data & | resize (const int *sizes, int numDims) |
| Resize array, allocating new memory if necessary.
|
Data & | resize (int size1, int size2=1, int size3=1, int size4=1) |
| Resize array, allocating new memory if necessary.
|
Data & | resize (Data::Type type, const int *sizes, int numDims) |
| Resize array, allocating new memory if necessary.
|
Data & | resize (Data::Type type, int size1=1, int size2=1, int size3=1, int size4=1) |
| Resize array allocating new memory, if necessary.
|
template<class T > |
Data & | set (T &v) |
| Set data to reference a scalar.
|
template<class T > |
Data & | set (const T &v) |
| Set new data from a scalar with specified value.
|
Data & | set (const char *v) |
| Set new data from a character string.
|
template<class T > |
Data & | set (T *data, const int *sizes, int numDims) |
| Set data to reference an external multidimensional array.
|
template<class T > |
Data & | set (T *data, int size) |
| Set data to reference an external 1D array.
|
Data & | shape (const int *sizes, int n) |
| Set dimensions without reallocing new memory.
|
Data & | shape (int n1, int n2=1, int n3=1, int n4=1) |
| Set dimensions without reallocing new memory.
|
Data & | stride (int v) |
| Set index stride factor.
|
Data & | type (Data::Type type) |
| Change type of data.
|
Static Public Member Functions |
static int | maxDim () |
| Get maximum allowable dimensions.
|
Dynamically typed multidimensional array of primitive values.
For operations between data with different types, standard type conversions will be used when possible. For binary operations between arrays, each array is treated as a one-dimensional array. If the number of elements differ, then the maximum possible number of elements are used in the comparison.