DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Expander.h
1 
17 #pragma once
18 
31 #if defined(Expander_RECURSES)
32 #error Recursive header files inclusion detected in Expander.h
33 #else // defined(Expander_RECURSES)
34 
35 #define Expander_RECURSES
36 
37 #if !defined Expander_h
38 
39 #define Expander_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/kernel/sets/DigitalSetSelector.h"
46 #include "DGtal/kernel/sets/DigitalSetDomain.h"
47 #include "DGtal/topology/DomainAdjacency.h"
48 #include "DGtal/topology/Object.h"
50 
51 namespace DGtal
52 {
53 
55  // template class Expander
95  template <typename TObject>
96  class Expander
97  {
98  // ----------------------- Associated types ------------------------------
99  public:
100  typedef TObject Object;
101  typedef typename Object::Size Size;
102  typedef typename Object::Point Point;
103  typedef typename Object::Domain Domain;
104  typedef typename Object::DigitalSet DigitalSet;
106  typedef typename Domain::Space Space;
107  typedef typename DigitalSet::ConstIterator ConstIterator;
113 
114  // ----------------------- Standard services ------------------------------
115  public:
116 
120  ~Expander();
121 
129  Expander( const Object & object, const Point & p );
130 
142  template <typename PointInputIterator>
143  Expander( const Object & object,
144  PointInputIterator b, PointInputIterator e );
145 
146 
147  // ----------------------- Expansion services ------------------------------
148  public:
149 
153  bool finished() const;
154 
159  Size distance() const;
160 
168  bool nextLayer();
169 
173  const DigitalSet & core() const;
174 
178  const DigitalSet & layer() const;
179 
183  ConstIterator begin() const;
184 
188  ConstIterator end() const;
189 
190  // ----------------------- Interface --------------------------------------
191  public:
192 
197  void selfDisplay ( std::ostream & out ) const;
198 
203  bool isValid() const;
204 
205  // ------------------------- Protected Datas ------------------------------
206  private:
207  // ------------------------- Private Datas --------------------------------
208  private:
209 
214 
218  const Object & myObject;
219 
224 
229 
235 
240 
245 
250 
255 
260 
261  // ------------------------- Hidden services ------------------------------
262  protected:
263 
268  Expander();
269 
278  void computeNextLayer( const DigitalSet & src );
279 
284  void endLayer();
285 
286  private:
287 
293  Expander ( const Expander & other );
294 
301  Expander & operator= ( const Expander & other );
302 
303  // ------------------------- Internals ------------------------------------
304  private:
305 
306  }; // end of class Expander
307 
308 
315  template <typename T>
316  std::ostream&
317  operator<< ( std::ostream & out, const Expander<T> & object );
318 
319 } // namespace DGtal
320 
321 
323 // Includes inline functions.
324 #include "DGtal/topology/Expander.ih"
325 
326 // //
328 
329 #endif // !defined Expander_h
330 
331 #undef Expander_RECURSES
332 #endif // else defined(Expander_RECURSES)