Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86345 - trunk/boost/geometry/algorithms
From: bruno.lalande_at_[hidden]
Date: 2013-10-18 04:14:13


Author: bruno.lalande
Date: 2013-10-18 04:14:13 EDT (Fri, 18 Oct 2013)
New Revision: 86345
URL: http://svn.boost.org/trac/boost/changeset/86345

Log:
Converted all devarianted_xxx classes to the new resolve_variant approach.

Text files modified:
   trunk/boost/geometry/algorithms/append.hpp | 35 +++++++++++++++++++----------------
   trunk/boost/geometry/algorithms/area.hpp | 25 +++++++++++++++----------
   trunk/boost/geometry/algorithms/buffer.hpp | 20 ++++++++++++--------
   trunk/boost/geometry/algorithms/clear.hpp | 17 ++++++++++-------
   trunk/boost/geometry/algorithms/convert.hpp | 19 +++++++++++--------
   trunk/boost/geometry/algorithms/equals.hpp | 38 ++++++++++++++++++++++----------------
   trunk/boost/geometry/algorithms/length.hpp | 28 ++++++++++++++++------------
   trunk/boost/geometry/algorithms/num_points.hpp | 20 ++++++++++++--------
   8 files changed, 117 insertions(+), 85 deletions(-)

Modified: trunk/boost/geometry/algorithms/append.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/append.hpp Thu Oct 17 19:30:30 2013 (r86344)
+++ trunk/boost/geometry/algorithms/append.hpp 2013-10-18 04:14:13 EDT (Fri, 18 Oct 2013) (r86345)
@@ -194,8 +194,14 @@
     : splitted_dispatch::append_point<typename tag<Geometry>::type, Geometry, RangeOrPoint>
 {};
 
+} // namespace dispatch
+#endif // DOXYGEN_NO_DISPATCH
+
+
+namespace resolve_variant {
+
 template <typename Geometry>
-struct devarianted_append
+struct append
 {
     template <typename RangeOrPoint>
     static inline void apply(Geometry& geometry,
@@ -204,16 +210,16 @@
                              int multi_index)
     {
         concept::check<Geometry>();
- append<Geometry, RangeOrPoint>::apply(geometry,
- range_or_point,
- ring_index,
- multi_index);
+ dispatch::append<Geometry, RangeOrPoint>::apply(geometry,
+ range_or_point,
+ ring_index,
+ multi_index);
     }
 };
 
 
 template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
-struct devarianted_append<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
+struct append<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
 {
     template <typename RangeOrPoint>
     struct visitor: boost::static_visitor<void>
@@ -233,11 +239,10 @@
         template <typename Geometry>
         void operator()(Geometry& geometry) const
         {
- concept::check<Geometry>();
- append<Geometry, RangeOrPoint>::apply(geometry,
- m_range_or_point,
- m_ring_index,
- m_multi_index);
+ append<Geometry>::apply(geometry,
+ m_range_or_point,
+ m_ring_index,
+ m_multi_index);
         }
     };
 
@@ -258,9 +263,7 @@
     }
 };
 
