]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/include/boost/geometry/core/geometry_id.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / core / geometry_id.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
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
15 #ifndef BOOST_GEOMETRY_CORE_GEOMETRY_ID_HPP
16 #define BOOST_GEOMETRY_CORE_GEOMETRY_ID_HPP
17
18
19 #include <boost/mpl/assert.hpp>
20 #include <boost/mpl/int.hpp>
21
22 #include <boost/geometry/core/tag.hpp>
23 #include <boost/geometry/core/tags.hpp>
24
25
26 namespace boost { namespace geometry
27 {
28
29
30 #ifndef DOXYGEN_NO_DISPATCH
31 namespace core_dispatch
32 {
33
34 template <typename GeometryTag>
35 struct geometry_id
36 {
37 BOOST_MPL_ASSERT_MSG
38 (
39 false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
40 , (types<GeometryTag>)
41 );
42 };
43
44
45 template <>
46 struct geometry_id<point_tag> : boost::mpl::int_<1> {};
47
48
49 template <>
50 struct geometry_id<linestring_tag> : boost::mpl::int_<2> {};
51
52
53 template <>
54 struct geometry_id<polygon_tag> : boost::mpl::int_<3> {};
55
56
57 template <>
58 struct geometry_id<multi_point_tag> : boost::mpl::int_<4> {};
59
60
61 template <>
62 struct geometry_id<multi_linestring_tag> : boost::mpl::int_<5> {};
63
64
65 template <>
66 struct geometry_id<multi_polygon_tag> : boost::mpl::int_<6> {};
67
68
69 template <>
70 struct geometry_id<segment_tag> : boost::mpl::int_<92> {};
71
72
73 template <>
74 struct geometry_id<ring_tag> : boost::mpl::int_<93> {};
75
76
77 template <>
78 struct geometry_id<box_tag> : boost::mpl::int_<94> {};
79
80
81 } // namespace core_dispatch
82 #endif
83
84
85
86 /*!
87 \brief Meta-function returning the id of a geometry type
88 \details The meta-function geometry_id defines a numerical ID (based on
89 boost::mpl::int_<...> ) for each geometry concept. A numerical ID is
90 sometimes useful, and within Boost.Geometry it is used for the
91 reverse_dispatch metafuntion.
92 \note Used for e.g. reverse meta-function
93 \ingroup core
94 */
95 template <typename Geometry>
96 struct geometry_id : core_dispatch::geometry_id<typename tag<Geometry>::type>
97 {};
98
99
100 }} // namespace boost::geometry
101
102
103 #endif // BOOST_GEOMETRY_CORE_GEOMETRY_ID_HPP