$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r71475 - in trunk: boost/geometry/geometries/adapted libs/geometry/example libs/geometry/test/geometries
From: bruno.lalande_at_[hidden]
Date: 2011-04-25 04:32:54
Author: bruno.lalande
Date: 2011-04-25 04:32:51 EDT (Mon, 25 Apr 2011)
New Revision: 71475
URL: http://svn.boost.org/trac/boost/changeset/71475
Log:
Removed adapted/fusion_<cs>.hpp files and added a macro to use instead.
Added:
   trunk/boost/geometry/geometries/adapted/boost_fusion.hpp
      - copied, changed from r71467, /trunk/boost/geometry/geometries/adapted/fusion.hpp
Removed:
   trunk/boost/geometry/geometries/adapted/fusion.hpp
   trunk/boost/geometry/geometries/adapted/fusion_cartesian.hpp
   trunk/boost/geometry/geometries/adapted/fusion_geographic.hpp
Text files modified: 
   trunk/boost/geometry/geometries/adapted/boost_fusion.hpp  |    23 ++++++++++++++++++-----                 
   trunk/libs/geometry/example/c09_custom_fusion_example.cpp |     5 +++--                                   
   trunk/libs/geometry/test/geometries/boost_fusion.cpp      |     6 +++---                                  
   3 files changed, 24 insertions(+), 10 deletions(-)
Copied: trunk/boost/geometry/geometries/adapted/boost_fusion.hpp (from r71467, /trunk/boost/geometry/geometries/adapted/fusion.hpp)
==============================================================================
--- /trunk/boost/geometry/geometries/adapted/fusion.hpp	(original)
+++ trunk/boost/geometry/geometries/adapted/boost_fusion.hpp	2011-04-25 04:32:51 EDT (Mon, 25 Apr 2011)
@@ -130,10 +130,6 @@
     }
 };
 
-// The library user has
-// 1) either to specify the coordinate system using a traits class
-// 2) or include <boost/geometry/geometries/adapted/fusion__at_.hpp>
-//          where @=cartesian,geographic,...
 
 template <typename Sequence>
 struct tag
@@ -148,6 +144,7 @@
     typedef point_tag type;
 };
 
+
 } // namespace traits
 
 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
@@ -155,5 +152,21 @@
 
 }} // namespace boost::geometry
 
-#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_HPP
 
