DGtal  0.9.2
TiledImageBidirectionalRangeFromPoint.h
1 
17 #pragma once
18 
33 #if defined(TiledImageBidirectionalRangeFromPoint_RECURSES)
34 #error Recursive header files inclusion detected in TiledImageBidirectionalRangeFromPoint.h
35 #else // defined(TiledImageBidirectionalRangeFromPoint_RECURSES)
36 
37 #define TiledImageBidirectionalRangeFromPoint_RECURSES
38 
39 #if !defined TiledImageBidirectionalRangeFromPoint_h
40 
41 #define TiledImageBidirectionalRangeFromPoint_h
42 
44 // Inclusions
45 #include "DGtal/base/BasicFunctors.h"
46 #include "DGtal/base/Circulator.h"
47 #include "DGtal/base/IteratorAdapter.h"
48 #include "DGtal/base/CBidirectionalRangeFromPoint.h"
49 #include "boost/concept_check.hpp"
51 
52 namespace DGtal
53 {
54 
55 
57  // class TiledImageBidirectionalRangeFromPoint
59 
69  template <typename TTiledImage>
70 
72  {
73 
76 
77  // ------------------------- inner types --------------------------------
78 
79  public:
80 
81  typedef TTiledImage TiledImage;
82 
83  typedef typename TiledImage::Point Point;
84 
87 
88  typedef std::reverse_iterator<Iterator> ReverseIterator;
89  typedef std::reverse_iterator<ConstIterator> ConstReverseIterator;
90 
92  typedef std::reverse_iterator<Iterator> ReverseOutputIterator;
93 
94  // typedef Circulator<Iterator> Circulator;
95  // typedef std::reverse_iterator<Circulator> ReverseCirculator;
96 
97  // ------------------------- standard services --------------------------------
98 
103  TiledImageBidirectionalRangeFromPoint ( const TiledImage *ti )
104  : myti ( ti ) {}
105 
111  : myti ( other.myti ) {}
112 
119  {
120  if ( this != &other )
121  {
122  myti = other.myti;
123  }
124 
125  return *this;
126  }
127 
132 
137  bool isValid() const
138  {
139  return true;
140  }
141 
142  // ------------------------- display --------------------------------
147  void selfDisplay ( std::ostream & out ) const
148  {
149  typedef typename IteratorCirculatorTraits<Iterator>::Value Value;
150  out << "[TiledImageBidirectionalRangeFromPoint]" << std::endl;
151  out << "\t";
152  std::copy ( myti->begin(), myti->end(), std::ostream_iterator<Value> ( out, ", " ) );
153  out << std::endl;
154  }
155 
159  std::string className() const
160  {
161  return "TiledImageBidirectionalRangeFromPoint";
162  }
163 
164 
165  // ------------------------- private data --------------------------------
166 
167  private:
168 
169  const TTiledImage *myti;
170 
171  // ------------------------- iterator services --------------------------------
172 
173  public:
174 
179  Iterator begin()
180  {
181  return Iterator ( myti->begin() );
182  }
183 
189  Iterator begin ( const Point &aPoint )
190  {
191  return Iterator ( myti->begin(aPoint) );
192  }
193 
198  ConstIterator begin() const
199  {
200  return ConstIterator ( myti->begin() );
201  }
202 
208  ConstIterator begin ( const Point &aPoint ) const
209  {
210  return ConstIterator ( myti->begin(aPoint) );
211  }
212 
217  Iterator end()
218  {
219  return Iterator ( myti->end() );
220  }
221 
226  ConstIterator end() const
227  {
228  return ConstIterator ( myti->end() );
229  }
230 
235  OutputIterator outputIterator()
236  {
237  return OutputIterator ( myti->begin() );
238  }
239 
245  OutputIterator outputIterator ( const Point &aPoint )
246  {
247  return OutputIterator ( myti->begin(aPoint) );
248  }
249 
254  ReverseOutputIterator routputIterator()
255  {
256  return ReverseOutputIterator ( myti->begin() );
257  }
258 
264  ReverseOutputIterator routputIterator ( const Point &aPoint )
265  {
266  return ReverseOutputIterator ( myti->begin(aPoint) );
267  }
268 
273  ReverseIterator rbegin()
274  {
275  return ReverseIterator ( this->end() );
276  }
277 
283  ReverseIterator rbegin ( const Point &aPoint )
284  {
285  return ReverseIterator ( myti->rbegin(aPoint) );
286  }
287 
292  ReverseIterator rend()
293  {
294  return ReverseIterator ( this->begin() );
295  }
296 
301  ConstReverseIterator rbegin() const
302  {
303  return ConstReverseIterator ( this->end() );
304  }
305 
311  ConstReverseIterator rbegin ( const Point &aPoint ) const
312  {
313  return ConstReverseIterator ( myti->rbegin(aPoint) );
314  }
315 
320  ConstReverseIterator rend() const
321  {
322  return ConstReverseIterator ( this->begin() );
323  }
324 
325  // /**
326  // * Circulator service.
327  // * @return a circulator
328  // */
329  // Circulator c() const
330  // {
331  // return Circulator ( this->begin(), this->begin(), this->end() );
332  // }
333 
334  // /**
335  // * Circulator service.
336  // * @return a reverse circulator
337  // */
338  // ReverseCirculator rc() const
339  // {
340  // return ReverseCirculator ( this->c() );
341  // }
342 
343  }; //end class TiledImageBidirectionalRangeFromPoint
344 
345 } // namespace DGtal
346 
348 
349 
350 #endif // !defined TiledImageBidirectionalRangeFromPoint_h
351 
352 #undef TiledImageBidirectionalRangeFromPoint_RECURSES
353 #endif // else defined(TiledImageBidirectionalRangeFromPoint_RECURSES)
Aim: model of CBidirectionalRangeFromPoint that adapts a TiledImage range of elements bounded by two ...
ImageContainer::Point Point
Definition: TiledImage.h:93
TiledImageBidirectionalRangeFromPoint(const TiledImageBidirectionalRangeFromPoint &other)
BOOST_CONCEPT_ASSERT((boost::BidirectionalIterator< typename TTiledImage::OutputIterator >))
TiledImageBidirectionalRangeFromPoint & operator=(const TiledImageBidirectionalRangeFromPoint &other)
ReverseOutputIterator routputIterator(const Point &aPoint)
DGtal is the top-level namespace which contains all DGtal functions and types.
ConstReverseIterator rbegin(const Point &aPoint) const
Go to http://www.sgi.com/tech/stl/BidirectionalIterator.html.
Definition: Boost.dox:42