DGtal  0.9.4beta
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 387 of file FreemanChain.h.

Member Typedef Documentation

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

Definition at line 395 of file FreemanChain.h.

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

Definition at line 393 of file FreemanChain.h.

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

Definition at line 396 of file FreemanChain.h.

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

Definition at line 394 of file FreemanChain.h.

Constructor & Destructor Documentation

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

Default Constructor.

Definition at line 403 of file FreemanChain.h.

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

Constructor.

Definition at line 408 of file FreemanChain.h.

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

Copy constructor.

Parameters
aOtherthe iterator to clone.

Definition at line 414 of file FreemanChain.h.

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

Destructor. Does nothing.

Definition at line 434 of file FreemanChain.h.

434 {}

Member Function Documentation

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

Iterator service.

Returns
begin iterator

Definition at line 488 of file FreemanChain.h.

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

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

Circulator service.

Returns
a circulator

Definition at line 520 of file FreemanChain.h.

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

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

520  {
521  return ConstCirculator( this->begin(), this->begin(), this->end() );
522  }
ConstIterator end() const
Definition: FreemanChain.h:496
ConstIterator begin() const
Definition: FreemanChain.h:488
Circulator< ConstIterator > ConstCirculator
Definition: FreemanChain.h:395
template<typename TInteger>
ConstIterator DGtal::FreemanChain< TInteger >::CodesRange::end ( ) const
inline

Iterator service.

Returns
end iterator

Definition at line 496 of file FreemanChain.h.

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

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

448 { 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 422 of file FreemanChain.h.

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

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

Iterator service.

Returns
rbegin iterator

Definition at line 504 of file FreemanChain.h.

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

Circulator service.

Returns
a reverse circulator

Definition at line 528 of file FreemanChain.h.

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

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

Iterator service.

Returns
rend iterator

Definition at line 512 of file FreemanChain.h.

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

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

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

Definition at line 439 of file FreemanChain.h.

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

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

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

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

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 480 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: