DGtal  1.1.0
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/BasicBoolFunctors.h"
50 #include "DGtal/base/CPredicate.h"
51 #include "DGtal/base/ConstAlias.h"
52 #include "DGtal/kernel/CPointFunctor.h"
53 #include "DGtal/kernel/CPointPredicate.h"
55 
56 // @since 0.8 In DGtal::functors
57 namespace DGtal {
58  namespace functors {
59 
61  // template class ConstantPointPredicate
69  template <typename TPoint, bool boolCst>
71  {
72  typedef TPoint Point;
73 
78  bool operator()( const Point & p ) const;
79 
80  }; // end of class ConstantPointPredicates
81 
83  // template class TruePointPredicate
90  template <typename TPoint>
91  struct TruePointPredicate : public ConstantPointPredicate<TPoint,true>
92  {
93  };
94 
96  // template class FalsePointPredicate
103  template <typename TPoint>
104  struct FalsePointPredicate : public ConstantPointPredicate<TPoint,false>
105  {
106  };
107 
109  // template class IsLowerPointPredicate
117  template <typename TPoint>
119  {
120  typedef TPoint Point;
121 
125  IsLowerPointPredicate( const Point & upperBound );
126 
131  bool operator()( const Point & p ) const;
132 
135  };
136 
138  // template class IsUpperPointPredicate
146  template <typename TPoint>
148  {
149  typedef TPoint Point;
150 
154  IsUpperPointPredicate( const Point & lowerBound );
155 
160  bool operator()( const Point & p ) const;
161 
164  };
165 
167  // template class IsWithinPointPredicate
174  template <typename TPoint>
176  {
177  typedef TPoint Point;
178 
182  IsWithinPointPredicate( const Point & lowerBound,
183  const Point & upperBound );
184 
189  bool operator()( const Point & p ) const;
190 
195  };
196 
198  // template class NotPointPredicate
206  template <typename TPointPredicate>
208  {
209  typedef TPointPredicate PointPredicate;
211  typedef typename PointPredicate::Point Point;
212 
217 
222  bool operator()( const Point & p ) const;
223 
226  };
227 
229  // template class EqualPointPredicate
237  template <typename TPoint>
239  {
240  typedef TPoint Point;
241 
246 
251  bool operator()( const Point & p ) const;
252 
255  };
256 
258  // template class BinaryPointPredicate
273  template <typename TPointPredicate1, typename TPointPredicate2,
274  typename TBinaryFunctor = BoolFunctor2 >
276  {
277  typedef TPointPredicate1 PointPredicate1;
278  typedef TPointPredicate2 PointPredicate2;
279  typedef typename PointPredicate1::Point Point;
280  typedef typename PointPredicate2::Point Point2;
281 
285  BOOST_STATIC_ASSERT (( boost::is_same< Point, Point2 >::value ));
286 
295 
300  bool operator()( const Point & p ) const;
301 
307  const TBinaryFunctor* myBoolFunctor;
308  };
309 
313  template <typename TPointPredicate1, typename TPointPredicate2>
314  struct BinaryPointPredicate<TPointPredicate1, TPointPredicate2, AndBoolFct2>
315  {
316  typedef TPointPredicate1 PointPredicate1;
317  typedef TPointPredicate2 PointPredicate2;
318  typedef typename PointPredicate1::Point Point;
319  typedef typename PointPredicate2::Point Point2;
320 
323  BOOST_STATIC_ASSERT (( boost::is_same< Point, Point2 >::value ));
324 
326 
327  bool operator()( const Point & p ) const;
328 
332  };
333 
337  template <typename TPointPredicate1, typename TPointPredicate2>
338  struct BinaryPointPredicate<TPointPredicate1, TPointPredicate2, OrBoolFct2>
339  {
340  typedef TPointPredicate1 PointPredicate1;
341  typedef TPointPredicate2 PointPredicate2;
342  typedef typename PointPredicate1::Point Point;
343  typedef typename PointPredicate2::Point Point2;
344 
347  BOOST_STATIC_ASSERT (( boost::is_same< Point, Point2 >::value ));
348 
350 
351  bool operator()( const Point & p ) const;
352 
356  };
357 
359  // template class PointFunctorPredicate
369  template <typename TPointFunctor, typename TPredicate>
371  {
374 
375  typedef TPointFunctor PointFunctor;
376  typedef TPredicate Predicate;
377  typedef typename PointFunctor::Point Point;
378 
385 
390  bool operator()( const Point & p ) const;
391 
396  };
397 
398 } // namespace functors
399 } // namespace DGtal
400 
401 
403 // Includes inline functions.
404 #include "DGtal/kernel/BasicPointPredicates.ih"
405 
406 // //
408 
409 #endif // !defined BasicPointPredicates_h
410 
411 #undef BasicPointPredicates_RECURSES
412 #endif // else defined(BasicPointPredicates_RECURSES)
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, OrBoolFct2 >::Point
PointPredicate1::Point Point
Definition: BasicPointPredicates.h:342
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, OrBoolFct2 >::myBoolFunctor
const OrBoolFct2 * myBoolFunctor
Definition: BasicPointPredicates.h:355
DGtal::functors::IsWithinPointPredicate::IsWithinPointPredicate
IsWithinPointPredicate(const Point &lowerBound, const Point &upperBound)
DGtal::functors::FalsePointPredicate
Aim: The predicate that returns always false.
Definition: BasicPointPredicates.h:105
boost::BinaryFunction
Go to http://www.sgi.com/tech/stl/BinaryFunction.html.
Definition: Boost.dox:76
DGtal::functors::BinaryPointPredicate::PointPredicate2
TPointPredicate2 PointPredicate2
Definition: BasicPointPredicates.h:278
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, OrBoolFct2 >::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< PointPredicate2 >))
DGtal::ConstAlias
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
DGtal::functors::EqualPointPredicate
Aim: The predicate returns true when the point given as argument equals the reference point given at ...
Definition: BasicPointPredicates.h:239
DGtal::functors::IsUpperPointPredicate::Point
TPoint Point
Definition: BasicPointPredicates.h:149
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, AndBoolFct2 >::myPred2
const PointPredicate2 * myPred2
Definition: BasicPointPredicates.h:330
DGtal::functors::BinaryPointPredicate::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< PointPredicate2 >))
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, AndBoolFct2 >::BinaryPointPredicate
BinaryPointPredicate(ConstAlias< PointPredicate1 > pred1, ConstAlias< PointPredicate2 > pred2, ConstAlias< AndBoolFct2 > boolFunctor)
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, OrBoolFct2 >::PointPredicate1
TPointPredicate1 PointPredicate1
Definition: BasicPointPredicates.h:340
DGtal::functors::PointFunctorPredicate::PointFunctor
TPointFunctor PointFunctor
Definition: BasicPointPredicates.h:375
DGtal::functors::IsUpperPointPredicate::myLowerBound
Point myLowerBound
the lower bound.
Definition: BasicPointPredicates.h:163
DGtal::functors::NotPointPredicate::operator()
bool operator()(const Point &p) const
DGtal::functors::ConstantPointPredicate
Aim: The predicate that returns always the same value boolCst.
Definition: BasicPointPredicates.h:71
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, AndBoolFct2 >::Point
PointPredicate1::Point Point
Definition: BasicPointPredicates.h:318
DGtal::functors::BinaryPointPredicate::operator()
bool operator()(const Point &p) const
aPoint
const Point aPoint(3, 4)
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, AndBoolFct2 >::Point2
PointPredicate2::Point Point2
Definition: BasicPointPredicates.h:319
DGtal::functors::BinaryPointPredicate::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< PointPredicate1 >))
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, AndBoolFct2 >::myBoolFunctor
const AndBoolFct2 * myBoolFunctor
Definition: BasicPointPredicates.h:331
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, AndBoolFct2 >::myPred1
const PointPredicate1 * myPred1
Definition: BasicPointPredicates.h:329
DGtal::functors::BinaryPointPredicate::PointPredicate1
TPointPredicate1 PointPredicate1
Definition: BasicPointPredicates.h:277
DGtal::functors::IsLowerPointPredicate
Aim: The predicate returns true when the point is below (or equal) the given upper bound.
Definition: BasicPointPredicates.h:119
DGtal::functors::IsUpperPointPredicate
Aim: The predicate returns true when the point is above (or equal) the given lower bound.
Definition: BasicPointPredicates.h:148
DGtal::functors::IsWithinPointPredicate
Aim: The predicate returns true when the point is within the given bounds.
Definition: BasicPointPredicates.h:176
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, OrBoolFct2 >::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< PointPredicate1 >))
DGtal::functors::PointFunctorPredicate::operator()
bool operator()(const Point &p) const
DGtal::functors::PointFunctorPredicate::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CPointFunctor< TPointFunctor >))
DGtal::functors::BinaryPointPredicate::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((boost::BinaryFunction< TBinaryFunctor, bool, bool, bool >))
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, OrBoolFct2 >::myPred1
const PointPredicate1 * myPred1
Definition: BasicPointPredicates.h:353
DGtal::functors::NotPointPredicate::myPred
const PointPredicate * myPred
The PointPredicate that is inversed.
Definition: BasicPointPredicates.h:225
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, AndBoolFct2 >::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< PointPredicate2 >))
DGtal::functors::IsWithinPointPredicate::myLowerBound
Point myLowerBound
the upper bound.
Definition: BasicPointPredicates.h:192
DGtal::functors::BinaryPointPredicate::Point2
PointPredicate2::Point Point2
Definition: BasicPointPredicates.h:280
DGtal::functors::PointFunctorPredicate::myPred
const Predicate * myPred
alias of the predicate.
Definition: BasicPointPredicates.h:395
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, AndBoolFct2 >::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< PointPredicate1 >))
DGtal::functors::IsWithinPointPredicate::operator()
bool operator()(const Point &p) const
DGtal::functors::BinaryPointPredicate::myBoolFunctor
const TBinaryFunctor * myBoolFunctor
aliasing pointer to the binary functor.
Definition: BasicPointPredicates.h:307
DGtal::functors::EqualPointPredicate::EqualPointPredicate
EqualPointPredicate(const Point &aPoint)
DGtal::functors::BinaryPointPredicate::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((boost::is_same< Point, Point2 >::value))
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, AndBoolFct2 >::PointPredicate2
TPointPredicate2 PointPredicate2
Definition: BasicPointPredicates.h:317
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition: ClosedIntegerHalfPlane.h:49
DGtal::functors::BoolFunctor2
boost::function2< bool, bool, bool > BoolFunctor2
Definition: BasicBoolFunctors.h:64
DGtal::functors::IsUpperPointPredicate::operator()
bool operator()(const Point &p) const
DGtal::functors::PointFunctorPredicate::Point
PointFunctor::Point Point
Definition: BasicPointPredicates.h:377
DGtal::functors::EqualPointPredicate::Point
TPoint Point
Definition: BasicPointPredicates.h:240
DGtal::functors::OrBoolFct2
Definition: BasicBoolFunctors.h:129
DGtal::functors::BinaryPointPredicate::myPred2
const PointPredicate2 * myPred2
aliasing pointer to the right predicate.
Definition: BasicPointPredicates.h:305
DGtal::functors::PointFunctorPredicate::Predicate
TPredicate Predicate
Definition: BasicPointPredicates.h:376
DGtal::functors::NotPointPredicate::NotPointPredicate
NotPointPredicate(ConstAlias< PointPredicate > pred)
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, OrBoolFct2 >::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((boost::is_same< Point, Point2 >::value))
DGtal::functors::EqualPointPredicate::operator()
bool operator()(const Point &p) const
DGtal::functors::TruePointPredicate
Aim: The predicate that returns always true.
Definition: BasicPointPredicates.h:92
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, AndBoolFct2 >::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((boost::is_same< Point, Point2 >::value))
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, AndBoolFct2 >::PointPredicate1
TPointPredicate1 PointPredicate1
Definition: BasicPointPredicates.h:316
DGtal::functors::BinaryPointPredicate::myPred1
const PointPredicate1 * myPred1
aliasing pointer to the left predicate.
Definition: BasicPointPredicates.h:303
DGtal::functors::NotPointPredicate::Point
PointPredicate::Point Point
Definition: BasicPointPredicates.h:211
DGtal::functors::NotPointPredicate
Aim: The predicate returns true when the point predicate given at construction return false....
Definition: BasicPointPredicates.h:208
DGtal::functors::IsLowerPointPredicate::operator()
bool operator()(const Point &p) const
DGtal::functors::IsUpperPointPredicate::IsUpperPointPredicate
IsUpperPointPredicate(const Point &lowerBound)
DGtal::functors::IsWithinPointPredicate::Point
TPoint Point
Definition: BasicPointPredicates.h:177
DGtal::functors::BinaryPointPredicate::BinaryPointPredicate
BinaryPointPredicate(ConstAlias< PointPredicate1 > pred1, ConstAlias< PointPredicate2 > pred2, ConstAlias< TBinaryFunctor > boolFunctor)
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, OrBoolFct2 >::myPred2
const PointPredicate2 * myPred2
Definition: BasicPointPredicates.h:354
DGtal::functors::IsLowerPointPredicate::myUpperBound
Point myUpperBound
the upper bound.
Definition: BasicPointPredicates.h:134
DGtal::functors::NotPointPredicate::PointPredicate
TPointPredicate PointPredicate
Definition: BasicPointPredicates.h:209
DGtal::concepts::CPointFunctor
Aim: Defines a functor on points.
Definition: CPointFunctor.h:89
DGtal::concepts::CPointPredicate
Aim: Defines a predicate on a point.
Definition: CPointPredicate.h:81
DGtal::functors::IsLowerPointPredicate::IsLowerPointPredicate
IsLowerPointPredicate(const Point &upperBound)
DGtal::functors::AndBoolFct2
Definition: BasicBoolFunctors.h:122
DGtal::functors::BinaryPointPredicate::Point
PointPredicate1::Point Point
Definition: BasicPointPredicates.h:279
DGtal::functors::IsLowerPointPredicate::Point
TPoint Point
Definition: BasicPointPredicates.h:120
DGtal::functors::PointFunctorPredicate::myFun
const PointFunctor * myFun
alias of the PointFunctor.
Definition: BasicPointPredicates.h:393
DGtal::functors::PointFunctorPredicate::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< TPredicate, typename TPointFunctor::Value, bool >))
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, OrBoolFct2 >::Point2
PointPredicate2::Point Point2
Definition: BasicPointPredicates.h:343
DGtal::functors::IsWithinPointPredicate::myUpperBound
Point myUpperBound
the lower bound.
Definition: BasicPointPredicates.h:194
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, OrBoolFct2 >::PointPredicate2
TPointPredicate2 PointPredicate2
Definition: BasicPointPredicates.h:341
DGtal::functors::ConstantPointPredicate::operator()
bool operator()(const Point &p) const
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, AndBoolFct2 >::operator()
bool operator()(const Point &p) const
DGtal::functors::ConstantPointPredicate::Point
TPoint Point
Definition: BasicPointPredicates.h:72
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, OrBoolFct2 >::BinaryPointPredicate
BinaryPointPredicate(ConstAlias< PointPredicate1 > pred1, ConstAlias< PointPredicate2 > pred2, ConstAlias< OrBoolFct2 > boolFunctor)
Point
MyPointD Point
Definition: testClone2.cpp:383
DGtal::functors::BinaryPointPredicate< TPointPredicate1, TPointPredicate2, OrBoolFct2 >::operator()
bool operator()(const Point &p) const
DGtal::functors::BinaryPointPredicate
Aim: The predicate returns true when the given binary functor returns true for the two PointPredicate...
Definition: BasicPointPredicates.h:276
DGtal::concepts::CUnaryFunctor
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:90
DGtal::functors::PointFunctorPredicate
Aim: The predicate returns true when the predicate returns true for the value assigned to a given poi...
Definition: BasicPointPredicates.h:371
DGtal::functors::NotPointPredicate::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< PointPredicate >))
DGtal::functors::EqualPointPredicate::myPoint
Point myPoint
Reference point.
Definition: BasicPointPredicates.h:254
DGtal::functors::PointFunctorPredicate::PointFunctorPredicate
PointFunctorPredicate(ConstAlias< PointFunctor > aFun, ConstAlias< Predicate > aPred)