DGtal 1.4.0
Loading...
Searching...
No Matches
DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor > Class Template Reference

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). More...

#include <DGtal/base/SimpleRandomAccessRangeFromPoint.h>

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

Definition at line 73 of file SimpleRandomAccessRangeFromPoint.h.

Member Typedef Documentation

◆ Circulator

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.

◆ ConstCirculator

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.

◆ ConstIterator

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

Definition at line 87 of file SimpleRandomAccessRangeFromPoint.h.

◆ ConstReverseCirculator

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.

◆ ConstReverseIterator

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.

◆ Iterator

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

Definition at line 86 of file SimpleRandomAccessRangeFromPoint.h.

◆ OutputIterator

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

Definition at line 92 of file SimpleRandomAccessRangeFromPoint.h.

◆ Point

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

Definition at line 84 of file SimpleRandomAccessRangeFromPoint.h.

◆ ReverseCirculator

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.

◆ ReverseIterator

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.

◆ ReverseOutputIterator

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

◆ SimpleRandomAccessRangeFromPoint() [1/2]

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.

◆ SimpleRandomAccessRangeFromPoint() [2/2]

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.

121 : myBegin ( other.myBegin ), myEnd ( other.myEnd ),
122 myDistance ( other.myDistance ) {}

◆ ~SimpleRandomAccessRangeFromPoint()

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

◆ begin() [1/4]

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

◆ begin() [2/4]

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

◆ begin() [3/4]

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

Iterator service.

Parameters
aPointa Point
Returns
begin iterator at aPoint

Definition at line 214 of file SimpleRandomAccessRangeFromPoint.h.

215 {
216 return Iterator ( myBegin ) + myDistance ( aPoint );
217 }
const Point aPoint(3, 4)

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

◆ begin() [4/4]

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

◆ BOOST_CONCEPT_ASSERT() [1/3]

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

◆ BOOST_CONCEPT_ASSERT() [2/3]

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

◆ BOOST_CONCEPT_ASSERT() [3/3]

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

◆ c() [1/2]

◆ c() [2/2]

template<typename TConstIterator , typename TIterator , typename DistanceFunctor >
ConstCirculator DGtal::SimpleRandomAccessRangeFromPoint< TConstIterator, TIterator, DistanceFunctor >::c ( ) const
inline

◆ className()

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 }

◆ end() [1/2]

◆ end() [2/2]

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.

253 {
254 return ConstIterator ( myEnd );
255 }

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

◆ isValid()

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 }

◆ operator=()

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

Assignment.

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

Definition at line 129 of file SimpleRandomAccessRangeFromPoint.h.

130 {
131 if ( this != &other )
132 {
133 myBegin = other.myBegin;
134 myEnd = other.myEnd;
135 myDistance = other.myDistance;
136 }
137
138 return *this;
139 }

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

◆ outputIterator() [1/2]

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.

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

Referenced by testImage().

◆ outputIterator() [2/2]

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

◆ rbegin() [1/4]

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

Iterator service.

Returns
rbegin iterator

Definition at line 299 of file SimpleRandomAccessRangeFromPoint.h.

300 {
301 return ReverseIterator ( this->end() );
302 }

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

◆ rbegin() [2/4]

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.

330 {
331 return ConstReverseIterator ( this->end() );
332 }
std::reverse_iterator< ConstIterator > ConstReverseIterator

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

◆ rbegin() [3/4]

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

◆ rbegin() [4/4]

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

◆ rc() [1/2]

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.

368 {
369 return ReverseCirculator ( this->c() );
370 }
std::reverse_iterator< Circulator > ReverseCirculator

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

◆ rc() [2/2]

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.

386 {
387 return ConstReverseCirculator ( this->c() );
388 }
std::reverse_iterator< ConstCirculator > ConstReverseCirculator

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

◆ rend() [1/2]

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

Iterator service.

Returns
rend iterator

Definition at line 319 of file SimpleRandomAccessRangeFromPoint.h.

320 {
321 return ReverseIterator ( myBegin );
322 }

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

◆ rend() [2/2]

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.

350 {
351 return ConstReverseIterator ( myBegin );
352 }

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

◆ routputIterator() [1/2]

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.

281 {
282 return ReverseOutputIterator ( this->end() );
283 }
std::reverse_iterator< Iterator > ReverseOutputIterator

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

◆ routputIterator() [2/2]

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.

291 {
292 return ReverseOutputIterator ( myBegin + myDistance ( aPoint ) + 1 ) ;
293 }

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

◆ selfDisplay()

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.

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

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

Field Documentation

◆ myBegin

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

◆ myDistance

◆ myEnd


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