DGtal  0.9.4beta
Public Types | Public Member Functions | Private Member Functions | Private Attributes
DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor > Class Template Reference

#include <DGtal/base/SimpleRandomAccessRangeFromPoint.h>

Collaboration diagram for DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >:
[legend]

Public Types

typedef DistanceFunctor::Point Point
 
typedef TIterator Iterator
 
typedef TConstIterator ConstIterator
 
typedef std::reverse_iterator< IteratorReverseIterator
 
typedef std::reverse_iterator< ConstIteratorConstReverseIterator
 
typedef TIterator OutputIterator
 
typedef std::reverse_iterator< IteratorReverseOutputIterator
 
typedef DGtal::Circulator< IteratorCirculator
 
typedef std::reverse_iterator< CirculatorReverseCirculator
 
typedef DGtal::Circulator< ConstIteratorConstCirculator
 
typedef std::reverse_iterator< ConstCirculatorConstReverseCirculator
 

Public Member Functions

 SimpleRandomAccessRangeFromPoint (const TIterator &itb, const TIterator &ite, const DistanceFunctor &aDistance)
 
 SimpleRandomAccessRangeFromPoint (const SimpleRandomAccessRangeFromPoint &other)
 
SimpleRandomAccessRangeFromPointoperator= (const SimpleRandomAccessRangeFromPoint &other)
 
 ~SimpleRandomAccessRangeFromPoint ()
 
bool isValid () const
 
void selfDisplay (std::ostream &out) const
 
std::string className () const
 
Iterator begin ()
 
Iterator begin (const Point &aPoint)
 
ConstIterator begin () const
 
ConstIterator begin (const Point &aPoint) const
 
Iterator end ()
 
ConstIterator end () const
 
OutputIterator outputIterator ()
 
OutputIterator outputIterator (const Point &aPoint)
 
ReverseOutputIterator routputIterator ()
 
ReverseOutputIterator routputIterator (const Point &aPoint)
 
ReverseIterator rbegin ()
 
ReverseIterator rbegin (const Point &aPoint)
 
ReverseIterator rend ()
 
ConstReverseIterator rbegin () const
 
ConstReverseIterator rbegin (const Point &aPoint) const
 
ConstReverseIterator rend () const
 
Circulator c ()
 
ReverseCirculator rc ()
 
ConstCirculator c () const
 
ConstReverseCirculator rc () const
 

Private Member Functions

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

Private Attributes

TIterator myBegin
 
TIterator myEnd
 
DistanceFunctor myDistance
 

Detailed Description

template<typename TConstIterator, typename TIterator, typename DistanceFunctor>
class DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >

Aim: model of CBidirectionalRangeFromPoint 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
TIteratorthe 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
RangeAdapter
Examples:
geometry/curves/estimation/exampleCurvature.cpp, and geometry/curves/exampleGridCurve2d.cpp.

Definition at line 73 of file SimpleRandomAccessRangeFromPoint.h.

Member Typedef Documentation

template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
typedef DGtal::Circulator<Iterator> DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::Circulator

Definition at line 95 of file SimpleRandomAccessRangeFromPoint.h.

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

Definition at line 98 of file SimpleRandomAccessRangeFromPoint.h.

template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
typedef TConstIterator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::ConstIterator

Definition at line 87 of file SimpleRandomAccessRangeFromPoint.h.

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

Definition at line 99 of file SimpleRandomAccessRangeFromPoint.h.

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

Definition at line 90 of file SimpleRandomAccessRangeFromPoint.h.

template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
typedef TIterator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::Iterator

Definition at line 86 of file SimpleRandomAccessRangeFromPoint.h.

template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
typedef TIterator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::OutputIterator

Definition at line 92 of file SimpleRandomAccessRangeFromPoint.h.

template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
typedef DistanceFunctor::Point DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::Point

Definition at line 84 of file SimpleRandomAccessRangeFromPoint.h.

template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
typedef std::reverse_iterator<Circulator> DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::ReverseCirculator

Definition at line 96 of file SimpleRandomAccessRangeFromPoint.h.

template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
typedef std::reverse_iterator<Iterator> DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::ReverseIterator

Definition at line 89 of file SimpleRandomAccessRangeFromPoint.h.

template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
typedef std::reverse_iterator<Iterator> DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::ReverseOutputIterator

Definition at line 93 of file SimpleRandomAccessRangeFromPoint.h.

Constructor & Destructor Documentation

