DGtal  1.5.beta
DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor > Class Template Reference

Aim: model of CConstBidirectionalRangeFromPoint 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/SimpleRandomAccessConstRangeFromPoint.h>

Public Types

typedef DistanceFunctor::Point Point
 
typedef TConstIterator ConstIterator
 
typedef std::reverse_iterator< ConstIteratorConstReverseIterator
 
typedef Circulator< ConstIteratorConstCirculator
 
typedef std::reverse_iterator< ConstCirculatorConstReverseCirculator
 

Public Member Functions

 SimpleRandomAccessConstRangeFromPoint (const TConstIterator &itb, const TConstIterator &ite, const DistanceFunctor &aDistance)
 
 SimpleRandomAccessConstRangeFromPoint (const SimpleRandomAccessConstRangeFromPoint &other)
 
SimpleRandomAccessConstRangeFromPointoperator= (const SimpleRandomAccessConstRangeFromPoint &other)
 
 ~SimpleRandomAccessConstRangeFromPoint ()
 
bool isValid () const
 
void selfDisplay (std::ostream &out) const
 
std::string className () 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
 
ConstCirculator c () const
 
ConstReverseCirculator rc () const
 

Private Member Functions

 BOOST_CONCEPT_ASSERT ((boost::RandomAccessIterator< TConstIterator >))
 
 BOOST_CONCEPT_ASSERT ((boost::UnaryFunction< DistanceFunctor, typename DistanceFunctor::Difference, typename DistanceFunctor::Point >))
 

Private Attributes

TConstIterator myBegin
 
TConstIterator myEnd
 
DistanceFunctor myDistance
 

Detailed Description

template<typename TConstIterator, typename DistanceFunctor>
class DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >

Aim: model of CConstBidirectionalRangeFromPoint 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).

Template Parameters
TConstIteratorthe type of the iterator to adapt (at least bidirectional)
DistanceFunctortype of distance from point functor for random access container models. Models must have a Point and a Difference inner types. operator() returns a number of type Difference on instances of Point)
See also
ConstRangeAdapter

Definition at line 73 of file SimpleRandomAccessConstRangeFromPoint.h.

Member Typedef Documentation

◆ ConstCirculator

template<typename TConstIterator , typename DistanceFunctor >
typedef Circulator<ConstIterator> DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::ConstCirculator

Definition at line 89 of file SimpleRandomAccessConstRangeFromPoint.h.

◆ ConstIterator

template<typename TConstIterator , typename DistanceFunctor >
typedef TConstIterator DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::ConstIterator

Definition at line 86 of file SimpleRandomAccessConstRangeFromPoint.h.

◆ ConstReverseCirculator

template<typename TConstIterator , typename DistanceFunctor >
typedef std::reverse_iterator<ConstCirculator> DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::ConstReverseCirculator

Definition at line 90 of file SimpleRandomAccessConstRangeFromPoint.h.

◆ ConstReverseIterator

template<typename TConstIterator , typename DistanceFunctor >
typedef std::reverse_iterator<ConstIterator> DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::ConstReverseIterator

Definition at line 87 of file SimpleRandomAccessConstRangeFromPoint.h.

◆ Point

template<typename TConstIterator , typename DistanceFunctor >
typedef DistanceFunctor::Point DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::Point

Definition at line 84 of file SimpleRandomAccessConstRangeFromPoint.h.

Constructor & Destructor Documentation

◆ SimpleRandomAccessConstRangeFromPoint() [1/2]

template<typename TConstIterator , typename DistanceFunctor >
DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::SimpleRandomAccessConstRangeFromPoint ( const TConstIterator &  itb,
const TConstIterator &  ite,
const DistanceFunctor &  aDistance 
)
inline

Standard constructor from two iterators and one functor.

Parameters
itbbegin iterator.
iteend iterator.
aDistancefunctor used to adapt on-the-fly the elements of the range

Definition at line 102 of file SimpleRandomAccessConstRangeFromPoint.h.

◆ SimpleRandomAccessConstRangeFromPoint() [2/2]

template<typename TConstIterator , typename DistanceFunctor >
DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::SimpleRandomAccessConstRangeFromPoint ( const SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor > &  other)
inline

Copy constructor.

Parameters
otherthe iterator to clone.

Definition at line 109 of file SimpleRandomAccessConstRangeFromPoint.h.

110  : myBegin ( other.myBegin ), myEnd ( other.myEnd ), myDistance ( other.myDistance ) {}

◆ ~SimpleRandomAccessConstRangeFromPoint()

template<typename TConstIterator , typename DistanceFunctor >
DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::~SimpleRandomAccessConstRangeFromPoint ( )
inline

Destructor. Does nothing.

