File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/config/TeX-MML-AM_CHTML/MathJax.js
DGtal 2.0.0
DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType > Class Template Reference

Aim: model of CConstBidirectionalRangeFromPoint that adapts any bidirectional range and provides services to iterate over it (in a read-only manner). More...

#include <DGtal/base/ConstRangeFromPointAdapter.h>

Public Types

typedef TRange::Point Point
typedef ConstIteratorAdapter< typename TRange::ConstIterator, TFunctor, TReturnType > ConstIterator
typedef boost::reverse_iterator< ConstIteratorConstReverseIterator

Public Member Functions

 ConstRangeFromPointAdapter (ConstAlias< TRange > aRange, ConstAlias< TFunctor > aFunctor)
 ConstRangeFromPointAdapter (const ConstRangeFromPointAdapter &other)
ConstRangeFromPointAdapteroperator= (const ConstRangeFromPointAdapter &other)
 ~ConstRangeFromPointAdapter ()
bool isValid () const
ConstIterator begin () const
ConstIterator begin (const Point &aPoint) const
ConstIterator end () const
ConstReverseIterator rbegin () const
ConstReverseIterator rbegin (const Point &aPoint) const
ConstReverseIterator rend () const

Private Member Functions

 BOOST_CONCEPT_ASSERT ((CConstBidirectionalRangeFromPoint< TRange >))

Private Attributes

const TRange * myRangePtr
const TFunctor * myFunctorPtr

Detailed Description

template<typename TRange, typename TFunctor, typename TReturnType>
class DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >

Aim: model of CConstBidirectionalRangeFromPoint that adapts any bidirectional range and provides services to iterate over it (in a read-only manner).

Template Parameters
TRangea model of CConstBidirectionalRangeFromPoint

Moreover, the provided iterators are adapted with a functor f given at construction so that operator* calls f(*it), instead of calling directly operator* of the iterator it.

Template Parameters
TFunctorthe type of functor that transforms the pointed element into another one
TReturnTypethe type of the element returned by the underlying functor.

NB: the underlying range and functor are stored as aliasing pointers in order to avoid copies. As a consequence the pointed object must exist and must not be deleted during the use of any instance of this class.

See also
ConstIteratorAdapter BasicFunctors.h

Definition at line 87 of file ConstRangeFromPointAdapter.h.

Member Typedef Documentation

◆ ConstIterator

template<typename TRange, typename TFunctor, typename TReturnType>
typedef ConstIteratorAdapter<typename TRange::ConstIterator,TFunctor,TReturnType> DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::ConstIterator

Definition at line 96 of file ConstRangeFromPointAdapter.h.

◆ ConstReverseIterator

template<typename TRange, typename TFunctor, typename TReturnType>
typedef boost::reverse_iterator<ConstIterator> DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::ConstReverseIterator

Definition at line 97 of file ConstRangeFromPointAdapter.h.

◆ Point

template<typename TRange, typename TFunctor, typename TReturnType>
typedef TRange::Point DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::Point

Definition at line 95 of file ConstRangeFromPointAdapter.h.

Constructor & Destructor Documentation

◆ ConstRangeFromPointAdapter() [1/2]

template<typename TRange, typename TFunctor, typename TReturnType>
DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::ConstRangeFromPointAdapter ( ConstAlias< TRange > aRange,
ConstAlias< TFunctor > aFunctor )
inline

Standard constructor from one range and one functor.

Parameters
aRangethe range to adapt.
aFunctorfunctor used to adapt on-the-fly the elements of the range

Definition at line 107 of file ConstRangeFromPointAdapter.h.

Aim: model of CConstBidirectionalRangeFromPoint that adapts any bidirectional range and provides serv...

References myFunctorPtr, and myRangePtr.

Referenced by ConstRangeFromPointAdapter(), and operator=().

◆ ConstRangeFromPointAdapter() [2/2]

template<typename TRange, typename TFunctor, typename TReturnType>
DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::ConstRangeFromPointAdapter ( const ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType > & other)
inline

Copy constructor.

Parameters
otherthe iterator to clone.

Definition at line 115 of file ConstRangeFromPointAdapter.h.

References ConstRangeFromPointAdapter(), myFunctorPtr, and myRangePtr.

◆ ~ConstRangeFromPointAdapter()

template<typename TRange, typename TFunctor, typename TReturnType>
DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::~ConstRangeFromPointAdapter ( )
inline

Destructor. Does nothing.

Definition at line 136 of file ConstRangeFromPointAdapter.h.

