Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82482 - in trunk/boost/geometry: geometries/concepts multi/geometries/concepts
From: barend.gehrels_at_[hidden]
Date: 2013-01-13 12:34:51


Author: barendgehrels
Date: 2013-01-13 12:34:50 EST (Sun, 13 Jan 2013)
New Revision: 82482
URL: http://svn.boost.org/trac/boost/changeset/82482

Log:
[geometry] Made concept-checks variant aware. For now the underlying types are skipped. So a specialization for variants is made, being empty. This also solves two omissions: checks for Ring and Segment. Besides that, it now derives from not-inherited. This was earlier not the case (i.e. concepts were not checked, if type was not found). The commit makes it also consistent with the new system (template parameters auto-derived if possible)
Text files modified:
   trunk/boost/geometry/geometries/concepts/check.hpp | 70 +++++++++++++++++++++++++++++----------
   trunk/boost/geometry/multi/geometries/concepts/check.hpp | 12 +++---
   2 files changed, 58 insertions(+), 24 deletions(-)

Modified: trunk/boost/geometry/geometries/concepts/check.hpp
==============================================================================
--- trunk/boost/geometry/geometries/concepts/check.hpp (original)
+++ trunk/boost/geometry/geometries/concepts/check.hpp 2013-01-13 12:34:50 EST (Sun, 13 Jan 2013)
@@ -28,7 +28,11 @@
 #include <boost/geometry/geometries/concepts/point_concept.hpp>
 #include <boost/geometry/geometries/concepts/polygon_concept.hpp>
 #include <boost/geometry/geometries/concepts/ring_concept.hpp>
+#include <boost/geometry/geometries/concepts/segment_concept.hpp>
 
+#include <boost/geometry/algorithms/not_implemented.hpp>
+
+#include <boost/variant/variant_fwd.hpp>
 
 namespace boost { namespace geometry
 {
@@ -53,59 +57,86 @@
 namespace dispatch
 {
 
-template <typename GeometryTag, typename Geometry, bool IsConst>
-struct check
+template
+<
+ typename Geometry,
+ typename GeometryTag = typename geometry::tag<Geometry>::type,
+ bool IsConst = boost::is_const<Geometry>::type::value
+>
+struct check : not_implemented<GeometryTag>
 {};
 
 
 template <typename Geometry>
-struct check<point_tag, Geometry, true>
+struct check<Geometry, point_tag, true>
     : detail::concept_check::check<concept::ConstPoint<Geometry> >
 {};
 
 
 template <typename Geometry>
-struct check<point_tag, Geometry, false>
+struct check<Geometry, point_tag, false>
     : detail::concept_check::check<concept::Point<Geometry> >
 {};
 
 
 template <typename Geometry>
-struct check<linestring_tag, Geometry, true>
+struct check<Geometry, linestring_tag, true>
     : detail::concept_check::check<concept::ConstLinestring<Geometry> >
 {};
 
 
 template <typename Geometry>
-struct check<linestring_tag, Geometry, false>
+struct check<Geometry, linestring_tag, false>
     : detail::concept_check::check<concept::Linestring<Geometry> >
 {};
 
 
 template <typename Geometry>
-struct check<polygon_tag, Geometry, true>
+struct check<Geometry, ring_tag, true>
+ : detail::concept_check::check<concept::ConstRing<Geometry> >
+{};
+
+
+template <typename Geometry>
+struct check<Geometry, ring_tag, false>
+ : detail::concept_check::check<concept::Ring<Geometry> >
+{};
+
+template <typename Geometry>
+struct check<Geometry, polygon_tag, true>
     : detail::concept_check::check<concept::ConstPolygon<Geometry> >
 {};
 
 
 template <typename Geometry>
-struct check<polygon_tag, Geometry, false>
+struct check<Geometry, polygon_tag, false>
     : detail::concept_check::check<concept::Polygon<Geometry> >
 {};
 
 
 template <typename Geometry>
-struct check<box_tag, Geometry, true>
+struct check<Geometry, box_tag, true>
     : detail::concept_check::check<concept::ConstBox<Geometry> >
 {};
 
 
 template <typename Geometry>
-struct check<box_tag, Geometry, false>
+struct check<Geometry, box_tag, false>
     : detail::concept_check::check<concept::Box<Geometry> >
 {};
 
 
+template <typename Geometry>
+struct check<Geometry, segment_tag, true>
+ : detail::concept_check::check<concept::ConstSegment<Geometry> >
+{};
+
+
+template <typename Geometry>
+struct check<Geometry, segment_tag, false>
+ : detail::concept_check::check<concept::Segment<Geometry> >
+{};
+
 
 } // namespace dispatch
 #endif
@@ -122,13 +153,16 @@
 {
 
 
-template <typename Geometry, bool IsConst>
-struct checker : dispatch::check
- <
- typename tag<Geometry>::type,
- Geometry,
- IsConst
- >
+template <typename Geometry>
+struct checker : dispatch::check<Geometry>
+{};
+
+template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
+struct checker<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
+{};
+
+template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
+struct checker<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const>
 {};
 
 
@@ -143,7 +177,7 @@
 template <typename Geometry>
 inline void check()
 {
- detail::checker<Geometry, boost::is_const<Geometry>::type::value> c;
+ detail::checker<Geometry> c;
     boost::ignore_unused_variable_warning(c);
 }
 

Modified: trunk/boost/geometry/multi/geometries/concepts/check.hpp
==============================================================================
--- trunk/boost/geometry/multi/geometries/concepts/check.hpp (original)
+++ trunk/boost/geometry/multi/geometries/concepts/check.hpp 2013-01-13 12:34:50 EST (Sun, 13 Jan 2013)
@@ -38,37 +38,37 @@
 
 
 template <typename Geometry>
-struct check<multi_point_tag, Geometry, true>
+struct check<Geometry, multi_point_tag, true>
     : detail::concept_check::check<concept::ConstMultiPoint<Geometry> >
 {};
 
 
 template <typename Geometry>
-struct check<multi_point_tag, Geometry, false>
+struct check<Geometry, multi_point_tag, false>
     : detail::concept_check::check<concept::MultiPoint<Geometry> >
 {};
 
 
 template <typename Geometry>
-struct check<multi_linestring_tag, Geometry, true>
+struct check<Geometry, multi_linestring_tag, true>
     : detail::concept_check::check<concept::ConstMultiLinestring<Geometry> >
 {};
 
 
 template <typename Geometry>
-struct check<multi_linestring_tag, Geometry, false>
+struct check<Geometry, multi_linestring_tag, false>
     : detail::concept_check::check<concept::MultiLinestring<Geometry> >
 {};
 
 
 template <typename Geometry>
-struct check<multi_polygon_tag, Geometry, true>
+struct check<Geometry, multi_polygon_tag, true>
     : detail::concept_check::check<concept::ConstMultiPolygon<Geometry> >
 {};
 
 
 template <typename Geometry>
-struct check<multi_polygon_tag, Geometry, false>
+struct check<Geometry, multi_polygon_tag, false>
     : detail::concept_check::check<concept::MultiPolygon<Geometry> >
 {};
 


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