OpenGM  2.3.x
Discrete Graphical Model Library
Public Types | Public Member Functions | List of all members
marray::Iterator< T, isConst, A > Class Template Reference

STL-compliant random access iterator for View and Marray. More...

#include <marray.hxx>

+ Collaboration diagram for marray::Iterator< T, isConst, A >:

Public Types

typedef std::random_access_iterator_tag iterator_category
 
typedef T value_type
 
typedef std::ptrdiff_t difference_type
 
typedef marray_detail::IfBool< isConst, const T *, T * >::type pointer
 
typedef marray_detail::IfBool< isConst, const T &, T & >::type reference
 
typedef marray_detail::IfBool< isConst, const View< T, true, A > *, View< T, false, A > * >::type view_pointer
 
typedef marray_detail::IfBool< isConst, const View< T, true, A > &, View< T, false, A > & >::type view_reference
 

Public Member Functions

 Iterator ()
 Empty constructor. More...
 
 Iterator (const View< T, false, A > &, const size_t=0)
 Construct from View on mutable data. More...
 
 Iterator (View< T, false, A > &, const size_t=0)
 Construct from View on mutable data. More...
 
 Iterator (const View< T, true, A > &, const size_t=0)
 Construct from View on constant data. More...
 
 Iterator (const Iterator< T, false, A > &)
 Copy constructor or conversion from an Iterator on mutable data. More...
 
reference operator* () const
 De-reference. More...
 
pointer operator-> () const
 Pointer. More...
 
reference operator[] (const size_t) const
 Element access. More...
 
Iterator< T, isConst, A > & operator+= (const difference_type &)
 
Iterator< T, isConst, A > & operator-= (const difference_type &)
 
Iterator< T, isConst, A > & operator++ ()
 Prefix increment. More...
 
Iterator< T, isConst, A > & operator-- ()
 Prefix decrement. More...
 
Iterator< T, isConst, A > operator++ (int)
 Postfix increment. More...
 
Iterator< T, isConst, A > operator-- (int)
 Postfix decrement. More...
 
Iterator< T, isConst, A > operator+ (const difference_type &) const
 
Iterator< T, isConst, A > operator- (const difference_type &) const
 
template<bool isConstLocal>
difference_type operator- (const Iterator< T, isConstLocal, A > &) const
 
template<bool isConstLocal>
bool operator== (const Iterator< T, isConstLocal, A > &) const
 
template<bool isConstLocal>
bool operator!= (const Iterator< T, isConstLocal, A > &) const
 
template<bool isConstLocal>
bool operator< (const Iterator< T, isConstLocal, A > &) const
 
template<bool isConstLocal>
bool operator> (const Iterator< T, isConstLocal, A > &) const
 
template<bool isConstLocal>
bool operator<= (const Iterator< T, isConstLocal, A > &) const
 
template<bool isConstLocal>
bool operator>= (const Iterator< T, isConstLocal, A > &) const
 
bool hasMore () const
 Fast alternative to comparing with the end iterator. More...
 
size_t index () const
 Get the corresponding index in the View. More...
 
template<class CoordinateIterator >
void coordinate (CoordinateIterator) const
 Get the corresponding coordinate sequence in the View. More...
 

Detailed Description

template<class T, bool isConst, class A>
class marray::Iterator< T, isConst, A >

STL-compliant random access iterator for View and Marray.

In addition to the STL iterator interface, the member functions hasMore(), index(), and coordinate() are defined.

Definition at line 49 of file marray.hxx.

Member Typedef Documentation

template<class T, bool isConst, class A>
typedef std::ptrdiff_t marray::Iterator< T, isConst, A >::difference_type

Definition at line 479 of file marray.hxx.

template<class T, bool isConst, class A>
typedef std::random_access_iterator_tag marray::Iterator< T, isConst, A >::iterator_category

Definition at line 477 of file marray.hxx.

template<class T, bool isConst, class A>
typedef marray_detail::IfBool<isConst, const T*, T*>::type marray::Iterator< T, isConst, A >::pointer

Definition at line 480 of file marray.hxx.

template<class T, bool isConst, class A>
typedef marray_detail::IfBool<isConst, const T&, T&>::type marray::Iterator< T, isConst, A >::reference

Definition at line 481 of file marray.hxx.

template<class T, bool isConst, class A>
typedef T marray::Iterator< T, isConst, A >::value_type

Definition at line 478 of file marray.hxx.

template<class T, bool isConst, class A>
typedef marray_detail::IfBool<isConst, const View<T, true, A>*, View<T, false, A>*>::type marray::Iterator< T, isConst, A >::view_pointer

Definition at line 485 of file marray.hxx.

template<class T, bool isConst, class A>
typedef marray_detail::IfBool<isConst, const View<T, true, A>&, View<T, false, A>&>::type marray::Iterator< T, isConst, A >::view_reference

Definition at line 487 of file marray.hxx.

Constructor & Destructor Documentation

template<class T , bool isConst, class A >
marray::Iterator< T, isConst, A >::Iterator ( )
inline

Empty constructor.

Definition at line 4031 of file marray.hxx.

template<class T, bool isConst, class A>
marray::Iterator< T, isConst, A >::Iterator ( const View< T, false, A > &  view,
const size_t  index = 0 
)
inline

Construct from View on mutable data.

Parameters
viewView
indexIndex into the View.

Definition at line 4100 of file marray.hxx.

+ Here is the call graph for this function:

template<class T, bool isConst, class A>
marray::Iterator< T, isConst, A >::Iterator ( View< T, false, A > &  view,
const size_t  index = 0 
)
inline

