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

details IteratorTraits Struct Template Reference VIGRA

Export associated information for each image iterator. More...

#include "vigra/iteratortraits.hxx"



Detailed Description


template<class T>
struct vigra::IteratorTraits< T >

Export associated information for each image iterator.

The IteratorTraits class contains the following fields:

    template <class T> 
    struct IteratorTraits 
    {
        typedef T                                     Iterator;
        typedef Iterator                              iterator;
        typedef typename iterator::iterator_category  iterator_category;
        typedef typename iterator::value_type         value_type;
        typedef typename iterator::reference          reference;
        typedef typename iterator::index_reference    index_reference;
        typedef typename iterator::pointer            pointer;
        typedef typename iterator::difference_type    difference_type;
        typedef typename iterator::row_iterator       row_iterator;
        typedef typename iterator::column_iterator    column_iterator;
        typedef StandardAccessor<value_type>          DefaultAccessor;
        typedef StandardAccessor<value_type>          default_accessor;
    };

By (partially) specializing this template for an iterator class the defaults given above can be changed as approiate. For example, iterators for rgb images are associated with RGBAccessor<value_type> instead of StandardAccessor<value_type>. To get the accessor associated with a given iterator, use code like this:

    template <class Iterator>
    void foo(Iterator i)
    {
        typedef typename IteratorTraits<Iterator>::DefaultAccessor Accessor;
        Accessor a;
        ...
    }

This technique is, for example, used by the Iterator Based Argument Object Factories. The possibility to retrieve the default accessor by means of a traits class is especially important since this information is not contained in the iterator directly.

#include "vigra/iteratortraits.hxx" Namespace: vigra


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

© Ullrich Köthe (koethe@informatik.uni-hamburg.de)
Cognitive Systems Group, University of Hamburg, Germany

html generated using doxygen and Python
VIGRA 1.2.0 (7 Aug 2003)