comparison DEPENDENCIES/generic/include/boost/geometry/algorithms/num_geometries.hpp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children c530137014c0
comparison
equal deleted inserted replaced
15:663ca0da4350 16:2665513ce2d3
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_ALGORITHMS_NUM_GEOMETRIES_HPP
16 #define BOOST_GEOMETRY_ALGORITHMS_NUM_GEOMETRIES_HPP
17
18 #include <cstddef>
19
20 #include <boost/geometry/algorithms/not_implemented.hpp>
21
22 #include <boost/geometry/core/tag.hpp>
23 #include <boost/geometry/core/tags.hpp>
24 #include <boost/geometry/core/tag_cast.hpp>
25
26 #include <boost/geometry/geometries/concepts/check.hpp>
27
28
29 namespace boost { namespace geometry
30 {
31
32
33 #ifndef DOXYGEN_NO_DISPATCH
34 namespace dispatch
35 {
36
37
38 template
39 <
40 typename Geometry,
41 typename Tag = typename tag_cast
42 <
43 typename tag<Geometry>::type,
44 single_tag,
45 multi_tag
46 >::type
47 >
48 struct num_geometries: not_implemented<Tag>
49 {};
50
51
52 template <typename Geometry>
53 struct num_geometries<Geometry, single_tag>
54 {
55 static inline std::size_t apply(Geometry const&)
56 {
57 return 1;
58 }
59 };
60
61
62
63 } // namespace dispatch
64 #endif
65
66
67 /*!
68 \brief \brief_calc{number of geometries}
69 \ingroup num_geometries
70 \details \details_calc{num_geometries, number of geometries}.
71 \tparam Geometry \tparam_geometry
72 \param geometry \param_geometry
73 \return \return_calc{number of geometries}
74
75 \qbk{[include reference/algorithms/num_geometries.qbk]}
76 */
77 template <typename Geometry>
78 inline std::size_t num_geometries(Geometry const& geometry)
79 {
80 concept::check<Geometry const>();
81
82 return dispatch::num_geometries<Geometry>::apply(geometry);
83 }
84
85
86 }} // namespace boost::geometry
87
88
89 #endif // BOOST_GEOMETRY_ALGORITHMS_NUM_GEOMETRIES_HPP