DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes
DGtal::SimpleConstRange< TConstIterator > Class Template Reference

#include <SimpleConstRange.h>

Collaboration diagram for DGtal::SimpleConstRange< TConstIterator >:
Collaboration graph
[legend]

Public Types

typedef TConstIterator ConstIterator
typedef std::reverse_iterator
< ConstIterator
ConstReverseIterator
typedef Circulator< ConstIteratorConstCirculator
typedef std::reverse_iterator
< ConstCirculator
ConstReverseCirculator

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


Member Typedef Documentation

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

Definition at line 81 of file SimpleConstRange.h.

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

Definition at line 78 of file SimpleConstRange.h.

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

Definition at line 82 of file SimpleConstRange.h.

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

Definition at line 79 of file SimpleConstRange.h.


Constructor & Destructor Documentation

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.
aFunctorfunctor used to adapt on-the-fly the elements of the range

Definition at line 94 of file SimpleConstRange.h.

: myBegin(itb), myEnd(ite) {}
template<typename TConstIterator >
DGtal::SimpleConstRange< TConstIterator >::SimpleConstRange ( const SimpleConstRange< TConstIterator > &  other)
inline

Copy constructor.

Parameters:
otherthe iterator to clone.

Definition at line 101 of file SimpleConstRange.h.

: myBegin(other.myBegin), myEnd(other.myEnd) {}
template<typename TConstIterator >
DGtal::SimpleConstRange< TConstIterator >::~SimpleConstRange ( )
inline

Destructor. Does nothing.

Definition at line 122 of file SimpleConstRange.h.

{}

Member Function Documentation

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

Iterator service.

Returns:
begin iterator

Definition at line 171 of file SimpleConstRange.h.

References DGtal::SimpleConstRange< TConstIterator >::myBegin.

Referenced by DGtal::SimpleConstRange< TConstIterator >::c(), and DGtal::SimpleConstRange< TConstIterator >::rend().

{
}
template<typename TConstIterator >
DGtal::SimpleConstRange< TConstIterator >::BOOST_CONCEPT_ASSERT ( (boost::BidirectionalIterator< TConstIterator >)  )
private
template<typename TConstIterator >
ConstCirculator DGtal::SimpleConstRange< TConstIterator >::c ( ) const
inline

Circulator service.

Returns:
a circulator

Definition at line 203 of file SimpleConstRange.h.

References DGtal::SimpleConstRange< TConstIterator >::begin(), and DGtal::SimpleConstRange< TConstIterator >::end().

Referenced by DGtal::SimpleConstRange< TConstIterator >::rc().

{
return ConstCirculator( this->begin(), this->begin(), this->end() );
}
template<typename TConstIterator >
std::string DGtal::SimpleConstRange< TConstIterator >::className ( ) const
inline
Returns:
the style name used for drawing this object.

Definition at line 147 of file SimpleConstRange.h.

{
return "SimpleConstRange";
}
template<typename TConstIterator >
ConstIterator DGtal::SimpleConstRange< TConstIterator >::end ( ) const
inline
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 128 of file SimpleConstRange.h.

{ return true; }
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 109 of file SimpleConstRange.h.

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

{
if ( this != &other )
{
myBegin = other.myBegin;
myEnd = other.myEnd;
}
return *this;
}
template<typename TConstIterator >
ConstReverseIterator DGtal::SimpleConstRange< TConstIterator >::rbegin ( ) const
inline

Iterator service.

Returns:
rbegin iterator

Definition at line 187 of file SimpleConstRange.h.

References DGtal::SimpleConstRange< TConstIterator >::end().

{
return ConstReverseIterator(this->end());
}
template<typename TConstIterator >
ConstReverseCirculator DGtal::SimpleConstRange< TConstIterator >::rc ( ) const
inline

Circulator service.

Returns:
a reverse circulator

Definition at line 211 of file SimpleConstRange.h.

References DGtal::SimpleConstRange< TConstIterator >::c().

{
return ConstReverseCirculator( this->c() );
}
template<typename TConstIterator >
ConstReverseIterator DGtal::SimpleConstRange< TConstIterator >::rend ( ) const
inline

Iterator service.

Returns:
rend iterator

Definition at line 195 of file SimpleConstRange.h.

References DGtal::SimpleConstRange< TConstIterator >::begin().

{
return ConstReverseIterator(this->begin());
}
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 135 of file SimpleConstRange.h.

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

{
out << "[SimpleConstRange]" << std::endl;
out << "\t";
std::copy( myBegin, myEnd, ostream_iterator<Value>(out, ", ") );
out << std::endl;
}

Field Documentation

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

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