DGtal  0.9.3beta
Public Types | Public Member Functions | Private Attributes | Friends
DGtal::FreemanChain< TInteger >::CodesRange Class Reference

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

Collaboration diagram for DGtal::FreemanChain< TInteger >::CodesRange:
[legend]

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

const 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 386 of file FreemanChain.h.

Member Typedef Documentation

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

Definition at line 394 of file FreemanChain.h.

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

Definition at line 392 of file FreemanChain.h.

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

Definition at line 395 of file FreemanChain.h.

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

Definition at line 393 of file FreemanChain.h.

Constructor & Destructor Documentation

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

Default Constructor.

Definition at line 402 of file FreemanChain.h.

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

Constructor.

Definition at line 407 of file FreemanChain.h.

407 : myChain(aChain){}
template<typename TInteger>
DGtal::FreemanChain< TInteger >::CodesRange::CodesRange ( const CodesRange aOther)
inline

Copy constructor.

Parameters
aOtherthe iterator to clone.

Definition at line 413 of file FreemanChain.h.

414  : myChain( aOther.myChain ){}
template<typename TInteger>
DGtal::FreemanChain< TInteger >::CodesRange::~CodesRange ( )
inline

Destructor. Does nothing.

Definition at line 433 of file FreemanChain.h.

433 {}

Member Function Documentation

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

Iterator service.

Returns
begin iterator

Definition at line 487 of file FreemanChain.h.

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

487  {
488  return myChain.begin();
489  }
template<typename TInteger>
ConstCirculator DGtal::FreemanChain< TInteger >::CodesRange::c ( ) const
inline

Circulator service.

Returns
a circulator

Definition at line 519 of file FreemanChain.h.

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

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

519  {
520  return ConstCirculator( this->begin(), this->begin(), this->end() );
521  }
ConstIterator end() const
Definition: FreemanChain.h:495
ConstIterator begin() const
Definition: FreemanChain.h:487
Circulator< ConstIterator > ConstCirculator
Definition: FreemanChain.h:394
template<typename TInteger>
ConstIterator DGtal::FreemanChain< TInteger >::CodesRange::end ( ) const
inline

Iterator service.

Returns
end iterator

Definition at line 495 of file FreemanChain.h.

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

495  {
496  return myChain.end();
497  }
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 447 of file FreemanChain.h.

447 { return true; }
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 421 of file FreemanChain.h.

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

422  {
423  if ( this != &other )
424  {
425  myChain = other.myChain;
426  }
427  return *this;
428  }
template<typename TInteger>
ConstReverseIterator DGtal::FreemanChain< TInteger >::CodesRange::rbegin ( ) const
inline

Iterator service.

Returns
rbegin iterator

Definition at line 503 of file FreemanChain.h.

503  {
504  return myChain.rbegin();
505  }
template<typename TInteger>
ConstReverseCirculator DGtal::FreemanChain< TInteger >::CodesRange::rc ( ) const
inline

Circulator service.

Returns
a reverse circulator

Definition at line 527 of file FreemanChain.h.

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

527  {
528  return ConstReverseCirculator( this->c() );
529  }
std::reverse_iterator< ConstCirculator > ConstReverseCirculator
Definition: FreemanChain.h:395
ConstCirculator c() const
Definition: FreemanChain.h:519
template<typename TInteger>
ConstReverseIterator DGtal::FreemanChain< TInteger >::CodesRange::rend ( ) const
inline

Iterator service.

Returns
rend iterator

Definition at line 511 of file FreemanChain.h.

511  {
512  return myChain.rend();
513  }
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 454 of file FreemanChain.h.

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

455  {
456  typedef typename IteratorCirculatorTraits<ConstIterator>::Value Value;
457  out << "[FreemanChainCodes]" << std::endl;
458  out << "\t";
459  std::copy( this->begin(), this->end(), std::ostream_iterator<Value>(out, "") );
460  out << std::endl;
461  }
ConstIterator end() const
Definition: FreemanChain.h:495
ConstIterator begin() const
Definition: FreemanChain.h:487
template<typename TInteger>
std::string::size_type DGtal::FreemanChain< TInteger >::CodesRange::size ( ) const
inline
Returns
the size of the range

Definition at line 438 of file FreemanChain.h.

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

439  {
440  return myChain.size();
441  }

Friends And Related Function Documentation

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 469 of file FreemanChain.h.

470  {
471  object.selfDisplay( out );
472  return out;
473  }

Field Documentation

template<typename TInteger>
const std::string DGtal::FreemanChain< TInteger >::CodesRange::myChain
private

Private member myChain is a string of letters

Definition at line 479 of file FreemanChain.h.

Referenced by DGtal::FreemanChain< TInteger >::CodesRange::operator=(), and DGtal::FreemanChain< TInteger >::CodesRange::size().


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