Imagine++
|
nD array of variable size. More...
#include "Imagine/Common.h"
Public Types | |
typedef const T * | const_iterator |
Const iterator type. | |
typedef T * | iterator |
Iterator type. | |
Public Types inherited from Imagine::Array< T > | |
typedef const T * | const_iterator |
Const iterator type. | |
typedef T * | iterator |
Iterator type. | |
Public Member Functions | |
MultiArray () | |
Empty constructor. More... | |
MultiArray (const Coords< dim > &sz) | |
Constructor (known size). More... | |
MultiArray (int s0, int s1) | |
Constructor (2D shorcut). More... | |
MultiArray (int s0, int s1, int s2) | |
Constructor (3D shorcut). More... | |
MultiArray (T *ptr, const Coords< dim > &sz, bool handleDelete=false) | |
Constructor (pre-allocated). More... | |
MultiArray (T *ptr, int s0, int s1, bool handleDelete=false) | |
Constructor (pre-allocated) 2D alias. More... | |
MultiArray (T *ptr, int s0, int s1, int s2, bool handleDelete=false) | |
Constructor (pre-allocated) 3D alias. More... | |
MultiArray (const MultiArray &A) | |
Copy constructor. More... | |
template<typename T2 > | |
MultiArray (const MultiArray< T2, dim > &A) | |
Constructor (different type). More... | |
virtual | ~MultiArray () |
Destructor. More... | |
MultiArray | clone () const |
Cloning. More... | |
CoordsIterator< dim > | coordsBegin () const |
Begin coords iterator. More... | |
CoordsIterator< dim > | coordsEnd () const |
End coords iterator. More... | |
int | depth () const |
Size alias 2. More... | |
MultiArray & | fill (T x) |
Filling. More... | |
MultiArray | getSubArray (const Coords< dim > &offset, const Coords< dim > &sz) const |
Sub array. More... | |
int | height () const |
Size alias 1. More... | |
size_t | offset (const Coords< dim > &c) const |
Offset. More... | |
size_t | offset (int x, int y) const |
Offset (2D alias). More... | |
size_t | offset (int x, int y, int z) const |
Offset (3D alias). More... | |
const T & | operator() (const Coords< dim > &c) const |
Read access. More... | |
T & | operator() (const Coords< dim > &c) |
Write access. More... | |
const T & | operator() (int x, int y) const |
Read access 2D alias. More... | |
T & | operator() (int x, int y) |
Write access 2D alias. More... | |
const T & | operator() (int x, int y, int z) const |
Read access 3D alias. More... | |
T & | operator() (int x, int y, int z) |
Write access 3D alias. More... | |
MultiArray & | operator= (const MultiArray &A) |
Assignment. More... | |
template<typename T2 > | |
MultiArray & | operator= (const MultiArray< T2, dim > &A) |
Assignment (different type). More... | |
void | setSize (const Coords< dim > &sz) |
Change sizes. More... | |
void | setSize (int s0, int s1) |
Change size 2D alias. More... | |
void | setSize (int s0, int s1, int s2) |
Change size 3D alias. More... | |
int | size (int i) const |
ith size. More... | |
Coords< dim > | sizes () const |
Sizes. More... | |
FArray< size_t, dim > | stride () const |
Stride. More... | |
size_t | stride (int i) const |
ith stride. More... | |
size_t | totalSize () const |
Total Size. More... | |
int | width () const |
Size alias 0. More... | |
Public Member Functions inherited from Imagine::Array< T > | |
Array () | |
Empty constructor. More... | |
Array (size_t size) | |
Constructor (known size). More... | |
Array (T *ptr, size_t size, bool handleDelete=false) | |
Constructor (pre-allocated). More... | |
Array (const Array &A) | |
Copy constructor. More... | |
template<typename T2 > | |
Array (const Array< T2 > &A) | |
Constructor (different type). More... | |
Array (const std::list< T > &L) | |
Constructor (from list). More... | |
virtual | ~Array () |
Destructor. More... | |
iterator | begin () |
Begin iterator. More... | |
const_iterator | begin () const |
Begin const iterator. More... | |
Array | clone () const |
Cloning. More... | |
T * | data () |
Data pointer (read/write). More... | |
const T * | data () const |
Data pointer (read). More... | |
bool | empty () const |
Is empty. More... | |
iterator | end () |
End iterator. More... | |
const_iterator | end () const |
End const iterator. More... | |
Array & | fill (const T &x) |
Filling. More... | |
Array | getSubArray (size_t offset, size_t size) const |
Sub array. More... | |
bool | operator!= (const Array &A) const |
Inequality test. More... | |
Array & | operator= (const Array &A) |
Assignment. More... | |
template<typename T2 > | |
Array & | operator= (const Array< T2 > &A) |
Assignment (different type). More... | |
bool | operator== (const Array &A) const |
Equality test. More... | |
const T & | operator[] (size_t i) const |
Read access. More... | |
T & | operator[] (size_t i) |
Write access. More... | |
void | setSize (size_t size) |
Change size. More... | |
size_t | size () const |
Size. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const MultiArray &A) |
ASCII write. More... | |
std::istream & | operator>> (std::istream &in, MultiArray &A) |
ASCII read. More... | |
void | read (std::istream &in, MultiArray &A) |
Binary read. More... | |
void | write (std::ostream &out, const MultiArray &A) |
Binary write. More... | |
nD array of variable size. Memory is reference counted, i.e.:
T | value type |
dim | dimension |
|
inline |
Constructs an unallocated array of variables of type T and dimension dim
|
inlineexplicit |
Constructs an allocated array of variables of type T and dimension dim. sz[i] specifies size for dimension i.
sz | array sizes |
|
inline |
Constructs an allocated array of variables of type T, dimension 2 and specified size
s0 | array size for dimension 0 |
s1 | array size for dimension 1 |
|
inline |
Constructs an allocated array of variables of type T, dimension 3 and specified size
s0 | array size for dimension 0 |
s1 | array size for dimension 1 |
s2 | array size for dimension 2 |
|
inline |
Constructs an array of variables of type T and dimension dim, stored at an already allocated memory. ptr contains elements (0,0,...), (1,0,...), ... Does not allocate fresh memory. Does not free given memory at object destruction unless handleDelete=true. This memory must indeed stay available during object life.
ptr | address of memory |
sz | array sizes |
handleDelete | delete memory at destruction? (default=false) |
|
inline |
Constructs an array of variables of type T and dimension 2, stored at an already allocated memory. ptr contains elements (0,0), (1,0), ... Does not allocate fresh memory. Does not free given memory at object destruction unless handleDelete=true. This memory must indeed stay available during object life.
ptr | address of memory |
s0 | array size for dimension 0 |
s1 | array size for dimension 1 |
handleDelete | delete memory at destruction? (default=false) |
|
inline |
Constructs an array of variables of type T and dimension 3, stored at an already allocated memory. ptr contains elements (0,0,0), (1,0,0), ... Does not allocate fresh memory. Does not free given memory at object destruction unless handleDelete=true. This memory must indeed stay available during object life.
ptr | address of memory |
s0 | array size for dimension 0 |
s1 | array size for dimension 1 |
s2 | array size for dimension 2 |
handleDelete | delete memory at destruction? (default=false) |
|
inlineexplicit |
Constructs an nD array from another one (sharing memory!)
A | nD array to copy |
|
inline |
Constructs an nD array of type T from one of another type (thus without sharing memory!)
A | nD array to copy |
T2 | type of A |
|
inlinevirtual |
Reference counted desctructor: frees memory if the object is the last one to use it.
|
inline |
Clones: creates a new nD array, with fresh memory, copying values to it
|
inline |
Coordinates iterator over the array domain. Use this to iterates over an nD array if coordinates are needed (otherwise, use a standard Array::iterator)
|
inline |
Coordinates iterator over the array domain. Use this to iterates over an nD array if coordinates are needed (otherwise, use a standard Array::iterator)
|
inline |
|
inline |
Fills with constant value
x | value to be copied to each element |
|
inline |
Construct a sub array, i.e. a new array with fresh memory, initialized from a part of values of *this
offset | coordinates of first element of sub array |
sz | sizes of sub array |
|
inline |
|
inline |
Offset (i.e. index of coordinates in the underlying Array) given coordinates
c | coordinates in the MultiArray domain |
|
inline |
Offset (2D alias)
x,y | coordinates |
|
inline |
Offset (3D alias)
x,y,z | coordinates |
|
inline |
Reads element at coordinates c
c | coordinates |
|
inline |
Writes element at coordinates c
c | coordinates |
|
inline |
Read access 2D alias
x,y | coordinates |
|
inline |
Write access 2D alias
x,y | coordinates |
|
inline |
Read access 3D alias
x,y,z | coordinates |
|
inline |
Write access 3D alias
x,y,z | coordinates |
|
inline |
Assigns from another nD Array (sharing its memory)
A | array to be assigned to |
|
inline |
Assign from an array of another type (thus without sharing memory!)
A | array to copy |
T2 | type of A |
|
inline |
Resize nD array:
sz | array sizes |
|
inline |
Resize 2D array. 2D alias.
s0 | array size for dimension 0 |
s1 | array size for dimension 1 |
|
inline |
Resize 3D array. 3D alias.
s0 | array size for dimension 0 |
s1 | array size for dimension 1 |
s2 | array size for dimension 2 |
|
inline |
Size of nD Array along dimension i.
|
inline |
|
inline |
Stride of nD Array (stride(i) gives the distance to next element along dimension i)
|
inline |
ith stride of nD Array (distance to element along dimension i)
|
inline |
Number of elements
|
inline |
|
friend |
Writes Array to stream (size and values)
out | output stream |
A | MultiArray to write |
|
friend |
Reads and allocates Array from stream (providing size and values)
in | input stream |
A | MultiArray to read |
|
friend |
Reads and allocates Array from binary stream (providing size and values)
in | input stream |
A | MultiArray to read |
|
friend |
Writes Array to binary stream (size and values)
out | output stream |
A | MultiArray to write |