]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/include/boost/geometry/index/detail/rtree/node/node_elements.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / index / detail / rtree / node / node_elements.hpp
1 // Boost.Geometry Index
2 //
3 // R-tree node elements access
4 //
5 // Copyright (c) 2011-2015 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_RTREE_NODE_NODE_ELEMENTS_HPP
12 #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_ELEMENTS_HPP
13
14 #include <boost/container/vector.hpp>
15 #include <boost/geometry/algorithms/detail/expand_by_epsilon.hpp>
16 #include <boost/geometry/index/detail/varray.hpp>
17 #include <boost/geometry/index/detail/rtree/node/pairs.hpp>
18
19 namespace boost { namespace geometry { namespace index {
20
21 namespace detail { namespace rtree {
22
23 // element's indexable type
24
25 template <typename Element, typename Translator>
26 struct element_indexable_type
27 {
28 typedef typename indexable_type<Translator>::type type;
29 };
30
31 template <typename First, typename Pointer, typename Translator>
32 struct element_indexable_type<
33 rtree::ptr_pair<First, Pointer>,
34 Translator
35 >
36 {
37 typedef First type;
38 };
39
40 // is leaf element
41
42 template <typename Element>
43 struct is_leaf_element
44 {
45 static const bool value = true;
46 };
47
48 template <typename First, typename Pointer>
49 struct is_leaf_element< rtree::ptr_pair<First, Pointer> >
50 {
51 static const bool value = false;
52 };
53
54 // element's indexable getter
55
56 template <typename Element, typename Translator>
57 typename result_type<Translator>::type
58 element_indexable(Element const& el, Translator const& tr)
59 {
60 return tr(el);
61 }
62
63 template <typename First, typename Pointer, typename Translator>
64 First const&
65 element_indexable(rtree::ptr_pair<First, Pointer> const& el, Translator const& /*tr*/)
66 {
67 return el.first;
68 }
69
70 // nodes elements
71
72 template <typename Node>
73 struct elements_type
74 {
75 typedef typename Node::elements_type type;
76 };
77
78 template <typename Node>
79 inline typename elements_type<Node>::type &
80 elements(Node & n)
81 {
82 return n.elements;
83 }
84
85 template <typename Node>
86 inline typename elements_type<Node>::type const&
87 elements(Node const& n)
88 {
89 return n.elements;
90 }
91
92 // elements derived type
93
94 template <typename Elements, typename NewValue>
95 struct container_from_elements_type
96 {
97 typedef boost::container::vector<NewValue> type;
98 };
99
100 template <typename OldValue, size_t N, typename NewValue>
101 struct container_from_elements_type<detail::varray<OldValue, N>, NewValue>
102 {
103 typedef detail::varray<NewValue, N> type;
104 };
105
106 }} // namespace detail::rtree
107
108 }}} // namespace boost::geometry::index
109
110 #endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_ELEMENTS_HPP