template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::SimpleRandomAccessRangeFromPoint ( const TIterator &  itb,
const TIterator &  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 111 of file SimpleRandomAccessRangeFromPoint.h.

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

Copy constructor.

Parameters
otherthe iterator to clone.

Definition at line 120 of file SimpleRandomAccessRangeFromPoint.h.

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

Destructor. Does nothing.

Definition at line 144 of file SimpleRandomAccessRangeFromPoint.h.

144 {}

Member Function Documentation

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

Iterator service.

Returns
begin iterator

Definition at line 223 of file SimpleRandomAccessRangeFromPoint.h.

template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
ConstIterator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::begin ( const Point aPoint) const
inline
template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::BOOST_CONCEPT_ASSERT ( (boost::RandomAccessIterator< TIterator >)  )
private
template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::BOOST_CONCEPT_ASSERT ( (boost::RandomAccessIterator< TConstIterator >)  )
private
template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::BOOST_CONCEPT_ASSERT ( (boost::UnaryFunction< DistanceFunctor, typename DistanceFunctor::Difference, typename DistanceFunctor::Point >)  )
private
template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
Circulator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::c ( )
inline
template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
ConstCirculator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::c ( ) const
inline
template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
std::string DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::className ( ) const
inline
Returns
the style name used for drawing this object.

Definition at line 172 of file SimpleRandomAccessRangeFromPoint.h.

173  {
174  return "SimpleRandomAccessRangeFromPoint";
175  }
template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
Iterator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::end ( )
inline
template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
ConstIterator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::end ( ) const
inline

Iterator service.

Returns
end iterator

Definition at line 252 of file SimpleRandomAccessRangeFromPoint.h.

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

Checks the validity/consistency of the object.

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

Definition at line 150 of file SimpleRandomAccessRangeFromPoint.h.

151  {
152  return true;
153  }
template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
SimpleRandomAccessRangeFromPoint& DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::operator= ( const SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor > &  other)
inline
template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
OutputIterator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::outputIterator ( )
inline

OutputIterator service.

Returns
an output iterator on the first elements

Definition at line 261 of file SimpleRandomAccessRangeFromPoint.h.

template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
OutputIterator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::outputIterator ( const Point aPoint)
inline

OutputIterator service.

Parameters
aPointa point
Returns
an output iterator on the point

Definition at line 271 of file SimpleRandomAccessRangeFromPoint.h.

References DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::myDistance.

template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
ReverseIterator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::rbegin ( )
inline
template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
ReverseIterator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::rbegin ( const Point aPoint)
inline

Iterator service.

Parameters
aPointa Point
Returns
rbegin iterator at aPoint

Definition at line 309 of file SimpleRandomAccessRangeFromPoint.h.

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

Iterator service.

Returns
rbegin iterator

Definition at line 329 of file SimpleRandomAccessRangeFromPoint.h.

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

330  {
331  return ConstReverseIterator ( this->end() );
332  }
std::reverse_iterator< ConstIterator > ConstReverseIterator
template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
ConstReverseIterator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::rbegin ( const Point aPoint) const
inline

Iterator service.

Parameters
aPointa Point
Returns
rbegin iterator at aPoint

Definition at line 339 of file SimpleRandomAccessRangeFromPoint.h.

template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
ReverseCirculator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::rc ( )
inline

Reverse mutable circulator service.

Returns
a reverse circulator

Definition at line 367 of file SimpleRandomAccessRangeFromPoint.h.

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

368  {
369  return ReverseCirculator ( this->c() );
370  }
std::reverse_iterator< Circulator > ReverseCirculator
template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
ConstReverseCirculator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::rc ( ) const
inline

Reverse constant circulator service.

Returns
a reverse constant circulator

Definition at line 385 of file SimpleRandomAccessRangeFromPoint.h.

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

386  {
387  return ConstReverseCirculator ( this->c() );
388  }
std::reverse_iterator< ConstCirculator > ConstReverseCirculator
template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
ReverseIterator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::rend ( )
inline

Iterator service.

Returns
rend iterator
Examples:
geometry/curves/exampleGridCurve2d.cpp.

Definition at line 319 of file SimpleRandomAccessRangeFromPoint.h.

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

Iterator service.

Returns
rend iterator

Definition at line 349 of file SimpleRandomAccessRangeFromPoint.h.

template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
ReverseOutputIterator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::routputIterator ( )
inline

ReverseOutputIterator service.

Returns
an output itertor on the first elements

Definition at line 280 of file SimpleRandomAccessRangeFromPoint.h.

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

281  {
282  return ReverseOutputIterator ( this->end() );
283  }
std::reverse_iterator< Iterator > ReverseOutputIterator
template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
ReverseOutputIterator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::routputIterator ( const Point aPoint)
inline

ReverseOutputIterator service.

Parameters
aPointa point
Returns
an output iterator on the point

Definition at line 290 of file SimpleRandomAccessRangeFromPoint.h.

template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
void DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, 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 160 of file SimpleRandomAccessRangeFromPoint.h.

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

161  {
162  typedef typename IteratorCirculatorTraits<Iterator>::Value Value;
163  out << "[SimpleRandomAccessRangeFromPoint]" << std::endl;
164  out << "\t";
165  std::copy ( myBegin, myEnd, std::ostream_iterator<Value> ( out, ", " ) );
166  out << std::endl;
167  }

Field Documentation

template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
TIterator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::myBegin
private
template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
DistanceFunctor DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::myDistance
private
template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
TIterator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::myEnd
private

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