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

details ArrayVectorView< T > Class Template Reference VIGRA

#include <vigra/array_vector.hxx>

Inheritance diagram for ArrayVectorView< T >:
ArrayVector< T > ArrayVector< T, Alloc >

Public Types

typedef T value_type
 

Public Member Functions

 ArrayVectorView ()
 
 ArrayVectorView (size_type size, pointer const &data)
 
 ArrayVectorView (this_type const &rhs)
 
reference back ()
 
const_reference back () const
 
const_iterator begin () const
 
iterator begin ()
 
const_iterator cbegin () const
 
const_iterator cend () const
 
void copy (this_type const &rhs)
 
template<class U >
void copy (ArrayVectorView< U > const &rhs)
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 
const_pointer data () const
 
pointer data ()
 
bool empty () const
 
const_iterator end () const
 
iterator end ()
 
reference front ()
 
const_reference front () const
 
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
 
ArrayVectorViewoperator= (ArrayVectorView const &rhs)
 
template<class U >
this_typeoperator= (ArrayVectorView< U > const &rhs)
 
template<class U >
bool operator== (ArrayVectorView< U > const &rhs) 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 () const
 
size_type size () const
 
this_type subarray (size_type begin, size_type end) const
 
void swapData (this_type rhs)
 
template<class U >
void swapData (ArrayVectorView< U > 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

Constructor & Destructor Documentation

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

ArrayVectorView& 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.
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.

void init ( U const &  initial)

Overwrite all array elements with the value initial.

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.

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 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.

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.

this_type subarray ( size_type  begin,
size_type  end 
) const

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

const_pointer data ( ) const

Get contained const pointer to the data.

pointer data ( )

Get contained pointer to the data.

const_iterator begin ( ) const

Get const iterator referring to the first array element.

iterator begin ( )

Get iterator referring to the first array element.

const_iterator end ( ) const

Get const iterator pointing beyond the last array element.

iterator end ( )

Get iterator pointing beyond the last array element.

const_iterator cbegin ( ) const

Get const iterator referring to the first array element.

const_iterator cend ( ) const

Get const iterator pointing beyond the last array element.

reverse_iterator rbegin ( )

Get reverse iterator referring to the last array element.

const_reverse_iterator rbegin ( ) const

Get const reverse iterator referring to the last array element.

reverse_iterator rend ( )

Get reverse iterator pointing before the first array element.

const_reverse_iterator rend ( ) const

Get const reverse iterator pointing before the first array element.

const_reverse_iterator crbegin ( ) const

Get const reverse iterator referring to the last array element.

const_reverse_iterator crend ( ) const

Get const reverse iterator pointing before the first array element.

reference front ( )

Access first array element.

const_reference front ( ) const

Read first array element.

reference back ( )

Access last array element.

const_reference back ( ) const

Read last array element.

reference operator[] ( difference_type  i)

Access array element i.

const_reference operator[] ( difference_type  i) const

Read array element i.

bool empty ( ) const

Equivalent to size() == 0.

size_type size ( ) const

Number of elements in the array.

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.

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.

bool isInside ( difference_type const &  p) const

check whether the given point is in the array range.


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

© 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.11.1 (Fri May 19 2017)