-
-} // namespace dispatch
-#endif // DOXYGEN_NO_DISPATCH
+} // namespace resolve_variant;
 
 
 /*!
@@ -281,8 +284,8 @@
 inline void append(Geometry& geometry, RangeOrPoint const& range_or_point,
                    int ring_index = -1, int multi_index = 0)
 {
- dispatch::devarianted_append<Geometry>
- ::apply(geometry, range_or_point, ring_index, multi_index);
+ resolve_variant::append<Geometry>
+ ::apply(geometry, range_or_point, ring_index, multi_index);
 }
 
 

Modified: trunk/boost/geometry/algorithms/area.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/area.hpp Thu Oct 17 19:30:30 2013 (r86344)
+++ trunk/boost/geometry/algorithms/area.hpp 2013-10-18 04:14:13 EDT (Fri, 18 Oct 2013) (r86345)
@@ -176,19 +176,25 @@
 };
 
 
+} // namespace dispatch
+#endif // DOXYGEN_NO_DISPATCH
+
+
+namespace resolve_variant {
+
 template <typename Geometry>
-struct devarianted_area
+struct area
 {
     template <typename Strategy>
     static inline typename Strategy::return_type apply(Geometry const& geometry,
                                                        Strategy const& strategy)
     {
- return area<Geometry>::apply(geometry, strategy);
+ return dispatch::area<Geometry>::apply(geometry, strategy);
     }
 };
 
 template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
-struct devarianted_area<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
+struct area<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
 {
     template <typename Strategy>
     struct visitor: boost::static_visitor<typename Strategy::return_type>
@@ -200,7 +206,7 @@
         template <typename Geometry>
         typename Strategy::return_type operator()(Geometry const& geometry) const
         {
- return devarianted_area<Geometry>::apply(geometry, m_strategy);
+ return area<Geometry>::apply(geometry, m_strategy);
         }
     };
 
@@ -213,10 +219,7 @@
     }
 };
 
-
-} // namespace dispatch
-#endif // DOXYGEN_NO_DISPATCH
-
+} // namespace resolve_variant
 
 
 /*!
@@ -245,6 +248,8 @@
 {
     concept::check<Geometry const>();
 
+ // TODO put this into a resolve_strategy stage
+ // (and take the return type from resolve_variant)
     typedef typename point_type<Geometry>::type point_type;
     typedef typename strategy::area::services::default_strategy
         <
@@ -254,7 +259,7 @@
 
     // detail::throw_on_empty_input(geometry);
         
- return dispatch::devarianted_area<Geometry>::apply(geometry, strategy_type());
+ return resolve_variant::area<Geometry>::apply(geometry, strategy_type());
 }
 
 /*!
@@ -289,7 +294,7 @@
 
     // detail::throw_on_empty_input(geometry);
     
- return dispatch::devarianted_area<Geometry>::apply(geometry, strategy);
+ return resolve_variant::area<Geometry>::apply(geometry, strategy);
 }
 
 

Modified: trunk/boost/geometry/algorithms/buffer.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/buffer.hpp Thu Oct 17 19:30:30 2013 (r86344)
+++ trunk/boost/geometry/algorithms/buffer.hpp 2013-10-18 04:14:13 EDT (Fri, 18 Oct 2013) (r86345)
@@ -105,9 +105,14 @@
 // of a set of geometries are often lateron combined using a "dissolve" operation.
 // Two points close to each other get a combined kidney shaped buffer then.
 
+} // namespace dispatch
+#endif // DOXYGEN_NO_DISPATCH
+
+
+namespace resolve_variant {
 
 template <typename Geometry>
-struct devarianted_buffer
+struct buffer
 {
     template <typename Distance, typename GeometryOut>
     static inline void apply(Geometry const& geometry,
@@ -115,12 +120,12 @@
                              Distance const& chord_length,
                              GeometryOut& out)
     {
- buffer<Geometry, GeometryOut>::apply(geometry, distance, chord_length, out);
+ dispatch::buffer<Geometry, GeometryOut>::apply(geometry, distance, chord_length, out);
     }
 };
 
 template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
-struct devarianted_buffer<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
+struct buffer<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
 {
     template <typename Distance, typename GeometryOut>
     struct visitor: boost::static_visitor<void>
@@ -140,7 +145,7 @@
         template <typename Geometry>
         void operator()(Geometry const& geometry) const
         {
- devarianted_buffer<Geometry>::apply(geometry, m_distance, m_chord_length, m_out);
+ buffer<Geometry>::apply(geometry, m_distance, m_chord_length, m_out);
         }
     };
 
@@ -156,8 +161,7 @@
     }
 };
 
-} // namespace dispatch
-#endif // DOXYGEN_NO_DISPATCH
+} // namespace resolve_variant
 
 
 /*!
@@ -182,7 +186,7 @@
     concept::check<Input const>();
     concept::check<Output>();
 
- dispatch::devarianted_buffer<Input>::apply(geometry_in, distance, chord_length, geometry_out);
+ resolve_variant::buffer<Input>::apply(geometry_in, distance, chord_length, geometry_out);
 }
 
 /*!
@@ -206,7 +210,7 @@
 
     Output geometry_out;
 
- dispatch::devarianted_buffer<Input>::apply(geometry, distance, chord_length, geometry_out);
+ resolve_variant::buffer<Input>::apply(geometry, distance, chord_length, geometry_out);
 
     return geometry_out;
 }

Modified: trunk/boost/geometry/algorithms/clear.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/clear.hpp Thu Oct 17 19:30:30 2013 (r86344)
+++ trunk/boost/geometry/algorithms/clear.hpp 2013-10-18 04:14:13 EDT (Fri, 18 Oct 2013) (r86345)
@@ -123,18 +123,23 @@
     : detail::clear::polygon_clear<Polygon>
 {};
 
+} // namespace dispatch
+#endif // DOXYGEN_NO_DISPATCH
+
+
+namespace resolve_variant {
 
 template <typename Geometry>
-struct devarianted_clear
+struct clear
 {
     static inline void apply(Geometry& geometry)
     {
- clear<Geometry>::apply(geometry);
+ dispatch::clear<Geometry>::apply(geometry);
     }
 };
 
 template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
-struct devarianted_clear<variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
+struct clear<variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
 {
     struct visitor: static_visitor<void>
     {
@@ -151,9 +156,7 @@
     }
 };
 
-
-} // namespace dispatch
-#endif // DOXYGEN_NO_DISPATCH
+} // namespace resolve_variant
 
 
 /*!
@@ -174,7 +177,7 @@
 {
     concept::check<Geometry>();
 
- dispatch::devarianted_clear<Geometry>::apply(geometry);
+ resolve_variant::clear<Geometry>::apply(geometry);
 }
 
 

Modified: trunk/boost/geometry/algorithms/convert.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/convert.hpp Thu Oct 17 19:30:30 2013 (r86344)
+++ trunk/boost/geometry/algorithms/convert.hpp 2013-10-18 04:14:13 EDT (Fri, 18 Oct 2013) (r86345)
@@ -388,19 +388,24 @@
     }
 };
 
+} // namespace dispatch
+#endif // DOXYGEN_NO_DISPATCH
+
+
+namespace resolve_variant {
 
 template <typename Geometry1, typename Geometry2>
-struct devarianted_convert
+struct convert
 {
     static inline void apply(Geometry1 const& geometry1, Geometry2& geometry2)
     {
         concept::check_concepts_and_equal_dimensions<Geometry1 const, Geometry2>();
- convert<Geometry1, Geometry2>::apply(geometry1, geometry2);
+ dispatch::convert<Geometry1, Geometry2>::apply(geometry1, geometry2);
     }
 };
 
 template <BOOST_VARIANT_ENUM_PARAMS(typename T), typename Geometry2>
-struct devarianted_convert<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Geometry2>
+struct convert<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Geometry2>
 {
     struct visitor: static_visitor<void>
     {
@@ -413,7 +418,7 @@
         template <typename Geometry1>
         inline void operator()(Geometry1 const& geometry1) const
         {
- devarianted_convert<Geometry1, Geometry2>::apply(geometry1, m_geometry2);
+ convert<Geometry1, Geometry2>::apply(geometry1, m_geometry2);
         }
     };
 
@@ -426,9 +431,7 @@
     }
 };
 
-
-} // namespace dispatch
-#endif // DOXYGEN_NO_DISPATCH
+}
 
 
 /*!
@@ -449,7 +452,7 @@
 template <typename Geometry1, typename Geometry2>
 inline void convert(Geometry1 const& geometry1, Geometry2& geometry2)
 {
- dispatch::devarianted_convert<Geometry1, Geometry2>::apply(geometry1, geometry2);
+ resolve_variant::convert<Geometry1, Geometry2>::apply(geometry1, geometry2);
 }
 
 #if defined(_MSC_VER)

Modified: trunk/boost/geometry/algorithms/equals.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/equals.hpp Thu Oct 17 19:30:30 2013 (r86344)
+++ trunk/boost/geometry/algorithms/equals.hpp 2013-10-18 04:14:13 EDT (Fri, 18 Oct 2013) (r86345)
@@ -242,8 +242,14 @@
 {};
 
 
+} // namespace dispatch
+#endif // DOXYGEN_NO_DISPATCH
+
+
+namespace resolve_variant {
+
 template <typename Geometry1, typename Geometry2>
-struct devarianted_equals
+struct equals
 {
     static inline bool apply(Geometry1 const& geometry1,
                              Geometry2 const& geometry2)
@@ -253,12 +259,14 @@
             Geometry1 const,
             Geometry2 const
>();
- return equals<Geometry1, Geometry2>::apply(geometry1, geometry2);
+
+ return dispatch::equals<Geometry1, Geometry2>
+ ::apply(geometry1, geometry2);
     }
 };
 
 template <BOOST_VARIANT_ENUM_PARAMS(typename T), typename Geometry2>
-struct devarianted_equals<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Geometry2>
+struct equals<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Geometry2>
 {
     struct visitor: static_visitor<bool>
     {
@@ -271,8 +279,8 @@
         template <typename Geometry1>
         inline bool operator()(Geometry1 const& geometry1) const
         {
- return devarianted_equals<Geometry1, Geometry2>
- ::apply(geometry1, m_geometry2);
+ return equals<Geometry1, Geometry2>
+ ::apply(geometry1, m_geometry2);
         }
 
     };
@@ -287,7 +295,7 @@
 };
 
 template <typename Geometry1, BOOST_VARIANT_ENUM_PARAMS(typename T)>
-struct devarianted_equals<Geometry1, boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
+struct equals<Geometry1, boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
 {
     struct visitor: static_visitor<bool>
     {
@@ -300,8 +308,8 @@
         template <typename Geometry2>
         inline bool operator()(Geometry2 const& geometry2) const
         {
- return devarianted_equals<Geometry1, Geometry2>
- ::apply(m_geometry1, geometry2);
+ return equals<Geometry1, Geometry2>
+ ::apply(m_geometry1, geometry2);
         }
 
     };
@@ -319,7 +327,7 @@
     BOOST_VARIANT_ENUM_PARAMS(typename T1),
     BOOST_VARIANT_ENUM_PARAMS(typename T2)
>
-struct devarianted_equals<
+struct equals<
     boost::variant<BOOST_VARIANT_ENUM_PARAMS(T1)>,
     boost::variant<BOOST_VARIANT_ENUM_PARAMS(T2)>
>
@@ -330,8 +338,8 @@
         inline bool operator()(Geometry1 const& geometry1,
                                Geometry2 const& geometry2) const
         {
- return devarianted_equals<Geometry1, Geometry2>
- ::apply(geometry1, geometry2);
+ return equals<Geometry1, Geometry2>
+ ::apply(geometry1, geometry2);
         }
 
     };
@@ -345,9 +353,7 @@
     }
 };
 
-
-} // namespace dispatch
-#endif // DOXYGEN_NO_DISPATCH
+} // namespace resolve_variant
 
 
 /*!
@@ -370,8 +376,8 @@
 template <typename Geometry1, typename Geometry2>
 inline bool equals(Geometry1 const& geometry1, Geometry2 const& geometry2)
 {
- return dispatch::devarianted_equals<Geometry1, Geometry2>
- ::apply(geometry1, geometry2);
+ return resolve_variant::equals<Geometry1, Geometry2>
+ ::apply(geometry1, geometry2);
 }
 
 

Modified: trunk/boost/geometry/algorithms/length.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/length.hpp Thu Oct 17 19:30:30 2013 (r86344)
+++ trunk/boost/geometry/algorithms/length.hpp 2013-10-18 04:14:13 EDT (Fri, 18 Oct 2013) (r86345)
@@ -148,9 +148,14 @@
     : detail::length::segment_length<Geometry>
 {};
 
+} // namespace dispatch
+#endif // DOXYGEN_NO_DISPATCH
+
+
+namespace resolve_variant {
 
 template <typename Geometry>
-struct devarianted_length
+struct length
 {
     typedef typename default_length_result<Geometry>::type result_type;
 
@@ -158,12 +163,12 @@
     static inline result_type apply(Geometry const& geometry,
                                     Strategy const& strategy)
     {
- return length<Geometry>::apply(geometry, strategy);
+ return dispatch::length<Geometry>::apply(geometry, strategy);
     }
 };
 
 template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
-struct devarianted_length<variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
+struct length<variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
 {
     typedef typename mpl::fold<
                 typename mpl::transform<
@@ -194,10 +199,10 @@
         {}
 
         template <typename Geometry>
- inline typename devarianted_length<Geometry>::result_type
+ inline typename length<Geometry>::result_type
         operator()(Geometry const& geometry) const
         {
- return devarianted_length<Geometry>::apply(geometry, m_strategy);
+ return length<Geometry>::apply(geometry, m_strategy);
         }
     };
 
@@ -211,9 +216,7 @@
     }
 };
 
-
-} // namespace dispatch
-#endif // DOXYGEN_NO_DISPATCH
+} // namespace resolve_variant
 
 
 /*!
@@ -228,19 +231,20 @@
 \qbk{[length] [length_output]}
  */
 template<typename Geometry>
