|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r76072 - in trunk: boost/geometry/algorithms libs/geometry/doc/src/docutils/tools/support_status
From: bruno.lalande_at_[hidden]
Date: 2011-12-19 18:00:34
Author: bruno.lalande
Date: 2011-12-19 18:00:32 EST (Mon, 19 Dec 2011)
New Revision: 76072
URL: http://svn.boost.org/trac/boost/changeset/76072
Log:
Simplified not_implemented.
Text files modified:
trunk/boost/geometry/algorithms/convert.hpp | 4
trunk/boost/geometry/algorithms/distance.hpp | 3
trunk/boost/geometry/algorithms/not_implemented.hpp | 138 +++++++++++++++++++--------------------
trunk/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp | 6
4 files changed, 73 insertions(+), 78 deletions(-)
Modified: trunk/boost/geometry/algorithms/convert.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/convert.hpp (original)
+++ trunk/boost/geometry/algorithms/convert.hpp 2011-12-19 18:00:32 EST (Mon, 19 Dec 2011)
@@ -221,9 +221,7 @@
bool UseAssignment = boost::is_same<Geometry1, Geometry2>::value
&& !boost::is_array<Geometry1>::value
>
-struct convert: boost::geometry::not_implemented<for_geometry<Tag1>,
- and_geometry<Tag2>,
- in_dimension<DimensionCount> >
+struct convert: not_implemented<Tag1, Tag2, mpl::int_<DimensionCount> >
{};
Modified: trunk/boost/geometry/algorithms/distance.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/distance.hpp (original)
+++ trunk/boost/geometry/algorithms/distance.hpp 2011-12-19 18:00:32 EST (Mon, 19 Dec 2011)
@@ -267,8 +267,7 @@
typename StrategyTag = typename strategy::distance::services::tag<Strategy>::type,
bool Reverse = reverse_dispatch<Geometry1, Geometry2>::type::value
>
-struct distance: not_implemented<for_geometry<Tag1>,
- and_geometry<Tag2> >
+struct distance: not_implemented<Tag1, Tag2>
{};
Modified: trunk/boost/geometry/algorithms/not_implemented.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/not_implemented.hpp (original)
+++ trunk/boost/geometry/algorithms/not_implemented.hpp 2011-12-19 18:00:32 EST (Mon, 19 Dec 2011)
@@ -17,101 +17,99 @@
#include <boost/mpl/assert.hpp>
-#include <boost/mpl/fold.hpp>
-#include <boost/mpl/vector.hpp>
-#include <boost/mpl/remove.hpp>
-#include <boost/mpl/apply_wrap.hpp>
+#include <boost/geometry/core/tags.hpp>
+#include <boost/geometry/multi/core/tags.hpp>
namespace boost { namespace geometry
{
-// Class containing the elements of the actual user-facing error message
-
-template <class>
-struct FOR_GEOMETRY_TYPE
+namespace info
{
- template <class>
- struct AND_GEOMETRY_TYPE
- {
- template <size_t>
- struct IN_DIMENSION
- {};
- };
-
- template <size_t>
- struct IN_DIMENSION
- {};
-};
-
-
-// Unary metafunction class templates which return their corresponding error
-// message element nested in the previous one.
-
-template <class G>
-struct for_geometry
+ struct UNRECOGNIZED_GEOMETRY_TYPE {};
+ struct POINT {};
+ struct LINESTRING {};
+ struct POLYGON {};
+ struct RING {};
+ struct BOX {};
+ struct SEGMENT {};
+ struct MULTI_POINT {};
+ struct MULTI_LINESTRING {};
+ struct MULTI_POLYGON {};
+ struct GEOMETRY_COLLECTION {};
+ template <size_t D> struct DIMENSION {};
+}
+
+
+namespace nyi
{
- template <class>
- struct apply
- {
- typedef FOR_GEOMETRY_TYPE<G> type;
- };
-};
-template <class G>
-struct and_geometry
-{
- template <class Prev>
- struct apply
- {
- typedef typename Prev::template AND_GEOMETRY_TYPE<G> type;
- };
-};
-template <size_t D>
-struct in_dimension
+struct not_implemented_tag {};
+
+template
+<
+ typename Term1,
+ typename Term2,
+ typename Term3
+>
+struct not_implemented_error
{
- template <class Prev>
- struct apply
- {
- typedef typename Prev::template IN_DIMENSION<D> type;
- };
-};
-
#ifndef BOOST_GEOMETRY_IMPLEMENTATION_STATUS_BUILD
# define BOOST_GEOMETRY_IMPLEMENTATION_STATUS_BUILD false
#endif
-
-struct not_implemented_base {};
-
-
-template <
- typename Word1 = void,
- typename Word2 = void,
- typename Word3 = void
->
-struct not_implemented: not_implemented_base
-{
BOOST_MPL_ASSERT_MSG
(
BOOST_GEOMETRY_IMPLEMENTATION_STATUS_BUILD,
THIS_OPERATION_IS_NOT_OR_NOT_YET_IMPLEMENTED,
(
- typename boost::mpl::fold<
- typename boost::mpl::remove<
- boost::mpl::vector<Word1, Word2, Word3>,
- void
- >::type,
- void,
- boost::mpl::apply_wrap1<boost::mpl::_2, boost::mpl::_1>
- >::type
+ types<Term1, Term2, Term3>
)
);
};
+template <typename Tag>
+struct tag_to_term
+{
+ typedef Tag type;
+};
+
+template <> struct tag_to_term<geometry_not_recognized_tag> { typedef info::UNRECOGNIZED_GEOMETRY_TYPE type; };
+template <> struct tag_to_term<point_tag> { typedef info::POINT type; };
+template <> struct tag_to_term<linestring_tag> { typedef info::LINESTRING type; };
+template <> struct tag_to_term<polygon_tag> { typedef info::POLYGON type; };
+template <> struct tag_to_term<ring_tag> { typedef info::RING type; };
+template <> struct tag_to_term<box_tag> { typedef info::BOX type; };
+template <> struct tag_to_term<segment_tag> { typedef info::SEGMENT type; };
+template <> struct tag_to_term<multi_point_tag> { typedef info::MULTI_POINT type; };
+template <> struct tag_to_term<multi_linestring_tag> { typedef info::MULTI_LINESTRING type; };
+template <> struct tag_to_term<multi_polygon_tag> { typedef info::MULTI_POLYGON type; };
+template <> struct tag_to_term<geometry_collection_tag> { typedef info::GEOMETRY_COLLECTION type; };
+template <int D> struct tag_to_term<mpl::int_<D> > { typedef info::DIMENSION<D> type; };
+
+
+}
+
+
+template
+<
+ typename Term1 = void,
+ typename Term2 = void,
+ typename Term3 = void
+>
+struct not_implemented
+ : nyi::not_implemented_tag,
+ nyi::not_implemented_error
+ <
+ typename mpl::identity<typename nyi::tag_to_term<Term1>::type>::type,
+ typename mpl::identity<typename nyi::tag_to_term<Term2>::type>::type,
+ typename mpl::identity<typename nyi::tag_to_term<Term3>::type>::type
+ >
+{};
+
}} // namespace boost::geometry
Modified: trunk/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp
==============================================================================
--- trunk/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp (original)
+++ trunk/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp 2011-12-19 18:00:32 EST (Mon, 19 Dec 2011)
@@ -15,7 +15,7 @@
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::linestring<point_type> linestring_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;
@@ -23,7 +23,7 @@
typedef boost::mpl::vector<
point_type,
- line_type,
+ linestring_type,
polygon_type,
box_type,
ring_type,
@@ -47,7 +47,7 @@
template <typename G2>
void operator()(G2)
{
- if (boost::is_base_of<boost::geometry::not_implemented_base, Dispatcher<G1, G2> >::type::value)
+ if (boost::is_base_of<boost::geometry::nyi::not_implemented_tag, Dispatcher<G1, G2> >::type::value)
{
std::cout << "-\t";
}
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