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 | #ifndef BOOST_GEOMETRY_CORE_TAG_HPP |
15 | #define BOOST_GEOMETRY_CORE_TAG_HPP |
16 | |
17 | #include <boost/mpl/assert.hpp> |
18 | |
19 | #include <boost/geometry/core/tags.hpp> |
20 | #include <boost/geometry/util/bare_type.hpp> |
21 | |
22 | |
23 | namespace boost { namespace geometry |
24 | { |
25 | |
26 | namespace traits |
27 | { |
28 | |
29 | /*! |
30 | \brief Traits class to attach a tag to a geometry |
31 | \details All geometries should implement a traits::tag<G>::type metafunction to indicate their |
32 | own geometry type. |
33 | \ingroup traits |
34 | \par Geometries: |
35 | - all geometries |
36 | \par Specializations should provide: |
37 | - typedef XXX_tag type; (point_tag, box_tag, ...) |
38 | \tparam Geometry geometry |
39 | */ |
40 | template <typename Geometry, typename Enable = void> |
41 | struct tag |
42 | { |
43 | typedef void type; |
44 | }; |
45 | |
46 | } // namespace traits |
47 | |
48 | |
49 | |
50 | /*! |
51 | \brief \brief_meta{type, tag, \meta_geometry_type} |
52 | \details With Boost.Geometry, tags are the driving force of the tag dispatching |
53 | mechanism. The tag metafunction is therefore used in every free function. |
54 | \tparam Geometry \tparam_geometry |
55 | \ingroup core |
56 | |
57 | \qbk{[include reference/core/tag.qbk]} |
58 | */ |
59 | template <typename Geometry> |
60 | struct tag |
61 | { |
62 | typedef typename traits::tag |
63 | < |
64 | typename geometry::util::bare_type<Geometry>::type |
65 | >::type type; |
66 | }; |
67 | |
68 | }} // namespace boost::geometry |
69 | |
70 | #endif // BOOST_GEOMETRY_CORE_TAG_HPP |
71 | |