DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes
DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType > Class Template Reference

#include <ConstRangeFromPointAdapter.h>

Public Types

typedef TRange::Point Point
typedef ConstIteratorAdapter
< typename
TRange::ConstIterator,
TFunctor, TReturnType > 
ConstIterator
typedef std::reverse_iterator
< ConstIterator
ConstReverseIterator

Public Member Functions

 ConstRangeFromPointAdapter (const TRange &aRange, const 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(<em>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 85 of file ConstRangeFromPointAdapter.h.


Member Typedef Documentation

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

Definition at line 94 of file ConstRangeFromPointAdapter.h.

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

Definition at line 95 of file ConstRangeFromPointAdapter.h.

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

Definition at line 93 of file ConstRangeFromPointAdapter.h.


Constructor & Destructor Documentation

template<typename TRange , typename TFunctor , typename TReturnType >
DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::ConstRangeFromPointAdapter ( const TRange &  aRange,
const 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 105 of file ConstRangeFromPointAdapter.h.

: myRangePtr(&aRange), myFunctorPtr(&aFunctor) {}
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 113 of file ConstRangeFromPointAdapter.h.

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

Destructor. Does nothing.

Definition at line 134 of file ConstRangeFromPointAdapter.h.

{}

Member Function Documentation

template<typename TRange , typename TFunctor , typename TReturnType >
ConstIterator DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::begin ( ) const
inline
template<typename TRange , typename TFunctor , typename TReturnType >
ConstIterator DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::begin ( const Point aPoint) const
inline
template<typename TRange , typename TFunctor , typename TReturnType >
DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::BOOST_CONCEPT_ASSERT ( (CConstBidirectionalRangeFromPoint< TRange >)  )
private
template<typename TRange , typename TFunctor , typename TReturnType >
ConstIterator DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::end ( ) const
inline
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 140 of file ConstRangeFromPointAdapter.h.

{ return true; }
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 121 of file ConstRangeFromPointAdapter.h.

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

{
if ( this != &other )
{
}
return *this;
}
template<typename TRange , typename TFunctor , typename TReturnType >
ConstReverseIterator DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::rbegin ( ) const
inline

Iterator service.

Returns:
rbegin iterator

Definition at line 185 of file ConstRangeFromPointAdapter.h.

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

{
return ConstReverseIterator(this->end());
}
template<typename TRange , typename TFunctor , typename TReturnType >
ConstReverseIterator DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::rbegin ( const Point aPoint) const
inline
template<typename TRange , typename TFunctor , typename TReturnType >
ConstReverseIterator DGtal::ConstRangeFromPointAdapter< TRange, TFunctor, TReturnType >::rend ( ) const
inline

Iterator service.

Returns:
rend iterator

Definition at line 203 of file ConstRangeFromPointAdapter.h.

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

{
return ConstReverseIterator(this->begin());
}

Field Documentation

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

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