DGtal 1.4.0
Loading...
Searching...
No Matches
testPointPredicateConcepts.cpp File Reference
#include <iostream>
#include <functional>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/kernel/BasicPointPredicates.h"
#include "DGtal/images/ImageSelector.h"
Include dependency graph for testPointPredicateConcepts.cpp:

Go to the source code of this file.

Functions

template<typename PointFunctor1 , typename Predicate1 , typename PointFunctor2 , typename Predicate2 >
bool testPointPredicateConcepts ()
 
int main (int argc, char **argv)
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Pierre Gueth (pierr.nosp@m.e.gu.nosp@m.eth@l.nosp@m.iris.nosp@m..cnrs.nosp@m..fr ) Laboratoire d'InfoRmatique en Image et Systemes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
Date
2013/11/07

Functions for testing class PointPredicateConcepts.

This file is part of the DGtal library.

Definition in file testPointPredicateConcepts.cpp.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 89 of file testPointPredicateConcepts.cpp.

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}
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
std::ostream & info()
double endBlock()
Trace trace
Definition Common.h:153
bool testPointPredicateConcepts()

References DGtal::Trace::beginBlock(), DGtal::Trace::emphase(), DGtal::Trace::endBlock(), DGtal::Trace::info(), testPointPredicateConcepts(), and DGtal::trace.

◆ testPointPredicateConcepts()

template<typename PointFunctor1 , typename Predicate1 , typename PointFunctor2 , typename Predicate2 >
bool testPointPredicateConcepts ( )

Example of a test. To be completed.

Definition at line 53 of file testPointPredicateConcepts.cpp.

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}
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.
MyPointD Point

Referenced by main().