DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
BasicPointPredicates.h
1 
17 #pragma once
18 
35 #if defined(BasicPointPredicates_RECURSES)
36 #error Recursive header files inclusion detected in BasicPointPredicates.h
37 #else // defined(BasicPointPredicates_RECURSES)
38 
39 #define BasicPointPredicates_RECURSES
40 
41 #if !defined BasicPointPredicates_h
42 
43 #define BasicPointPredicates_h
44 
46 // Inclusions
47 #include <iostream>
48 #include "DGtal/base/Common.h"
49 #include "DGtal/base/BasicBoolFunctions.h"
50 #include "DGtal/base/CUnaryFunctor.h"
51 #include "DGtal/kernel/CPointFunctor.h"
52 #include "DGtal/kernel/CPointPredicate.h"
54 
55 namespace DGtal
56 {
57 
59  // template class ConstantPointPredicate
67  template <typename TPoint, bool boolCst>
69  {
70  typedef TPoint Point;
71 
76  bool operator()( const Point & p ) const;
77 
78  }; // end of class ConstantPointPredicates
79 
81  // template class TruePointPredicate
88  template <typename TPoint>
89  struct TruePointPredicate : public ConstantPointPredicate<TPoint,true>
90  {
91  typedef TPoint Point;
92  };
93 
95  // template class FalsePointPredicate
102  template <typename TPoint>
103  struct FalsePointPredicate : public ConstantPointPredicate<TPoint,false>
104  {
105  typedef TPoint Point;
106  };
107 
109  // template class IsLowerPointPredicate
117  template <typename TPoint>
119  {
120  typedef TPoint Point;
124  IsLowerPointPredicate( const Point & upperBound );
125 
130  bool operator()( const Point & p ) const;
131 
134  };
135 
137  // template class IsUpperPointPredicate
145  template <typename TPoint>
147  {
148  typedef TPoint Point;
152  IsUpperPointPredicate( const Point & lowerBound );
153 
158  bool operator()( const Point & p ) const;
159 
162  };
163 
165  // template class IsWithinPointPredicate
172  template <typename TPoint>
174  {
175  typedef TPoint Point;
179  IsWithinPointPredicate( const Point & lowerBound,
180  const Point & upperBound );
181 
186  bool operator()( const Point & p ) const;
187 
192  };
193 
195  // template class NotPointPredicate
203  template <typename TPointPredicate>
205  {
206  typedef TPointPredicate PointPredicate;
207  //BOOST_CONCEPT_ASSERT (( CPointPredicate<PointPredicate> ));
208 
209  typedef typename PointPredicate::Point Point;
210 
214  NotPointPredicate( const PointPredicate & pred );
215 
220  bool operator()( const Point & p ) const;
221 
224  };
225 
227  // template class EqualPointPredicate
235  template <typename TPoint>
237  {
238  typedef TPoint Point;
239 
243  EqualPointPredicate( const Point & aPoint );
244 
249  bool operator()( const Point & p ) const;
250 
253  };
254 
256  // template class BinaryPointPredicate
266  template <typename TPointPredicate1, typename TPointPredicate2,
267  typename TBinaryFunctor = BoolFunction2 >
269  {
270  typedef TPointPredicate1 PointPredicate1;
271  typedef TPointPredicate2 PointPredicate2;
272  typedef typename PointPredicate1::Point Point;
273  // should be the same.
274  BOOST_STATIC_ASSERT ((boost::is_same< Point, typename PointPredicate2::Point >::value));
275  //BOOST_CONCEPT_ASSERT (( CPointPredicate<PointPredicate1> ));
276  //BOOST_CONCEPT_ASSERT (( CPointPredicate<PointPredicate2> ));
277 
278  typedef typename PointPredicate2::Point Point2;
279 
287  BinaryPointPredicate( const PointPredicate1 & pred1,
288  const PointPredicate2 & pred2,
289  const TBinaryFunctor & boolFunctor );
290 
296 
303 
308 
313  bool operator()( const Point & p ) const;
314 
320  const TBinaryFunctor* myBoolFunctor;
321  };
322 
324  // template class PointFunctorPredicate
334  template <typename TPointFunctor, typename TPredicate>
336  {
339 
340  typedef TPointFunctor PointFunctor;
341  typedef TPredicate Predicate;
342  typedef typename PointFunctor::Point Point;
343 
349  PointFunctorPredicate( const PointFunctor & aFun,
350  const Predicate & aPred );
351 
357 
364 
369 
374  bool operator()( const Point & p ) const;
375 
380  };
381 
382 } // namespace DGtal
383 
384 
386 // Includes inline functions.
387 #include "DGtal/kernel/BasicPointPredicates.ih"
388 
389 // //
391 
392 #endif // !defined BasicPointPredicates_h
393 
394 #undef BasicPointPredicates_RECURSES
395 #endif // else defined(BasicPointPredicates_RECURSES)