~ubuntu-branches/ubuntu/saucy/merkaartor/saucy

« back to all changes in this revision

Viewing changes to include/ggl/core/geometry_id.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Bernd Zeimetz
  • Date: 2009-09-13 00:52:12 UTC
  • mto: (1.2.7 upstream) (0.1.3 upstream) (3.1.7 sid)
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: james.westby@ubuntu.com-20090913005212-pjecal8zxm07x0fj
ImportĀ upstreamĀ versionĀ 0.14+svnfixes~20090912

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Generic Geometry Library
 
2
//
 
3
// Copyright Barend Gehrels 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
 
4
// Copyright Bruno Lalande 2008, 2009
 
5
// Use, modification and distribution is subject to the Boost Software License,
 
6
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 
7
// http://www.boost.org/LICENSE_1_0.txt)
 
8
 
 
9
 
 
10
#ifndef GGL_CORE_GEOMETRY_ID_HPP
 
11
#define GGL_CORE_GEOMETRY_ID_HPP
 
12
 
 
13
 
 
14
#include <boost/mpl/int.hpp>
 
15
#include <boost/type_traits.hpp>
 
16
 
 
17
 
 
18
#include <ggl/core/tag.hpp>
 
19
#include <ggl/core/tags.hpp>
 
20
 
 
21
 
 
22
namespace ggl {
 
23
 
 
24
 
 
25
#ifndef DOXYGEN_NO_DISPATCH
 
26
namespace core_dispatch
 
27
{
 
28
 
 
29
template <typename GeometryTag>
 
30
struct geometry_id {};
 
31
 
 
32
 
 
33
template <>
 
34
struct geometry_id<point_tag>      : boost::mpl::int_<1> {};
 
35
 
 
36
 
 
37
template <>
 
38
struct geometry_id<linestring_tag> : boost::mpl::int_<2> {};
 
39
 
 
40
 
 
41
template <>
 
42
struct geometry_id<polygon_tag>    : boost::mpl::int_<3> {};
 
43
 
 
44
 
 
45
template <>
 
46
struct geometry_id<nsphere_tag>    : boost::mpl::int_<91> {};
 
47
 
 
48
 
 
49
template <>
 
50
struct geometry_id<segment_tag>    : boost::mpl::int_<92> {};
 
51
 
 
52
 
 
53
template <>
 
54
struct geometry_id<ring_tag>       : boost::mpl::int_<93> {};
 
55
 
 
56
 
 
57
template <>
 
58
struct geometry_id<box_tag>        : boost::mpl::int_<94> {};
 
59
 
 
60
 
 
61
 
 
62
} // namespace core_dispatch
 
63
#endif
 
64
 
 
65
 
 
66
 
 
67
/*!
 
68
    \brief Meta-function the id for a geometry type
 
69
    \note Used for e.g. reverse meta-function
 
70
    \ingroup core
 
71
*/
 
72
template <typename Geometry>
 
73
struct geometry_id : core_dispatch::geometry_id<typename tag<Geometry>::type>
 
74
{};
 
75
 
 
76
 
 
77
} // namespace ggl
 
78
 
 
79
 
 
80
#endif // GGL_CORE_GEOMETRY_ID_HPP