DGtal  1.5.beta
InputIteratorWithRankOnSequence.h
1 
17 #pragma once
18 
31 #if defined(InputIteratorWithRankOnSequence_RECURSES)
32 #error Recursive header files inclusion detected in InputIteratorWithRankOnSequence.h
33 #else // defined(InputIteratorWithRankOnSequence_RECURSES)
35 #define InputIteratorWithRankOnSequence_RECURSES
36 
37 #if !defined InputIteratorWithRankOnSequence_h
39 #define InputIteratorWithRankOnSequence_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <iterator>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/base/CountedPtr.h"
47 #include "DGtal/kernel/CInteger.h"
49 
50 namespace DGtal
51 {
52 
54  // template class InputIteratorWithRankOnSequence
78  template <typename TSequence, typename TRank = typename TSequence::difference_type>
80  {
81  // ----------------------- public types ------------------------------
82  public:
85 
86  typedef TSequence Sequence;
87  typedef TRank Rank;
89  typedef typename Sequence::value_type SequenceValue;
90  typedef std::pair<SequenceValue,Rank> Value;
91  typedef typename Sequence::const_iterator ConstIterator;
92  typedef Value* Pointer;
93 
94  // ----------------------- std types ----------------------------------
95  typedef Value value_type;
96  typedef typename Sequence::size_type size_type;
97  typedef typename Sequence::difference_type difference_type;
98  typedef Pointer pointer;
101  typedef std::input_iterator_tag iterator_category;
102 
103  // ----------------------- Standard services ------------------------------
104  public:
105 
110 
117 
124 
131 
137 
143  Self & operator= ( const Self & other );
144 
149  Value operator*() const;
150 
156 
162 
167  Self operator++( int );
168 
174  bool operator==( const Self & other ) const;
175 
181  bool operator!=( const Self & other ) const;
182 
183  // ----------------------- Interface --------------------------------------
184  public:
185 
190  void selfDisplay ( std::ostream & out ) const;
191 
196  bool isValid() const;
197 
198  // ------------------------- Protected Datas ------------------------------
199  private:
200  // ------------------------- Private Datas --------------------------------
201  private:
202 
210 
211  // ------------------------- Hidden services ------------------------------
212  protected:
217 
218  // ------------------------- Internals ------------------------------------
219  private:
220 
221  }; // end of class InputIteratorWithRankOnSequence
222 
223 
230  template <typename TSequence, typename TRank>
231  std::ostream&
232  operator<< ( std::ostream & out, const InputIteratorWithRankOnSequence<TSequence, TRank> & object );
233 
234 } // namespace DGtal
235 
236 
238 // Includes inline functions.
239 #include "DGtal/base/InputIteratorWithRankOnSequence.ih"
240 
241 // //
243 
244 #endif // !defined InputIteratorWithRankOnSequence_h
245 
246 #undef InputIteratorWithRankOnSequence_RECURSES
247 #endif // else defined(InputIteratorWithRankOnSequence_RECURSES)
Aim: Useful to create an iterator that returns a pair (value,rank) when visiting a sequence....
BOOST_CONCEPT_ASSERT((boost::Sequence< TSequence >))
InputIteratorWithRankOnSequence(const Self &other)
InputIteratorWithRankOnSequence< Sequence, Rank > Self
BOOST_CONCEPT_ASSERT((concepts::CInteger< TRank >))
bool operator!=(const Self &other) const
ConstIterator myIterator
The current iterator position on the sequence.
InputIteratorWithRankOnSequence(Sequence *ptrSeq, ConstIterator it)
InputIteratorWithRankOnSequence(const Sequence &seq, ConstIterator it)
void selfDisplay(std::ostream &out) const
Self & operator=(const Self &other)
CountedPtr< Sequence > mySequence
A smart pointer to the visited sequence.
InputIteratorWithRankOnSequence(const CountedPtr< Sequence > &ptrSeq, ConstIterator it)
bool operator==(const Self &other) const
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Definition: CInteger.h:88
Go to http://www.sgi.com/tech/stl/Sequence.html.
Definition: Boost.dox:128