• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
8 // Modifications copyright (c) 2018, 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 
25 #include <boost/tuple/tuple.hpp>
26 
27 #include <boost/geometry/core/access.hpp>
28 #include <boost/geometry/core/coordinate_dimension.hpp>
29 #include <boost/geometry/core/coordinate_type.hpp>
30 #include <boost/geometry/core/point_type.hpp>
31 #include <boost/geometry/core/tags.hpp>
32 
33 
34 namespace boost { namespace geometry
35 {
36 
37 
38 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
39 namespace traits
40 {
41 
42 
43 template <typename T1, typename T2, typename T3, typename T4, typename T5,
44           typename T6, typename T7, typename T8, typename T9, typename T10>
45 struct tag<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> >
46 {
47     typedef point_tag type;
48 };
49 
50 
51 template <typename T1, typename T2, typename T3, typename T4, typename T5,
52           typename T6, typename T7, typename T8, typename T9, typename T10>
53 struct coordinate_type<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> >
54 {
55     typedef T1 type;
56 };
57 
58 
59 template <typename T1, typename T2, typename T3, typename T4, typename T5,
60           typename T6, typename T7, typename T8, typename T9, typename T10>
61 struct dimension<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> >
62     : boost::mpl::int_
63           <
64               boost::tuples::length
65                   <
66                       boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
67                   >::value
68           >
69 {};
70 
71 
72 template <typename T1, typename T2, typename T3, typename T4, typename T5,
73           typename T6, typename T7, typename T8, typename T9, typename T10,
74           std::size_t Dimension>
75 struct access
76     <
77         boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>,
78         Dimension
79     >
80 {
getboost::geometry::traits::access81     static inline T1 get(
82         boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> const& point)
83     {
84         return point.template get<Dimension>();
85     }
86 
setboost::geometry::traits::access87     static inline void set(
88         boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& point,
89         T1 const& value)
90     {
91         point.template get<Dimension>() = value;
92     }
93 };
94 
95 
96 } // namespace traits
97 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
98 
99 
100 }} // namespace boost::geometry
101 
102 
103 // Convenience registration macro to bind boost::tuple to a CS
104 #define BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(CoordinateSystem) \
105     namespace boost { namespace geometry { namespace traits { \
106     template <typename T1, typename T2, typename T3, typename T4, typename T5, \
107               typename T6, typename T7, typename T8, typename T9, typename T10> \
108     struct coordinate_system<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> > \
109     { \
110         typedef CoordinateSystem type; \
111     }; \
112     }}}
113 
114 
115 #endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_TUPLE_HPP
116