[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
Main MultiArray
class containing the memory management.
More...
#include <vigra/multi_array.hxx>
Public Types | |
typedef A | allocator_type |
typedef T * | const_iterator |
typedef view_type::const_pointer | const_pointer |
typedef view_type::const_reference | const_reference |
typedef vigra::detail::MultiIteratorChooser < UnstridedArrayTag > ::template Traverser< N, T, T const &, T const * >::type | const_traverser |
typedef view_type::difference_type | difference_type |
typedef view_type::difference_type_1 | difference_type_1 |
typedef T * | iterator |
typedef MultiArray< N, T, A > | matrix_type |
typedef view_type::pointer | pointer |
typedef view_type::reference | reference |
typedef view_type::size_type | size_type |
typedef vigra::detail::MultiIteratorChooser < UnstridedArrayTag > ::template Traverser< N, T, T &, T * >::type | traverser |
typedef view_type::value_type | value_type |
typedef MultiArrayView< N, T > | view_type |
![]() | |
enum | ActualDimension |
typedef StridedScanOrderIterator < actual_dimension, T, T const &, T const * > | const_iterator |
typedef const value_type * | const_pointer |
typedef const value_type & | const_reference |
typedef vigra::detail::MultiIteratorChooser < StrideTag >::template Traverser< actual_dimension, T, T const &, T const * >::type | const_traverser |
typedef MultiArrayShape < actual_dimension >::type | difference_type |
typedef MultiArrayIndex | difference_type_1 |
typedef StridedScanOrderIterator < actual_dimension, T, T &, T * > | iterator |
typedef MultiArray< N, T > | matrix_type |
typedef value_type * | pointer |
typedef value_type & | reference |
typedef difference_type | size_type |
typedef vigra::detail::MultiIteratorChooser < StrideTag >::template Traverser< actual_dimension, T, T &, T * >::type | traverser |
typedef T | value_type |
typedef MultiArrayView< N, T, StrideTag > | view_type |
Protected Member Functions | |
void | allocate (pointer &ptr, difference_type_1 s, const_reference init) |
template<class U > | |
void | allocate (pointer &ptr, difference_type_1 s, U const *init) |
template<class U , class StrideTag > | |
void | allocate (pointer &ptr, MultiArrayView< N, U, StrideTag > const &init) |
void | deallocate (pointer &ptr, difference_type_1 s) |
Protected Attributes | |
allocator_type | m_alloc |
![]() | |
pointer | m_ptr |
difference_type | m_shape |
difference_type | m_stride |
Additional Inherited Members | |
![]() | |
static difference_type | strideOrdering (difference_type strides) |
Main MultiArray
class containing the memory management.
This class inherits the interface of MultiArrayView, and implements the memory ownership. MultiArray's are always unstrided, striding them creates a MultiArrayView.
The template parameters are as follows
#include <vigra/multi_array.hxx>
Namespace: vigra
typedef A allocator_type |
the allocator type used to allocate the memory
typedef MultiArrayView<N, T> view_type |
the view type associated with this array.
typedef MultiArray<N, T, A> matrix_type |
the matrix type associated with this array.
typedef view_type::value_type value_type |
the array's value type
typedef view_type::pointer pointer |
pointer type
const pointer type
typedef view_type::reference reference |
reference type (result of operator[])
const reference type (result of operator[] const)
typedef view_type::size_type size_type |
size type
difference type (used for multi-dimensional offsets and indices)
difference and index type for a single dimension
typedef vigra::detail::MultiIteratorChooser< UnstridedArrayTag>::template Traverser<N, T, T &, T *>::type traverser |
traverser type
typedef vigra::detail::MultiIteratorChooser< UnstridedArrayTag>::template Traverser<N, T, T const &, T const *>::type const_traverser |
traverser type to const data
typedef T* iterator |
sequential (random access) iterator type
typedef T* const_iterator |
sequential (random access) const iterator type
MultiArray | ( | ) |
default constructor
MultiArray | ( | allocator_type const & | alloc) |
construct with given allocator
|
explicit |
construct with given length
Use only for 1-dimensional arrays (N==1
).
|
explicit |
construct with given shape
MultiArray | ( | const difference_type & | shape, |
const_reference | init, | ||
allocator_type const & | alloc = allocator_type() |
||
) |
construct from shape with an initial value
MultiArray | ( | const difference_type & | shape, |
const_pointer | init, | ||
allocator_type const & | alloc = allocator_type() |
||
) |
construct from shape and copy values from the given array
MultiArray | ( | const MultiArray< N, T, A > & | rhs) |
copy constructor
MultiArray | ( | multi_math::MultiMathOperand< Expression > const & | rhs, |
allocator_type const & | alloc = allocator_type() |
||
) |
constructor from an array expression
MultiArray | ( | const MultiArrayView< N, U, StrideTag > & | rhs, |
allocator_type const & | alloc = allocator_type() |
||
) |
construct by copying from a MultiArrayView
~MultiArray | ( | ) |
destructor
|
protected |
allocate memory for s pixels, write its address into the given pointer and initialize the pixels with init.
|
protected |
allocate memory for s pixels, write its address into the given pointer and initialize the linearized pixels to the values of init.
|
protected |
allocate memory, write its address into the given pointer and initialize it by copying the data from the given MultiArrayView.
|
protected |
deallocate the memory (of length s) starting at the given address.
MultiArray& operator= | ( | const MultiArray< N, T, A > & | rhs) |
assignment.
If the size of rhs is the same as the left-hand side arrays's old size, only the data are copied. Otherwise, new storage is allocated, which invalidates all objects (array views, iterators) depending on the lhs array.
MultiArray& operator= | ( | const MultiArrayView< N, U, StrideTag > & | rhs) |
assignment from arbitrary MultiArrayView.
If the size of rhs is the same as the left-hand side arrays's old size, only the data are copied. Otherwise, new storage is allocated, which invalidates all objects (array views, iterators) depending on the lhs array.
MultiArray& operator= | ( | value_type const & | v) |
assignment from scalar.
Equivalent to MultiArray::init(v).
MultiArray& operator+= | ( | const MultiArrayView< N, U, StrideTag > & | rhs) |
Add-assignment from arbitrary MultiArrayView. Fails with PreconditionViolation
exception when the shapes do not match. If the left array has no data (hasData() is false), this function is equivalent to a normal assignment (i.e. an empty array is interpreted as a zero-array of appropriate size).
MultiArray& operator-= | ( | const MultiArrayView< N, U, StrideTag > & | rhs) |
Subtract-assignment from arbitrary MultiArrayView. Fails with PreconditionViolation
exception when the shapes do not match. If the left array has no data (hasData() is false), this function is equivalent to an assignment of the negated rhs (i.e. an empty array is interpreted as a zero-array of appropriate size).
MultiArray& operator*= | ( | const MultiArrayView< N, U, StrideTag > & | rhs) |
Multiply-assignment from arbitrary MultiArrayView. Fails with PreconditionViolation
exception when the shapes do not match. If the left array has no data (hasData() is false), this function is equivalent to reshape(rhs.shape()) with zero initialisation (i.e. an empty array is interpreted as a zero-array of appropriate size).
MultiArray& operator/= | ( | const MultiArrayView< N, U, StrideTag > & | rhs) |
Divide-assignment from arbitrary MultiArrayView. Fails with PreconditionViolation
exception when the shapes do not match. If the left array has no data (hasData() is false), this function is equivalent to reshape(rhs.shape()) with zero initialisation (i.e. an empty array is interpreted as a zero-array of appropriate size).
MultiArray& operator+= | ( | const T & | rhs) |
Add-assignment of a scalar.
MultiArray& operator-= | ( | const T & | rhs) |
Subtract-assignment of a scalar.
MultiArray& operator*= | ( | const T & | rhs) |
Multiply-assignment of a scalar.
MultiArray& operator/= | ( | const T & | rhs) |
Divide-assignment of a scalar.
MultiArray& operator= | ( | multi_math::MultiMathOperand< Expression > const & | rhs) |
Assignment of an array expression. Fails with PreconditionViolation
exception when the shapes do not match.
MultiArray& operator+= | ( | multi_math::MultiMathOperand< Expression > const & | rhs) |
Add-assignment of an array expression. Fails with PreconditionViolation
exception when the shapes do not match.
MultiArray& operator-= | ( | multi_math::MultiMathOperand< Expression > const & | rhs) |
Subtract-assignment of an array expression. Fails with PreconditionViolation
exception when the shapes do not match.
MultiArray& operator*= | ( | multi_math::MultiMathOperand< Expression > const & | rhs) |
Multiply-assignment of an array expression. Fails with PreconditionViolation
exception when the shapes do not match.
MultiArray& operator/= | ( | multi_math::MultiMathOperand< Expression > const & | rhs) |
Divide-assignment of an array expression. Fails with PreconditionViolation
exception when the shapes do not match.
MultiArray& init | ( | const U & | init) |
init elements with a constant
void reshape | ( | const difference_type & | shape) |
Allocate new memory with the given shape and initialize with zeros.
Note: this operation invalidates all dependent objects (array views and iterators)
void reshape | ( | const difference_type & | shape, |
const_reference | init | ||
) |
Allocate new memory with the given shape and initialize it with the given value.
Note: this operation invalidates all dependent objects (array views and iterators)
void swap | ( | MultiArray< N, T, A > & | other) |
Swap the contents with another MultiArray. This is fast, because no data are copied, but only pointers and shapes swapped. Note: this operation invalidates all dependent objects (array views and iterators)
iterator begin | ( | ) |
sequential iterator pointing to the first array element.
iterator end | ( | ) |
sequential iterator pointing beyond the last array element.
const_iterator begin | ( | ) | const |
sequential const iterator pointing to the first array element.
const_iterator end | ( | ) | const |
sequential const iterator pointing beyond the last array element.
allocator_type const& allocator | ( | ) | const |
get the allocator.
|
protected |
the allocator used to allocate the memory
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |
html generated using doxygen and Python
|