DGtal  0.9.2
CDomain.h
1 
17 #pragma once
18 
31 #if defined(CDomain_RECURSES)
32 #error Recursive header files inclusion detected in CDomain.h
33 #else // defined(CDomain_RECURSES)
34 
35 #define CDomain_RECURSES
36 
37 #if !defined CDomain_h
38 
39 #define CDomain_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "boost/concept_check.hpp"
45 #include "DGtal/base/Common.h"
46 #include "DGtal/base/ConceptUtils.h"
47 #include "DGtal/base/CConstSinglePassRange.h"
49 
50 namespace DGtal
51 {
52  namespace concepts
53  {
55  // class CDomain
128  template <typename T>
129  struct CDomain : public CConstSinglePassRange<T>
130  {
131  // ----------------------- Concept checks ------------------------------
132  public:
133  typedef typename T::Domain Domain;
134  typedef typename T::Space Space;
135  typedef typename T::Point Point;
136  typedef typename T::Vector Vector;
137  typedef typename T::Integer Integer;
138  typedef typename T::Size Size;
139  typedef typename T::Dimension Dimension;
140  typedef typename T::Predicate Predicate;
141  typedef typename T::ConstIterator ConstIterator;
142 
144  {
145  // Domain should have a lowerBound() returning a Point.
146  ConceptUtils::sameType( myP, myT.lowerBound() );
147  // Domain should have an upperBound() returning a Point.
148  ConceptUtils::sameType( myP, myT.upperBound() );
149  // Domain should have a size() returning a Size.
150  ConceptUtils::sameType( mySize, myT.size() );
151  // Domain should have a isInside(p) returning a bool.
152  ConceptUtils::sameType( myBool, myT.isInside( myP ) );
153  // Domain should have a predicate() returning a Predicate.
154  ConceptUtils::sameType( myPred, myT.predicate() );
155  // Domain should have a begin(Point) method returning an
156  // ConstIterator starting from Point
157  ConceptUtils::sameType( myIt, myT.begin(myP) );
158 
159 
160  }
161 
162  // ------------------------- Private Datas --------------------------------
163  private:
164  T myT;
165  Point myP;
166  Predicate myPred;
167  bool myBool;
168  Size mySize;
169  ConstIterator myIt;
170  // ------------------------- Internals ------------------------------------
171  private:
172 
173  }; // end of concept CDomain
174  }
175 } // namespace DGtal
176 
177 // //
179 
180 #endif // !defined CDomain_h
181 
182 #undef CDomain_RECURSES
183 #endif // else defined(CDomain_RECURSES)
T::Predicate Predicate
Definition: CDomain.h:140
T::Dimension Dimension
Definition: CDomain.h:139
T::ConstIterator ConstIterator
Definition: CDomain.h:141
Aim: Defines the concept describing a const single pass range.
BOOST_CONCEPT_USAGE(CDomain)
Definition: CDomain.h:143
Aim: This concept represents a digital domain, i.e. a non mutable subset of points of the given digit...
Definition: CDomain.h:129
void sameType(const T &t1, const T &t2)
DGtal is the top-level namespace which contains all DGtal functions and types.
ConstIterator myIt
Definition: CDomain.h:169