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

| ArrayVectorView |

`#include <vigra/array_vector.hxx>`

Inheritance diagram for ArrayVectorView:

List of all members.

## Public Types
typedef T | value_type
## Public Member Functions
| ArrayVectorView (this_type const &rhs)
| ArrayVectorView (size_type size, pointer const &data)
| ArrayVectorView ()
const_reference | back () const
reference | back ()
iterator | begin ()
const_iterator | begin () const
template<class U>
void | copy (ArrayVectorView< U > const &rhs)
void | copy (this_type const &rhs)
pointer | data ()
const_pointer | data () const
bool | empty () const
iterator | end ()
const_iterator | end () const
const_reference | front () const
reference | front ()
template<class U>
void | init (U const &initial)
bool | isInside (difference_type const &p) const
template<class U>
bool | operator!= (ArrayVectorView< U > const &rhs) const
template<class U>
this_type & | operator= (ArrayVectorView< U > const &rhs)
ArrayVectorView & | operator= (ArrayVectorView const &rhs)
template<class U>
bool | operator== (ArrayVectorView< U > const &rhs) const
const_reference | operator[] (difference_type i) const
reference | operator[] (difference_type i)
const_reverse_iterator | rbegin () const
reverse_iterator | rbegin ()
const_reverse_iterator | rend () const
reverse_iterator | rend ()
size_type | size () const
this_type | subarray (size_type begin, size_type end) const
template<class U>
void | swapData (ArrayVectorView< U > rhs)
void | swapData (this_type rhs)

## Detailed Description

### template<class T>
class vigra::ArrayVectorView< T >

Provide STL conforming interface for C-arrays.

This template implements much of the functionality of `std::vector` on top of a C-array. `ArrayVectorView` does not manage the memory it refers to (i.e. it does not allocate or deallocate any memory). Thus, if the underlying memory changes, all dependent `ArrayVectorView` objects are invalidated. This is especially important when `ArrayVectorView` is used as a base class for `ArrayVector`, where several functions (e.g. resize(), insert()) can allocate new memory and thus invalidate the dependent views. The rules what operations invalidate view objects are the same as the rules concerning standard iterators.

#include <vigra/array_vector.hxx>
Namespace: vigra

## Member Typedef Documentation

typedef T value_type

default constructor

Reimplemented in ArrayVector, ArrayVector< hsize_t >, ArrayVector< double >, ArrayVector< LabelType >, ArrayVector< ClassLabelType >, ArrayVector< int >, ArrayVector< vigra::detail::DecisionTree >, ArrayVector< std::ptrdiff_t >, ArrayVector< T >, ArrayVector< INT >, ArrayVector< ptrdiff_t >, ArrayVector< vigra::NonparametricNoiseNormalizationFunctor::Segment >, ArrayVector< vigra::detail::DecisionTreeDeprec >, ArrayVector< ImageType, Alloc >, ArrayVector< unsigned char >, ArrayVector< ARITHTYPE >, ArrayVector< bool >, ArrayVector< std::pair< detail::SelectIntegerType< 32, detail::SignedIntTypes >::type, double > >, ArrayVector< fftw_complex >, and ArrayVector< Int32 >.

## Constructor & Destructor Documentation

ArrayVectorView | ( |  | ) |

default constructor. View contains NULL pointer.

ArrayVectorView | ( | size_type | size,
|  | pointer const & | data |
| ) |  |  |

Construct for given array data of length size. `data, data+size` must form a valid range.

ArrayVectorView | ( | this_type const & | rhs | ) |

Copy constructor.

## Member Function Documentation

const_reference back | ( |  | ) | const

Read last array element.

reference back | ( |  | ) |

Access last array element.

iterator begin | ( |  | ) |

Get iterator refering to the first array element.

const_iterator begin | ( |  | ) | const

Get const iterator refering to the first array element.

template<class U>
void copy | ( | ArrayVectorView< U > const & | rhs | ) |

Copy array elements. When the shapes of the two arrays match, the array contents (not the pointers) are copied. Otherwise, a `PreconditionViolation` exception is thrown.

void copy | ( | this_type const & | rhs | ) |

