File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/config/TeX-MML-AM_CHTML/MathJax.js
DGtal 2.0.0
DGtal::SimpleConstRange< TConstIterator > Class Template Reference

Aim: model of CConstRange 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/SimpleConstRange.h>

Public Types

typedef TConstIterator ConstIterator
typedef boost::reverse_iterator< ConstIteratorConstReverseIterator
typedef Circulator< ConstIteratorConstCirculator
typedef boost::reverse_iterator< ConstCirculatorConstReverseCirculator

Public Member Functions

 SimpleConstRange (const TConstIterator &itb, const TConstIterator &ite)
 SimpleConstRange (const SimpleConstRange &other)
SimpleConstRangeoperator= (const SimpleConstRange &other)
 ~SimpleConstRange ()
bool isValid () const
void selfDisplay (std::ostream &out) const
std::string className () const
ConstIterator begin () const
ConstIterator end () const
ConstReverseIterator rbegin () const
ConstReverseIterator rend () const
ConstCirculator c () const
ConstReverseCirculator rc () const

Private Member Functions

 BOOST_CONCEPT_ASSERT ((boost::BidirectionalIterator< TConstIterator >))

Private Attributes

TConstIterator myBegin
TConstIterator myEnd

Detailed Description

template<typename TConstIterator>
class DGtal::SimpleConstRange< TConstIterator >

Aim: model of CConstRange 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)
See also
ConstRangeAdapter

Definition at line 73 of file SimpleConstRange.h.

Member Typedef Documentation

◆ ConstCirculator

template<typename TConstIterator>
typedef Circulator<ConstIterator> DGtal::SimpleConstRange< TConstIterator >::ConstCirculator

Definition at line 84 of file SimpleConstRange.h.

◆ ConstIterator

template<typename TConstIterator>
typedef TConstIterator DGtal::SimpleConstRange< TConstIterator >::ConstIterator

Definition at line 81 of file SimpleConstRange.h.

◆ ConstReverseCirculator

template<typename TConstIterator>
typedef boost::reverse_iterator<ConstCirculator> DGtal::SimpleConstRange< TConstIterator >::ConstReverseCirculator

Definition at line 85 of file SimpleConstRange.h.

◆ ConstReverseIterator

template<typename TConstIterator>
typedef boost::reverse_iterator<ConstIterator> DGtal::SimpleConstRange< TConstIterator >::ConstReverseIterator

Definition at line 82 of file SimpleConstRange.h.

Constructor & Destructor Documentation

◆ SimpleConstRange() [1/2]

template<typename TConstIterator>
DGtal::SimpleConstRange< TConstIterator >::SimpleConstRange ( const TConstIterator & itb,
const TConstIterator & ite )
inline

Standard constructor from two iterators and one functor.

Parameters
itbbegin iterator.
iteend iterator.

Definition at line 96 of file SimpleConstRange.h.

