DGtal 0.3.0

BasicPointPredicates.h

Go to the documentation of this file.
00001 
00017 #pragma once
00018 
00032 #if defined(BasicPointPredicates_RECURSES)
00033 #error Recursive header files inclusion detected in BasicPointPredicates.h
00034 #else // defined(BasicPointPredicates_RECURSES)
00035 
00036 #define BasicPointPredicates_RECURSES
00037 
00038 #if !defined BasicPointPredicates_h
00039 
00040 #define BasicPointPredicates_h
00041 
00043 // Inclusions
00044 #include <iostream>
00045 #include "DGtal/base/Common.h"
00046 #include "DGtal/base/BasicBoolFunctions.h"
00048 
00049 namespace DGtal
00050 {
00051 
00053   // template class ConstantPointPredicate
00061   template <typename TPoint, bool boolCst>
00062   struct ConstantPointPredicate
00063   {
00064     typedef TPoint Point;
00065 
00070     bool operator()( const Point & p ) const;
00071 
00072   }; // end of class ConstantPointPredicates
00073 
00075   // template class TruePointPredicate
00082   template <typename TPoint>
00083   struct TruePointPredicate : ConstantPointPredicate<TPoint,true>
00084   {
00085       typedef TPoint Point;
00086   };
00087 
00089   // template class FalsePointPredicate
00096   template <typename TPoint>
00097   struct FalsePointPredicate : ConstantPointPredicate<TPoint,false>
00098   {
00099       typedef TPoint Point;
00100   };
00101 
00103   // template class IsLowerPointPredicate
00111   template <typename TPoint>
00112   struct IsLowerPointPredicate
00113   {
00114     typedef TPoint Point;
00118     IsLowerPointPredicate( const Point & upperBound );
00119 
00124     bool operator()( const Point & p ) const;
00125 
00126     Point myUpperBound;
00127   };
00128 
00130   // template class IsUpperPointPredicate
00138   template <typename TPoint>
00139   struct IsUpperPointPredicate
00140   {
00141     typedef TPoint Point;
00145     IsUpperPointPredicate( const Point & lowerBound );
00146 
00151     bool operator()( const Point & p ) const;
00152 
00153     Point myLowerBound;
00154   };
00155 
00157   // template class IsWithinPointPredicate
00164   template <typename TPoint>
00165   struct IsWithinPointPredicate
00166   {
00167     typedef TPoint Point;
00171     IsWithinPointPredicate( const Point & lowerBound,
00172                             const Point & upperBound );
00173 
00178     bool operator()( const Point & p ) const;
00179 
00180     Point myLowerBound;
00181     Point myUpperBound;
00182   };
00183 
00185   // template class NotPointPredicate
00192   template <typename TPointPredicate>
00193   struct NotPointPredicate
00194   {
00195     typedef TPointPredicate PointPredicate;
00196     typedef typename PointPredicate::Point Point;
00197 
00201     NotPointPredicate( const PointPredicate & pred );
00202 
00207     bool operator()( const Point & p ) const;
00208 
00209     const PointPredicate & myPred;
00210   };
00211 
00213   // template class BinaryPointPredicate
00221   template <typename TPointPredicate1, typename TPointPredicate2>
00222   struct BinaryPointPredicate
00223   {
00224     typedef TPointPredicate1 PointPredicate1;
00225     typedef TPointPredicate2 PointPredicate2;
00226     typedef typename PointPredicate1::Point Point;
00227     // should be the same.
00228     typedef typename PointPredicate2::Point Point2;
00229 
00233     BinaryPointPredicate( const PointPredicate1 & pred1,
00234                           const PointPredicate2 & pred2,
00235                           const BoolFunction2 & boolFunctor );
00236 
00241     bool operator()( const Point & p ) const;
00242 
00243     const PointPredicate1 & myPred1;
00244     const PointPredicate2 & myPred2;
00245     BoolFunction2 myBoolFunctor;
00246   };
00247 
00248 } // namespace DGtal
00249 
00250 
00252 // Includes inline functions.
00253 #include "DGtal/kernel/BasicPointPredicates.ih"
00254 
00255 //                                                                           //
00257 
00258 #endif // !defined BasicPointPredicates_h
00259 
00260 #undef BasicPointPredicates_RECURSES
00261 #endif // else defined(BasicPointPredicates_RECURSES)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines