[index] Rename "static" nodes to "variant" nodes (it is more clear).

This commit is contained in:
Adam Wulkiewicz
2014-10-05 16:19:18 +02:00
parent 9d7ed2962e
commit 8e4bc68ed5
5 changed files with 94 additions and 95 deletions

View File

@@ -23,9 +23,9 @@
//#include <boost/geometry/index/detail/rtree/node/weak_dynamic.hpp>
//#include <boost/geometry/index/detail/rtree/node/weak_static.hpp>
#include <boost/geometry/index/detail/rtree/node/static_visitor.hpp>
#include <boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp>
#include <boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp>
#include <boost/geometry/index/detail/rtree/node/variant_visitor.hpp>
#include <boost/geometry/index/detail/rtree/node/variant_dynamic.hpp>
#include <boost/geometry/index/detail/rtree/node/variant_static.hpp>
#include <boost/geometry/index/detail/rtree/node/node_auto_ptr.hpp>

View File

@@ -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 <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
struct static_internal_node
struct variant_internal_node
{
typedef boost::container::vector
<
@@ -30,7 +30,7 @@ struct static_internal_node
> elements_type;
template <typename Al>
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 <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
struct static_leaf
struct variant_leaf
{
typedef boost::container::vector
<
@@ -50,7 +50,7 @@ struct static_leaf
> elements_type;
template <typename Al>
inline static_leaf(Al const& al)
inline variant_leaf(Al const& al)
: elements(al)
{}
@@ -60,30 +60,30 @@ struct static_leaf
// nodes traits
template <typename Value, typename Parameters, typename Box, typename Allocators>
struct node<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>
struct node<Value, Parameters, Box, Allocators, node_variant_dynamic_tag>
{
typedef boost::variant<
static_leaf<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>,
static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>
variant_leaf<Value, Parameters, Box, Allocators, node_variant_dynamic_tag>,
variant_internal_node<Value, Parameters, Box, Allocators, node_variant_dynamic_tag>
> type;
};
template <typename Value, typename Parameters, typename Box, typename Allocators>
struct internal_node<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>
struct internal_node<Value, Parameters, Box, Allocators, node_variant_dynamic_tag>
{
typedef static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag> type;
typedef variant_internal_node<Value, Parameters, Box, Allocators, node_variant_dynamic_tag> type;
};
template <typename Value, typename Parameters, typename Box, typename Allocators>
struct leaf<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>
struct leaf<Value, Parameters, Box, Allocators, node_variant_dynamic_tag>
{
typedef static_leaf<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag> type;
typedef variant_leaf<Value, Parameters, Box, Allocators, node_variant_dynamic_tag> type;
};
// visitor traits
template <typename Value, typename Parameters, typename Box, typename Allocators, bool IsVisitableConst>
struct visitor<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag, IsVisitableConst>
struct visitor<Value, Parameters, Box, Allocators, node_variant_dynamic_tag, IsVisitableConst>
{
typedef static_visitor<> type;
};
@@ -91,9 +91,12 @@ struct visitor<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag, IsVis
// allocators
template <typename Allocator, typename Value, typename Parameters, typename Box>
class allocators<Allocator, Value, Parameters, Box, node_s_mem_dynamic_tag>
class allocators<Allocator, Value, Parameters, Box, node_variant_dynamic_tag>
: public Allocator::template rebind<
typename node<Value, Parameters, Box, allocators<Allocator, Value, Parameters, Box, node_s_mem_dynamic_tag>, node_s_mem_dynamic_tag>::type
typename node<
Value, Parameters, Box,
allocators<Allocator, Value, Parameters, Box, node_variant_dynamic_tag>,
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<Value, Parameters, Box, allocators, node_s_mem_dynamic_tag>::type
typename node<Value, Parameters, Box, allocators, node_variant_dynamic_tag>::type
>::other::pointer node_pointer;
// typedef typename Allocator::template rebind<
// typename internal_node<Value, Parameters, Box, allocators, node_s_mem_dynamic_tag>::type
// >::other::pointer internal_node_pointer;
typedef typename Allocator::template rebind<
typename node<Value, Parameters, Box, allocators, node_s_mem_dynamic_tag>::type
typename node<Value, Parameters, Box, allocators, node_variant_dynamic_tag>::type
>::other node_allocator_type;
inline allocators()
@@ -168,7 +167,7 @@ public:
// create_node_variant
template <typename VariantPtr, typename Node>
struct create_static_node
struct create_variant_node
{
template <typename AllocNode>
static inline VariantPtr apply(AllocNode & alloc_node)
@@ -193,7 +192,7 @@ struct create_static_node
// destroy_node_variant
template <typename Node>
struct destroy_static_node
struct destroy_variant_node
{
template <typename AllocNode, typename VariantPtr>
static inline void apply(AllocNode & alloc_node, VariantPtr n)
@@ -210,15 +209,15 @@ struct destroy_static_node
template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
struct create_node<
Allocators,
static_internal_node<Value, Parameters, Box, Allocators, Tag>
variant_internal_node<Value, Parameters, Box, Allocators, Tag>
>
{
static inline typename Allocators::node_pointer
apply(Allocators & allocators)
{
return create_static_node<
return create_variant_node<
typename Allocators::node_pointer,
static_internal_node<Value, Parameters, Box, Allocators, Tag>
variant_internal_node<Value, Parameters, Box, Allocators, Tag>
>::apply(allocators.node_allocator());
}
};
@@ -226,15 +225,15 @@ struct create_node<
template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
struct create_node<
Allocators,
static_leaf<Value, Parameters, Box, Allocators, Tag>
variant_leaf<Value, Parameters, Box, Allocators, Tag>
>
{
static inline typename Allocators::node_pointer
apply(Allocators & allocators)
{
return create_static_node<
return create_variant_node<
typename Allocators::node_pointer,
static_leaf<Value, Parameters, Box, Allocators, Tag>
variant_leaf<Value, Parameters, Box, Allocators, Tag>
>::apply(allocators.node_allocator());
}
};
@@ -244,13 +243,13 @@ struct create_node<
template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
struct destroy_node<
Allocators,
static_internal_node<Value, Parameters, Box, Allocators, Tag>
variant_internal_node<Value, Parameters, Box, Allocators, Tag>
>
{
static inline void apply(Allocators & allocators, typename Allocators::node_pointer n)
{
destroy_static_node<
static_internal_node<Value, Parameters, Box, Allocators, Tag>
destroy_variant_node<
variant_internal_node<Value, Parameters, Box, Allocators, Tag>
>::apply(allocators.node_allocator(), n);
}
};
@@ -258,13 +257,13 @@ struct destroy_node<
template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
struct destroy_node<
Allocators,
static_leaf<Value, Parameters, Box, Allocators, Tag>
variant_leaf<Value, Parameters, Box, Allocators, Tag>
>
{
static inline void apply(Allocators & allocators, typename Allocators::node_pointer n)
{
destroy_static_node<
static_leaf<Value, Parameters, Box, Allocators, Tag>
destroy_variant_node<
variant_leaf<Value, Parameters, Box, Allocators, Tag>
>::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

View File

@@ -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 <typename Value, typename Parameters, typename Box, typename Allocators>
struct static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
struct variant_internal_node<Value, Parameters, Box, Allocators, node_variant_static_tag>
{
typedef detail::varray<
rtree::ptr_pair<Box, typename Allocators::node_pointer>,
@@ -26,13 +26,13 @@ struct static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_stati
> elements_type;
template <typename Alloc>
inline static_internal_node(Alloc const&) {}
inline variant_internal_node(Alloc const&) {}
elements_type elements;
};
template <typename Value, typename Parameters, typename Box, typename Allocators>
struct static_leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
struct variant_leaf<Value, Parameters, Box, Allocators, node_variant_static_tag>
{
typedef detail::varray<
Value,
@@ -40,7 +40,7 @@ struct static_leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
> elements_type;
template <typename Alloc>
inline static_leaf(Alloc const&) {}
inline variant_leaf(Alloc const&) {}
elements_type elements;
};
@@ -48,30 +48,30 @@ struct static_leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
// nodes traits
template <typename Value, typename Parameters, typename Box, typename Allocators>
struct node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
struct node<Value, Parameters, Box, Allocators, node_variant_static_tag>
{
typedef boost::variant<
static_leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag>,
static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
variant_leaf<Value, Parameters, Box, Allocators, node_variant_static_tag>,
variant_internal_node<Value, Parameters, Box, Allocators, node_variant_static_tag>
> type;
};
template <typename Value, typename Parameters, typename Box, typename Allocators>
struct internal_node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
struct internal_node<Value, Parameters, Box, Allocators, node_variant_static_tag>
{
typedef static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_static_tag> type;
typedef variant_internal_node<Value, Parameters, Box, Allocators, node_variant_static_tag> type;
};
template <typename Value, typename Parameters, typename Box, typename Allocators>
struct leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
struct leaf<Value, Parameters, Box, Allocators, node_variant_static_tag>
{
typedef static_leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag> type;
typedef variant_leaf<Value, Parameters, Box, Allocators, node_variant_static_tag> type;
};
// visitor traits
template <typename Value, typename Parameters, typename Box, typename Allocators, bool IsVisitableConst>
struct visitor<Value, Parameters, Box, Allocators, node_s_mem_static_tag, IsVisitableConst>
struct visitor<Value, Parameters, Box, Allocators, node_variant_static_tag, IsVisitableConst>
{
typedef static_visitor<> type;
};
@@ -79,9 +79,13 @@ struct visitor<Value, Parameters, Box, Allocators, node_s_mem_static_tag, IsVisi
// allocators
template <typename Allocator, typename Value, typename Parameters, typename Box>
struct allocators<Allocator, Value, Parameters, Box, node_s_mem_static_tag>
struct allocators<Allocator, Value, Parameters, Box, node_variant_static_tag>
: public Allocator::template rebind<
typename node<Value, Parameters, Box, allocators<Allocator, Value, Parameters, Box, node_s_mem_static_tag>, node_s_mem_static_tag>::type
typename node<
Value, Parameters, Box,
allocators<Allocator, Value, Parameters, Box, node_variant_static_tag>,
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<Value, Parameters, Box, allocators, node_s_mem_static_tag>::type
typename node<Value, Parameters, Box, allocators, node_variant_static_tag>::type
>::other::pointer node_pointer;
// typedef typename Allocator::template rebind<
// typename internal_node<Value, Parameters, Box, allocators, node_s_mem_static_tag>::type
// >::other::pointer internal_node_pointer;
typedef typename Allocator::template rebind<
typename node<Value, Parameters, Box, allocators, node_s_mem_static_tag>::type
typename node<Value, Parameters, Box, allocators, node_variant_static_tag>::type
>::other node_allocator_type;
inline allocators()
@@ -158,15 +158,15 @@ public:
template <typename Allocators, typename Value, typename Parameters, typename Box>
struct create_node<
Allocators,
static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
variant_internal_node<Value, Parameters, Box, Allocators, node_variant_static_tag>
>
{
static inline typename Allocators::node_pointer
apply(Allocators & allocators)
{
return create_static_node<
return create_variant_node<
typename Allocators::node_pointer,
static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
variant_internal_node<Value, Parameters, Box, Allocators, node_variant_static_tag>
>::apply(allocators.node_allocator());
}
};
@@ -174,15 +174,15 @@ struct create_node<
template <typename Allocators, typename Value, typename Parameters, typename Box>
struct create_node<
Allocators,
static_leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
variant_leaf<Value, Parameters, Box, Allocators, node_variant_static_tag>
>
{
static inline typename Allocators::node_pointer
apply(Allocators & allocators)
{
return create_static_node<
return create_variant_node<
typename Allocators::node_pointer,
static_leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
variant_leaf<Value, Parameters, Box, Allocators, node_variant_static_tag>
>::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

View File

@@ -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 <boost/variant.hpp>
@@ -20,18 +20,18 @@ namespace detail { namespace rtree {
// nodes variants forward declarations
template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
struct static_internal_node;
struct variant_internal_node;
template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
struct static_leaf;
struct variant_leaf;
// nodes conversion
template <typename V, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
inline V & get(
boost::variant<
static_leaf<Value, Parameters, Box, Allocators, Tag>,
static_internal_node<Value, Parameters, Box, Allocators, Tag>
variant_leaf<Value, Parameters, Box, Allocators, Tag>,
variant_internal_node<Value, Parameters, Box, Allocators, Tag>
> & v)
{
return boost::get<V>(v);
@@ -42,8 +42,8 @@ inline V & get(
template <typename Visitor, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
inline void apply_visitor(Visitor & v,
boost::variant<
static_leaf<Value, Parameters, Box, Allocators, Tag>,
static_internal_node<Value, Parameters, Box, Allocators, Tag>
variant_leaf<Value, Parameters, Box, Allocators, Tag>,
variant_internal_node<Value, Parameters, Box, Allocators, Tag>
> & n)
{
boost::apply_visitor(v, n);
@@ -52,8 +52,8 @@ inline void apply_visitor(Visitor & v,
template <typename Visitor, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
inline void apply_visitor(Visitor & v,
boost::variant<
static_leaf<Value, Parameters, Box, Allocators, Tag>,
static_internal_node<Value, Parameters, Box, Allocators, Tag>
variant_leaf<Value, Parameters, Box, Allocators, Tag>,
variant_internal_node<Value, Parameters, Box, Allocators, Tag>
> 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

View File

@@ -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 <typename Parameters, typename InsertTag, typename ChooseNextNodeTag, typename SplitTag, typename RedistributeTag, typename NodeTag>
struct options
@@ -66,7 +66,7 @@ struct options_type< index::linear<MaxElements, MinElements> >
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<MaxElements, MinElements> >
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<MaxElements, MinElements, OverlapCostThreshold
choose_by_overlap_diff_tag,
split_default_tag,
rstar_tag,
node_s_mem_static_tag
node_variant_static_tag
> type;
};
@@ -105,7 +105,7 @@ struct options_type< index::rstar<MaxElements, MinElements, OverlapCostThreshold
// choose_by_content_diff_tag, // change it?
// split_kmeans_tag,
// int, // dummy tag - not used for now
// node_s_mem_static_tag
// node_variant_static_tag
// > 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;
};