97 : myBegin(itb), myEnd(ite) {}
Aim: model of CConstRange that adapts any range of elements bounded by two iterators [itb,...

References myBegin, and myEnd.

Referenced by operator=(), and SimpleConstRange().

◆ SimpleConstRange() [2/2]

template<typename TConstIterator>
DGtal::SimpleConstRange< TConstIterator >::SimpleConstRange ( const SimpleConstRange< TConstIterator > & other)
inline

Copy constructor.

Parameters
otherthe iterator to clone.

Definition at line 103 of file SimpleConstRange.h.

References myBegin, myEnd, and SimpleConstRange().

◆ ~SimpleConstRange()

template<typename TConstIterator>
DGtal::SimpleConstRange< TConstIterator >::~SimpleConstRange ( )
inline

Destructor. Does nothing.

Definition at line 124 of file SimpleConstRange.h.

124{}

Member Function Documentation

◆ begin()

template<typename TConstIterator>
ConstIterator DGtal::SimpleConstRange< TConstIterator >::begin ( ) const
inline

Iterator service.

Returns
begin iterator

Definition at line 173 of file SimpleConstRange.h.

173 {
174 return ConstIterator( myBegin );
175 }

References myBegin.

Referenced by c(), and rend().

◆ BOOST_CONCEPT_ASSERT()

template<typename TConstIterator>
DGtal::SimpleConstRange< TConstIterator >::BOOST_CONCEPT_ASSERT ( (boost::BidirectionalIterator< TConstIterator >) )
private

◆ c()

template<typename TConstIterator>
ConstCirculator DGtal::SimpleConstRange< TConstIterator >::c ( ) const
inline

Circulator service.

Returns
a circulator

Definition at line 205 of file SimpleConstRange.h.

205 {
206 return ConstCirculator( this->begin(), this->begin(), this->end() );
207 }
ConstIterator end() const
Circulator< ConstIterator > ConstCirculator
ConstIterator begin() const

References begin(), and end().

Referenced by rc().

◆ className()

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

Definition at line 149 of file SimpleConstRange.h.

150 {
151 return "SimpleConstRange";
152 }

◆ end()

template<typename TConstIterator>
ConstIterator DGtal::SimpleConstRange< TConstIterator >::end ( ) const
inline

Iterator service.

Returns
end iterator

Definition at line 181 of file SimpleConstRange.h.

181 {
182 return ConstIterator( myEnd );
183 }

References myEnd.

Referenced by c(), and rbegin().

◆ isValid()

template<typename TConstIterator>
bool DGtal::SimpleConstRange< TConstIterator >::isValid ( ) const
inline

Checks the validity/consistency of the object.

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

Definition at line 130 of file SimpleConstRange.h.

130{ return true; }

◆ operator=()

template<typename TConstIterator>
SimpleConstRange & DGtal::SimpleConstRange< TConstIterator >::operator= ( const SimpleConstRange< TConstIterator > & other)
inline

Assignment.

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

Definition at line 111 of file SimpleConstRange.h.

112 {
113 if ( this != &other )
114 {
116 myEnd = other.myEnd;
117 }
118 return *this;
119 }

References myBegin, myEnd, and SimpleConstRange().

◆ rbegin()

template<typename TConstIterator>
ConstReverseIterator DGtal::SimpleConstRange< TConstIterator >::rbegin ( ) const
inline

Iterator service.

Returns
rbegin iterator

Definition at line 189 of file SimpleConstRange.h.

189 {
190 return ConstReverseIterator(this->end());
191 }
boost::reverse_iterator< ConstIterator > ConstReverseIterator

References end().

◆ rc()

template<typename TConstIterator>
ConstReverseCirculator DGtal::SimpleConstRange< TConstIterator >::rc ( ) const
inline

Circulator service.

Returns
a reverse circulator

Definition at line 213 of file SimpleConstRange.h.

213 {
214 return ConstReverseCirculator( this->c() );
215 }
boost::reverse_iterator< ConstCirculator > ConstReverseCirculator
ConstCirculator c() const

References c().

◆ rend()

template<typename TConstIterator>
ConstReverseIterator DGtal::SimpleConstRange< TConstIterator >::rend ( ) const
inline

Iterator service.

Returns
rend iterator

Definition at line 197 of file SimpleConstRange.h.

197 {
198 return ConstReverseIterator(this->begin());
199 }

References begin().

◆ selfDisplay()

template<typename TConstIterator>
void DGtal::SimpleConstRange< TConstIterator >::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 137 of file SimpleConstRange.h.

138 {
140 out << "[SimpleConstRange]" << std::endl;
141 out << "\t";
143 out << std::endl;
144 }

References myBegin, and myEnd.

Field Documentation

◆ myBegin

template<typename TConstIterator>
TConstIterator DGtal::SimpleConstRange< TConstIterator >::myBegin
private

Begin underlying iterator

Definition at line 160 of file SimpleConstRange.h.

Referenced by begin(), operator=(), selfDisplay(), SimpleConstRange(), and SimpleConstRange().

◆ myEnd

template<typename TConstIterator>
TConstIterator DGtal::SimpleConstRange< TConstIterator >::myEnd
private

End underlying iterator

Definition at line 164 of file SimpleConstRange.h.

Referenced by end(), operator=(), selfDisplay(), SimpleConstRange(), and SimpleConstRange().


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