From 8e4bc68ed51750d238fcbf0197e29deaf50bbebf Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 5 Oct 2014 16:19:18 +0200 Subject: [PATCH] [index] Rename "static" nodes to "variant" nodes (it is more clear). --- .../geometry/index/detail/rtree/node/node.hpp | 6 +- ..._s_mem_dynamic.hpp => variant_dynamic.hpp} | 77 +++++++++---------- ...de_s_mem_static.hpp => variant_static.hpp} | 60 +++++++-------- ...static_visitor.hpp => variant_visitor.hpp} | 24 +++--- .../geometry/index/detail/rtree/options.hpp | 22 +++--- 5 files changed, 94 insertions(+), 95 deletions(-) rename include/boost/geometry/index/detail/rtree/node/{node_s_mem_dynamic.hpp => variant_dynamic.hpp} (71%) rename include/boost/geometry/index/detail/rtree/node/{node_s_mem_static.hpp => variant_static.hpp} (65%) rename include/boost/geometry/index/detail/rtree/node/{static_visitor.hpp => variant_visitor.hpp} (64%) diff --git a/include/boost/geometry/index/detail/rtree/node/node.hpp b/include/boost/geometry/index/detail/rtree/node/node.hpp index bc6a37baf..2b53efd53 100644 --- a/include/boost/geometry/index/detail/rtree/node/node.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node.hpp @@ -23,9 +23,9 @@ //#include //#include -#include -#include -#include +#include +#include +#include #include diff --git a/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/variant_dynamic.hpp similarity index 71% rename from include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp rename to include/boost/geometry/index/detail/rtree/node/variant_dynamic.hpp index ce55721bc..f13dd1036 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/variant_dynamic.hpp @@ -1,15 +1,15 @@ // Boost.Geometry Index // -// R-tree nodes based on Boost.Variant, storing std::vectors +// R-tree nodes based on Boost.Variant, storing dynamic-size containers // -// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP -#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_DYNAMIC_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_DYNAMIC_HPP namespace boost { namespace geometry { namespace index { @@ -18,7 +18,7 @@ namespace detail { namespace rtree { // nodes default types template -struct static_internal_node +struct variant_internal_node { typedef boost::container::vector < @@ -30,7 +30,7 @@ struct static_internal_node > elements_type; template - inline static_internal_node(Al const& al) + inline variant_internal_node(Al const& al) : elements(al) {} @@ -38,7 +38,7 @@ struct static_internal_node }; template -struct static_leaf +struct variant_leaf { typedef boost::container::vector < @@ -50,7 +50,7 @@ struct static_leaf > elements_type; template - inline static_leaf(Al const& al) + inline variant_leaf(Al const& al) : elements(al) {} @@ -60,30 +60,30 @@ struct static_leaf // nodes traits template -struct node +struct node { typedef boost::variant< - static_leaf, - static_internal_node + variant_leaf, + variant_internal_node > type; }; template -struct internal_node +struct internal_node { - typedef static_internal_node type; + typedef variant_internal_node type; }; template -struct leaf +struct leaf { - typedef static_leaf type; + typedef variant_leaf type; }; // visitor traits template -struct visitor +struct visitor { typedef static_visitor<> type; }; @@ -91,9 +91,12 @@ struct visitor -class allocators +class allocators : public Allocator::template rebind< - typename node, node_s_mem_dynamic_tag>::type + typename node< + Value, Parameters, Box, + allocators, + node_variant_dynamic_tag>::type >::other { typedef typename Allocator::template rebind< @@ -112,15 +115,11 @@ public: typedef typename value_allocator_type::const_pointer const_pointer; typedef typename Allocator::template rebind< - typename node::type + typename node::type >::other::pointer node_pointer; -// typedef typename Allocator::template rebind< -// typename internal_node::type -// >::other::pointer internal_node_pointer; - typedef typename Allocator::template rebind< - typename node::type + typename node::type >::other node_allocator_type; inline allocators() @@ -168,7 +167,7 @@ public: // create_node_variant template -struct create_static_node +struct create_variant_node { template static inline VariantPtr apply(AllocNode & alloc_node) @@ -193,7 +192,7 @@ struct create_static_node // destroy_node_variant template -struct destroy_static_node +struct destroy_variant_node { template static inline void apply(AllocNode & alloc_node, VariantPtr n) @@ -210,15 +209,15 @@ struct destroy_static_node template struct create_node< Allocators, - static_internal_node + variant_internal_node > { static inline typename Allocators::node_pointer apply(Allocators & allocators) { - return create_static_node< + return create_variant_node< typename Allocators::node_pointer, - static_internal_node + variant_internal_node >::apply(allocators.node_allocator()); } }; @@ -226,15 +225,15 @@ struct create_node< template struct create_node< Allocators, - static_leaf + variant_leaf > { static inline typename Allocators::node_pointer apply(Allocators & allocators) { - return create_static_node< + return create_variant_node< typename Allocators::node_pointer, - static_leaf + variant_leaf >::apply(allocators.node_allocator()); } }; @@ -244,13 +243,13 @@ struct create_node< template struct destroy_node< Allocators, - static_internal_node + variant_internal_node > { static inline void apply(Allocators & allocators, typename Allocators::node_pointer n) { - destroy_static_node< - static_internal_node + destroy_variant_node< + variant_internal_node >::apply(allocators.node_allocator(), n); } }; @@ -258,13 +257,13 @@ struct destroy_node< template struct destroy_node< Allocators, - static_leaf + variant_leaf > { static inline void apply(Allocators & allocators, typename Allocators::node_pointer n) { - destroy_static_node< - static_leaf + destroy_variant_node< + variant_leaf >::apply(allocators.node_allocator(), n); } }; @@ -273,4 +272,4 @@ struct destroy_node< }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_DYNAMIC_HPP diff --git a/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp b/include/boost/geometry/index/detail/rtree/node/variant_static.hpp similarity index 65% rename from include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp rename to include/boost/geometry/index/detail/rtree/node/variant_static.hpp index 4abb95549..f6e9761b2 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/variant_static.hpp @@ -2,14 +2,14 @@ // // R-tree nodes based on Boost.Variant, storing static-size containers // -// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP -#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_STATIC_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_STATIC_HPP namespace boost { namespace geometry { namespace index { @@ -18,7 +18,7 @@ namespace detail { namespace rtree { // nodes default types template -struct static_internal_node +struct variant_internal_node { typedef detail::varray< rtree::ptr_pair, @@ -26,13 +26,13 @@ struct static_internal_node elements_type; template - inline static_internal_node(Alloc const&) {} + inline variant_internal_node(Alloc const&) {} elements_type elements; }; template -struct static_leaf +struct variant_leaf { typedef detail::varray< Value, @@ -40,7 +40,7 @@ struct static_leaf > elements_type; template - inline static_leaf(Alloc const&) {} + inline variant_leaf(Alloc const&) {} elements_type elements; }; @@ -48,30 +48,30 @@ struct static_leaf // nodes traits template -struct node +struct node { typedef boost::variant< - static_leaf, - static_internal_node + variant_leaf, + variant_internal_node > type; }; template -struct internal_node +struct internal_node { - typedef static_internal_node type; + typedef variant_internal_node type; }; template -struct leaf +struct leaf { - typedef static_leaf type; + typedef variant_leaf type; }; // visitor traits template -struct visitor +struct visitor { typedef static_visitor<> type; }; @@ -79,9 +79,13 @@ struct visitor -struct allocators +struct allocators : public Allocator::template rebind< - typename node, node_s_mem_static_tag>::type + typename node< + Value, Parameters, Box, + allocators, + node_variant_static_tag + >::type >::other { typedef typename Allocator::template rebind< @@ -100,15 +104,11 @@ public: typedef typename value_allocator_type::const_pointer const_pointer; typedef typename Allocator::template rebind< - typename node::type + typename node::type >::other::pointer node_pointer; -// typedef typename Allocator::template rebind< -// typename internal_node::type -// >::other::pointer internal_node_pointer; - typedef typename Allocator::template rebind< - typename node::type + typename node::type >::other node_allocator_type; inline allocators() @@ -158,15 +158,15 @@ public: template struct create_node< Allocators, - static_internal_node + variant_internal_node > { static inline typename Allocators::node_pointer apply(Allocators & allocators) { - return create_static_node< + return create_variant_node< typename Allocators::node_pointer, - static_internal_node + variant_internal_node >::apply(allocators.node_allocator()); } }; @@ -174,15 +174,15 @@ struct create_node< template struct create_node< Allocators, - static_leaf + variant_leaf > { static inline typename Allocators::node_pointer apply(Allocators & allocators) { - return create_static_node< + return create_variant_node< typename Allocators::node_pointer, - static_leaf + variant_leaf >::apply(allocators.node_allocator()); } }; @@ -191,4 +191,4 @@ struct create_node< }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_STATIC_HPP diff --git a/include/boost/geometry/index/detail/rtree/node/static_visitor.hpp b/include/boost/geometry/index/detail/rtree/node/variant_visitor.hpp similarity index 64% rename from include/boost/geometry/index/detail/rtree/node/static_visitor.hpp rename to include/boost/geometry/index/detail/rtree/node/variant_visitor.hpp index 9b74b1e41..ffd67039d 100644 --- a/include/boost/geometry/index/detail/rtree/node/static_visitor.hpp +++ b/include/boost/geometry/index/detail/rtree/node/variant_visitor.hpp @@ -2,14 +2,14 @@ // // R-tree nodes static visitor related code // -// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_STATIC_VISITOR_HPP -#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_STATIC_VISITOR_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_VISITOR_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_VISITOR_HPP #include @@ -20,18 +20,18 @@ namespace detail { namespace rtree { // nodes variants forward declarations template -struct static_internal_node; +struct variant_internal_node; template -struct static_leaf; +struct variant_leaf; // nodes conversion template inline V & get( boost::variant< - static_leaf, - static_internal_node + variant_leaf, + variant_internal_node > & v) { return boost::get(v); @@ -42,8 +42,8 @@ inline V & get( template inline void apply_visitor(Visitor & v, boost::variant< - static_leaf, - static_internal_node + variant_leaf, + variant_internal_node > & n) { boost::apply_visitor(v, n); @@ -52,8 +52,8 @@ inline void apply_visitor(Visitor & v, template inline void apply_visitor(Visitor & v, boost::variant< - static_leaf, - static_internal_node + variant_leaf, + variant_internal_node > const& n) { boost::apply_visitor(v, n); @@ -63,4 +63,4 @@ inline void apply_visitor(Visitor & v, }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_STATIC_VISITOR_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_VISITOR_HPP diff --git a/include/boost/geometry/index/detail/rtree/options.hpp b/include/boost/geometry/index/detail/rtree/options.hpp index 5070fed70..ff772834d 100644 --- a/include/boost/geometry/index/detail/rtree/options.hpp +++ b/include/boost/geometry/index/detail/rtree/options.hpp @@ -35,10 +35,10 @@ struct quadratic_tag {}; struct rstar_tag {}; // NodeTag -struct node_weak_dynamic_tag {}; -struct node_weak_static_tag {}; -struct node_s_mem_dynamic_tag {}; -struct node_s_mem_static_tag {}; +struct node_variant_dynamic_tag {}; +struct node_variant_static_tag {}; +//struct node_weak_dynamic_tag {}; +//struct node_weak_static_tag {}; template struct options @@ -66,7 +66,7 @@ struct options_type< index::linear > choose_by_content_diff_tag, split_default_tag, linear_tag, - node_s_mem_static_tag + node_variant_static_tag > type; }; @@ -79,7 +79,7 @@ struct options_type< index::quadratic > choose_by_content_diff_tag, split_default_tag, quadratic_tag, - node_s_mem_static_tag + node_variant_static_tag > type; }; @@ -92,7 +92,7 @@ struct options_type< index::rstar type; }; @@ -105,7 +105,7 @@ struct options_type< index::rstar type; //}; @@ -118,7 +118,7 @@ struct options_type< index::dynamic_linear > choose_by_content_diff_tag, split_default_tag, linear_tag, - node_s_mem_dynamic_tag + node_variant_dynamic_tag > type; }; @@ -131,7 +131,7 @@ struct options_type< index::dynamic_quadratic > choose_by_content_diff_tag, split_default_tag, quadratic_tag, - node_s_mem_dynamic_tag + node_variant_dynamic_tag > type; }; @@ -144,7 +144,7 @@ struct options_type< index::dynamic_rstar > choose_by_overlap_diff_tag, split_default_tag, rstar_tag, - node_s_mem_dynamic_tag + node_variant_dynamic_tag > type; };