Definition at line 132 of file SimpleRandomAccessConstRangeFromPoint.h.

132 {}

Member Function Documentation

◆ begin() [1/2]

template<typename TConstIterator , typename DistanceFunctor >
ConstIterator DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::begin ( ) const
inline

◆ begin() [2/2]

template<typename TConstIterator , typename DistanceFunctor >
ConstIterator DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::begin ( const Point aPoint) const
inline

Iterator service.

Parameters
aPointa Point
Returns
begin iterator

Definition at line 202 of file SimpleRandomAccessConstRangeFromPoint.h.

203  {
204  return ConstIterator ( myBegin ) + myDistance ( aPoint );
205  }
const Point aPoint(3, 4)

References aPoint(), DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::myBegin, and DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::myDistance.

◆ BOOST_CONCEPT_ASSERT() [1/2]

template<typename TConstIterator , typename DistanceFunctor >
DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::BOOST_CONCEPT_ASSERT ( (boost::RandomAccessIterator< TConstIterator >)  )
private

◆ BOOST_CONCEPT_ASSERT() [2/2]

template<typename TConstIterator , typename DistanceFunctor >
DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::BOOST_CONCEPT_ASSERT ( (boost::UnaryFunction< DistanceFunctor, typename DistanceFunctor::Difference, typename DistanceFunctor::Point >)  )
private

◆ c()

◆ className()

template<typename TConstIterator , typename DistanceFunctor >
std::string DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::className ( ) const
inline
Returns
the style name used for drawing this object.

Definition at line 160 of file SimpleRandomAccessConstRangeFromPoint.h.

161  {
162  return "SimpleRandomAccessConstRangeFromPoint";
163  }

◆ end()

◆ isValid()

template<typename TConstIterator , typename DistanceFunctor >
bool DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::isValid ( ) const
inline

Checks the validity/consistency of the object.

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

Definition at line 138 of file SimpleRandomAccessConstRangeFromPoint.h.

139  {
140  return true;
141  }

◆ operator=()

template<typename TConstIterator , typename DistanceFunctor >
SimpleRandomAccessConstRangeFromPoint& DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::operator= ( const SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor > &  other)
inline

Assignment.

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

Definition at line 117 of file SimpleRandomAccessConstRangeFromPoint.h.

118  {
119  if ( this != &other )
120  {
121  myBegin = other.myBegin;
122  myEnd = other.myEnd;
123  myDistance = other.myDistance;
124  }
125 
126  return *this;
127  }

References DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::myBegin, DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::myDistance, and DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::myEnd.

◆ rbegin() [1/2]

template<typename TConstIterator , typename DistanceFunctor >
ConstReverseIterator DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::rbegin ( ) const
inline

Iterator service.

Returns
rbegin iterator

Definition at line 220 of file SimpleRandomAccessConstRangeFromPoint.h.

221  {
222  return ConstReverseIterator ( this->end() );
223  }

References DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::end().

Referenced by SECTION().

◆ rbegin() [2/2]

template<typename TConstIterator , typename DistanceFunctor >
ConstReverseIterator DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::rbegin ( const Point aPoint) const
inline

◆ rc()

template<typename TConstIterator , typename DistanceFunctor >
ConstReverseCirculator DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::rc ( ) const
inline

Circulator service.

Returns
a reverse circulator

Definition at line 258 of file SimpleRandomAccessConstRangeFromPoint.h.

259  {
260  return ConstReverseCirculator ( this->c() );
261  }
std::reverse_iterator< ConstCirculator > ConstReverseCirculator

References DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::c().

Referenced by SECTION().

◆ rend()

template<typename TConstIterator , typename DistanceFunctor >
ConstReverseIterator DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::rend ( ) const
inline

Iterator service.

Returns
rend iterator

Definition at line 240 of file SimpleRandomAccessConstRangeFromPoint.h.

241  {
242  return ConstReverseIterator ( myBegin );
243  }

References DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::myBegin.

Referenced by SECTION().

◆ selfDisplay()

template<typename TConstIterator , typename DistanceFunctor >
void DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::selfDisplay ( std::ostream &  out) const
inline

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

Definition at line 148 of file SimpleRandomAccessConstRangeFromPoint.h.

149  {
151  out << "[SimpleRandomAccessConstRangeFromPoint]" << std::endl;
152  out << "\t";
153  std::copy ( myBegin, myEnd, std::ostream_iterator<Value> ( out, ", " ) );
154  out << std::endl;
155  }

References DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::myBegin, and DGtal::SimpleRandomAccessConstRangeFromPoint< TConstIterator, DistanceFunctor >::myEnd.

Field Documentation

◆ myBegin

◆ myDistance

◆ myEnd


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