DGtal  1.5.beta
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)
35 #define Expander_RECURSES
36 
37 #if !defined Expander_h
39 #define Expander_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/base/ConstAlias.h"
46 #include "DGtal/kernel/sets/DigitalSetSelector.h"
47 #include "DGtal/kernel/sets/DigitalSetDomain.h"
48 #include "DGtal/topology/DomainAdjacency.h"
49 #include "DGtal/topology/Object.h"
51 
52 namespace DGtal
53 {
54 
56  // template class Expander
96  template <typename TObject>
97  class Expander
98  {
99  // ----------------------- Associated types ------------------------------
100  public:
101  typedef TObject Object;
102  typedef typename Object::Size Size;
103  typedef typename Object::Point Point;
104  typedef typename Object::Domain Domain;
105  typedef typename Object::DigitalSet DigitalSet;
107  typedef typename Domain::Space Space;
114 
115  // ----------------------- Standard services ------------------------------
116  public:
117 
122 
130  Expander( ConstAlias<Object> object, const Point & p );
131 
143  template <typename PointInputIterator>
145  PointInputIterator b, PointInputIterator e );
146 
147 
148  // ----------------------- Expansion services ------------------------------
149  public:
150 
154  bool finished() const;
155 
160  Size distance() const;
161 
169  bool nextLayer();
170 
174  const DigitalSet & core() const;
175 
179  const DigitalSet & layer() const;
180 
185 
190 
191  // ----------------------- Interface --------------------------------------
192  public:
193 
198  void selfDisplay ( std::ostream & out ) const;
199 
204  bool isValid() const;
205 
206  // ------------------------- Protected Datas ------------------------------
207  private:
208  // ------------------------- Private Datas --------------------------------
209  private:
210 
215 
219  const Object & myObject;
220 
225 
230 
236 
241 
246 
251 
256 
257  // ------------------------- Hidden services ------------------------------
258  protected:
259 
265 
274  void computeNextLayer( const DigitalSet & src );
275 
280  void endLayer();
281 
282  private:
283 
289  Expander ( const Expander & other );
290 
297  Expander & operator= ( const Expander & other );
298 
299  // ------------------------- Internals ------------------------------------
300  private:
301 
302  }; // end of class Expander
303 
304 
311  template <typename T>
312  std::ostream&
313  operator<< ( std::ostream & out, const Expander<T> & object );
314 
315 } // namespace DGtal
316 
317 
319 // Includes inline functions.
320 #include "DGtal/graph/Expander.ih"
321 
322 // //
324 
325 #endif // !defined Expander_h
326 
327 #undef Expander_RECURSES
328 #endif // else defined(Expander_RECURSES)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
Container::const_iterator ConstIterator
ConstIterator type of the container;.
Aim: This class is useful to visit an object by adjacencies, layer by layer.
Definition: Expander.h:98
ObjectAdjacency myObjectAdjacency
Definition: Expander.h:229
Domain::Space Space
Definition: Expander.h:107
const Object & myObject
Definition: Expander.h:219
Object::Point Point
Definition: Expander.h:103
ConstIterator end() const
DigitalSetDomain< DigitalSet > CoreDomain
Definition: Expander.h:110
ObjectDomain myObjectDomain
Definition: Expander.h:224
Expander(const Expander &other)
Object::ForegroundAdjacency ForegroundAdjacency
Definition: Expander.h:106
void computeNextLayer(const DigitalSet &src)
DigitalSet::ConstIterator ConstIterator
Definition: Expander.h:108
DigitalSet myLayer
Definition: Expander.h:240
const Domain & myEmbeddingDomain
Definition: Expander.h:214
CoreDomain::Predicate InCoreDomainPredicate
Definition: Expander.h:112
const DigitalSet & core() const
ConstIterator begin() const
functors::NotPointPredicate< InCoreDomainPredicate > NotInCoreDomainPredicate
Definition: Expander.h:113
Object::Domain Domain
Definition: Expander.h:104
Expander(ConstAlias< Object > object, PointInputIterator b, PointInputIterator e)
DomainAdjacency< ObjectDomain, ForegroundAdjacency > ObjectAdjacency
Definition: Expander.h:111
bool isValid() const
Size distance() const
Expander(ConstAlias< Object > object, const Point &p)
const DigitalSet & layer() const
TObject Object
Definition: Expander.h:101
DigitalSetDomain< DigitalSet > ObjectDomain
Definition: Expander.h:109
Object::DigitalSet DigitalSet
Definition: Expander.h:105
Object::Size Size
Definition: Expander.h:102
DigitalSet myCore
Definition: Expander.h:235
Expander & operator=(const Expander &other)
void selfDisplay(std::ostream &out) const
NotInCoreDomainPredicate myNotInCorePred
Definition: Expander.h:255
bool finished() const
DigitalSet::Size Size
Definition: Object.h:140
TDigitalSet DigitalSet
Definition: Object.h:123
DigitalSet::Domain Domain
Definition: Object.h:145
DigitalTopology::ForegroundAdjacency ForegroundAdjacency
Definition: Object.h:150
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)