]> git.proxmox.com Git - ceph.git/blame - 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
CommitLineData
7c673cae
FG
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
19namespace boost { namespace geometry { namespace index {
20
21namespace detail { namespace rtree {
22
23// element's indexable type
24
25template <typename Element, typename Translator>
26struct element_indexable_type
27{
28 typedef typename indexable_type<Translator>::type type;
29};
30
31template <typename First, typename Pointer, typename Translator>
32struct element_indexable_type<
33 rtree::ptr_pair<First, Pointer>,
34 Translator
35>
36{
37 typedef First type;
38};
39
40// is leaf element
41
42template <typename Element>
43struct is_leaf_element
44{
45 static const bool value = true;
46};
47
48template <typename First, typename Pointer>
49struct is_leaf_element< rtree::ptr_pair<First, Pointer> >
50{
51 static const bool value = false;
52};
53
54// element's indexable getter
55
56template <typename Element, typename Translator>
57typename result_type<Translator>::type
58element_indexable(Element const& el, Translator const& tr)
59{
60 return tr(el);
61}
62
63template <typename First, typename Pointer, typename Translator>
64First const&
65element_indexable(rtree::ptr_pair<First, Pointer> const& el, Translator const& /*tr*/)
66{
67 return el.first;
68}
69
70// nodes elements
71
72template <typename Node>
73struct elements_type
74{
75 typedef typename Node::elements_type type;
76};
77
78template <typename Node>
79inline typename elements_type<Node>::type &
80elements(Node & n)
81{
82 return n.elements;
83}
84
85template <typename Node>
86inline typename elements_type<Node>::type const&
87elements(Node const& n)
88{
89 return n.elements;
90}
91
92// elements derived type
93
94template <typename Elements, typename NewValue>
95struct container_from_elements_type
96{
97 typedef boost::container::vector<NewValue> type;
98};
99
100template <typename OldValue, size_t N, typename NewValue>
101struct 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