]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/include/boost/geometry/index/detail/rtree/node/weak_static.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / index / detail / rtree / node / weak_static.hpp
CommitLineData
7c673cae
FG
1// Boost.Geometry Index
2//
3// R-tree nodes based on static conversion, storing static-size containers
4//
5// Copyright (c) 2011-2014 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_WEAK_STATIC_HPP
12#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_WEAK_STATIC_HPP
13
14namespace boost { namespace geometry { namespace index {
15
16namespace detail { namespace rtree {
17
18template <typename Value, typename Parameters, typename Box, typename Allocators>
19struct weak_internal_node<Value, Parameters, Box, Allocators, node_weak_static_tag>
20 : public weak_node<Value, Parameters, Box, Allocators, node_weak_static_tag>
21{
22 typedef detail::varray<
23 rtree::ptr_pair<Box, typename Allocators::node_pointer>,
24 Parameters::max_elements + 1
25 > elements_type;
26
27 template <typename Alloc>
28 inline weak_internal_node(Alloc const&) {}
29
30 elements_type elements;
31};
32
33template <typename Value, typename Parameters, typename Box, typename Allocators>
34struct weak_leaf<Value, Parameters, Box, Allocators, node_weak_static_tag>
35 : public weak_node<Value, Parameters, Box, Allocators, node_weak_static_tag>
36{
37 typedef detail::varray<
38 Value,
39 Parameters::max_elements + 1
40 > elements_type;
41
42 template <typename Alloc>
43 inline weak_leaf(Alloc const&) {}
44
45 elements_type elements;
46};
47
48// nodes traits
49
50template <typename Value, typename Parameters, typename Box, typename Allocators>
51struct node<Value, Parameters, Box, Allocators, node_weak_static_tag>
52{
53 typedef weak_node<Value, Parameters, Box, Allocators, node_weak_static_tag> type;
54};
55
56template <typename Value, typename Parameters, typename Box, typename Allocators>
57struct internal_node<Value, Parameters, Box, Allocators, node_weak_static_tag>
58{
59 typedef weak_internal_node<Value, Parameters, Box, Allocators, node_weak_static_tag> type;
60};
61
62template <typename Value, typename Parameters, typename Box, typename Allocators>
63struct leaf<Value, Parameters, Box, Allocators, node_weak_static_tag>
64{
65 typedef weak_leaf<Value, Parameters, Box, Allocators, node_weak_static_tag> type;
66};
67
68template <typename Value, typename Parameters, typename Box, typename Allocators, bool IsVisitableConst>
69struct visitor<Value, Parameters, Box, Allocators, node_weak_static_tag, IsVisitableConst>
70{
71 typedef weak_visitor<Value, Parameters, Box, Allocators, node_weak_static_tag, IsVisitableConst> type;
72};
73
74// allocators
75
76template <typename Allocator, typename Value, typename Parameters, typename Box>
77class allocators<Allocator, Value, Parameters, Box, node_weak_static_tag>
78 : public Allocator::template rebind<
79 typename internal_node<
80 Value, Parameters, Box,
81 allocators<Allocator, Value, Parameters, Box, node_weak_static_tag>,
82 node_weak_static_tag
83 >::type
84 >::other
85 , public Allocator::template rebind<
86 typename leaf<
87 Value, Parameters, Box,
88 allocators<Allocator, Value, Parameters, Box, node_weak_static_tag>,
89 node_weak_static_tag
90 >::type
91 >::other
92{
93 typedef typename Allocator::template rebind<
94 Value
95 >::other value_allocator_type;
96
97public:
98 typedef Allocator allocator_type;
99
100 typedef Value value_type;
101 typedef value_type & reference;
102 typedef const value_type & const_reference;
103 typedef typename value_allocator_type::size_type size_type;
104 typedef typename value_allocator_type::difference_type difference_type;
105 typedef typename value_allocator_type::pointer pointer;
106 typedef typename value_allocator_type::const_pointer const_pointer;
107
108 typedef typename Allocator::template rebind<
109 typename node<Value, Parameters, Box, allocators, node_weak_static_tag>::type
110 >::other::pointer node_pointer;
111
112 typedef typename Allocator::template rebind<
113 typename internal_node<Value, Parameters, Box, allocators, node_weak_static_tag>::type
114 >::other internal_node_allocator_type;
115
116 typedef typename Allocator::template rebind<
117 typename leaf<Value, Parameters, Box, allocators, node_weak_static_tag>::type
118 >::other leaf_allocator_type;
119
120 inline allocators()
121 : internal_node_allocator_type()
122 , leaf_allocator_type()
123 {}
124
125 template <typename Alloc>
126 inline explicit allocators(Alloc const& alloc)
127 : internal_node_allocator_type(alloc)
128 , leaf_allocator_type(alloc)
129 {}
130
131 inline allocators(BOOST_FWD_REF(allocators) a)
132 : internal_node_allocator_type(boost::move(a.internal_node_allocator()))
133 , leaf_allocator_type(boost::move(a.leaf_allocator()))
134 {}
135
136 inline allocators & operator=(BOOST_FWD_REF(allocators) a)
137 {
138 internal_node_allocator() = ::boost::move(a.internal_node_allocator());
139 leaf_allocator() = ::boost::move(a.leaf_allocator());
140 return *this;
141 }
142
143#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
144 inline allocators & operator=(allocators const& a)
145 {
146 internal_node_allocator() = a.internal_node_allocator();
147 leaf_allocator() = a.leaf_allocator();
148 return *this;
149 }
150#endif
151
152 void swap(allocators & a)
153 {
154 boost::swap(internal_node_allocator(), a.internal_node_allocator());
155 boost::swap(leaf_allocator(), a.leaf_allocator());
156 }
157
158 bool operator==(allocators const& a) const { return leaf_allocator() == a.leaf_allocator(); }
159 template <typename Alloc>
160 bool operator==(Alloc const& a) const { return leaf_allocator() == leaf_allocator_type(a); }
161
162 Allocator allocator() const { return Allocator(leaf_allocator()); }
163
164 internal_node_allocator_type & internal_node_allocator() { return *this; }
165 internal_node_allocator_type const& internal_node_allocator() const { return *this; }
166 leaf_allocator_type & leaf_allocator() { return *this; }
167 leaf_allocator_type const& leaf_allocator() const{ return *this; }
168};
169
170}} // namespace detail::rtree
171
172}}} // namespace boost::geometry::index
173
174#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_WEAK_STATIC_HPP