New mechanism for easy checking of implementation status.

[SVN r75796]
This commit is contained in:
Bruno Lalande
2011-12-04 02:00:25 +00:00
parent f4b27c2b7d
commit 8e4e6a2fc2
3 changed files with 128 additions and 2 deletions

View File

@@ -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;
}

View File

@@ -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 @@ 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<Geometry1, Geometry2>)
);
};

View File

@@ -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