]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/include/boost/geometry/index/detail/algorithms/smallest_for_indexable.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / index / detail / algorithms / smallest_for_indexable.hpp
1 // Boost.Geometry Index
2 //
3 // Get smallest value calculated for indexable's dimensions, used in R-tree k nearest neighbors query
4 //
5 // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
6 //
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
10
11 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SMALLEST_FOR_INDEXABLE_HPP
12 #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SMALLEST_FOR_INDEXABLE_HPP
13
14 namespace boost { namespace geometry { namespace index { namespace detail {
15
16 template <
17 typename Geometry,
18 typename Indexable,
19 typename IndexableTag,
20 typename AlgoTag,
21 size_t DimensionIndex>
22 struct smallest_for_indexable_dimension
23 {
24 BOOST_MPL_ASSERT_MSG(
25 (false),
26 NOT_IMPLEMENTED_FOR_THIS_INDEXABLE_TAG_TYPE,
27 (smallest_for_indexable_dimension));
28 };
29
30 template <
31 typename Geometry,
32 typename Indexable,
33 typename IndexableTag,
34 typename AlgoTag,
35 size_t N>
36 struct smallest_for_indexable
37 {
38 typedef typename smallest_for_indexable_dimension<
39 Geometry, Indexable, IndexableTag, AlgoTag, N - 1
40 >::result_type result_type;
41
42 template <typename Data>
43 inline static result_type apply(Geometry const& g, Indexable const& i, Data const& data)
44 {
45 result_type r1 = smallest_for_indexable<
46 Geometry, Indexable, IndexableTag, AlgoTag, N - 1
47 >::apply(g, i, data);
48
49 result_type r2 = smallest_for_indexable_dimension<
50 Geometry, Indexable, IndexableTag, AlgoTag, N - 1
51 >::apply(g, i, data);
52
53 return r1 < r2 ? r1 : r2;
54 }
55 };
56
57 template <
58 typename Geometry,
59 typename Indexable,
60 typename IndexableTag,
61 typename AlgoTag>
62 struct smallest_for_indexable<Geometry, Indexable, IndexableTag, AlgoTag, 1>
63 {
64 typedef typename smallest_for_indexable_dimension<
65 Geometry, Indexable, IndexableTag, AlgoTag, 0
66 >::result_type result_type;
67
68 template <typename Data>
69 inline static result_type apply(Geometry const& g, Indexable const& i, Data const& data)
70 {
71 return
72 smallest_for_indexable_dimension<
73 Geometry, Indexable, IndexableTag, AlgoTag, 0
74 >::apply(g, i, data);
75 }
76 };
77
78 }}}} // namespace boost::geometry::index::detail
79
80 #endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SMALLEST_FOR_INDEXABLE_HPP