From 8e4e6a2fc2e4d5608123d37c3659f4f9f711ded0 Mon Sep 17 00:00:00 2001 From: Bruno Lalande Date: Sun, 4 Dec 2011 02:00:25 +0000 Subject: [PATCH] New mechanism for easy checking of implementation status. [SVN r75796] --- .../tools/support_status/support_status.cpp | 89 +++++++++++++++++++ .../boost/geometry/algorithms/distance.hpp | 7 +- .../geometry/algorithms/not_implemented.hpp | 34 +++++++ 3 files changed, 128 insertions(+), 2 deletions(-) create mode 100644 doc/src/docutils/tools/support_status/support_status.cpp create mode 100644 include/boost/geometry/algorithms/not_implemented.hpp diff --git a/doc/src/docutils/tools/support_status/support_status.cpp b/doc/src/docutils/tools/support_status/support_status.cpp new file mode 100644 index 000000000..248a7bc13 --- /dev/null +++ b/doc/src/docutils/tools/support_status/support_status.cpp @@ -0,0 +1,89 @@ +#include + +#include +#include +#include + +#define BOOST_GEOMETRY_IMPLEMENTATION_STATUS_BUILD true +#include +#include +#include +#include + + +template +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 point_type; +typedef boost::geometry::model::linestring line_type; +typedef boost::geometry::model::polygon polygon_type; +typedef boost::geometry::model::box box_type; +typedef boost::geometry::model::ring ring_type; +typedef boost::geometry::model::segment segment_type; + +typedef boost::mpl::vector< + point_type, + line_type, + polygon_type, + box_type, + ring_type, + segment_type +> types; + + + +template +struct tester +{ + template + void operator()(T2) + { + typedef typename boost::geometry::tag::type tag1; + typedef typename boost::geometry::tag::type tag2; + + if (boost::is_base_of >::type::value + && boost::is_base_of >::type::value) + { + std::cout << "-\t"; + } + else + { + std::cout << "OK\t"; + } + } +}; + +template <> +struct tester +{ + template + void operator()(T) + { + boost::mpl::for_each(tester()); + std::cout << std::endl; + } +}; + + +int main() +{ + boost::mpl::for_each(tester()); + + return 0; +} diff --git a/include/boost/geometry/algorithms/distance.hpp b/include/boost/geometry/algorithms/distance.hpp index c28d4a6c0..9f92dbbc7 100644 --- a/include/boost/geometry/algorithms/distance.hpp +++ b/include/boost/geometry/algorithms/distance.hpp @@ -28,6 +28,8 @@ #include #include +#include + #include #include @@ -253,11 +255,12 @@ template 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) ); }; diff --git a/include/boost/geometry/algorithms/not_implemented.hpp b/include/boost/geometry/algorithms/not_implemented.hpp new file mode 100644 index 000000000..76addd9d7 --- /dev/null +++ b/include/boost/geometry/algorithms/not_implemented.hpp @@ -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