DGtal  0.9.2
CDigitalSet.h
1 
17 #pragma once
18 
35 #if defined(CDigitalSet_RECURSES)
36 #error Recursive header files inclusion detected in CDigitalSet.h
37 #else // defined(CDigitalSet_RECURSES)
38 
39 #define CDigitalSet_RECURSES
40 
41 #if !defined CDigitalSet_h
42 
43 #define CDigitalSet_h
44 
46 // Inclusions
47 #include <iostream>
48 #include "boost/concept_check.hpp"
49 #include "DGtal/base/Common.h"
50 #include "DGtal/base/CowPtr.h"
51 #include "DGtal/kernel/CPointPredicate.h"
52 #include "DGtal/kernel/domains/CDomain.h"
54 
55 namespace DGtal
56 {
57  namespace concepts
58  {
60  // class CDigitalSet
62  // class CDigitalSet
137  template <typename T>
138  struct CDigitalSet :
141  {
142  // ----------------------- Concept checks ------------------------------
143  public:
144  // 1. define first provided types (i.e. inner types), like
145  typedef typename T::Domain Domain;
146  typedef typename T::Point Point;
147  typedef typename T::Size Size;
148  typedef typename T::Iterator Iterator;
149  typedef typename T::ConstIterator ConstIterator;
150 
154 
155  // 2. then check the presence of data members, operators and methods with
157  {
160  }
165  {
166  ConceptUtils::sameType( myDomain, myX.domain() );
167  ConceptUtils::sameType( myDomainPtr, myX.domainPointer() );
168  ConceptUtils::sameType( mySize, myX.size() );
169  ConceptUtils::sameType( myBool, myX.empty() );
170 
174  }
175 
180  {
181  myX.insert( myPoint );
182  // template <typename PointInputIterator>
183  // BOOST_CONCEPT_REQUIRES
184  // ( ((boost::InputIterator<PointInputIterator>)),
185  // (void) )
186  // myX.insert( PointInputIterator, PointInputIterator );
187  myX.insertNew( myPoint );
189  myX.erase( myIterator );
190  myX.erase( myIterator, myIterator );
191  myX.clear();
192  ConceptUtils::sameType( myX, myX.operator+=( myX ) );
193  myX.computeComplement( myOutputIt );
194  myX.assignFromComplement( myX );
195  myX.computeBoundingBox( myPoint, myPoint );
199  }
200 
201  // ------------------------- Private Datas --------------------------------
202  private:
203  T myX; // only if T is default constructible.
204  Domain myDomain;
206  Size mySize;
207  bool myBool;
208  Point myPoint;
209  Iterator myIterator;
210  ConstIterator myConstIterator;
211  Point* myOutputIt;
212  // ------------------------- Internals ------------------------------------
213  private:
214 
215  }; // end of concept CDigitalSet
216  }
217 } // namespace DGtal
218 
219 // //
221 
222 #endif // !defined CDigitalSet_h
223 
224 #undef CDigitalSet_RECURSES
225 #endif // else defined(CDigitalSet_RECURSES)
CowPtr< Domain > myDomainPtr
Definition: CDigitalSet.h:205
Aim: This concept represents a digital domain, i.e. a non mutable subset of points of the given digit...
Definition: CDomain.h:129
T::ConstIterator ConstIterator
Definition: CDigitalSet.h:149
Aim: Defines a predicate on a point.
void sameType(const T &t1, const T &t2)
Go to http://www.sgi.com/tech/stl/CopyConstructible.html.
Definition: Boost.dox:34
BOOST_CONCEPT_USAGE(CDigitalSet)
Definition: CDigitalSet.h:156
DGtal is the top-level namespace which contains all DGtal functions and types.
void checkConstConstraints() const
Definition: CDigitalSet.h:164
Go to http://www.boost.org/doc/libs/1_52_0/libs/iterator/doc/SinglePassIterator.html.
Aim: Represents a set of points within the given domain. This set of points is modifiable by the user...
Definition: CDigitalSet.h:138
BOOST_CONCEPT_ASSERT((concepts::CDomain< Domain >))
Go to http://www.boost.org/doc/libs/1_52_0/libs/iterator/doc/ReadableIterator.html.