]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 | // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library | |
8 | // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. | |
9 | ||
10 | // Use, modification and distribution is subject to the Boost Software License, | |
11 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
12 | // http://www.boost.org/LICENSE_1_0.txt) | |
13 | ||
14 | #ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_TUPLE_HPP | |
15 | #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_TUPLE_HPP | |
16 | ||
17 | ||
18 | #include <cstddef> | |
19 | ||
20 | #include <boost/tuple/tuple.hpp> | |
21 | ||
22 | #include <boost/geometry/core/coordinate_dimension.hpp> | |
23 | #include <boost/geometry/core/coordinate_type.hpp> | |
24 | #include <boost/geometry/core/point_type.hpp> | |
25 | #include <boost/geometry/core/tags.hpp> | |
26 | ||
27 | ||
28 | namespace boost { namespace geometry | |
29 | { | |
30 | ||
31 | ||
32 | #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS | |
33 | namespace traits | |
34 | { | |
35 | ||
36 | ||
37 | template <typename T1, typename T2, typename T3, typename T4, typename T5, | |
38 | typename T6, typename T7, typename T8, typename T9, typename T10> | |
39 | struct tag<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> > | |
40 | { | |
41 | typedef point_tag type; | |
42 | }; | |
43 | ||
44 | ||
45 | template <typename T1, typename T2, typename T3, typename T4, typename T5, | |
46 | typename T6, typename T7, typename T8, typename T9, typename T10> | |
47 | struct coordinate_type<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> > | |
48 | { | |
49 | typedef T1 type; | |
50 | }; | |
51 | ||
52 | ||
53 | template <typename T1, typename T2, typename T3, typename T4, typename T5, | |
54 | typename T6, typename T7, typename T8, typename T9, typename T10> | |
55 | struct dimension<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> > | |
56 | : boost::mpl::int_ | |
57 | < | |
58 | boost::tuples::length | |
59 | < | |
60 | boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> | |
61 | >::value | |
62 | > | |
63 | {}; | |
64 | ||
65 | ||
66 | template <typename T1, typename T2, typename T3, typename T4, typename T5, | |
67 | typename T6, typename T7, typename T8, typename T9, typename T10, | |
68 | std::size_t Dimension> | |
69 | struct access | |
70 | < | |
71 | boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, | |
72 | Dimension | |
73 | > | |
74 | { | |
75 | static inline T1 get( | |
76 | boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> const& point) | |
77 | { | |
78 | return point.template get<Dimension>(); | |
79 | } | |
80 | ||
81 | static inline void set( | |
82 | boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& point, | |
83 | T1 const& value) | |
84 | { | |
85 | point.template get<Dimension>() = value; | |
86 | } | |
87 | }; | |
88 | ||
89 | ||
90 | } // namespace traits | |
91 | #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS | |
92 | ||
93 | ||
94 | }} // namespace boost::geometry | |
95 | ||
96 | ||
97 | // Convenience registration macro to bind boost::tuple to a CS | |
98 | #define BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(CoordinateSystem) \ | |
99 | namespace boost { namespace geometry { namespace traits { \ | |
100 | template <typename T1, typename T2, typename T3, typename T4, typename T5, \ | |
101 | typename T6, typename T7, typename T8, typename T9, typename T10> \ | |
102 | struct coordinate_system<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> > \ | |
103 | { \ | |
104 | typedef CoordinateSystem type; \ | |
105 | }; \ | |
106 | }}} | |
107 | ||
108 | ||
109 | #endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_TUPLE_HPP |