Construct from View on mutable data.

Parameters
viewView
indexIndex into the View.

Definition at line 4154 of file marray.hxx.

+ Here is the call graph for this function:

template<class T, bool isConst, class A>
marray::Iterator< T, isConst, A >::Iterator ( const View< T, true, A > &  view,
const size_t  index = 0 
)
inline

Construct from View on constant data.

Parameters
viewView
indexIndex into the View.

Definition at line 4047 of file marray.hxx.

template<class T, bool isConst, class A>
marray::Iterator< T, isConst, A >::Iterator ( const Iterator< T, false, A > &  in)
inline

Copy constructor or conversion from an Iterator on mutable data.

Definition at line 4205 of file marray.hxx.

Member Function Documentation

template<class T , bool isConst, class A >
template<class CoordinateIterator >
void marray::Iterator< T, isConst, A >::coordinate ( CoordinateIterator< T, isConst, A >  it) const
inline

Get the corresponding coordinate sequence in the View.

Parameters
itIterator into a container starting from which the coordinate sequence is to be written (output).

Definition at line 4612 of file marray.hxx.

template<class T , bool isConst, class A >
bool marray::Iterator< T, isConst, A >::hasMore ( ) const
inline

Fast alternative to comparing with the end iterator.

Returns
Boolean indicator.

Definition at line 4586 of file marray.hxx.

template<class T , bool isConst, class A >
size_t marray::Iterator< T, isConst, A >::index ( ) const
inline

Get the corresponding index in the View.

Returns
index Index.

Definition at line 4598 of file marray.hxx.

template<class T, bool isConst, class A>
template<bool isConstLocal>
bool marray::Iterator< T, isConst, A >::operator!= ( const Iterator< T, isConstLocal, A > &  it) const
inline

Definition at line 4517 of file marray.hxx.

template<class T , bool isConst, class A >
Iterator< T, isConst, A >::reference marray::Iterator< T, isConst, A >::operator* ( ) const
inline

De-reference.

Definition at line 4220 of file marray.hxx.

template<class T , bool isConst, class A >
Iterator< T, isConst, A > marray::Iterator< T, isConst, A >::operator+ ( const difference_type x) const
inline

Definition at line 4464 of file marray.hxx.

template<class T , bool isConst, class A >
Iterator< T, isConst, A > & marray::Iterator< T, isConst, A >::operator++ ( )
inline

Prefix increment.

Definition at line 4315 of file marray.hxx.

template<class T , bool isConst, class A >
Iterator< T, isConst, A > marray::Iterator< T, isConst, A >::operator++ ( int  )
inline

Postfix increment.

Definition at line 4441 of file marray.hxx.

template<class T , bool isConst, class A >
Iterator< T, isConst, A > & marray::Iterator< T, isConst, A >::operator+= ( const difference_type x)
inline

Definition at line 4252 of file marray.hxx.

template<class T , bool isConst, class A >
Iterator< T, isConst, A > marray::Iterator< T, isConst, A >::operator- ( const difference_type x) const
inline

Definition at line 4477 of file marray.hxx.

template<class T, bool isConst, class A>
template<bool isConstLocal>
Iterator< T, isConst, A >::difference_type marray::Iterator< T, isConst, A >::operator- ( const Iterator< T, isConstLocal, A > &  it) const
inline

Definition at line 4491 of file marray.hxx.

template<class T , bool isConst, class A >
Iterator< T, isConst, A > & marray::Iterator< T, isConst, A >::operator-- ( )
inline

Prefix decrement.

Definition at line 4379 of file marray.hxx.

template<class T , bool isConst, class A >
Iterator< T, isConst, A > marray::Iterator< T, isConst, A >::operator-- ( int  )
inline

Postfix decrement.

Definition at line 4453 of file marray.hxx.

template<class T , bool isConst, class A >
Iterator< T, isConst, A > & marray::Iterator< T, isConst, A >::operator-= ( const difference_type x)
inline

Definition at line 4293 of file marray.hxx.

template<class T , bool isConst, class A >
Iterator< T, isConst, A >::pointer marray::Iterator< T, isConst, A >::operator-> ( ) const
inline

Pointer.

Definition at line 4230 of file marray.hxx.

template<class T, bool isConst, class A>
template<bool isConstLocal>
bool marray::Iterator< T, isConst, A >::operator< ( const Iterator< T, isConstLocal, A > &  it) const
inline

Definition at line 4532 of file marray.hxx.

template<class T, bool isConst, class A>
template<bool isConstLocal>
bool marray::Iterator< T, isConst, A >::operator<= ( const Iterator< T, isConstLocal, A > &  it) const
inline

Definition at line 4558 of file marray.hxx.

template<class T, bool isConst, class A>
template<bool isConstLocal>
bool marray::Iterator< T, isConst, A >::operator== ( const Iterator< T, isConstLocal, A > &  it) const
inline

Definition at line 4504 of file marray.hxx.

template<class T, bool isConst, class A>
template<bool isConstLocal>
bool marray::Iterator< T, isConst, A >::operator> ( const Iterator< T, isConstLocal, A > &  it) const
inline

Definition at line 4545 of file marray.hxx.

template<class T, bool isConst, class A>
template<bool isConstLocal>
bool marray::Iterator< T, isConst, A >::operator>= ( const Iterator< T, isConstLocal, A > &  it) const
inline

Definition at line 4571 of file marray.hxx.

template<class T , bool isConst, class A >
Iterator< T, isConst, A >::reference marray::Iterator< T, isConst, A >::operator[] ( const size_t  x) const
inline

Element access.

Definition at line 4241 of file marray.hxx.