DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Private Attributes
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 std::reverse_iterator< ConstIteratorConstReverseIterator
 
typedef Circulator< ConstIteratorConstCirculator
 
typedef std::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 72 of file SimpleConstRange.h.

Member Typedef Documentation

◆ ConstCirculator

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

Definition at line 83 of file SimpleConstRange.h.

◆ ConstIterator

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

Definition at line 80 of file SimpleConstRange.h.

◆ ConstReverseCirculator

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

Definition at line 84 of file SimpleConstRange.h.

◆ ConstReverseIterator

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

Definition at line 81 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 95 of file SimpleConstRange.h.

96 : 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 102 of file SimpleConstRange.h.

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

◆ ~SimpleConstRange()

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

Destructor. Does nothing.

Definition at line 123 of file SimpleConstRange.h.

123{}

Member Function Documentation

◆ begin()

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

Iterator service.

Returns
begin iterator

Definition at line 172 of file SimpleConstRange.h.

172 {
173 return ConstIterator( myBegin );
174 }
TConstIterator ConstIterator

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 204 of file SimpleConstRange.h.

204 {
205 return ConstCirculator( this->begin(), this->begin(), this->end() );
206 }
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 148 of file SimpleConstRange.h.

149 {
150 return "SimpleConstRange";
151 }

◆ end()

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

Iterator service.

Returns
end iterator

Definition at line 180 of file SimpleConstRange.h.

180 {
181 return ConstIterator( myEnd );
182 }

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 129 of file SimpleConstRange.h.

129{ 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 110 of file SimpleConstRange.h.

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

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 188 of file SimpleConstRange.h.

188 {
189 return ConstReverseIterator(this->end());
190 }
std::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 212 of file SimpleConstRange.h.

212 {
213 return ConstReverseCirculator( this->c() );
214 }
std::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 196 of file SimpleConstRange.h.

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

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 136 of file SimpleConstRange.h.

137 {
139 out << "[SimpleConstRange]" << std::endl;
140 out << "\t";
141 std::copy( myBegin, myEnd, std::ostream_iterator<Value>(out, ", ") );
142 out << std::endl;
143 }

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: