Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84215 - in trunk/boost/geometry/index: . detail
From: adam.wulkiewicz_at_[hidden]
Date: 2013-05-09 19:33:53


Author: awulkiew
Date: 2013-05-09 19:33:52 EDT (Thu, 09 May 2013)
New Revision: 84215
URL: http://svn.boost.org/trac/boost/changeset/84215

Log:
geometry.index: negation of satisfies() predicate added.
Text files modified:
   trunk/boost/geometry/index/detail/predicates.hpp | 31 +++++++++++++++++++++++++++++++
   trunk/boost/geometry/index/predicates.hpp | 38 ++++++++++++++++++++++++++------------
   2 files changed, 57 insertions(+), 12 deletions(-)

Modified: trunk/boost/geometry/index/detail/predicates.hpp
==============================================================================
--- trunk/boost/geometry/index/detail/predicates.hpp (original)
+++ trunk/boost/geometry/index/detail/predicates.hpp 2013-05-09 19:33:52 EDT (Thu, 09 May 2013)
@@ -43,6 +43,17 @@
     typedef satisfies_impl<Fun, ::boost::is_function<Fun>::value> base;
 
     satisfies(Fun const& f) : base(f) {}
+ satisfies(base const& b) : base(b) {}
+};
+
+template <typename Fun>
+struct not_satisfies
+ : satisfies_impl<Fun, ::boost::is_function<Fun>::value>
+{
+ typedef satisfies_impl<Fun, ::boost::is_function<Fun>::value> base;
+
+ not_satisfies(Fun const& f) : base(f) {}
+ not_satisfies(base const& b) : base(b) {}
 };
 
 template <typename Geometry>
@@ -258,6 +269,16 @@
     }
 };
 
+template <typename Fun>
+struct predicate_check<not_satisfies<Fun>, value_tag>
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(not_satisfies<Fun> const& p, Value const& v, Indexable const&)
+ {
+ return !p.fun(v);
+ }
+};
+
 template <typename Geometry>
 struct predicate_check<covered_by<Geometry>, value_tag>
 {
@@ -458,6 +479,16 @@
     }
 };
 
+template <typename Fun>
+struct predicate_check<not_satisfies<Fun>, bounds_tag>
+{
+ template <typename Value, typename Box>
+ static bool apply(not_satisfies<Fun> const&, Value const&, Box const&)
+ {
+ return true;
+ }
+};
+
 template <typename Geometry>
 struct predicate_check<covered_by<Geometry>, bounds_tag>
 {

Modified: trunk/boost/geometry/index/predicates.hpp
==============================================================================
--- trunk/boost/geometry/index/predicates.hpp (original)
+++ trunk/boost/geometry/index/predicates.hpp 2013-05-09 19:33:52 EDT (Thu, 09 May 2013)
@@ -271,84 +271,98 @@
 
 // operator! generators
 
-template <typename Geometry>
+template <typename Fun> inline
+not_satisfies<Fun>
+operator!(satisfies<Fun> const& p)
+{
+ return not_satisfies<Fun>(p);
+}
+
+template <typename Fun> inline
+satisfies<Fun>
+operator!(not_satisfies<Fun> const& p)
+{
+ return satisfies<Fun>(p);
+}
+
+template <typename Geometry> inline
 not_covered_by<Geometry>
 operator!(covered_by<Geometry> const& p)
 {
     return not_covered_by<Geometry>(p.geometry);
 }
 
-template <typename Geometry>
+template <typename Geometry> inline
 covered_by<Geometry>
 operator!(not_covered_by<Geometry> const& p)
 {
     return covered_by<Geometry>(p.geometry);
 }
 
-template <typename Geometry>
+template <typename Geometry> inline
 not_disjoint<Geometry>
 operator!(disjoint<Geometry> const& p)
 {
     return not_disjoint<Geometry>(p.geometry);
 }
 
-template <typename Geometry>
+template <typename Geometry> inline
 disjoint<Geometry>
 operator!(not_disjoint<Geometry> const& p)
 {
     return disjoint<Geometry>(p.geometry);
 }
 
-template <typename Geometry>
+template <typename Geometry> inline
 not_intersects<Geometry>
 operator!(intersects<Geometry> const& p)
 {
     return not_intersects<Geometry>(p.geometry);
 }
 
-template <typename Geometry>
+template <typename Geometry> inline
 intersects<Geometry>
 operator!(not_intersects<Geometry> const& p)
 {
     return intersects<Geometry>(p.geometry);
 }
 
-template <typename Geometry>
+template <typename Geometry> inline
 not_overlaps<Geometry>
 operator!(overlaps<Geometry> const& p)
 {
     return not_overlaps<Geometry>(p.geometry);
 }
 
-template <typename Geometry>
+template <typename Geometry> inline
 overlaps<Geometry>
 operator!(not_overlaps<Geometry> const& p)
 {
     return overlaps<Geometry>(p.geometry);
 }
 
-//template <typename Geometry>
+//template <typename Geometry> inline
 //not_touches<Geometry>
 //operator!(touches<Geometry> const& p)
 //{
 // return not_touches<Geometry>(p.geometry);
 //}
 //
-//template <typename Geometry>
+//template <typename Geometry> inline
 //touches<Geometry>
 //operator!(not_touches<Geometry> const& p)
 //{
 // return touches<Geometry>(p.geometry);
 //}
 
-template <typename Geometry>
+template <typename Geometry> inline
 not_within<Geometry>
 operator!(within<Geometry> const& p)
 {
     return not_within<Geometry>(p.geometry);
 }
 
-template <typename Geometry>
+template <typename Geometry> inline
 within<Geometry>
 operator!(not_within<Geometry> const& p)
 {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk