DGtal  1.5.beta
DGtal::FreemanChain< TInteger >::CodesRange Class Reference

Aim: model of CRange that provides services to (circularly)iterate over the letters of the freeman chain. More...

#include <DGtal/geometry/curves/FreemanChain.h>

Public Types

typedef std::string::const_iterator ConstIterator
 
typedef std::string::const_reverse_iterator ConstReverseIterator
 
typedef Circulator< ConstIteratorConstCirculator
 
typedef std::reverse_iterator< ConstCirculatorConstReverseCirculator
 

Public Member Functions

 CodesRange ()
 
 CodesRange (const std::string &aChain)
 
 CodesRange (const CodesRange &aOther)
 
CodesRangeoperator= (const CodesRange &other)
 
 ~CodesRange ()
 
std::string::size_type size () const
 
bool isValid () const
 
void selfDisplay (std::ostream &out) const
 
ConstIterator begin () const
 
ConstIterator end () const
 
ConstReverseIterator rbegin () const
 
ConstReverseIterator rend () const
 
ConstCirculator c () const
 
ConstReverseCirculator rc () const
 

Private Attributes

std::string myChain
 

Friends

std::ostream & operator<< (std::ostream &out, const CodesRange &object)
 

Detailed Description

template<typename TInteger>
class DGtal::FreemanChain< TInteger >::CodesRange

Aim: model of CRange that provides services to (circularly)iterate over the letters of the freeman chain.

See also
FreemanChain.h testFreemanChain.cpp

Definition at line 393 of file FreemanChain.h.

Member Typedef Documentation

◆ ConstCirculator

template<typename TInteger >
typedef Circulator<ConstIterator> DGtal::FreemanChain< TInteger >::CodesRange::ConstCirculator

Definition at line 401 of file FreemanChain.h.

◆ ConstIterator

template<typename TInteger >
typedef std::string::const_iterator DGtal::FreemanChain< TInteger >::CodesRange::ConstIterator

Definition at line 399 of file FreemanChain.h.

◆ ConstReverseCirculator

template<typename TInteger >
typedef std::reverse_iterator<ConstCirculator> DGtal::FreemanChain< TInteger >::CodesRange::ConstReverseCirculator

Definition at line 402 of file FreemanChain.h.

◆ ConstReverseIterator

template<typename TInteger >
typedef std::string::const_reverse_iterator DGtal::FreemanChain< TInteger >::CodesRange::ConstReverseIterator

Definition at line 400 of file FreemanChain.h.

Constructor & Destructor Documentation

◆ CodesRange() [1/3]

template<typename TInteger >
DGtal::FreemanChain< TInteger >::CodesRange::CodesRange ( )
inline

Default Constructor.

Definition at line 409 of file FreemanChain.h.

409 {}

◆ CodesRange() [2/3]

template<typename TInteger >
DGtal::FreemanChain< TInteger >::CodesRange::CodesRange ( const std::string &  aChain)
inline

Constructor.

Definition at line 414 of file FreemanChain.h.

414 : myChain(aChain){}

◆ CodesRange() [3/3]

template<typename TInteger >
DGtal::FreemanChain< TInteger >::CodesRange::CodesRange ( const CodesRange aOther)
inline

Copy constructor.

Parameters
aOtherthe iterator to clone.

Definition at line 420 of file FreemanChain.h.

421  : myChain( aOther.myChain ){}

◆ ~CodesRange()

template<typename TInteger >
DGtal::FreemanChain< TInteger >::CodesRange::~CodesRange ( )
inline

Destructor. Does nothing.

Definition at line 440 of file FreemanChain.h.

440 {}

Member Function Documentation

◆ begin()

template<typename TInteger >
ConstIterator DGtal::FreemanChain< TInteger >::CodesRange::begin ( ) const
inline

Iterator service.

Returns
begin iterator

Definition at line 494 of file FreemanChain.h.

494  {
495  return myChain.begin();
496  }

References DGtal::FreemanChain< TInteger >::CodesRange::myChain.

Referenced by DGtal::FreemanChain< TInteger >::CodesRange::c(), and DGtal::FreemanChain< TInteger >::CodesRange::selfDisplay().

◆ c()

template<typename TInteger >
ConstCirculator DGtal::FreemanChain< TInteger >::CodesRange::c ( ) const
inline

Circulator service.

Returns
a circulator

Definition at line 526 of file FreemanChain.h.

526  {
527  return ConstCirculator( this->begin(), this->begin(), this->end() );
528  }
ConstIterator end() const
Definition: FreemanChain.h:502
Circulator< ConstIterator > ConstCirculator
Definition: FreemanChain.h:401
ConstIterator begin() const
Definition: FreemanChain.h:494

References DGtal::FreemanChain< TInteger >::CodesRange::begin(), and DGtal::FreemanChain< TInteger >::CodesRange::end().

Referenced by DGtal::FreemanChain< TInteger >::CodesRange::rc().

◆ end()

template<typename TInteger >
ConstIterator DGtal::FreemanChain< TInteger >::CodesRange::end ( ) const
inline

Iterator service.

Returns
end iterator

Definition at line 502 of file FreemanChain.h.

502  {
503  return myChain.end();
504  }

References DGtal::FreemanChain< TInteger >::CodesRange::myChain.

Referenced by DGtal::FreemanChain< TInteger >::CodesRange::c(), and DGtal::FreemanChain< TInteger >::CodesRange::selfDisplay().

◆ isValid()

template<typename TInteger >
bool DGtal::FreemanChain< TInteger >::CodesRange::isValid ( ) const
inline

Checks the validity/consistency of the object.

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

Definition at line 454 of file FreemanChain.h.

454 { return true; }

◆ operator=()

template<typename TInteger >
CodesRange& DGtal::FreemanChain< TInteger >::CodesRange::operator= ( const CodesRange other)
inline

Assignment.

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

Definition at line 428 of file FreemanChain.h.

429  {
430  if ( this != &other )
431  {
432  myChain = other.myChain;
433  }
434  return *this;
435  }

References DGtal::FreemanChain< TInteger >::CodesRange::myChain.

◆ rbegin()

template<typename TInteger >
ConstReverseIterator DGtal::FreemanChain< TInteger >::CodesRange::rbegin ( ) const
inline

Iterator service.

Returns
rbegin iterator

Definition at line 510 of file FreemanChain.h.

510  {
511  return myChain.rbegin();
512  }

References DGtal::FreemanChain< TInteger >::CodesRange::myChain.

◆ rc()

template<typename TInteger >
ConstReverseCirculator DGtal::FreemanChain< TInteger >::CodesRange::rc ( ) const
inline

Circulator service.

Returns
a reverse circulator

Definition at line 534 of file FreemanChain.h.

534  {
535  return ConstReverseCirculator( this->c() );
536  }
ConstCirculator c() const
Definition: FreemanChain.h:526
std::reverse_iterator< ConstCirculator > ConstReverseCirculator
Definition: FreemanChain.h:402

References DGtal::FreemanChain< TInteger >::CodesRange::c().

◆ rend()

template<typename TInteger >
ConstReverseIterator DGtal::FreemanChain< TInteger >::CodesRange::rend ( ) const
inline

Iterator service.

Returns
rend iterator

Definition at line 518 of file FreemanChain.h.

518  {
519  return myChain.rend();
520  }

References DGtal::FreemanChain< TInteger >::CodesRange::myChain.

◆ selfDisplay()

template<typename TInteger >
void DGtal::FreemanChain< TInteger >::CodesRange::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 461 of file FreemanChain.h.

462  {
464  out << "[FreemanChainCodes]" << std::endl;
465  out << "\t";
466  std::copy( this->begin(), this->end(), std::ostream_iterator<Value>(out, "") );
467  out << std::endl;
468  }

References DGtal::FreemanChain< TInteger >::CodesRange::begin(), and DGtal::FreemanChain< TInteger >::CodesRange::end().

◆ size()

template<typename TInteger >
std::string::size_type DGtal::FreemanChain< TInteger >::CodesRange::size ( ) const
inline
Returns
the size of the range

Definition at line 445 of file FreemanChain.h.

446  {
447  return myChain.size();
448  }

References DGtal::FreemanChain< TInteger >::CodesRange::myChain.

Friends And Related Function Documentation

◆ operator<<

template<typename TInteger >
std::ostream& operator<< ( std::ostream &  out,
const CodesRange object 
)
friend

Overloads 'operator<<' for displaying objects of class 'CodesRange'.

Parameters
outthe output stream where the object is written.
objectthe object of class 'CodesRange' to write.
Returns
the output stream after the writing.

Definition at line 476 of file FreemanChain.h.

477  {
478  object.selfDisplay( out );
479  return out;
480  }

Field Documentation

◆ myChain


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