-inline typename dispatch::devarianted_length<Geometry>::result_type
+inline typename resolve_variant::length<Geometry>::result_type
 length(Geometry const& geometry)
 {
     concept::check<Geometry const>();
 
     // detail::throw_on_empty_input(geometry);
 
+ // TODO put this into a resolve_strategy stage
     typedef typename strategy::distance::services::default_strategy
         <
             point_tag, typename point_type<Geometry>::type
>::type strategy_type;
 
- return dispatch::devarianted_length<Geometry>::apply(geometry, strategy_type());
+ return resolve_variant::length<Geometry>::apply(geometry, strategy_type());
 }
 
 
@@ -259,14 +263,14 @@
 \qbk{[length_with_strategy] [length_with_strategy_output]}
  */
 template<typename Geometry, typename Strategy>
-inline typename dispatch::devarianted_length<Geometry>::result_type
+inline typename resolve_variant::length<Geometry>::result_type
 length(Geometry const& geometry, Strategy const& strategy)
 {
     concept::check<Geometry const>();
 
     // detail::throw_on_empty_input(geometry);
     
- return dispatch::devarianted_length<Geometry>::apply(geometry, strategy);
+ return resolve_variant::length<Geometry>::apply(geometry, strategy);
 }
 
 

Modified: trunk/boost/geometry/algorithms/num_points.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/num_points.hpp Thu Oct 17 19:30:30 2013 (r86344)
+++ trunk/boost/geometry/algorithms/num_points.hpp 2013-10-18 04:14:13 EDT (Fri, 18 Oct 2013) (r86345)
@@ -141,18 +141,24 @@
         : detail::num_points::polygon_count
 {};
 
