DGtal  0.9.3
Functions
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.

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

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  typedef std::binder2nd< std::less<int> > IntPredicate;
100  typedef ImageSelector<Z3i::Domain, float>::Type FloatImage;
101  typedef std::binder2nd< std::greater<float> > FloatPredicate;
102  res &= testPointPredicateConcepts<IntImage, IntPredicate, FloatImage, FloatPredicate>();
103 
104  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
105  trace.endBlock();
106  return res ? 0 : 1;
107 }
void beginBlock(const std::string &keyword="")
Trace trace
Definition: Common.h:137
double endBlock()
std::ostream & emphase()
std::ostream & info()

◆ 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
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 }
Aim: The predicate returns true when the point predicate given at construction return false...
Aim: The predicate returns true when the point given as argument equals the reference point given at ...
Aim: The predicate returns true when the point is above (or equal) the given lower bound...
Aim: The predicate that returns always false.
Aim: Defines a predicate on a point.
MyPointD Point
Definition: testClone2.cpp:383
Aim: The predicate returns true when the point is below (or equal) the given upper bound...
Aim: The predicate returns true when the given binary functor returns true for the two PointPredicate...
Aim: The predicate that returns always true.
Aim: The predicate returns true when the predicate returns true for the value assigned to a given poi...