DGtal  1.5.beta
DomainAdjacency.h
1 
17 #pragma once
18 
31 #if defined(DomainAdjacency_RECURSES)
32 #error Recursive header files inclusion detected in DomainAdjacency.h
33 #else // defined(DomainAdjacency_RECURSES)
35 #define DomainAdjacency_RECURSES
36 
37 #if !defined DomainAdjacency_h
39 #define DomainAdjacency_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <map>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/base/ConstAlias.h"
47 #include "DGtal/kernel/domains/CDomain.h"
48 #include "DGtal/kernel/domains/DomainPredicate.h"
49 #include "DGtal/topology/CAdjacency.h"
50 #include "DGtal/kernel/sets/DigitalSetSelector.h"
52 
53 namespace DGtal
54 {
55 
57  // template class DomainAdjacency
72  template <typename TDomain, typename TAdjacency>
74  {
77  public:
78 
79  // Required as model of CAdjacency
80  typedef typename TDomain::Space Space;
81  typedef TAdjacency Adjacency;
82  typedef typename TDomain::Point Point;
83 
84  // Required as model of CDomainAdjacency
85  typedef TDomain Domain;
87 
88  // Required by CUndirectedSimpleLocalGraph
89  typedef Point Vertex;
90  typedef typename Space::Size Size;
91  typedef typename DigitalSetSelector< Domain,
93  template <typename Value> struct VertexMap {
94  typedef typename std::map<Vertex, Value> Type;
95  };
96 
97  // ----------------------- Standard services ------------------------------
98  public:
99 
109 
115 
120 
124  const Domain & domain() const;
125 
126  // ----------------------- Adjacency services -----------------------------
127  public:
128 
135  const Predicate & predicate() const;
136 
144  bool isAdjacentTo( const Point & p1, const Point & p2 ) const;
145 
153  bool isProperlyAdjacentTo( const Point & p1, const Point & p2 ) const;
154 
155 // ----------------------- Local graph services --------------------------
156 
161 
167  Size degree( const Vertex & v ) const;
168 
180  template <typename OutputIterator>
181  void
182  writeNeighbors( OutputIterator &it ,
183  const Vertex & v ) const;
184 
201  template <typename OutputIterator, typename VertexPredicate>
202  void
203  writeNeighbors( OutputIterator &it ,
204  const Vertex & v,
205  const VertexPredicate & pred) const;
206 
207  // ----------------------- Interface --------------------------------------
208  public:
209 
214  void selfDisplay ( std::ostream & out ) const;
215 
220  bool isValid() const;
221 
222  // ------------------------- Protected Datas ------------------------------
223  private:
224  // ------------------------- Private Datas --------------------------------
225  private:
230 
235 
236  // ------------------------- Hidden services ------------------------------
237  protected:
238 
244 
245  private:
246 
254 
255  // ------------------------- Internals ------------------------------------
256  private:
257 
258  }; // end of class DomainAdjacency
259 
260 
267  template <typename TDomain, typename TAdjacency>
268  std::ostream&
269  operator<< ( std::ostream & out,
270  const DomainAdjacency<TDomain, TAdjacency> & object );
271 
272 } // namespace DGtal
273 
274 
276 // Includes inline functions.
277 #include "DGtal/topology/DomainAdjacency.ih"
278 
279 // //
281 
282 #endif // !defined DomainAdjacency_h
283 
284 #undef DomainAdjacency_RECURSES
285 #endif // else defined(DomainAdjacency_RECURSES)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
Aim: Given a domain and an adjacency, limits the given adjacency to the specified domain for all adja...
BOOST_CONCEPT_ASSERT((concepts::CDomain< TDomain >))
functors::DomainPredicate< Domain > Predicate
void writeNeighbors(OutputIterator &it, const Vertex &v) const
DomainAdjacency(const DomainAdjacency &other)
bool isAdjacentTo(const Point &p1, const Point &p2) const
DomainAdjacency(ConstAlias< Domain > aDomain, ConstAlias< Adjacency > adjacency)
const Adjacency & myAdjacency
void writeNeighbors(OutputIterator &it, const Vertex &v, const VertexPredicate &pred) const
const Predicate & predicate() const
BOOST_CONCEPT_ASSERT((concepts::CAdjacency< TAdjacency >))
DomainAdjacency & operator=(const DomainAdjacency &other)
Size degree(const Vertex &v) const
Size bestCapacity() const
DigitalSetSelector< Domain, SMALL_DS+HIGH_ITER_DS >::Type VertexSet
bool isProperlyAdjacentTo(const Point &p1, const Point &p2) const
void selfDisplay(std::ostream &out) const
const Domain & domain() const
size_t Size
Type used to represent sizes in the digital space.
Definition: SpaceND.h:107
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
Aim: Automatically defines an adequate digital set type according to the hints given by the user.
std::map< Vertex, Value > Type
Aim: The concept CAdjacency defines an elementary adjacency relation between points of a digital spac...
Definition: CAdjacency.h:100
Aim: This concept represents a digital domain, i.e. a non mutable subset of points of the given digit...
Definition: CDomain.h:130
MyPointD Point
Definition: testClone2.cpp:383