Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75796 - in trunk: boost/geometry/algorithms libs/geometry/doc/src/docutils/tools/support_status
From: bruno.lalande_at_[hidden]
Date: 2011-12-03 21:00:25


Author: bruno.lalande
Date: 2011-12-03 21:00:25 EST (Sat, 03 Dec 2011)
New Revision: 75796
URL: http://svn.boost.org/trac/boost/changeset/75796

Log:
New mechanism for easy checking of implementation status.
Added:
   trunk/boost/geometry/algorithms/not_implemented.hpp (contents, props changed)
   trunk/libs/geometry/doc/src/docutils/tools/support_status/
   trunk/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp (contents, props changed)
Text files modified:
   trunk/boost/geometry/algorithms/distance.hpp | 7 +++++--
   1 files changed, 5 insertions(+), 2 deletions(-)

Modified: trunk/boost/geometry/algorithms/distance.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/distance.hpp (original)
+++ trunk/boost/geometry/algorithms/distance.hpp 2011-12-03 21:00:25 EST (Sat, 03 Dec 2011)
@@ -28,6 +28,8 @@
 #include <boost/geometry/core/reverse_dispatch.hpp>
 #include <boost/geometry/core/tag_cast.hpp>
 
+#include <boost/geometry/algorithms/not_implemented.hpp>
+
 #include <boost/geometry/geometries/segment.hpp>
 #include <boost/geometry/geometries/concepts/check.hpp>
 
@@ -253,11 +255,12 @@
     typename Geometry1, typename Geometry2,
     typename StrategyTag, typename Strategy
>
-struct distance
+struct distance: boost::geometry::not_implemented
 {
     BOOST_MPL_ASSERT_MSG
         (
- false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
+ BOOST_GEOMETRY_IMPLEMENTATION_STATUS_BUILD,
+ NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
             , (types<Geometry1, Geometry2>)
         );
 };

Added: trunk/boost/geometry/algorithms/not_implemented.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/algorithms/not_implemented.hpp 2011-12-03 21:00:25 EST (Sat, 03 Dec 2011)
@@ -0,0 +1,34 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
+// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2009-2011 Mateusz Loskot, London, UK.
+
+// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
+// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#ifndef BOOST_GEOMETRY_ALGORITHMS_NOT_IMPLEMENTED_HPP
+#define BOOST_GEOMETRY_ALGORITHMS_NOT_IMPLEMENTED_HPP
+
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef BOOST_GEOMETRY_IMPLEMENTATION_STATUS_BUILD
+# define BOOST_GEOMETRY_IMPLEMENTATION_STATUS_BUILD false
+#endif
+
+
+struct not_implemented {};
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_ALGORITHMS_NOT_IMPLEMENTED_HPP

Added: trunk/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp 2011-12-03 21:00:25 EST (Sat, 03 Dec 2011)
@@ -0,0 +1,89 @@
+#include <iostream>
+
+#include <boost/type_traits/is_base_of.hpp>
+#include <boost/mpl/for_each.hpp>
+#include <boost/mpl/vector.hpp>
+
+#define BOOST_GEOMETRY_IMPLEMENTATION_STATUS_BUILD true
+#include <boost/geometry/core/cs.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/algorithms/distance.hpp>
+#include <boost/geometry/strategies/cartesian/distance_pythagoras.hpp>
+
+
+template <typename Tag1, typename Tag2, typename G1, typename G2>
+struct check
+ : boost::geometry::dispatch::distance<
+ Tag1,
+ Tag2,
+ G1,
+ G2,
+ boost::geometry::strategy_tag_distance_point_point,
+ typename boost::geometry::strategy::distance::services::default_strategy<
+ boost::geometry::point_tag,
+ G1,
+ G2
+ >::type
+ >
+{};
+
+
+typedef boost::geometry::cs::cartesian cartesian;
+
+typedef boost::geometry::model::point<double, 2, cartesian> point_type;
+typedef boost::geometry::model::linestring<point_type> line_type;
+typedef boost::geometry::model::polygon<point_type> polygon_type;
+typedef boost::geometry::model::box<point_type> box_type;
+typedef boost::geometry::model::ring<point_type> ring_type;
+typedef boost::geometry::model::segment<point_type> segment_type;
+
+typedef boost::mpl::vector<
+ point_type,
+ line_type,
+ polygon_type,
+ box_type,
+ ring_type,
+ segment_type
+> types;
+
+
+
+template <class T1>
+struct tester
+{
+ template <typename T2>
+ void operator()(T2)
+ {
+ typedef typename boost::geometry::tag<T1>::type tag1;
+ typedef typename boost::geometry::tag<T2>::type tag2;
+
+ if (boost::is_base_of<boost::geometry::not_implemented, check<tag1, tag2, T1, T2> >::type::value
+ && boost::is_base_of<boost::geometry::not_implemented, check<tag2, tag1, T2, T1> >::type::value)
+ {
+ std::cout << "-\t";
+ }
+ else
+ {
+ std::cout << "OK\t";
+ }
+ }
+};
+
+template <>
+struct tester<void>
+{
+ template <typename T>
+ void operator()(T)
+ {
+ boost::mpl::for_each<types>(tester<T>());
+ std::cout << std::endl;
+ }
+};
+
+
+int main()
+{
+ boost::mpl::for_each<types>(tester<void>());
+
+ return 0;
+}


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