DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
GreedyDecomposition.h
1 
17 #pragma once
18 
31 #if defined(GreedyDecomposition_RECURSES)
32 #error Recursive header files inclusion detected in GreedyDecomposition.h
33 #else // defined(GreedyDecomposition_RECURSES)
34 
35 #define GreedyDecomposition_RECURSES
36 
37 #if !defined GreedyDecomposition_h
38 
39 #define GreedyDecomposition_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
46 
47 namespace DGtal
48 {
49  namespace deprecated
50  {
51 
53  // template class GreedyDecomposition
124  template <typename TSegment>
126  {
127 
128  public:
129 
130  typedef TSegment Segment;
131  typedef typename Segment::ConstIterator Iterator;
132 
133  // ----------------------- Standard services ------------------------------
134  public:
135 
136 
137 
143  {
144 
145  // ------------------------- data -----------------------
146  private:
147 
152 
153 
159 
165 
166 
171 
172 
179 
186 
187 
188 
189  // ------------------------- Standard services -----------------------
190  public:
191  friend class GreedyDecomposition<TSegment>;
192 
193 
194 
203  const typename TSegment::ConstIterator& aBack,
204  const TSegment& aSegment);
205 
206 
211  SegmentIterator( const SegmentIterator & aOther );
212 
218  SegmentIterator& operator=( const SegmentIterator & aOther );
219 
224 
225  // ------------------------- iteration services -------------------------
226  public:
227 
231  Segment operator*() const;
232 
236  Segment get() const;
237 
244 
249  void next();
250 
255  bool intersectNext() const;
256 
261  bool intersectPrevious() const;
262 
267  const Iterator getFront() const;
268 
273  const Iterator getBack() const;
274 
283  bool operator==( const SegmentIterator & aOther ) const;
284 
293  bool operator!=( const SegmentIterator & aOther ) const;
294 
295  // ----------------------- hidden services --------------------------------------
296 
297  private:
298 
304  void longestSegment();
305 
310  bool doesIntersectNext(const Iterator& it);
311  };
312 
313 
314  // ----------------------- Interface --------------------------------------
315  public:
316 
322 
332  GreedyDecomposition(const Iterator& aBegin,
333  const Iterator& aEnd,
334  const Segment& aSegment,
335  const bool& aFlag);
336 
346  void init(const Iterator& aBegin,
347  const Iterator& aEnd,
348  const Segment& aSegment,
349  const bool& aFlag);
350 
351 
356 
362 
367  typename GreedyDecomposition::SegmentIterator end() const;
368 
369 
374  void selfDisplay ( std::ostream & out ) const;
375 
380  bool isValid() const;
381 
382  // ------------------------- Protected Datas ------------------------------
383  private:
384  // ------------------------- Private Datas --------------------------------
385  private:
386 
388 
390 
391  bool isClosed;
392 
393  // ------------------------- Hidden services ------------------------------
394 
395 
396  private:
397 
402  GreedyDecomposition ( const GreedyDecomposition & other );
403 
410 
411  // ------------------------- Internals ------------------------------------
412  private:
413 
414  }; // end of class GreedyDecomposition
415 
416 
423  template <typename Segment>
424  std::ostream&
425  operator<< ( std::ostream & out, const GreedyDecomposition<Segment> & object );
426 
427  } // namespace deprecated
428 } // namespace DGtal
429 
430 
432 // Includes inline functions.
433 #include "DGtal/geometry/curves/GreedyDecomposition.ih"
434 
435 // //
437 
438 #endif // !defined GreedyDecomposition_h
439 
440 #undef GreedyDecomposition_RECURSES
441 #endif // else defined(GreedyDecomposition_RECURSES)