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

VectorAccessor< VECTOR > Class Template Reference

Accessor for items that are STL compatible vectors. More...

`#include <vigra/accessor.hxx>`

Inheritance diagram for VectorAccessor< VECTOR >:

## Public Types

typedef VECTOR::value_type | component_type
typedef VectorElementAccessor< VectorAccessor< VECTOR > > | ElementAccessor
Public Types inherited from SequenceAccessor< VECTOR >
typedef SEQUENCE::value_type | component_type
Public Types inherited from StandardAccessor< VALUETYPE >
typedef VALUETYPE | value_type

## Public Member Functions

template<class ITERATOR >
component_type const & | getComponent (ITERATOR const &i, int idx) const
template<class ITERATOR , class OFFSET >
component_type const & | getComponent (ITERATOR const &i, OFFSET const &diff, int idx) const
template<class V , class ITERATOR >
void | setComponent (V const &value, ITERATOR const &i, int idx) const
template<class V , class ITERATOR , class OFFSET >
void | setComponent (V const &value, ITERATOR const &i, OFFSET const &diff, int idx) const
Public Member Functions inherited from SequenceAccessor< VECTOR >
iterator | begin (ITERATOR const &i) const
iterator | begin (ITERATOR const &i, OFFSET const &diff) const
iterator | end (ITERATOR const &i) const
iterator | end (ITERATOR const &i, OFFSET const &diff) const
unsigned int | size (ITERATOR const &i) const
unsigned int | size (ITERATOR const &i, OFFSET const &diff) const
Public Member Functions inherited from StandardAccessor< VALUETYPE >
template<class ITERATOR >
VALUETYPE const & | operator() (ITERATOR const &i) const
template<class ITERATOR , class OFFSET >
VALUETYPE const & | operator() (ITERATOR const &i, OFFSET const &diff) const
template<class V , class ITERATOR >
void | set (V const &value, ITERATOR const &i) const
template<class V , class ITERATOR , class OFFSET >
void | set (V const &value, ITERATOR const &i, OFFSET const &diff) const

## Detailed Description

template<class VECTOR>
class vigra::VectorAccessor< VECTOR >

Accessor for items that are STL compatible vectors.

It encapsulates access to a vector's access functionality.

Usage:

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

The accessor has two modes of operation:

1. Access the vector's iterator via the `begin()` and `end()` functions:

   typedef std::list<std::vector<int> > ListOfVectors;
   ListOfVectors ll;
   ...
   typedef vigra::SequenceAccessor<ListOfVectors::value_type> ListOfVectorsAccessor;
   ListOfVectorsAccessor a;
   for(ListOfVectors::iterator li = ll.begin(); li != ll.end(); ++li)
   {
   for(ListOfVectorsAccessor::iterator i = a.begin(li); i != a.end(li); ++i)
   {
   *i = 10;
   }
   }
   vigra::RGBValue
   Class for a single RGB value.
   Definition rgbvalue.hxx:128
   vigra::TinyVectorBase::end
   iterator end()
   Definition tinyvector.hxx:864
   vigra::TinyVectorBase::begin
   iterator begin()
   Definition tinyvector.hxx:861
2. Access the vector's components via an index (internally calls the vector's `operator[]` ):
   typedef std::list<std::vector<int> > ListOfVectors;
   ListOfVectors ll;
   ...
   typedef vigra::SequenceAccessor<ListOfVectors::value_type> ListOfVectorsAccessor;
   ListOfVectorsAccessor a;
   for(ListOfVectors::iterator li = ll.begin(); li != ll.end(); ++li)
   {
   for(int i = 0; i != a.size(li); ++i)
   {
   a.setComponent(10, li, i);
   }
   }
   vigra::TinyVectorBase::size
   size_type size() const
   Definition tinyvector.hxx:913

Required Interface:

VECTOR v;
VECTOR::iterator i;
value_type d;
int index;
d = v[index];
v[index] = d;
i = v.begin();
i = v.end();
v.size();

## Member Typedef Documentation

## ◆ component_type

template<class VECTOR >

typedef VECTOR::value_type component_type

the vector's value_type

## ◆ ElementAccessor

template<class VECTOR >

typedef VectorElementAccessor<VectorAccessor<VECTOR> > ElementAccessor

the vector element accessor associated with this vector accessor (see VectorElementAccessor)

## Member Function Documentation

## ◆ getComponent() [1/2]

template<class VECTOR >
template<class ITERATOR >

component_type const & getComponent | ( | ITERATOR const & | i,
|  | int | idx
| ) |  | const

Read the component data at given vector index at given iterator position

## ◆ setComponent() [1/2]

template<class VECTOR >
template<class V , class ITERATOR >

void setComponent | ( | V const & | value,
|  | ITERATOR const & | i,
|  | int | idx
| ) |  | const

Set the component data at given vector index at given iterator position. The type `V` of the passed in `value` is automatically converted to `component_type`. In case of a conversion floating point -> integral this includes rounding and clipping.

## ◆ getComponent() [2/2]

template<class VECTOR >
template<class ITERATOR , class OFFSET >

component_type const & getComponent | ( | ITERATOR const & | i,
|  | OFFSET const & | diff,
|  | int | idx
| ) |  | const

Read the component data at given vector index at an offset of given iterator position

## ◆ setComponent() [2/2]

template<class VECTOR >
template<class V , class ITERATOR , class OFFSET >

void setComponent | ( | V const & | value,
|  | ITERATOR const & | i,
|  | OFFSET const & | diff,
|  | int | idx
| ) |  | const

Set the component data at given vector index at an offset of given iterator position. The type `V` of the passed in `value` is automatically converted to `component_type`. In case of a conversion floating point -> integral this includes rounding and clipping.

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

- vigra/accessor.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.12.2