+// Convenience registration macro to bind a Fusion sequence to a CS
+#define BOOST_GEOMETRY_REGISTER_BOOST_FUSION_CS(CoordinateSystem) \
+    namespace boost { namespace geometry { namespace traits { \
+    template <typename Sequence> \
+    struct coordinate_system \
+               < \
+                   Sequence, \
+                   typename boost::enable_if \
+                       < \
+                           fusion_adapt_detail::is_fusion_sequence<Sequence> \
+                       >::type \
+               > \
+    { typedef cs::cartesian type; }; \
+    }}}
+
+
+#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_HPP
Deleted: trunk/boost/geometry/geometries/adapted/fusion.hpp
==============================================================================
--- trunk/boost/geometry/geometries/adapted/fusion.hpp	2011-04-25 04:32:51 EDT (Mon, 25 Apr 2011)
+++ (empty file)
@@ -1,159 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-
-// Copyright (c) 2011 Akira Takahashi
-// Copyright (c) 2011 Barend Gehrels, 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_GEOMETRIES_ADAPTED_FUSION_HPP
-#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_HPP
-
-
-#include <cstddef>
-
-#include <boost/fusion/include/is_sequence.hpp>
-#include <boost/fusion/include/size.hpp>
-#include <boost/fusion/include/tag_of.hpp>
-#include <boost/fusion/include/front.hpp>
-#include <boost/fusion/include/at.hpp>
-#include <boost/utility/enable_if.hpp>
-
-#include <boost/fusion/mpl.hpp>
-#include <boost/mpl/front.hpp>
-#include <boost/mpl/count_if.hpp>
-#include <boost/mpl/pop_front.hpp>
-#include <boost/mpl/size.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-#include <boost/mpl/placeholders.hpp>
-#include <boost/mpl/and.hpp>
-#include <boost/mpl/front.hpp>
-
-#include <boost/geometry/core/access.hpp>
-#include <boost/geometry/core/coordinate_dimension.hpp>
-#include <boost/geometry/core/coordinate_system.hpp>
-#include <boost/geometry/core/coordinate_type.hpp>
-#include <boost/geometry/core/point_type.hpp>
-#include <boost/geometry/core/tags.hpp>
-
-
-namespace boost { namespace geometry
-{
-
-namespace fusion_adapt_detail
-{
-
-template <class Sequence>
-struct all_same :
-    boost::mpl::bool_<
-        boost::mpl::count_if<
-            Sequence,
-            boost::is_same<
-                typename boost::mpl::front<Sequence>::type,
-                boost::mpl::_
-            >
-        >::value == boost::mpl::size<Sequence>::value
-    >
-{};
-
-template <class Sequence>
-struct is_coordinate_size : boost::mpl::bool_<
-            boost::fusion::result_of::size<Sequence>::value == 2 ||
-            boost::fusion::result_of::size<Sequence>::value == 3> {};
-
-template<typename Sequence>
-struct is_fusion_sequence
-    : mpl::and_<boost::fusion::traits::is_sequence<Sequence>,
-                fusion_adapt_detail::is_coordinate_size<Sequence>,
-                fusion_adapt_detail::all_same<Sequence> >
-{};
-
-
-} // namespace fusion_adapt_detail
-
-
-#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
-namespace traits
-{
-
-// Boost Fusion Sequence, 2D or 3D
-template <typename Sequence>
-struct coordinate_type
-    <
-        Sequence,
-        typename boost::enable_if
-            <
-                fusion_adapt_detail::is_fusion_sequence<Sequence>
-            >::type
-    >
-{
-    typedef typename boost::mpl::front<Sequence>::type type;
-};
-
-
-template <typename Sequence>
-struct dimension
-    <
-        Sequence,
-        typename boost::enable_if
-            <
-                fusion_adapt_detail::is_fusion_sequence<Sequence>
-            >::type
-    > : boost::mpl::size<Sequence>
-{};
-
-
-template <typename Sequence, std::size_t Dimension>
-struct access
-    <
-        Sequence,
-        Dimension,
-        typename boost::enable_if
-            <
-                fusion_adapt_detail::is_fusion_sequence<Sequence>
-            >::type
-    >
-{
-    typedef typename coordinate_type<Sequence>::type ctype;
-
-    static inline ctype get(Sequence const& point)
-    {
-        return boost::fusion::at_c<Dimension>(point);
-    }
-
-    template <class CoordinateType>
-    static inline void set(Sequence& point, CoordinateType const& value)
-    {
-        boost::fusion::at_c<Dimension>(point) = value;
-    }
-};
-
-// The library user has
-// 1) either to specify the coordinate system using a traits class
-// 2) or include <boost/geometry/geometries/adapted/fusion__at_.hpp>
-//          where @=cartesian,geographic,...
-
-template <typename Sequence>
-struct tag
-    <
-        Sequence,
-        typename boost::enable_if
-            <
-                fusion_adapt_detail::is_fusion_sequence<Sequence>
-            >::type
-    >
-{
-    typedef point_tag type;
-};
-
-} // namespace traits
-
-#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
-
-
-}} // namespace boost::geometry
-
-#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_HPP
-
Deleted: trunk/boost/geometry/geometries/adapted/fusion_cartesian.hpp
==============================================================================
--- trunk/boost/geometry/geometries/adapted/fusion_cartesian.hpp	2011-04-25 04:32:51 EDT (Mon, 25 Apr 2011)
+++ (empty file)
@@ -1,44 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-
-// Copyright (c) 2011 Akira Takahashi
-// Copyright (c) 2011 Barend Gehrels, 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_GEOMETRIES_ADAPTED_FUSION_CARTESIAN_HPP
-#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_CARTESIAN_HPP
-
-#ifdef BOOST_GEOMETRY_ADAPTED_FUSION_COORDINATE_SYSTEM_DEFINED
-#error Include only one headerfile to register coordinate coordinate_system for adapted fusion
-#endif
-
-#define BOOST_GEOMETRY_ADAPTED_FUSION_COORDINATE_SYSTEM_DEFINED
-
-
-#include <boost/geometry/geometries/adapted/fusion.hpp>
-
-
-namespace boost { namespace geometry
-{
-
-
-#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
-namespace traits
-{
-    template <typename Sequence>
-    struct coordinate_system<
-        Sequence,
-        typename boost::enable_if<
-            fusion_adapt_detail::is_fusion_sequence<Sequence> >::type>
-    { typedef cs::cartesian type; };
-
-} // namespace traits
-#endif
-
-
-}} // namespace boost::geometry
-
-
-#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_CARTESIAN_HPP
Deleted: trunk/boost/geometry/geometries/adapted/fusion_geographic.hpp
==============================================================================
--- trunk/boost/geometry/geometries/adapted/fusion_geographic.hpp	2011-04-25 04:32:51 EDT (Mon, 25 Apr 2011)
+++ (empty file)
@@ -1,44 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-
-// Copyright (c) 2011 Akira Takahashi
-// Copyright (c) 2011 Barend Gehrels, 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_GEOMETRIES_ADAPTED_FUSION_GEOGRAPHIC_HPP
-#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_GEOGRAPHIC_HPP
-
-#ifdef BOOST_GEOMETRY_ADAPTED_FUSION_COORDINATE_SYSTEM_DEFINED
-#error Include only one headerfile to register coordinate coordinate_system for adapted fusion
-#endif
-
-#define BOOST_GEOMETRY_ADAPTED_FUSION_COORDINATE_SYSTEM_DEFINED
-
-
-#include <boost/geometry/geometries/adapted/fusion.hpp>
-
-
-namespace boost { namespace geometry
-{
-
-
-#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
-namespace traits
-{
-    template <typename Sequence>
-    struct coordinate_system<
-        Sequence,
-        typename boost::enable_if<
-            fusion_adapt_detail::is_fusion_sequence<Sequence> >::type>
-    { typedef cs::geographic<degree> type; };
-
-} // namespace traits
-#endif
-
-
-}} // namespace boost::geometry
-
-
-#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_GEOGRAPHIC_HPP
Modified: trunk/libs/geometry/example/c09_custom_fusion_example.cpp
==============================================================================
--- trunk/libs/geometry/example/c09_custom_fusion_example.cpp	(original)
+++ trunk/libs/geometry/example/c09_custom_fusion_example.cpp	2011-04-25 04:32:51 EDT (Mon, 25 Apr 2011)
@@ -15,12 +15,13 @@
 
 #include <boost/geometry/algorithms/distance.hpp>
 
