DGtal 1.4.0
|
Aim: Useful to create an iterator that returns a pair (value,rank) when visiting a sequence. The sequence is smartly copied within the iterator. Hence, the given sequence need not to persist during the visit. Since it is only an input sequence, it is not necessary to give a valid sequence when creating the end() iterator. More...
#include <DGtal/base/InputIteratorWithRankOnSequence.h>
Public Types | |
typedef TSequence | Sequence |
typedef TRank | Rank |
typedef InputIteratorWithRankOnSequence< Sequence, Rank > | Self |
typedef Sequence::value_type | SequenceValue |
typedef std::pair< SequenceValue, Rank > | Value |
typedef Sequence::const_iterator | ConstIterator |
typedef Value * | Pointer |
typedef Value | value_type |
typedef Sequence::size_type | size_type |
typedef Sequence::difference_type | difference_type |
typedef Pointer | pointer |
typedef value_type & | reference |
typedef reference | const_reference |
typedef std::input_iterator_tag | iterator_category |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((boost::Sequence< TSequence >)) | |
BOOST_CONCEPT_ASSERT ((concepts::CInteger< TRank >)) | |
~InputIteratorWithRankOnSequence () | |
InputIteratorWithRankOnSequence (const Sequence &seq, ConstIterator it) | |
InputIteratorWithRankOnSequence (Sequence *ptrSeq, ConstIterator it) | |
InputIteratorWithRankOnSequence (const CountedPtr< Sequence > &ptrSeq, ConstIterator it) | |
InputIteratorWithRankOnSequence (const Self &other) | |
Self & | operator= (const Self &other) |
Value | operator* () const |
Pointer | operator-> () const |
Self & | operator++ () |
Self | operator++ (int) |
bool | operator== (const Self &other) const |
bool | operator!= (const Self &other) const |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
Protected Member Functions | |
InputIteratorWithRankOnSequence () | |
Private Attributes | |
CountedPtr< Sequence > | mySequence |
A smart pointer to the visited sequence. | |
ConstIterator | myIterator |
The current iterator position on the sequence. | |
Value | myTmpValue |
Aim: Useful to create an iterator that returns a pair (value,rank) when visiting a sequence. The sequence is smartly copied within the iterator. Hence, the given sequence need not to persist during the visit. Since it is only an input sequence, it is not necessary to give a valid sequence when creating the end() iterator.
Description of template class 'InputIteratorWithRankOnSequence'
It is used by SternBrocot::Fraction, LightSternBrocot::Fraction, LighterSternBrocot::Fraction to visit the quotients of the continued fraction.
It is a model of boost::InputIterator.
TSequence | the type of sequence (a model of Sequence). |
TRank | the type of the rank (a model of CInteger). |
Definition at line 79 of file InputIteratorWithRankOnSequence.h.
typedef reference DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::const_reference |
Definition at line 100 of file InputIteratorWithRankOnSequence.h.
typedef Sequence::const_iterator DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::ConstIterator |
Definition at line 91 of file InputIteratorWithRankOnSequence.h.
typedef Sequence::difference_type DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::difference_type |
Definition at line 97 of file InputIteratorWithRankOnSequence.h.
typedef std::input_iterator_tag DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::iterator_category |
Definition at line 101 of file InputIteratorWithRankOnSequence.h.
typedef Value* DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::Pointer |
Definition at line 92 of file InputIteratorWithRankOnSequence.h.
typedef Pointer DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::pointer |
Definition at line 98 of file InputIteratorWithRankOnSequence.h.
typedef TRank DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::Rank |
Definition at line 87 of file InputIteratorWithRankOnSequence.h.
typedef value_type& DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::reference |
Definition at line 99 of file InputIteratorWithRankOnSequence.h.
typedef InputIteratorWithRankOnSequence<Sequence,Rank> DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::Self |
Definition at line 88 of file InputIteratorWithRankOnSequence.h.
typedef TSequence DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::Sequence |
Definition at line 86 of file InputIteratorWithRankOnSequence.h.
typedef Sequence::value_type DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::SequenceValue |
Definition at line 89 of file InputIteratorWithRankOnSequence.h.
typedef Sequence::size_type DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::size_type |
Definition at line 96 of file InputIteratorWithRankOnSequence.h.
typedef std::pair<SequenceValue,Rank> DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::Value |
Definition at line 90 of file InputIteratorWithRankOnSequence.h.
typedef Value DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::value_type |
Definition at line 95 of file InputIteratorWithRankOnSequence.h.
DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::~InputIteratorWithRankOnSequence | ( | ) |
Destructor.
DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::InputIteratorWithRankOnSequence | ( | const Sequence & | seq, |
ConstIterator | it ) |
Constructor.
seq | any sequence. |
it | any iterator in the sequence seq. |
DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::InputIteratorWithRankOnSequence | ( | Sequence * | ptrSeq, |
ConstIterator | it ) |
Constructor.
ptrSeq | any dynamically allocated pointer on a sequence (acquired). |
it | any iterator in the sequence ptrSeq. |
DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::InputIteratorWithRankOnSequence | ( | const CountedPtr< Sequence > & | ptrSeq, |
ConstIterator | it ) |
Constructor.
ptrSeq | any smart pointer on a sequence (CountedPtr or CowPtr). |
it | any iterator in the sequence ptrSeq. |
DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::InputIteratorWithRankOnSequence | ( | const Self & | other | ) |
Copy constructor.
other | the object to clone. |
|
protected |
Constructor.
DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::BOOST_CONCEPT_ASSERT | ( | (boost::Sequence< TSequence >) | ) |
DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::BOOST_CONCEPT_ASSERT | ( | (concepts::CInteger< TRank >) | ) |
bool DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
bool DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::operator!= | ( | const Self & | other | ) | const |
Inequality operator.
other | any other iterator. |
Value DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::operator* | ( | ) | const |
Dereference operator.
Self & DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::operator++ | ( | ) |
Pre-increment operator.
Self DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::operator++ | ( | int | ) |
Post-increment operator.
Pointer DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::operator-> | ( | ) | const |
Pointer dereference operator.
Self & DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::operator= | ( | const Self & | other | ) |
Assignment.
other | the object to copy. |
bool DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::operator== | ( | const Self & | other | ) | const |
Equality operator.
other | any other iterator. |
void DGtal::InputIteratorWithRankOnSequence< TSequence, TRank >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
|
private |
The current iterator position on the sequence.
Definition at line 206 of file InputIteratorWithRankOnSequence.h.
|
private |
A smart pointer to the visited sequence.
Definition at line 204 of file InputIteratorWithRankOnSequence.h.
|
private |
Hack to store a value when using operator->. This value is not copied nor initialized.
Definition at line 209 of file InputIteratorWithRankOnSequence.h.