]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/index/detail/rtree/node/weak_visitor.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / geometry / index / detail / rtree / node / weak_visitor.hpp
1 // Boost.Geometry Index
2 //
3 // R-tree nodes weak visitor and nodes base type
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_VISITOR_HPP
12 #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_WEAK_VISITOR_HPP
13
14 namespace boost { namespace geometry { namespace index {
15
16 namespace detail { namespace rtree {
17
18 // empty visitor
19 template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, bool IsVisitableConst>
20 struct weak_visitor {};
21
22 // node
23
24 template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
25 struct weak_node {};
26
27 // nodes variants forward declarations
28
29 template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
30 struct weak_internal_node;
31
32 template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
33 struct weak_leaf;
34
35 // nodes conversion
36
37 template <typename Derived, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
38 inline Derived & get(weak_node<Value, Parameters, Box, Allocators, Tag> & n)
39 {
40 return static_cast<Derived&>(n);
41 }
42
43 // apply visitor
44
45 template <typename Visitor, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
46 inline void apply_visitor(Visitor & v,
47 weak_node<Value, Parameters, Box, Allocators, Tag> & n,
48 bool is_internal_node)
49 {
50 BOOST_GEOMETRY_INDEX_ASSERT(&n, "null ptr");
51 if ( is_internal_node )
52 {
53 typedef weak_internal_node<Value, Parameters, Box, Allocators, Tag> internal_node;
54 v(get<internal_node>(n));
55 }
56 else
57 {
58 typedef weak_leaf<Value, Parameters, Box, Allocators, Tag> leaf;
59 v(get<leaf>(n));
60 }
61 }
62
63 }} // namespace detail::rtree
64
65 }}} // namespace boost::geometry::index
66
67 #endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_DYNAMIC_VISITOR_HPP