1 // Boost.Geometry (aka GGL, Generic Geometry Library)
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.
7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
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)
15 #ifndef BOOST_GEOMETRY_CORE_GEOMETRY_ID_HPP
16 #define BOOST_GEOMETRY_CORE_GEOMETRY_ID_HPP
19 #include <boost/mpl/assert.hpp>
20 #include <boost/mpl/int.hpp>
22 #include <boost/geometry/core/tag.hpp>
23 #include <boost/geometry/core/tags.hpp>
26 namespace boost { namespace geometry
30 #ifndef DOXYGEN_NO_DISPATCH
31 namespace core_dispatch
34 template <typename GeometryTag>
39 false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
40 , (types<GeometryTag>)
46 struct geometry_id<point_tag> : boost::mpl::int_<1> {};
50 struct geometry_id<linestring_tag> : boost::mpl::int_<2> {};
54 struct geometry_id<polygon_tag> : boost::mpl::int_<3> {};
58 struct geometry_id<multi_point_tag> : boost::mpl::int_<4> {};
62 struct geometry_id<multi_linestring_tag> : boost::mpl::int_<5> {};
66 struct geometry_id<multi_polygon_tag> : boost::mpl::int_<6> {};
70 struct geometry_id<segment_tag> : boost::mpl::int_<92> {};
74 struct geometry_id<ring_tag> : boost::mpl::int_<93> {};
78 struct geometry_id<box_tag> : boost::mpl::int_<94> {};
81 } // namespace core_dispatch
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
95 template <typename Geometry>
96 struct geometry_id : core_dispatch::geometry_id<typename tag<Geometry>::type>
100 }} // namespace boost::geometry
103 #endif // BOOST_GEOMETRY_CORE_GEOMETRY_ID_HPP