Chris@16
|
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
|
Chris@16
|
2
|
Chris@16
|
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
Chris@16
|
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
Chris@16
|
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
Chris@16
|
6
|
Chris@16
|
7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
Chris@16
|
8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
Chris@16
|
9
|
Chris@16
|
10 // Use, modification and distribution is subject to the Boost Software License,
|
Chris@16
|
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
12 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
13
|
Chris@16
|
14
|
Chris@16
|
15 #ifndef BOOST_GEOMETRY_ALGORITHMS_NUM_GEOMETRIES_HPP
|
Chris@16
|
16 #define BOOST_GEOMETRY_ALGORITHMS_NUM_GEOMETRIES_HPP
|
Chris@16
|
17
|
Chris@16
|
18 #include <cstddef>
|
Chris@16
|
19
|
Chris@16
|
20 #include <boost/geometry/algorithms/not_implemented.hpp>
|
Chris@16
|
21
|
Chris@16
|
22 #include <boost/geometry/core/tag.hpp>
|
Chris@16
|
23 #include <boost/geometry/core/tags.hpp>
|
Chris@16
|
24 #include <boost/geometry/core/tag_cast.hpp>
|
Chris@16
|
25
|
Chris@16
|
26 #include <boost/geometry/geometries/concepts/check.hpp>
|
Chris@16
|
27
|
Chris@16
|
28
|
Chris@16
|
29 namespace boost { namespace geometry
|
Chris@16
|
30 {
|
Chris@16
|
31
|
Chris@16
|
32
|
Chris@16
|
33 #ifndef DOXYGEN_NO_DISPATCH
|
Chris@16
|
34 namespace dispatch
|
Chris@16
|
35 {
|
Chris@16
|
36
|
Chris@16
|
37
|
Chris@16
|
38 template
|
Chris@16
|
39 <
|
Chris@16
|
40 typename Geometry,
|
Chris@16
|
41 typename Tag = typename tag_cast
|
Chris@16
|
42 <
|
Chris@16
|
43 typename tag<Geometry>::type,
|
Chris@16
|
44 single_tag,
|
Chris@16
|
45 multi_tag
|
Chris@16
|
46 >::type
|
Chris@16
|
47 >
|
Chris@16
|
48 struct num_geometries: not_implemented<Tag>
|
Chris@16
|
49 {};
|
Chris@16
|
50
|
Chris@16
|
51
|
Chris@16
|
52 template <typename Geometry>
|
Chris@16
|
53 struct num_geometries<Geometry, single_tag>
|
Chris@16
|
54 {
|
Chris@16
|
55 static inline std::size_t apply(Geometry const&)
|
Chris@16
|
56 {
|
Chris@16
|
57 return 1;
|
Chris@16
|
58 }
|
Chris@16
|
59 };
|
Chris@16
|
60
|
Chris@16
|
61
|
Chris@16
|
62
|
Chris@16
|
63 } // namespace dispatch
|
Chris@16
|
64 #endif
|
Chris@16
|
65
|
Chris@16
|
66
|
Chris@16
|
67 /*!
|
Chris@16
|
68 \brief \brief_calc{number of geometries}
|
Chris@16
|
69 \ingroup num_geometries
|
Chris@16
|
70 \details \details_calc{num_geometries, number of geometries}.
|
Chris@16
|
71 \tparam Geometry \tparam_geometry
|
Chris@16
|
72 \param geometry \param_geometry
|
Chris@16
|
73 \return \return_calc{number of geometries}
|
Chris@16
|
74
|
Chris@16
|
75 \qbk{[include reference/algorithms/num_geometries.qbk]}
|
Chris@16
|
76 */
|
Chris@16
|
77 template <typename Geometry>
|
Chris@16
|
78 inline std::size_t num_geometries(Geometry const& geometry)
|
Chris@16
|
79 {
|
Chris@16
|
80 concept::check<Geometry const>();
|
Chris@16
|
81
|
Chris@16
|
82 return dispatch::num_geometries<Geometry>::apply(geometry);
|
Chris@16
|
83 }
|
Chris@16
|
84
|
Chris@16
|
85
|
Chris@16
|
86 }} // namespace boost::geometry
|
Chris@16
|
87
|
Chris@16
|
88
|
Chris@16
|
89 #endif // BOOST_GEOMETRY_ALGORITHMS_NUM_GEOMETRIES_HPP
|