+} // namespace dispatch
+#endif
+
+
+namespace resolve_variant {
+
 template <typename Geometry>
-struct devarianted_num_points
+struct num_points
 {
     static inline std::size_t apply(Geometry const& geometry,
                                     bool add_for_open)
     {
- return num_points<Geometry>::apply(geometry, add_for_open);
+ return dispatch::num_points<Geometry>::apply(geometry, add_for_open);
     }
 };
 
 template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
-struct devarianted_num_points<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
+struct num_points<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
 {
     struct visitor: boost::static_visitor<std::size_t>
     {
@@ -163,7 +169,7 @@
         template <typename Geometry>
         typename std::size_t operator()(Geometry const& geometry) const
         {
- return dispatch::num_points<Geometry>::apply(geometry, m_add_for_open);
+ return num_points<Geometry>::apply(geometry, m_add_for_open);
         }
     };
 
@@ -175,9 +181,7 @@
     }
 };
 
-
-} // namespace dispatch
-#endif
+} // namespace resolve_variant
 
 
 /*!
@@ -196,7 +200,7 @@
 {
     concept::check<Geometry const>();
 
- return dispatch::devarianted_num_points<Geometry>::apply(geometry, add_for_open);
+ return resolve_variant::num_points<Geometry>::apply(geometry, add_for_open);
 }
 
 #if defined(_MSC_VER)


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