DGtal  0.9.2
TiledImageBidirectionalConstRangeFromPoint.h
1 
17 #pragma once
18 
33 #if defined(TiledImageBidirectionalConstRangeFromPoint_RECURSES)
34 #error Recursive header files inclusion detected in TiledImageBidirectionalConstRangeFromPoint.h
35 #else // defined(TiledImageBidirectionalConstRangeFromPoint_RECURSES)
36 
37 #define TiledImageBidirectionalConstRangeFromPoint_RECURSES
38 
39 #if !defined TiledImageBidirectionalConstRangeFromPoint_h
40 
41 #define TiledImageBidirectionalConstRangeFromPoint_h
42 
44 // Inclusions
45 #include "DGtal/base/BasicFunctors.h"
46 #include "DGtal/base/Circulator.h"
47 #include "DGtal/base/ConstIteratorAdapter.h"
48 #include "DGtal/base/CConstBidirectionalRangeFromPoint.h"
49 #include "boost/concept_check.hpp"
51 
52 namespace DGtal
53 {
54 
55 
57  // class TiledImageBidirectionalConstRangeFromPoint
59 
69  template <typename TTiledImage>
70 
72  {
73 
75 
76  // ------------------------- inner types --------------------------------
77 
78  public:
79 
80  typedef TTiledImage TiledImage;
81 
82  typedef typename TiledImage::Point Point;
83 
85  typedef std::reverse_iterator<ConstIterator> ConstReverseIterator;
86 
88  typedef std::reverse_iterator<ConstCirculator> ConstReverseCirculator;
89 
90  // ------------------------- standard services --------------------------------
91 
97  : myti ( ti ) {}
98 
104  : myti ( other.myti ) {}
105 
112  {
113  if ( this != &other )
114  {
115  myti = other.myti;
116  }
117 
118  return *this;
119  }
120 
125 
130  bool isValid() const
131  {
132  return true;
133  }
134 
135  // ------------------------- display --------------------------------
140  void selfDisplay ( std::ostream & out ) const
141  {
142  typedef typename IteratorCirculatorTraits<ConstIterator>::Value Value;
143  out << "[TiledImageBidirectionalConstRangeFromPoint]" << std::endl;
144  out << "\t";
145  std::copy ( myti->begin(), myti->end(), std::ostream_iterator<Value> ( out, ", " ) );
146  out << std::endl;
147  }
148 
152  std::string className() const
153  {
154  return "TiledImageBidirectionalConstRangeFromPoint";
155  }
156 
157 
158  // ------------------------- private data --------------------------------
159 
160  private:
161 
162  const TTiledImage *myti;
163 
164  // ------------------------- iterator services --------------------------------
165 
166  public:
167 
172  ConstIterator begin() const
173  {
174  return ConstIterator ( myti->begin() );
175  }
176 
181  ConstIterator begin ( const Point &aPoint ) const
182  {
183  return ConstIterator ( myti->begin(aPoint) );
184  }
185 
190  ConstIterator end() const
191  {
192  return ConstIterator ( myti->end() );
193  }
194 
199  ConstReverseIterator rbegin() const
200  {
201  return ConstReverseIterator ( this->end() );
202  }
203 
208  ConstReverseIterator rbegin ( const Point &aPoint ) const
209  {
210  return ConstReverseIterator ( myti->rbegin(aPoint) );
211  }
212 
217  ConstReverseIterator rend() const
218  {
219  return ConstReverseIterator ( this->begin() );
220  }
221 
226  ConstCirculator c() const
227  {
228  return ConstCirculator ( this->begin(), this->begin(), this->end() );
229  }
230 
235  ConstReverseCirculator rc() const
236  {
237  return ConstReverseCirculator ( this->c() );
238  }
239 
240  }; //end class TiledImageBidirectionalConstRangeFromPoint
241 
242 } // namespace DGtal
243 
245 
246 
247 #endif // !defined TiledImageBidirectionalConstRangeFromPoint_h
248 
249 #undef TiledImageBidirectionalConstRangeFromPoint_RECURSES
250 #endif // else defined(TiledImageBidirectionalConstRangeFromPoint_RECURSES)
Aim: model of CConstBidirectionalRangeFromPoint that adapts a TiledImage range of elements bounded by...
TiledImageBidirectionalConstRangeFromPoint(const TiledImageBidirectionalConstRangeFromPoint &other)
ImageContainer::Point Point
Definition: TiledImage.h:93
BOOST_CONCEPT_ASSERT((boost::BidirectionalIterator< typename TTiledImage::ConstIterator >))
Aim: Provides an adapter for classical iterators that can iterate through the underlying data structu...
Definition: Circulator.h:85
DGtal is the top-level namespace which contains all DGtal functions and types.
TiledImageBidirectionalConstRangeFromPoint & operator=(const TiledImageBidirectionalConstRangeFromPoint &other)
Go to http://www.sgi.com/tech/stl/BidirectionalIterator.html.
Definition: Boost.dox:42