DGtal 1.4.0
|
Aim: model of CConstBidirectionalRange that adapts any range of elements bounded by two iterators [itb, ite) and provides services to (circularly)iterate over it (in a read-only manner). More...
#include <DGtal/base/ConstRangeAdapter.h>
Public Types | |
typedef ConstIteratorAdapter< TIterator, TFunctor, TReturnType > | ConstIterator |
typedef ReverseIterator< ConstIterator > | ConstReverseIterator |
typedef Circulator< ConstIterator > | ConstCirculator |
typedef ReverseIterator< ConstCirculator > | ConstReverseCirculator |
typedef IteratorCirculatorTraits< ConstIterator >::Difference | Difference |
Public Member Functions | |
ConstRangeAdapter (const TIterator &itb, const TIterator &ite, const TFunctor &aFunctor) | |
ConstRangeAdapter (const TIterator &itb, const TIterator &ite, const TFunctor *aFunctorPtr) | |
ConstRangeAdapter (const ConstRangeAdapter &other) | |
~ConstRangeAdapter () | |
bool | isValid () const |
Difference | size () const |
void | selfDisplay (std::ostream &out) const |
std::string | className () const |
ConstIterator | begin () const |
ConstIterator | end () const |
ConstReverseIterator | rbegin () const |
ConstReverseIterator | rend () const |
ConstCirculator | c () const |
ConstReverseCirculator | rc () const |
Private Member Functions | |
BOOST_CONCEPT_ASSERT ((boost_concepts::ReadableIteratorConcept< TIterator >)) | |
BOOST_CONCEPT_ASSERT ((boost_concepts::BidirectionalTraversalConcept< TIterator >)) | |
ConstRangeAdapter & | operator= (const ConstRangeAdapter &other) |
Difference | size (const TIterator &itb, const TIterator &ite, RandomAccessCategory) const |
Difference | size (const TIterator &itb, const TIterator &ite, BidirectionalCategory) const |
Private Attributes | |
TIterator | myBegin |
TIterator | myEnd |
const TFunctor * | myFunctor |
bool | myFlagIsOwned |
Aim: model of CConstBidirectionalRange that adapts any range of elements bounded by two iterators [itb, ite) and provides services to (circularly)iterate over it (in a read-only manner).
TIterator | the type of the iterator to adapt (at least bidirectional). |
Moreover, the provided (circular)iterator is adapted with a functor f given at construction so that operator* calls f(*it), instead of calling directly operator* of the underlying iterator it.
TFunctor | the type of functor that transforms the pointed element into another one |
TReturnType | the type of the element returned by the underlying functor. |
NB: the underlying functor is stored in the range as aliasing pointer in order to avoid copies. As a consequence the pointed object must exist and must not be deleted during the use of the range.
Definition at line 86 of file ConstRangeAdapter.h.
typedef Circulator<ConstIterator> DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::ConstCirculator |
Definition at line 98 of file ConstRangeAdapter.h.
typedef ConstIteratorAdapter<TIterator,TFunctor,TReturnType> DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::ConstIterator |
Definition at line 95 of file ConstRangeAdapter.h.
typedef ReverseIterator<ConstCirculator> DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::ConstReverseCirculator |
Definition at line 99 of file ConstRangeAdapter.h.
typedef ReverseIterator<ConstIterator> DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::ConstReverseIterator |
Definition at line 96 of file ConstRangeAdapter.h.
typedef IteratorCirculatorTraits<ConstIterator>::Difference DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::Difference |
Definition at line 101 of file ConstRangeAdapter.h.
|
inline |
Standard constructor from two iterators and one functor (stored as an aliasing pointer).
itb | begin iterator. |
ite | end iterator. |
aFunctor | functor used to adapt on-the-fly the elements of the range |
Definition at line 112 of file ConstRangeAdapter.h.
|
inline |
Standard constructor from two iterators and one pointer on a functor (stored as an owning pointer).
itb | begin iterator. |
ite | end iterator. |
aFunctorPtr | pointer on a functor used to adapt on-the-fly the elements of the range |
Definition at line 124 of file ConstRangeAdapter.h.
|
inline |
Copy constructor.
other | the iterator to clone. |
Definition at line 132 of file ConstRangeAdapter.h.
References DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::myFlagIsOwned, and DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::myFunctor.
|
inline |
Destructor. Does nothing.
Definition at line 144 of file ConstRangeAdapter.h.
References DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::myFlagIsOwned, and DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::myFunctor.
|
inline |
Iterator service.
Definition at line 222 of file ConstRangeAdapter.h.
References DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::myBegin, and DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::myFunctor.
Referenced by DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::c(), DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::rend(), and DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::selfDisplay().
|
private |
|
private |
|
inline |
Circulator service. Prodives a circulator such that *c() == *begin()
Definition at line 257 of file ConstRangeAdapter.h.
References DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::begin(), and DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::end().
Referenced by compare(), and DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::rc().
|
inline |
Definition at line 180 of file ConstRangeAdapter.h.
|
inline |
Iterator service.
Definition at line 230 of file ConstRangeAdapter.h.
References DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::myEnd, and DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::myFunctor.
Referenced by DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::c(), DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::rbegin(), and DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::selfDisplay().
|
inline |
Checks the validity/consistency of the object.
Definition at line 153 of file ConstRangeAdapter.h.
|
private |
Assignment.
other | the iterator to copy. |
|
inline |
Iterator service.
Definition at line 238 of file ConstRangeAdapter.h.
References DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::end().
|
inline |
Circulator service. Provides a reverse circulator such that *rc() == *c() == *begin()
Definition at line 269 of file ConstRangeAdapter.h.
References DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::c().
|
inline |
Iterator service.
Definition at line 246 of file ConstRangeAdapter.h.
References DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::begin().
|
inline |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Definition at line 169 of file ConstRangeAdapter.h.
References DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::begin(), and DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::end().
|
inline |
Definition at line 158 of file ConstRangeAdapter.h.
References DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::myBegin, DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::myEnd, and DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::size().
Referenced by DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::size().
|
inlineprivate |
Get the size of [itb, ite)
itb | begin iterator |
ite | end iterator |
Definition at line 297 of file ConstRangeAdapter.h.
|
inlineprivate |
Get the size of [itb, ite)
itb | begin iterator |
ite | end iterator |
Definition at line 285 of file ConstRangeAdapter.h.
|
private |
Begin underlying iterator
Definition at line 191 of file ConstRangeAdapter.h.
Referenced by DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::begin(), and DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::size().
|
private |
End underlying iterator
Definition at line 195 of file ConstRangeAdapter.h.
Referenced by DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::end(), and DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::size().
|
private |
bool equal to true if myFunctor is owned
Definition at line 203 of file ConstRangeAdapter.h.
Referenced by DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::ConstRangeAdapter(), and DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::~ConstRangeAdapter().
|
private |
Pointer on the underlying functor
Definition at line 199 of file ConstRangeAdapter.h.
Referenced by DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::begin(), DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::ConstRangeAdapter(), DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::end(), and DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::~ConstRangeAdapter().