DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
testPointPredicateConcepts.cpp
Go to the documentation of this file.
1
16
29
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
39
using namespace
std
;
40
using namespace
DGtal
;
41
using namespace
DGtal::functors
;
42
using namespace
DGtal::concepts
;
43
45
// Functions for testing class PointPredicateConcepts.
47
51
template
<
typename
Po
int
Functor1,
typename
Predicate1,
typename
Po
int
Functor2,
typename
Predicate2>
52
bool
53
testPointPredicateConcepts
()
54
{
55
// PointFunctorPredicate
56
typedef
PointFunctorPredicate<PointFunctor1, Predicate1>
PointPredicate1;
57
BOOST_CONCEPT_ASSERT ((
concepts::CPointPredicate< PointPredicate1 >
));
58
typedef
PointFunctorPredicate<PointFunctor2, Predicate2>
PointPredicate2;
59
BOOST_CONCEPT_ASSERT ((
concepts::CPointPredicate< PointPredicate2 >
));
60
61
// Binary PointPredicate
62
typedef
std::logical_and<bool>
BinaryFunctor
;
63
BOOST_CONCEPT_ASSERT ((
concepts::CPointPredicate
<
BinaryPointPredicate<PointPredicate1, PointPredicate2, BinaryFunctor>
> ));
64
65
// NotPointPredicate
66
BOOST_CONCEPT_ASSERT((
concepts::CPointPredicate
<
NotPointPredicate<PointPredicate1>
> ));
67
BOOST_CONCEPT_ASSERT((
concepts::CPointPredicate
<
NotPointPredicate<PointPredicate2>
> ));
68
69
typedef
typename
PointFunctor1::Point
Point
;
70
// EqualPointPredicate
71
BOOST_CONCEPT_ASSERT((
concepts::CPointPredicate
<
EqualPointPredicate<Point>
> ));
72
// IsWithinPointPredicate
73
BOOST_CONCEPT_ASSERT((
concepts::CPointPredicate
<
IsWithinPointPredicate<Point>
> ));
74
// IsUpperPointPredicate
75
BOOST_CONCEPT_ASSERT((
concepts::CPointPredicate
<
IsUpperPointPredicate<Point>
> ));
76
// IsLowerPointPredicate
77
BOOST_CONCEPT_ASSERT((
concepts::CPointPredicate
<
IsLowerPointPredicate<Point>
> ));
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
89
int
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
;
98
typedef
ImageSelector<Z3i::Domain, int>::Type
IntImage;
99
using
IntPredicate = std::function<bool(
int
)>;
100
typedef
ImageSelector<Z3i::Domain, float>::Type
FloatImage;
101
using
FloatPredicate = std::function<bool(
float
)>;
102
res &=
testPointPredicateConcepts<IntImage, IntPredicate, FloatImage, FloatPredicate>
();
103
104
trace
.
emphase
() << ( res ?
"Passed."
:
"Error."
) << endl;
105
trace
.
endBlock
();
106
return
res ? 0 : 1;
107
}
108
// //
DGtal::Point
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::Trace::emphase
std::ostream & emphase()
DGtal::Trace::info
std::ostream & info()
DGtal::Trace::endBlock
double endBlock()
DGtal::concepts
Aim: Gathers several functions useful for concept checks.
Definition
CPositiveIrreducibleFraction.h:54
DGtal::functors
functors namespace gathers all DGtal functors.
Definition
BasicBoolFunctors.h:49
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::trace
Trace trace
std
STL namespace.
BinaryFunctor
Definition
testConstImageFunctorHolder.cpp:110
DGtal::ImageSelector::Type
ImageContainerBySTLVector< Domain, Value > Type
Definition
ImageSelector.h:84
DGtal::concepts::CPointPredicate
Aim: Defines a predicate on a point.
Definition
CPointPredicate.h:81
DGtal::functors::BinaryPointPredicate
Aim: The predicate returns true when the given binary functor returns true for the two PointPredicate...
Definition
BasicPointPredicates.h:276
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::FalsePointPredicate
Aim: The predicate that returns always false.
Definition
BasicPointPredicates.h:105
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::NotPointPredicate
Aim: The predicate returns true when the point predicate given at construction return false....
Definition
BasicPointPredicates.h:208
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::TruePointPredicate
Aim: The predicate that returns always true.
Definition
BasicPointPredicates.h:92
main
int main(int, char **)
Definition
testIntegerComputer.cpp:331
testPointPredicateConcepts
bool testPointPredicateConcepts()
Definition
testPointPredicateConcepts.cpp:53
tests
kernel
testPointPredicateConcepts.cpp
Generated on
for DGtal by
1.18.0