Copy array elements. When the shapes of the two arrays match, the array contents (not the pointers) are copied. Otherwise, a `PreconditionViolation` exception is thrown.

pointer data | ( |  | ) |

Get contained pointer to the data.

const_pointer data | ( |  | ) | const

Get contained const pointer to the data.

bool empty | ( |  | ) | const

Equivalent to `size() == 0`.

iterator end | ( |  | ) |

Get iterator pointing beyond the last array element.

const_iterator end | ( |  | ) | const

Get const iterator pointing beyond the last array element.

const_reference front | ( |  | ) | const

Read first array element.

reference front | ( |  | ) |

Access first array element.

template<class U>
void init | ( | U const & | initial | ) |

Overwrite all array elements with the value initial.

bool isInside | ( | difference_type const & | p | ) | const

check whether the given point is in the array range.

template<class U>
bool operator!= | ( | ArrayVectorView< U > const & | rhs | ) | const

check whether two arrays are not elementwise equal. Also returns `true` if the two arrays have different sizes.

this_type& operator= | ( | ArrayVectorView< U > const & | rhs | ) |

Copy assignment. When the shapes of the two arrays match, the array contents (not the pointers) are copied. Otherwise, a `PreconditionViolation` exception is thrown.

Reimplemented in ArrayVector, ArrayVector< hsize_t >, ArrayVector< double >, ArrayVector< LabelType >, ArrayVector< ClassLabelType >, ArrayVector< int >, ArrayVector< vigra::detail::DecisionTree >, ArrayVector< std::ptrdiff_t >, ArrayVector< T >, ArrayVector< INT >, ArrayVector< ptrdiff_t >, ArrayVector< vigra::NonparametricNoiseNormalizationFunctor::Segment >, ArrayVector< vigra::detail::DecisionTreeDeprec >, ArrayVector< ImageType, Alloc >, ArrayVector< unsigned char >, ArrayVector< ARITHTYPE >, ArrayVector< bool >, ArrayVector< std::pair< detail::SelectIntegerType< 32, detail::SignedIntTypes >::type, double > >, ArrayVector< fftw_complex >, and ArrayVector< Int32 >.

ArrayVectorView< T > & operator= | ( | ArrayVectorView< T > const & | rhs | ) |

Copy assignment. There are 3 cases:

- When this `ArrayVectorView` does not point to valid data (e.g. after default construction), it becomes a copy of rhs.
- When the shapes of the two arrays match, the array contents (not the pointers) are copied.
- Otherwise, a `PreconditionViolation` exception is thrown.

template<class U>
bool operator== | ( | ArrayVectorView< U > const & | rhs | ) | const

Check for element-wise equality of two array. Also returns `false` if the two arrays have different sizes.

const_reference operator[] | ( | difference_type | i | ) | const

Read array element i.

reference operator[] | ( | difference_type | i | ) |

Access array element i.

const_reverse_iterator rbegin | ( |  | ) | const

Get const reverse iterator referring to the last array element.

reverse_iterator rbegin | ( |  | ) |

Get reverse iterator referring to the last array element.

const_reverse_iterator rend | ( |  | ) | const

Get const reverse iterator pointing before the first array element.

reverse_iterator rend | ( |  | ) |

Get reverse iterator pointing before the first array element.

size_type size | ( |  | ) | const

Number of elements in the array.

this_type subarray | ( | size_type | begin,
|  | size_type | end |
| ) |  |  | const

Construct `ArrayVectorView` refering to a subarray. begin and end must be a valid sub-range of the current array. Otherwise, a `PreconditionViolation` exception is thrown.

template<class U>
void swapData | ( | ArrayVectorView< U > | rhs | ) |

Swap array elements. When the shapes of the two arrays match, the array contents (not the pointers) are swapped. Otherwise, a `PreconditionViolation` exception is thrown.

void swapData | ( | this_type | rhs | ) |

Swap array elements. When the shapes of the two arrays match, the array contents (not the pointers) are swapped. Otherwise, a `PreconditionViolation` exception is thrown.

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

- vigra/array_vector.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.7.1 (3 Dec 2010)