VIGRA - VIGRA: MultiArray Class Template Reference

[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

| MultiArray |

Main `MultiArray` class containing the memory management. More...

`#include <vigra/multi_array.hxx>`

Inheritance diagram for MultiArray:

List of all members.

## 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
## Public Member Functions
allocator_type const & | allocator () const
const_iterator | begin () const
iterator | begin ()
const_iterator | end () const
iterator | end ()
template<class U>
MultiArray & | init (const U &init)
template<class U, class C>
| MultiArray (const MultiArrayView< N, U, C > &rhs, allocator_type const &alloc=allocator_type())
| MultiArray (const MultiArray &rhs)
| MultiArray (const difference_type &shape, const_pointer init, allocator_type const &alloc=allocator_type())
| MultiArray (const difference_type &shape, const_reference init, allocator_type const &alloc=allocator_type())
| MultiArray (const difference_type &shape, allocator_type const &alloc=allocator_type())
| MultiArray (allocator_type const &alloc)
| MultiArray ()
MultiArray & | operator*= (const T &rhs)
template<class U, class C>
MultiArray & | operator*= (const MultiArrayView< N, U, C > &rhs)
MultiArray & | operator+= (const T &rhs)
template<class U, class C>
MultiArray & | operator+= (const MultiArrayView< N, U, C > &rhs)
MultiArray & | operator-= (const T &rhs)
template<class U, class C>
MultiArray & | operator-= (const MultiArrayView< N, U, C > &rhs)
MultiArray & | operator/= (const T &rhs)
template<class U, class C>
MultiArray & | operator/= (const MultiArrayView< N, U, C > &rhs)
template<class U, class C>
MultiArray & | operator= (const MultiArrayView< N, U, C > &rhs)
MultiArray & | operator= (const MultiArray &rhs)
void | reshape (const difference_type &shape, const_reference init)
void | reshape (const difference_type &shape)
void | swap (MultiArray &other)
| ~MultiArray ()
## Protected Member Functions
template<class U, class C>
void | allocate (pointer &ptr, MultiArrayView< N, U, C > const &init)
template<class U>
void | allocate (pointer &ptr, difference_type_1 s, U const *init)
void | allocate (pointer &ptr, difference_type_1 s, const_reference init)
void | deallocate (pointer &ptr, difference_type_1 s)
## Protected Attributes
allocator_type | m_alloc

## Detailed Description

### template<unsigned int N, class T, class A>
class vigra::MultiArray< N, T, A >

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

        N: the array dimension

        T: the type of the array elements

        A: the allocator used for internal storage management
           (default: std::allocator<T>)

#include <vigra/multi_array.hxx>

Namespace: vigra

## Member Typedef Documentation

template<class U, class C>
typedef A allocator_type

the allocator type used to allocate the memory

Reimplemented in Matrix.

typedef T* const_iterator

sequential (random access) const iterator type

typedef view_type::const_pointer const_pointer

const pointer type

Reimplemented from MultiArrayView< N, T >.

Reimplemented in Matrix.

typedef view_type::const_reference const_reference

const reference type (result of operator[] const)

Reimplemented from MultiArrayView< N, T >.

Reimplemented in Matrix.

typedef vigra::detail::MultiIteratorChooser< UnstridedArrayTag>::template Traverser<N, T, T const &, T const *>::type const_traverser

traverser type to const data

Reimplemented from MultiArrayView< N, T >.

typedef view_type::difference_type difference_type

difference type (used for multi-dimensional offsets and indices)

Reimplemented from MultiArrayView< N, T >.

Reimplemented in Matrix.

template<class U>
typedef view_type::difference_type_1 difference_type_1

difference and index type for a single dimension

Reimplemented from MultiArrayView< N, T >.

Reimplemented in Matrix.

typedef T* iterator

sequential (random access) iterator type

typedef MultiArray<N, T, A> matrix_type

the matrix type associated with this array.

Reimplemented from MultiArrayView< N, T >.

Reimplemented in Matrix.

template<class U, class C>
typedef view_type::pointer pointer

pointer type

Reimplemented from MultiArrayView< N, T >.

Reimplemented in Matrix.

typedef view_type::reference reference

reference type (result of operator[])

Reimplemented from MultiArrayView< N, T >.

Reimplemented in Matrix.

typedef view_type::size_type size_type

size type

Reimplemented from MultiArrayView< N, T >.

typedef vigra::detail::MultiIteratorChooser< UnstridedArrayTag>::template Traverser<N, T, T &, T *>::type traverser

traverser type

Reimplemented from MultiArrayView< N, T >.

typedef view_type::value_type value_type

the array's value type

Reimplemented from MultiArrayView< N, T >.

Reimplemented in Matrix.

typedef MultiArrayView<N, T> view_type

the view type associated with this array.

Reimplemented from MultiArrayView< N, T >.

Reimplemented in Matrix.

## Constructor & Destructor Documentation

MultiArray | ( |  | ) |

default constructor

MultiArray | ( | allocator_type const & | alloc | ) |

construct with given allocator

MultiArray | ( | const difference_type & | shape,
|  | allocator_type const & | alloc = `allocator_type()` |
| ) |  |  | `[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 | ( | const MultiArrayView< N, U, C > & | rhs,
|  | allocator_type const & | alloc = `allocator_type()` |
| ) |  |  |

construct by copying from a MultiArrayView

~MultiArray | ( |  | ) |

destructor

## Member Function Documentation

void allocate | ( | pointer & | ptr,
|  | MultiArrayView< N, U, C > const & | init |
| ) |  |  | `[protected]`

allocate memory, write its address into the given pointer and initialize it by copying the data from the given MultiArrayView.

void allocate | ( | pointer & | ptr,
|  | difference_type_1 | s,
|  | U const * | init |
| ) |  |  | `[protected]`

allocate memory for s pixels, write its address into the given pointer and initialize the linearized pixels to the values of init.

void allocate | ( | pointer & | ptr,
|  | difference_type_1 | s,
|  | const_reference | init |
| ) |  |  | `[protected]`

allocate memory for s pixels, write its address into the given pointer and initialize the pixels with init.

allocator_type const& allocator | ( |  | ) | const

get the allocator.

const_iterator begin | ( |  | ) | const

sequential const iterator pointing to the first array element.

iterator begin | ( |  | ) |

sequential iterator pointing to the first array element.

void deallocate | ( | pointer & | ptr,
|  | difference_type_1 | s |
| ) |  |  | `[protected]`

deallocate the memory (of length s) starting at the given address.

const_iterator end | ( |  | ) | const

sequential const iterator pointing beyond the last array element.

iterator end | ( |  | ) |

sequential iterator pointing beyond the last array element.

MultiArray& init | ( | const U & | init | ) |

init elements with a constant

Reimplemented from MultiArrayView< N, T >.

Reimplemented in Matrix.

MultiArray& operator*= | ( | const T & | rhs | ) |

Multiply-assignment of a scalar.

Reimplemented from MultiArrayView< N, T >.

MultiArray& operator*= | ( | const MultiArrayView< N, U, C > & | rhs | ) |

Multiply-assignment from arbitrary MultiArrayView. Fails with `PreconditionViolation` exception when the shapes do not match.

MultiArray& operator+= | ( | const T & | rhs | ) |

Add-assignment of a scalar.

Reimplemented from MultiArrayView< N, T >.

MultiArray& operator+= | ( | const MultiArrayView< N, U, C > & | rhs | ) |

Add-assignment from arbitrary MultiArrayView. Fails with `PreconditionViolation` exception when the shapes do not match.

MultiArray& operator-= | ( | const T & | rhs | ) |

Subtract-assignment of a scalar.

Reimplemented from MultiArrayView< N, T >.

MultiArray& operator-= | ( | const MultiArrayView< N, U, C > & | rhs | ) |

Subtract-assignment from arbitrary MultiArrayView. Fails with `PreconditionViolation` exception when the shapes do not match.

MultiArray& operator/= | ( | const T & | rhs | ) |

Divide-assignment of a scalar.

Reimplemented from MultiArrayView< N, T >.

MultiArray& operator/= | ( | const MultiArrayView< N, U, C > & | rhs | ) |

Divide-assignment from arbitrary MultiArrayView. Fails with `PreconditionViolation` exception when the shapes do not match.

MultiArray& operator= | ( | const MultiArrayView< N, U, C > & | 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= | ( | 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.

void reshape | ( | const difference_type & | shape,
|  | const_reference | init |
| ) |  |  |

change the shape, allocate new memory and initialize it with the given value.
Note: this operation invalidates all dependent objects (array views and iterators)

void reshape | ( | const difference_type & | shape | ) |

change the shape and allocate new memory.
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)

## Member Data Documentation

allocator_type m_alloc`[protected]`

the allocator used to allocate the memory

The documentation for this class was generated from the following file:

- vigra/multi_array.hxx

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python VIGRA 1.6.0 (13 Aug 2008)