-#include <boost/geometry/geometries/adapted/fusion.hpp>
-#include <boost/geometry/geometries/adapted/fusion_cartesian.hpp>
+#include <boost/geometry/geometries/adapted/boost_fusion.hpp>
 
 #include <boost/geometry/strategies/strategies.hpp>
 #include <boost/geometry/util/write_dsv.hpp>
 
+BOOST_GEOMETRY_REGISTER_BOOST_FUSION_CS(cs::cartesian);
+
 
 // Sample point, having x/y
 struct my_2d
Modified: trunk/libs/geometry/test/geometries/boost_fusion.cpp
==============================================================================
--- trunk/libs/geometry/test/geometries/boost_fusion.cpp	(original)
+++ trunk/libs/geometry/test/geometries/boost_fusion.cpp	2011-04-25 04:32:51 EDT (Mon, 25 Apr 2011)
@@ -13,12 +13,12 @@
 #include <boost/fusion/include/adapt_struct_named.hpp>
 
 #include <boost/geometry/geometry.hpp>
-#include <boost/geometry/geometries/adapted/fusion.hpp>
-#include <boost/geometry/geometries/adapted/fusion_cartesian.hpp>
-#include<boost/geometry/geometries/adapted/c_array_cartesian.hpp>
+#include <boost/geometry/geometries/adapted/boost_fusion.hpp>
+#include <boost/geometry/geometries/adapted/c_array_cartesian.hpp>
 #include <boost/geometry/geometries/adapted/boost_tuple.hpp>
 #include <iostream>
 
+BOOST_GEOMETRY_REGISTER_BOOST_FUSION_CS(cs::cartesian);
 BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian);