DGtal 1.4.2
Loading...
Searching...
No Matches
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 std::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 86 of file ConstRangeFromPointAdapter.h.

Member Typedef Documentation

◆ ConstIterator

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

Definition at line 95 of file ConstRangeFromPointAdapter.h.

◆ ConstReverseIterator

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

Definition at line 96 of file ConstRangeFromPointAdapter.h.

◆ Point

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

Definition at line 94 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 106 of file ConstRangeFromPointAdapter.h.

◆ 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 114 of file ConstRangeFromPointAdapter.h.

115 : myRangePtr(other.myRangePtr), myFunctorPtr(other.myFunctorPtr) {}

◆ ~ConstRangeFromPointAdapter()

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

Destructor. Does nothing.

Definition at line 135 of file ConstRangeFromPointAdapter.h.

135{}

Member Function Documentation

◆ begin() [1/2]

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

◆ 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 170 of file ConstRangeFromPointAdapter.h.

170 {
171 return ConstIterator( myRangePtr->begin(aPoint), *myFunctorPtr );
172 }
const Point aPoint(3, 4)

References aPoint(), DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::myFunctorPtr, and DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::myRangePtr.

◆ BOOST_CONCEPT_ASSERT()

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

◆ end()

◆ 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 141 of file ConstRangeFromPointAdapter.h.

141{ 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 122 of file ConstRangeFromPointAdapter.h.

123 {
124 if ( this != &other )
125 {
126 myRangePtr = other.myRangePtr;
127 myFunctorPtr = other.myFunctorPtr;
128 }
129 return *this;
130 }

References DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::myFunctorPtr, and DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::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 186 of file ConstRangeFromPointAdapter.h.

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

References DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::end().

◆ rbegin() [2/2]

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

◆ 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 204 of file ConstRangeFromPointAdapter.h.

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

References DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::begin().

Field Documentation

◆ myFunctorPtr

◆ myRangePtr


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