136{}

Member Function Documentation

◆ begin() [1/2]

template<typename TRange, typename TFunctor, typename TReturnType>
ConstIterator DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::begin ( ) const
inline

Iterator service.

Returns
begin iterator

Definition at line 163 of file ConstRangeFromPointAdapter.h.

163 {
164 return ConstIterator( myRangePtr->begin(), *myFunctorPtr );
165 }
ConstIteratorAdapter< typename TRange::ConstIterator, TFunctor, TReturnType > ConstIterator

References myFunctorPtr, and myRangePtr.

Referenced by rend().

◆ begin() [2/2]

template<typename TRange, typename TFunctor, typename TReturnType>
ConstIterator DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::begin ( const Point & aPoint) const
inline

Iterator service.

Returns
begin iterator from a point

Definition at line 171 of file ConstRangeFromPointAdapter.h.

171 {
172 return ConstIterator( myRangePtr->begin(aPoint), *myFunctorPtr );
173 }

References aPoint, myFunctorPtr, and myRangePtr.

◆ BOOST_CONCEPT_ASSERT()

template<typename TRange, typename TFunctor, typename TReturnType>
DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::BOOST_CONCEPT_ASSERT ( (CConstBidirectionalRangeFromPoint< TRange >) )
private

◆ end()

template<typename TRange, typename TFunctor, typename TReturnType>
ConstIterator DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::end ( ) const
inline

Iterator service.

Returns
end iterator

Definition at line 179 of file ConstRangeFromPointAdapter.h.

179 {
180 return ConstIterator( myRangePtr->end(), *myFunctorPtr );
181 }

References myFunctorPtr, and myRangePtr.

Referenced by rbegin(), and rbegin().

◆ isValid()

template<typename TRange, typename TFunctor, typename TReturnType>
bool DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::isValid ( ) const
inline

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.

Definition at line 142 of file ConstRangeFromPointAdapter.h.

142{ return true; }

◆ operator=()

template<typename TRange, typename TFunctor, typename TReturnType>
ConstRangeFromPointAdapter & DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::operator= ( const ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType > & other)
inline

Assignment.

Parameters
otherthe iterator to copy.
Returns
a reference on 'this'.

Definition at line 123 of file ConstRangeFromPointAdapter.h.

124 {
125 if ( this != &other )
126 {
129 }
130 return *this;
131 }

References ConstRangeFromPointAdapter(), myFunctorPtr, and myRangePtr.

◆ rbegin() [1/2]

template<typename TRange, typename TFunctor, typename TReturnType>
ConstReverseIterator DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::rbegin ( ) const
inline

Iterator service.

Returns
rbegin iterator

Definition at line 187 of file ConstRangeFromPointAdapter.h.

187 {
188 return ConstReverseIterator(this->end());
189 }
boost::reverse_iterator< ConstIterator > ConstReverseIterator

References end().

◆ rbegin() [2/2]

template<typename TRange, typename TFunctor, typename TReturnType>
ConstReverseIterator DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::rbegin ( const Point & aPoint) const
inline

Iterator service.

Returns
rbegin iterator from a point

Definition at line 195 of file ConstRangeFromPointAdapter.h.

195 {
197 if ( it != this->end() ) ++it;
198 return ConstReverseIterator( it );
199 }

References aPoint, end(), myFunctorPtr, and myRangePtr.

◆ rend()

template<typename TRange, typename TFunctor, typename TReturnType>
ConstReverseIterator DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::rend ( ) const
inline

Iterator service.

Returns
rend iterator

Definition at line 205 of file ConstRangeFromPointAdapter.h.

205 {
206 return ConstReverseIterator(this->begin());
207 }

References begin().

Field Documentation

◆ myFunctorPtr

template<typename TRange, typename TFunctor, typename TReturnType>
const TFunctor* DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::myFunctorPtr
private

Aliasing pointer on the underlying functor

Definition at line 154 of file ConstRangeFromPointAdapter.h.

Referenced by begin(), begin(), ConstRangeFromPointAdapter(), ConstRangeFromPointAdapter(), end(), operator=(), and rbegin().

◆ myRangePtr

template<typename TRange, typename TFunctor, typename TReturnType>
const TRange* DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::myRangePtr
private

Aliasing pointer on the range

Definition at line 150 of file ConstRangeFromPointAdapter.h.

Referenced by begin(), begin(), ConstRangeFromPointAdapter(), ConstRangeFromPointAdapter(), end(), operator=(), and rbegin().


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