]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/index/detail/rtree/visitors/children_box.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / geometry / index / detail / rtree / visitors / children_box.hpp
1 // Boost.Geometry Index
2 //
3 // R-tree node children box calculating visitor implementation
4 //
5 // Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland.
6 //
7 // This file was modified by Oracle on 2019.
8 // Modifications copyright (c) 2019 Oracle and/or its affiliates.
9 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
10 //
11 // Use, modification and distribution is subject to the Boost Software License,
12 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
13 // http://www.boost.org/LICENSE_1_0.txt)
14
15 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_CHILDREN_BOX_HPP
16 #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_CHILDREN_BOX_HPP
17
18 namespace boost { namespace geometry { namespace index {
19
20 namespace detail { namespace rtree { namespace visitors {
21
22 template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
23 class children_box
24 : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
25 {
26 typedef typename Options::parameters_type parameters_type;
27
28 typedef typename rtree::internal_node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
29 typedef typename rtree::leaf<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
30
31 public:
32 inline children_box(Box & result, parameters_type const& parameters, Translator const& tr)
33 : m_result(result), m_parameters(parameters), m_tr(tr)
34 {}
35
36 inline void operator()(internal_node const& n)
37 {
38 typedef typename rtree::elements_type<internal_node>::type elements_type;
39 elements_type const& elements = rtree::elements(n);
40
41 m_result = rtree::elements_box<Box>(elements.begin(), elements.end(), m_tr,
42 index::detail::get_strategy(m_parameters));
43 }
44
45 inline void operator()(leaf const& n)
46 {
47 typedef typename rtree::elements_type<leaf>::type elements_type;
48 elements_type const& elements = rtree::elements(n);
49
50 m_result = rtree::values_box<Box>(elements.begin(), elements.end(), m_tr,
51 index::detail::get_strategy(m_parameters));
52 }
53
54 private:
55 Box & m_result;
56 parameters_type const& m_parameters;
57 Translator const& m_tr;
58 };
59
60 }}} // namespace detail::rtree::visitors
61
62 }}} // namespace boost::geometry::index
63
64 #endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_CHILDREN_BOX_HPP