Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:29

0001 // Boost.Geometry Index
0002 //
0003 // R-tree nodes weak visitor and nodes base type
0004 //
0005 // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland.
0006 //
0007 // This file was modified by Oracle on 2021.
0008 // Modifications copyright (c) 2021 Oracle and/or its affiliates.
0009 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0010 //
0011 // Use, modification and distribution is subject to the Boost Software License,
0012 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0013 // http://www.boost.org/LICENSE_1_0.txt)
0014 
0015 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_WEAK_VISITOR_HPP
0016 #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_WEAK_VISITOR_HPP
0017 
0018 #include <boost/geometry/index/detail/assert.hpp>
0019 
0020 namespace boost { namespace geometry { namespace index {
0021 
0022 namespace detail { namespace rtree {
0023 
0024 // empty visitor
0025 template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, bool IsVisitableConst>
0026 struct weak_visitor {};
0027 
0028 // node
0029 
0030 template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
0031 struct weak_node {};
0032 
0033 // nodes variants forward declarations
0034 
0035 template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
0036 struct weak_internal_node;
0037 
0038 template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
0039 struct weak_leaf;
0040 
0041 // nodes conversion
0042 
0043 template <typename Derived, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
0044 inline Derived & get(weak_node<Value, Parameters, Box, Allocators, Tag> & n)
0045 {
0046     return static_cast<Derived&>(n);
0047 }
0048 
0049 // apply visitor
0050 
0051 template <typename Visitor, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
0052 inline void apply_visitor(Visitor & v,
0053                           weak_node<Value, Parameters, Box, Allocators, Tag> & n,
0054                           bool is_internal_node)
0055 {
0056     BOOST_GEOMETRY_INDEX_ASSERT(&n, "null ptr");
0057     if ( is_internal_node )
0058     {
0059         typedef weak_internal_node<Value, Parameters, Box, Allocators, Tag> internal_node;
0060         v(get<internal_node>(n));
0061     }
0062     else
0063     {
0064         typedef weak_leaf<Value, Parameters, Box, Allocators, Tag> leaf;
0065         v(get<leaf>(n));
0066     }
0067 }
0068 
0069 }} // namespace detail::rtree
0070 
0071 }}} // namespace boost::geometry::index
0072 
0073 #endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_DYNAMIC_VISITOR_HPP