DGtal 1.3.0
|
Aim: Provides an adapter for classical iterators that can iterate through the underlying data structure as in a loop. The increment (resp. decrement) operator encapsulates the validity test and the assignement to the begin (resp. end) iterator of a given range, when the end (resp. beginning) has been reached. For instance, the pre-increment operator does:
More...
#include <DGtal/base/Circulator.h>
Public Types | |
typedef TIterator | Iterator |
typedef Circulator< TIterator > | Self |
typedef CirculatorType | Type |
typedef boost::iterator_category< TIterator >::type | iterator_category |
typedef std::iterator_traits< TIterator >::value_type | value_type |
typedef std::iterator_traits< TIterator >::difference_type | difference_type |
typedef std::iterator_traits< TIterator >::pointer | pointer |
typedef std::iterator_traits< TIterator >::reference | reference |
Public Member Functions | |
Circulator () | |
Circulator (const Iterator &i, const Iterator &itb, const Iterator &ite) | |
~Circulator () | |
Circulator (const Circulator &other) | |
template<typename other_Iterator > | |
Circulator (const Circulator< other_Iterator > &other) | |
Circulator & | operator= (const Circulator &other) |
template<typename other_Iterator > | |
Circulator & | operator= (const Circulator< other_Iterator > &other) |
bool | isValid () const |
Iterator | base () const |
Iterator | begin () const |
Iterator | end () const |
reference | operator* () const |
pointer | operator-> () const |
Self & | operator++ () |
Self | operator++ (int) |
Self & | operator-- () |
Self | operator-- (int) |
bool | operator== (const Self &other) const |
bool | operator!= (const Self &other) const |
template<typename OtherIterator > | |
bool | operator== (const OtherIterator &other) const |
template<typename OtherIterator > | |
bool | operator!= (const OtherIterator &other) const |
Self & | operator+= (difference_type d) |
Self & | operator-= (difference_type d) |
Self | operator+ (difference_type d) const |
Self | operator- (difference_type d) const |
difference_type | operator- (const Self &c) const |
reference | operator[] (difference_type d) const |
bool | operator< (const Self &) const |
bool | operator<= (const Self &) const |
bool | operator> (const Self &c) const |
bool | operator>= (const Self &c) const |
Protected Attributes | |
Iterator | myCurrentIt |
Iterator | myBeginIt |
Iterator | myEndIt |
bool | myFlagIsValid |
Private Member Functions | |
BOOST_STATIC_ASSERT ((boost::is_same< typename IteratorCirculatorTraits< TIterator >::Type, IteratorType >::value)) | |
Aim: Provides an adapter for classical iterators that can iterate through the underlying data structure as in a loop. The increment (resp. decrement) operator encapsulates the validity test and the assignement to the begin (resp. end) iterator of a given range, when the end (resp. beginning) has been reached. For instance, the pre-increment operator does:
Description of template class 'Circulator'
whereas the pre-decrement operator does (if at least bidirectional):
Be aware that random access operators are quite different for circular iterators and classical iterators. Firstly, the difference between two circular iterators c and d is always positive and such that (c-d) + (d-c) is equal to the size of the underlying range. Secondly, comparison operators 'less than' and 'less than or equal to' always return 'true', whereas 'greater than' and 'greater than or equal to' always return 'false'.
TIterator | any forward, bidirectional or random access iterator |
Definition at line 85 of file Circulator.h.
typedef std::iterator_traits<TIterator>::difference_type DGtal::Circulator< TIterator >::difference_type |
Definition at line 104 of file Circulator.h.
typedef TIterator DGtal::Circulator< TIterator >::Iterator |
Definition at line 95 of file Circulator.h.
typedef boost::iterator_category<TIterator>::type DGtal::Circulator< TIterator >::iterator_category |
Definition at line 101 of file Circulator.h.
typedef std::iterator_traits<TIterator>::pointer DGtal::Circulator< TIterator >::pointer |
Definition at line 105 of file Circulator.h.
typedef std::iterator_traits<TIterator>::reference DGtal::Circulator< TIterator >::reference |
Definition at line 106 of file Circulator.h.
typedef Circulator<TIterator> DGtal::Circulator< TIterator >::Self |
Definition at line 96 of file Circulator.h.
typedef CirculatorType DGtal::Circulator< TIterator >::Type |
Definition at line 98 of file Circulator.h.
typedef std::iterator_traits<TIterator>::value_type DGtal::Circulator< TIterator >::value_type |
Definition at line 103 of file Circulator.h.
|
inline |
Default constructor. Default-initializes iterator members NB: not valid
Definition at line 118 of file Circulator.h.
|
inline |
Constructor. This object can iterate through the underlying data structure as in a loop, because it knows the begin and end iterator of the range.
i | any iterator |
itb | begin iterator |
ite | end iterator |
Definition at line 129 of file Circulator.h.
References DGtal::Circulator< TIterator >::myBeginIt, DGtal::Circulator< TIterator >::myEndIt, and DGtal::Circulator< TIterator >::myFlagIsValid.
|
inline |
|
inline |
Copy constructor.
other | the object to clone. |
Definition at line 144 of file Circulator.h.
|
inline |
Copy of circulators that adapts other iterator types (not const / const).
other | the object to clone. |
Definition at line 155 of file Circulator.h.
|
inline |
Definition at line 216 of file Circulator.h.
References DGtal::Circulator< TIterator >::myCurrentIt.
Referenced by basicForwardTest(), main(), DGtal::Circulator< TIterator >::operator=(), and DGtal::Circulator< TIterator >::operator==().
|
inline |
Definition at line 222 of file Circulator.h.
References DGtal::Circulator< TIterator >::myBeginIt.
Referenced by basicForwardTest(), DGtal::Circulator< TIterator >::operator=(), and DGtal::Circulator< TIterator >::operator==().
|
private |
|
inline |
Definition at line 228 of file Circulator.h.
References DGtal::Circulator< TIterator >::myEndIt.
Referenced by basicForwardTest(), DGtal::Circulator< TIterator >::operator=(), and DGtal::Circulator< TIterator >::operator==().
|
inline |
Checks the validity/consistency of the object.
Definition at line 206 of file Circulator.h.
References DGtal::Circulator< TIterator >::myFlagIsValid.
Referenced by basicForwardTest(), DGtal::Circulator< TIterator >::operator*(), DGtal::Circulator< TIterator >::operator++(), DGtal::Circulator< TIterator >::operator+=(), DGtal::Circulator< TIterator >::operator--(), DGtal::Circulator< TIterator >::operator->(), and DGtal::Circulator< TIterator >::operator==().
|
inline |
Definition at line 334 of file Circulator.h.
|
inline |
Definition at line 317 of file Circulator.h.
|
inline |
Definition at line 234 of file Circulator.h.
References DGtal::Circulator< TIterator >::isValid(), and DGtal::Circulator< TIterator >::myCurrentIt.
|
inline |
Definition at line 377 of file Circulator.h.
|
inline |
Pre-increment
Definition at line 258 of file Circulator.h.
References DGtal::Circulator< TIterator >::isValid(), DGtal::Circulator< TIterator >::myBeginIt, DGtal::Circulator< TIterator >::myCurrentIt, and DGtal::Circulator< TIterator >::myEndIt.
Referenced by DGtal::Circulator< TIterator >::operator++().
|
inline |
Post-increment
Definition at line 269 of file Circulator.h.
References DGtal::Circulator< TIterator >::operator++().
|
inline |
Definition at line 340 of file Circulator.h.
References DGtal::Circulator< TIterator >::isValid(), DGtal::Circulator< TIterator >::myBeginIt, DGtal::Circulator< TIterator >::myCurrentIt, and DGtal::Circulator< TIterator >::myEndIt.
Referenced by DGtal::Circulator< TIterator >::operator-=().
|
inline |
Definition at line 389 of file Circulator.h.
References DGtal::Circulator< TIterator >::myBeginIt, DGtal::Circulator< TIterator >::myCurrentIt, and DGtal::Circulator< TIterator >::myEndIt.
|
inline |
Definition at line 383 of file Circulator.h.
|
inline |
Pre-decrement
Definition at line 280 of file Circulator.h.
References DGtal::Circulator< TIterator >::isValid(), DGtal::Circulator< TIterator >::myBeginIt, DGtal::Circulator< TIterator >::myCurrentIt, and DGtal::Circulator< TIterator >::myEndIt.
Referenced by DGtal::Circulator< TIterator >::operator--().
|
inline |
Post-decrement
Definition at line 291 of file Circulator.h.
References DGtal::Circulator< TIterator >::operator--().
|
inline |
Definition at line 375 of file Circulator.h.
References DGtal::Circulator< TIterator >::operator+=().
|
inline |
Definition at line 244 of file Circulator.h.
References DGtal::Circulator< TIterator >::isValid(), and DGtal::Circulator< TIterator >::myCurrentIt.
|
inline |
Definition at line 409 of file Circulator.h.
|
inline |
Definition at line 413 of file Circulator.h.
Referenced by DGtal::Circulator< TIterator >::operator>().
|
inline |
Assignment.
other | the object to copy. |
Definition at line 166 of file Circulator.h.
References DGtal::Circulator< TIterator >::myBeginIt, DGtal::Circulator< TIterator >::myCurrentIt, DGtal::Circulator< TIterator >::myEndIt, and DGtal::Circulator< TIterator >::myFlagIsValid.
|
inline |
Assignment that adapts other iterator types (not const / const).
other | the object to copy. |
Definition at line 187 of file Circulator.h.
References DGtal::Circulator< TIterator >::base(), DGtal::Circulator< TIterator >::begin(), DGtal::Circulator< TIterator >::end(), DGtal::Circulator< TIterator >::myBeginIt, DGtal::Circulator< TIterator >::myCurrentIt, DGtal::Circulator< TIterator >::myEndIt, and DGtal::Circulator< TIterator >::myFlagIsValid.
|
inline |
Definition at line 320 of file Circulator.h.
References DGtal::Circulator< TIterator >::isValid(), DGtal::Circulator< TIterator >::myBeginIt, DGtal::Circulator< TIterator >::myCurrentIt, and DGtal::Circulator< TIterator >::myEndIt.
|
inline |
Definition at line 304 of file Circulator.h.
References DGtal::Circulator< TIterator >::base(), DGtal::Circulator< TIterator >::begin(), DGtal::Circulator< TIterator >::end(), DGtal::Circulator< TIterator >::isValid(), DGtal::Circulator< TIterator >::myBeginIt, DGtal::Circulator< TIterator >::myCurrentIt, and DGtal::Circulator< TIterator >::myEndIt.
|
inline |
Definition at line 417 of file Circulator.h.
References DGtal::Circulator< TIterator >::operator<=().
Referenced by DGtal::Circulator< TIterator >::operator>=().
|
inline |
Definition at line 421 of file Circulator.h.
References DGtal::Circulator< TIterator >::operator>().
|
inline |
Definition at line 401 of file Circulator.h.
|
protected |
Definition at line 431 of file Circulator.h.
Referenced by DGtal::Circulator< TIterator >::begin(), DGtal::Circulator< TIterator >::Circulator(), DGtal::Circulator< TIterator >::operator++(), DGtal::Circulator< TIterator >::operator+=(), DGtal::Circulator< TIterator >::operator-(), DGtal::Circulator< TIterator >::operator--(), DGtal::Circulator< TIterator >::operator=(), and DGtal::Circulator< TIterator >::operator==().
|
protected |
Definition at line 430 of file Circulator.h.
Referenced by DGtal::Circulator< TIterator >::base(), DGtal::Circulator< TIterator >::operator*(), DGtal::Circulator< TIterator >::operator++(), DGtal::Circulator< TIterator >::operator+=(), DGtal::Circulator< TIterator >::operator-(), DGtal::Circulator< TIterator >::operator--(), DGtal::Circulator< TIterator >::operator->(), DGtal::Circulator< TIterator >::operator=(), and DGtal::Circulator< TIterator >::operator==().
|
protected |
Definition at line 432 of file Circulator.h.
Referenced by DGtal::Circulator< TIterator >::Circulator(), DGtal::Circulator< TIterator >::end(), DGtal::Circulator< TIterator >::operator++(), DGtal::Circulator< TIterator >::operator+=(), DGtal::Circulator< TIterator >::operator-(), DGtal::Circulator< TIterator >::operator--(), DGtal::Circulator< TIterator >::operator=(), and DGtal::Circulator< TIterator >::operator==().
|
protected |
Definition at line 433 of file Circulator.h.
Referenced by DGtal::Circulator< TIterator >::Circulator(), DGtal::Circulator< TIterator >::isValid(), and DGtal::Circulator< TIterator >::operator=().