DGtal 1.4.0
Loading...
Searching...
No Matches
testPointPredicateConcepts.cpp
Go to the documentation of this file.
1
31#include <iostream>
32#include <functional>
33#include "DGtal/base/Common.h"
34#include "DGtal/helpers/StdDefs.h"
35#include "DGtal/kernel/BasicPointPredicates.h"
36#include "DGtal/images/ImageSelector.h"
38
39using namespace std;
40using namespace DGtal;
41using namespace DGtal::functors;
42using namespace DGtal::concepts;
43
45// Functions for testing class PointPredicateConcepts.
47
51template <typename PointFunctor1,typename Predicate1, typename PointFunctor2, typename Predicate2>
52bool
54{
55 // PointFunctorPredicate
57 BOOST_CONCEPT_ASSERT (( concepts::CPointPredicate< PointPredicate1 > ));
59 BOOST_CONCEPT_ASSERT (( concepts::CPointPredicate< PointPredicate2 > ));
60
61 // Binary PointPredicate
62 typedef std::logical_and<bool> BinaryFunctor;
64
65 // NotPointPredicate
68
69 typedef typename PointFunctor1::Point Point;
70 // EqualPointPredicate
71 BOOST_CONCEPT_ASSERT(( concepts::CPointPredicate< EqualPointPredicate<Point> > ));
72 // IsWithinPointPredicate
74 // IsUpperPointPredicate
76 // IsLowerPointPredicate
78 // TruePointPredicate
79 BOOST_CONCEPT_ASSERT(( concepts::CPointPredicate< TruePointPredicate<Point> > ));
80 // FalsePointPredicate
81 BOOST_CONCEPT_ASSERT(( concepts::CPointPredicate< FalsePointPredicate<Point> > ));
82
83 return true;
84}
85
87// Standard services - public :
88
89int main( int argc, char** argv )
90{
91 trace.beginBlock ( "Testing PointPredicate Concepts" );
92 trace.info() << "Args:";
93 for ( int i = 0; i < argc; ++i )
94 trace.info() << " " << argv[ i ];
95 trace.info() << endl;
96
97 bool res = true;
99 using IntPredicate = std::function<bool(int)>;
101 using FloatPredicate = std::function<bool(float)>;
103
104 trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
105 trace.endBlock();
106 return res ? 0 : 1;
107}
108// //
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
std::ostream & info()
double endBlock()
Aim: Gathers several functions useful for concept checks.
functors namespace gathers all DGtal functors.
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition Common.h:153
STL namespace.
Aim: Defines a predicate on a point.
Aim: The predicate returns true when the given binary functor returns true for the two PointPredicate...
Aim: The predicate returns true when the point given as argument equals the reference point given at ...
Aim: The predicate that returns always false.
Aim: The predicate returns true when the point is below (or equal) the given upper bound.
Aim: The predicate returns true when the point is above (or equal) the given lower bound.
Aim: The predicate returns true when the point is within the given bounds.
Aim: The predicate returns true when the point predicate given at construction return false....
Aim: The predicate returns true when the predicate returns true for the value assigned to a given poi...
Aim: The predicate that returns always true.
int main()
Definition testBits.cpp:56
MyPointD Point
bool testPointPredicateConcepts()