DGtal 2.1.0
Loading...
Searching...
No Matches
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) {}

◆ 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.

104 : myBegin(other.myBegin), myEnd(other.myEnd) {}

◆ ~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 DGtal::SimpleConstRange< TConstIterator >::myBegin.

Referenced by DGtal::SimpleConstRange< TConstIterator >::c(), and DGtal::SimpleConstRange< TConstIterator >::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 DGtal::SimpleConstRange< TConstIterator >::begin(), and DGtal::SimpleConstRange< TConstIterator >::end().

Referenced by DGtal::SimpleConstRange< TConstIterator >::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 DGtal::SimpleConstRange< TConstIterator >::myEnd.

Referenced by DGtal::SimpleConstRange< TConstIterator >::c(), and DGtal::SimpleConstRange< TConstIterator >::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 {
115 myBegin = other.myBegin;
116 myEnd = other.myEnd;
117 }
118 return *this;
119 }

References DGtal::SimpleConstRange< TConstIterator >::myBegin, and DGtal::SimpleConstRange< TConstIterator >::myEnd.

◆ 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 DGtal::SimpleConstRange< TConstIterator >::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 DGtal::SimpleConstRange< TConstIterator >::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 DGtal::SimpleConstRange< TConstIterator >::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";
142 std::copy( myBegin, myEnd, std::ostream_iterator<Value>(out, ", ") );
143 out << std::endl;
144 }

References DGtal::SimpleConstRange< TConstIterator >::myBegin, and DGtal::SimpleConstRange< TConstIterator >::myEnd.

Field Documentation

◆ myBegin

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

◆ myEnd

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

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