| 1 | // Boost.Geometry (aka GGL, Generic Geometry Library) |
| 2 | |
| 3 | // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. |
| 4 | // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. |
| 5 | // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. |
| 6 | |
| 7 | // This file was modified by Oracle on 2018-2020. |
| 8 | // Modifications copyright (c) 2018-2020, Oracle and/or its affiliates. |
| 9 | |
| 10 | // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle |
| 11 | |
| 12 | // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library |
| 13 | // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. |
| 14 | |
| 15 | // Use, modification and distribution is subject to the Boost Software License, |
| 16 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
| 17 | // http://www.boost.org/LICENSE_1_0.txt) |
| 18 | |
| 19 | #ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_TUPLE_HPP |
| 20 | #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_TUPLE_HPP |
| 21 | |
| 22 | |
| 23 | #include <cstddef> |
| 24 | #include <type_traits> |
| 25 | |
| 26 | #include <boost/tuple/tuple.hpp> |
| 27 | |
| 28 | #include <boost/geometry/core/access.hpp> |
| 29 | #include <boost/geometry/core/coordinate_dimension.hpp> |
| 30 | #include <boost/geometry/core/coordinate_type.hpp> |
| 31 | #include <boost/geometry/core/point_type.hpp> |
| 32 | #include <boost/geometry/core/tags.hpp> |
| 33 | |
| 34 | |
| 35 | namespace boost { namespace geometry |
| 36 | { |
| 37 | |
| 38 | |
| 39 | #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS |
| 40 | namespace traits |
| 41 | { |
| 42 | |
| 43 | |
| 44 | template <typename T1, typename T2, typename T3, typename T4, typename T5, |
| 45 | typename T6, typename T7, typename T8, typename T9, typename T10> |
| 46 | struct tag<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> > |
| 47 | { |
| 48 | typedef point_tag type; |
| 49 | }; |
| 50 | |
| 51 | |
| 52 | template <typename T1, typename T2, typename T3, typename T4, typename T5, |
| 53 | typename T6, typename T7, typename T8, typename T9, typename T10> |
| 54 | struct coordinate_type<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> > |
| 55 | { |
| 56 | typedef T1 type; |
| 57 | }; |
| 58 | |
| 59 | |
| 60 | template <typename T1, typename T2, typename T3, typename T4, typename T5, |
| 61 | typename T6, typename T7, typename T8, typename T9, typename T10> |
| 62 | struct dimension<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> > |
| 63 | : std::integral_constant |
| 64 | < |
| 65 | std::size_t, |
| 66 | boost::tuples::length |
| 67 | < |
| 68 | boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> |
| 69 | >::value |
| 70 | > |
| 71 | {}; |
| 72 | |
| 73 | |
| 74 | template <typename T1, typename T2, typename T3, typename T4, typename T5, |
| 75 | typename T6, typename T7, typename T8, typename T9, typename T10, |
| 76 | std::size_t Dimension> |
| 77 | struct access |
| 78 | < |
| 79 | boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, |
| 80 | Dimension |
| 81 | > |
| 82 | { |
| 83 | static inline T1 get( |
| 84 | boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> const& point) |
| 85 | { |
| 86 | return point.template get<Dimension>(); |
| 87 | } |
| 88 | |
| 89 | static inline void set( |
| 90 | boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& point, |
| 91 | T1 const& value) |
| 92 | { |
| 93 | point.template get<Dimension>() = value; |
| 94 | } |
| 95 | }; |
| 96 | |
| 97 | |
| 98 | } // namespace traits |
| 99 | #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS |
| 100 | |
| 101 | |
| 102 | }} // namespace boost::geometry |
| 103 | |
| 104 | |
| 105 | // Convenience registration macro to bind boost::tuple to a CS |
| 106 | #define BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(CoordinateSystem) \ |
| 107 | namespace boost { namespace geometry { namespace traits { \ |
| 108 | template <typename T1, typename T2, typename T3, typename T4, typename T5, \ |
| 109 | typename T6, typename T7, typename T8, typename T9, typename T10> \ |
| 110 | struct coordinate_system<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> > \ |
| 111 | { \ |
| 112 | typedef CoordinateSystem type; \ |
| 113 | }; \ |
| 114 | }}} |
| 115 | |
| 116 | |
| 117 | #endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_TUPLE_HPP |
| 118 | |