AFF --- A container for numbers (array) by Friederich and Forbriger.
|
Interface class to raw memory (C style array) More...
#include <Carray.h>
Public Types | |
Various types | |
In particular due to our concept of const-correctness we need several typedefs to declare types derived from the element type of the array. | |
typedef ConstArray< T > | Tarray |
Type of array to be interfaced. More... | |
typedef Tarray::Trepresentation | Trepresentation |
Type of representation. More... | |
typedef Tarray::Tshape | Tshape |
Type of shape. More... | |
typedef Tshape::TSizeVec | TSizeVec |
we use this for one of the access operators More... | |
typedef Tarray::Tvalue | Tvalue |
Element type. More... | |
typedef Tarray::Tpointer | Tpointer |
Type of pointer to element. More... | |
typedef Tarray::Treference | Treference |
Type of reference to element. More... | |
typedef Tarray::Tconst_value | Tconst_value |
const element type More... | |
typedef Tarray::Tconst_pointer | Tconst_pointer |
Type of pointer to const element. More... | |
typedef Tarray::Tconst_reference | Tconst_reference |
Type of reference to const element. More... | |
typedef ConstCArray< T > | Tcontainer |
Type of this array. More... | |
typedef Tcontainer | Tcontainer_of_const |
Type of the array of const values. More... | |
typedef Tcontainer | Tcoc |
Short for Tcontainer_of_const. More... | |
Public Member Functions | |
Constructors | |
No copy constructors or copy operators are provided since this is provided as an interface class only. | |
ConstCArray (const Tarray &array) | |
construct from shape and representation More... | |
Shape access | |
const Tsize & | size (const Tsubscript &i) const |
size of dimension More... | |
const Tsize & | stride (const Tsubscript &i) const |
stride of dimension More... | |
const TSizeVec & | size () const |
size of dimensions More... | |
const TSizeVec & | stride () const |
strides of dimensions More... | |
Memory access | |
Tconst_pointer | pointer () const |
return pointer to first element in Fortran layout More... | |
template<class TT > | |
TT * | castedpointer () const |
return type-casted pointer to first element in Fortran layout More... | |
Protected Member Functions | |
const TSizeVec::Tvalue & | offset () const |
pass offset to derived class More... | |
Private Attributes | |
Trepresentation | Mrepresentation |
representation member More... | |
TSizeVec | Msize |
sizes of dimensions More... | |
TSizeVec | Mstride |
strides of dimensions More... | |
TSizeVec::Tvalue | Moffset |
offset to first index More... | |
Interface class to raw memory (C style array)
This class together with aff::CArray is provided as an interface for users which have to provide the contents of an array through raw memory pointers in C style. Both classes take an aff::ConstArray or aff::Array instance respectively as an argument for their constructor. They provide a pointer to raw memory through their member functions pointer() and castedpointer(). If a pointer p
to the raw memeory behind array
is defined by
then the array element array(i0,i1,i2,i3)
is addressed by
where the index value ranges are
i0=0
,1,... n0-1
i1=0
,1,... n1-1
i2=0
,1,... n2-1
i3=0
,1,... n3-1
and
n0=carray.size(0)
n1=carray.size(1)
n2=carray.size(2)
n3=carray.size(3)
and
s0=carray.stride(0)
s1=carray.stride(1)
s2=carray.stride(2)
s3=carray.stride(3)