Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80779 - in sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree: . node
From: adam.wulkiewicz_at_[hidden]
Date: 2012-09-30 08:12:37


Author: awulkiew
Date: 2012-09-30 08:12:34 EDT (Sun, 30 Sep 2012)
New Revision: 80779
URL: http://svn.boost.org/trac/boost/changeset/80779

Log:
dynamic_visitor added and nodes tags changed.
Added:
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/concept.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp (contents, props changed)
Removed:
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default.hpp
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default_static.hpp
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp
Text files modified:
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node.hpp | 10 ++++++----
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/options.hpp | 22 +++++++++++-----------
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rtree.hpp | 2 +-
   3 files changed, 18 insertions(+), 16 deletions(-)

Added: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/concept.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/concept.hpp 2012-09-30 08:12:34 EDT (Sun, 30 Sep 2012)
@@ -0,0 +1,85 @@
+// Boost.Geometry Index
+//
+// R-tree node concept
+//
+// Copyright (c) 2011-2012 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_EXTENSIONS_INDEX_RTREE_NODE_CONCEPT_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_CONCEPT_HPP
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct node
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE,
+ (node));
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct internal_node
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE,
+ (internal_node));
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct leaf
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE,
+ (leaf));
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, bool IsVisitableConst>
+struct visitor
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE,
+ (visitor));
+};
+
+template <typename Allocator, typename Value, typename Parameters, typename Box, typename Tag>
+struct allocators
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE,
+ (allocators));
+};
+
+template <typename Allocators, typename Node>
+struct create_node
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_NODE_TYPE,
+ (create_node));
+};
+
+template <typename Allocators, typename Node>
+struct destroy_node
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_NODE_TYPE,
+ (destroy_node));
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_CONCEPT_HPP

Added: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp 2012-09-30 08:12:34 EDT (Sun, 30 Sep 2012)
@@ -0,0 +1,70 @@
+// Boost.Geometry Index
+//
+// R-tree nodes dynamic visitor and nodes base type
+//
+// Copyright (c) 2011-2012 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_EXTENSIONS_INDEX_RTREE_NODE_DYNAMIC_VISITOR_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_DYNAMIC_VISITOR_HPP
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+// visitor forward declaration
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, bool IsVisitableConst>
+struct dynamic_visitor;
+
+// node
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct dynamic_node
+{
+ virtual ~dynamic_node() {}
+ virtual void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, Tag, false> &) = 0;
+ virtual void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, Tag, true> &) const = 0;
+};
+
+// nodes variants forward declarations
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct dynamic_internal_node;
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct dynamic_leaf;
+
+// visitor
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct dynamic_visitor<Value, Parameters, Box, Allocators, Tag, true>
+{
+ typedef dynamic_internal_node<Value, Parameters, Box, Allocators, Tag> internal_node;
+ typedef dynamic_leaf<Value, Parameters, Box, Allocators, Tag> leaf;
+
+ virtual ~dynamic_visitor() {}
+
+ virtual void operator()(internal_node const&) = 0;
+ virtual void operator()(leaf const&) = 0;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct dynamic_visitor<Value, Parameters, Box, Allocators, Tag, false>
+{
+ typedef dynamic_internal_node<Value, Parameters, Box, Allocators, Tag> internal_node;
+ typedef dynamic_leaf<Value, Parameters, Box, Allocators, Tag> leaf;
+
+ virtual ~dynamic_visitor() {}
+
+ virtual void operator()(internal_node &) = 0;
+ virtual void operator()(leaf &) = 0;
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_DYNAMIC_VISITOR_HPP

Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node.hpp 2012-09-30 08:12:34 EDT (Sun, 30 Sep 2012)
@@ -11,11 +11,13 @@
 #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP
 #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP
 
-#include <boost/geometry/extensions/index/rtree/node/node_default.hpp>
-#include <boost/geometry/extensions/index/rtree/node/node_default_variant.hpp>
+#include <boost/geometry/extensions/index/rtree/node/concept.hpp>
 
-#include <boost/geometry/extensions/index/rtree/node/node_default_static.hpp>
-#include <boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp>
+#include <boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp>
+#include <boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp>
+
+#include <boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp>
+#include <boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp>
 
 #include <boost/geometry/algorithms/expand.hpp>
 

Added: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp 2012-09-30 08:12:34 EDT (Sun, 30 Sep 2012)
@@ -0,0 +1,324 @@
+// Boost.Geometry Index
+//
+// R-tree nodes based on run-time polymorphism, storing std::vectors
+//
+// Copyright (c) 2011-2012 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_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_HPP
+
+#include <vector>
+
+#include <boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct dynamic_internal_node<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag>
+ : public dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag>
+{
+ typedef std::vector<
+ std::pair<Box, dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag> *>,
+ typename Allocators::internal_node_elements_allocator_type
+ > elements_type;
+
+ inline dynamic_internal_node(typename Allocators::internal_node_elements_allocator_type & al)
+ : elements(al)
+ {}
+
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag, false> & v) { v(*this); }
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag, true> & v) const { v(*this); }
+
+ elements_type elements;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct dynamic_leaf<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag>
+ : public dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag>
+{
+ typedef std::vector<
+ Value,
+ typename Allocators::leaf_elements_allocator_type
+ > elements_type;
+
+ inline dynamic_leaf(typename Allocators::leaf_elements_allocator_type & al)
+ : elements(al)
+ {}
+
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag, false> & v) { v(*this); }
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag, true> & v) const { v(*this); }
+
+ elements_type elements;
+};
+
+// nodes traits
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct node<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag>
+{
+ typedef dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag> type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct internal_node<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag>
+{
+ typedef dynamic_internal_node<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag> type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct leaf<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag>
+{
+ typedef dynamic_leaf<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag> type;
+};
+
+// nodes conversion
+
+template <typename Derived, typename Parameters, typename Value, typename Box, typename Allocators, typename Tag>
+inline Derived & get(dynamic_node<Value, Parameters, Box, Allocators, Tag> & n)
+{
+ assert(dynamic_cast<Derived*>(&n));
+ return static_cast<Derived&>(n);
+}
+
+template <typename Derived, typename Parameters, typename Value, typename Box, typename Allocators, typename Tag>
+inline Derived * get(dynamic_node<Value, Parameters, Box, Allocators, Tag> * n)
+{
+ assert(dynamic_cast<Derived*>(n));
+ return static_cast<Derived*>(n);
+}
+
+// visitor traits
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, bool IsVisitableConst>
+struct visitor<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag, IsVisitableConst>
+{
+ typedef dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag, IsVisitableConst> type;
+};
+
+template <typename Visitor, typename Visitable>
+inline void apply_visitor(Visitor &v, Visitable & n)
+{
+ n.apply_visitor(v);
+}
+
+// element's indexable type
+
+template <typename Value, typename Translator>
+struct element_indexable_type
+{
+ typedef typename translator::indexable_type<Translator>::type type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, typename Translator>
+struct element_indexable_type<
+ std::pair<Box, dynamic_node<Value, Parameters, Box, Allocators, Tag> *>,
+ Translator
+>
+{
+ typedef Box type;
+};
+
+// element's indexable getter
+
+template <typename Value, typename Translator>
+inline typename Translator::result_type
+element_indexable(Value const& el, Translator const& tr)
+{
+ return tr(el);
+}
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, typename Translator>
+inline Box const&
+element_indexable(
+ std::pair< Box, dynamic_node<Value, Parameters, Box, Allocators, Tag> *> const& el,
+ Translator const&)
+{
+ return el.first;
+}
+
+// nodes elements
+
+template <typename Node>
+struct elements_type
+{
+ typedef typename Node::elements_type type;
+};
+
+template <typename Node>
+inline typename elements_type<Node>::type &
+elements(Node & n)
+{
+ return n.elements;
+}
+
+template <typename Node>
+inline typename elements_type<Node>::type const&
+elements(Node const& n)
+{
+ return n.elements;
+}
+
+// elements derived type
+template <typename Elements, typename NewValue>
+struct container_from_elements_type
+{
+ typedef std::vector<NewValue> type;
+};
+
+// allocators
+
+template <typename Allocator, typename Value, typename Parameters, typename Box>
+struct allocators<Allocator, Value, Parameters, Box, node_d_mem_dynamic_tag>
+{
+ typedef Allocator allocator_type;
+ typedef typename allocator_type::size_type size_type;
+
+ typedef typename allocator_type::template rebind<
+ typename internal_node<Value, Parameters, Box, allocators, node_d_mem_dynamic_tag>::type
+ >::other internal_node_allocator_type;
+
+ typedef typename allocator_type::template rebind<
+ typename leaf<Value, Parameters, Box, allocators, node_d_mem_dynamic_tag>::type
+ >::other leaf_allocator_type;
+
+ typedef typename allocator_type::template rebind<
+ std::pair<Box, dynamic_node<Value, Parameters, Box, allocators, node_d_mem_dynamic_tag> *>
+ >::other internal_node_elements_allocator_type;
+
+ typedef typename allocator_type::template rebind<
+ Value
+ >::other leaf_elements_allocator_type;
+
+ inline explicit allocators(Allocator alloc)
+ : allocator(alloc)
+ , internal_node_allocator(allocator)
+ , leaf_allocator(allocator)
+ , internal_node_elements_allocator(allocator)
+ , leaf_elements_allocator(allocator)
+ {}
+
+ allocator_type allocator;
+ internal_node_allocator_type internal_node_allocator;
+ leaf_allocator_type leaf_allocator;
+ internal_node_elements_allocator_type internal_node_elements_allocator;
+ leaf_elements_allocator_type leaf_elements_allocator;
+};
+
+// create_node_impl
+
+template <typename Node>
+struct create_node_poly
+{
+ template <typename RetNode, typename AllocNode, typename AllocElems>
+ static inline RetNode * apply(AllocNode & alloc_node, AllocElems & alloc_elems)
+ {
+ Node * p = alloc_node.allocate(1);
+
+ if ( 0 == p )
+ throw std::bad_alloc();
+
+ try
+ {
+ alloc_node.construct(p, Node(alloc_elems));
+ }
+ catch(...)
+ {
+ alloc_node.deallocate(p, 1);
+ throw;
+ }
+
+ return p;
+ }
+};
+
+// destroy_node_impl
+
+template <typename Node>
+struct destroy_node_poly
+{
+ template <typename AllocNode, typename BaseNode>
+ static inline void apply(AllocNode & alloc_node, BaseNode * n)
+ {
+ Node * p = rtree::get<Node>(n);
+ alloc_node.destroy(p);
+ alloc_node.deallocate(p, 1);
+ }
+};
+
+// create_node
+
+template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
+struct create_node<
+ Allocators,
+ dynamic_internal_node<Value, Parameters, Box, Allocators, Tag>
+>
+{
+ static inline typename node<Value, Parameters, Box, Allocators, Tag>::type *
+ apply(Allocators & allocators)
+ {
+ return create_node_poly<
+ dynamic_internal_node<Value, Parameters, Box, Allocators, Tag>
+ >::template apply<
+ typename node<Value, Parameters, Box, Allocators, Tag>::type
+ >(allocators.internal_node_allocator, allocators.internal_node_elements_allocator);
+ }
+};
+
+template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
+struct create_node<
+ Allocators,
+ dynamic_leaf<Value, Parameters, Box, Allocators, Tag>
+>
+{
+ static inline typename node<Value, Parameters, Box, Allocators, Tag>::type *
+ apply(Allocators & allocators)
+ {
+ return create_node_poly<
+ dynamic_leaf<Value, Parameters, Box, Allocators, Tag>
+ >::template apply<
+ typename node<Value, Parameters, Box, Allocators, Tag>::type
+ >(allocators.leaf_allocator, allocators.leaf_elements_allocator);
+ }
+};
+
+// destroy_node
+
+template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
+struct destroy_node<
+ Allocators,
+ dynamic_internal_node<Value, Parameters, Box, Allocators, Tag>
+>
+{
+ static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Allocators, Tag>::type * n)
+ {
+ destroy_node_poly<
+ dynamic_internal_node<Value, Parameters, Box, Allocators, Tag>
+ >::apply(allocators.internal_node_allocator, n);
+ }
+};
+
+template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
+struct destroy_node<
+ Allocators,
+ dynamic_leaf<Value, Parameters, Box, Allocators, Tag>
+>
+{
+ static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Allocators, Tag>::type * n)
+ {
+ destroy_node_poly<
+ dynamic_leaf<Value, Parameters, Box, Allocators, Tag>
+ >::apply(allocators.leaf_allocator, n);
+ }
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_HPP

Added: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp 2012-09-30 08:12:34 EDT (Sun, 30 Sep 2012)
@@ -0,0 +1,157 @@
+// Boost.Geometry Index
+//
+// R-tree nodes based on runtime-polymorphism, storing static-size containers
+//
+// Copyright (c) 2011-2012 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_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP
+
+#include <boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp>
+#include <boost/geometry/extensions/index/pushable_array.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct dynamic_internal_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+ : public dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+{
+ typedef index::pushable_array<
+ std::pair<
+ Box,
+ dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag> *
+ >,
+ Parameters::max_elements + 1
+ > elements_type;
+
+ template <typename Dummy>
+ inline dynamic_internal_node(Dummy) {}
+
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_static_tag, false> & v) { v(*this); }
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_static_tag, true> & v) const { v(*this); }
+
+ elements_type elements;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct dynamic_leaf<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+ : public dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+{
+ typedef index::pushable_array<Value, Parameters::max_elements + 1> elements_type;
+
+ template <typename Dummy>
+ inline dynamic_leaf(Dummy) {}
+
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_static_tag, false> & v) { v(*this); }
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_static_tag, true> & v) const { v(*this); }
+
+ elements_type elements;
+};
+
+// nodes traits
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+{
+ typedef dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag> type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct internal_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+{
+ typedef dynamic_internal_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag> type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct leaf<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+{
+ typedef dynamic_leaf<Value, Parameters, Box, Allocators, node_d_mem_static_tag> type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, bool IsVisitableConst>
+struct visitor<Value, Parameters, Box, Allocators, node_d_mem_static_tag, IsVisitableConst>
+{
+ typedef dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_static_tag, IsVisitableConst> type;
+};
+
+// elements derived type
+template <typename OldValue, size_t N, typename NewValue>
+struct container_from_elements_type<index::pushable_array<OldValue, N>, NewValue>
+{
+ typedef index::pushable_array<NewValue, N> type;
+};
+
+// allocators
+
+template <typename Allocator, typename Value, typename Parameters, typename Box>
+struct allocators<Allocator, Value, Parameters, Box, node_d_mem_static_tag>
+{
+ typedef Allocator allocator_type;
+ typedef typename allocator_type::size_type size_type;
+
+ typedef typename allocator_type::template rebind<
+ typename internal_node<Value, Parameters, Box, allocators, node_d_mem_static_tag>::type
+ >::other internal_node_allocator_type;
+
+ typedef typename allocator_type::template rebind<
+ typename leaf<Value, Parameters, Box, allocators, node_d_mem_static_tag>::type
+ >::other leaf_allocator_type;
+
+ inline explicit allocators(Allocator alloc)
+ : allocator(alloc)
+ , internal_node_allocator(allocator)
+ , leaf_allocator(allocator)
+ {}
+
+ allocator_type allocator;
+ internal_node_allocator_type internal_node_allocator;
+ leaf_allocator_type leaf_allocator;
+};
+
+// create_node
+
+template <typename Allocators, typename Value, typename Parameters, typename Box>
+struct create_node<
+ Allocators,
+ dynamic_internal_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+>
+{
+ static inline typename node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>::type *
+ apply(Allocators & allocators)
+ {
+ return create_node_poly<
+ dynamic_internal_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+ >::template apply<
+ typename node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>::type
+ >(allocators.internal_node_allocator, allocators.internal_node_allocator);
+ }
+};
+
+template <typename Allocators, typename Value, typename Parameters, typename Box>
+struct create_node<
+ Allocators,
+ dynamic_leaf<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+>
+{
+ static inline typename node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>::type *
+ apply(Allocators & allocators)
+ {
+ return create_node_poly<
+ dynamic_leaf<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+ >::template apply<
+ typename node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>::type
+ >(allocators.leaf_allocator, allocators.leaf_allocator);
+ }
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP

Deleted: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default.hpp 2012-09-30 08:12:34 EDT (Sun, 30 Sep 2012)
+++ (empty file)
@@ -1,386 +0,0 @@
-// Boost.Geometry Index
-//
-// R-tree nodes based on run-time polymorphism, storing std::vectors
-//
-// Copyright (c) 2011-2012 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_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_HPP
-#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_HPP
-
-#include <vector>
-
-namespace boost { namespace geometry { namespace index {
-
-namespace detail { namespace rtree {
-
-// visitor forward declaration
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, bool IsVisitableConst>
-struct visitor_poly;
-
-// nodes types
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
-struct node_poly
-{
- virtual ~node_poly() {}
- virtual void apply_visitor(visitor_poly<Value, Parameters, Box, Allocators, Tag, false> &) = 0;
- virtual void apply_visitor(visitor_poly<Value, Parameters, Box, Allocators, Tag, true> &) const = 0;
-};
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
-struct internal_node_poly : public node_poly<Value, Parameters, Box, Allocators, Tag>
-{
- typedef std::vector<
- std::pair<Box, node_poly<Value, Parameters, Box, Allocators, Tag> *>,
- typename Allocators::internal_node_elements_allocator_type
- > elements_type;
-
- inline internal_node_poly(typename Allocators::internal_node_elements_allocator_type & al)
- : elements(al)
- {}
-
- void apply_visitor(visitor_poly<Value, Parameters, Box, Allocators, Tag, false> & v) { v(*this); }
- void apply_visitor(visitor_poly<Value, Parameters, Box, Allocators, Tag, true> & v) const { v(*this); }
-
- elements_type elements;
-};
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
-struct leaf_poly : public node_poly<Value, Parameters, Box, Allocators, Tag>
-{
- typedef std::vector<
- Value,
- typename Allocators::leaf_elements_allocator_type
- > elements_type;
-
- inline leaf_poly(typename Allocators::leaf_elements_allocator_type & al)
- : elements(al)
- {}
-
- void apply_visitor(visitor_poly<Value, Parameters, Box, Allocators, Tag, false> & v) { v(*this); }
- void apply_visitor(visitor_poly<Value, Parameters, Box, Allocators, Tag, true> & v) const { v(*this); }
-
- elements_type elements;
-};
-
-// nodes traits
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
-struct node
-{
- typedef node_poly<Value, Parameters, Box, Allocators, Tag> type;
-};
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
-struct internal_node
-{
- typedef internal_node_poly<Value, Parameters, Box, Allocators, Tag> type;
-};
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
-struct leaf
-{
- typedef leaf_poly<Value, Parameters, Box, Allocators, Tag> type;
-};
-
-// nodes conversion
-
-template <typename Derived, typename Parameters, typename Value, typename Box, typename Allocators, typename Tag>
-inline Derived & get(node_poly<Value, Parameters, Box, Allocators, Tag> & n)
-{
- assert(dynamic_cast<Derived*>(&n));
- return static_cast<Derived&>(n);
-}
-
-template <typename Derived, typename Parameters, typename Value, typename Box, typename Allocators, typename Tag>
-inline Derived * get(node_poly<Value, Parameters, Box, Allocators, Tag> * n)
-{
- assert(dynamic_cast<Derived*>(n));
- return static_cast<Derived*>(n);
-}
-
-// visitor
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
-struct visitor_poly<Value, Parameters, Box, Allocators, Tag, true>
-{
- typedef typename internal_node<Value, Parameters, Box, Allocators, Tag>::type internal_node;
- typedef typename leaf<Value, Parameters, Box, Allocators, Tag>::type leaf;
-
- virtual ~visitor_poly() {}
-
- virtual void operator()(internal_node const&) = 0;
- virtual void operator()(leaf const&) = 0;
-};
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
-struct visitor_poly<Value, Parameters, Box, Allocators, Tag, false>
-{
- typedef typename internal_node<Value, Parameters, Box, Allocators, Tag>::type internal_node;
- typedef typename leaf<Value, Parameters, Box, Allocators, Tag>::type leaf;
-
- virtual ~visitor_poly() {}
-
- virtual void operator()(internal_node &) = 0;
- virtual void operator()(leaf &) = 0;
-};
-
-// visitor traits
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, bool IsVisitableConst>
-struct visitor
-{
- typedef visitor_poly<Value, Parameters, Box, Allocators, Tag, IsVisitableConst> type;
-};
-
-template <typename Visitor, typename Visitable>
-inline void apply_visitor(Visitor &v, Visitable & n)
-{
- n.apply_visitor(v);
-}
-
-// element's indexable type
-
-template <typename Value, typename Translator>
-struct element_indexable_type
-{
- typedef typename translator::indexable_type<Translator>::type type;
-};
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, typename Translator>
-struct element_indexable_type<
- std::pair<Box, node_poly<Value, Parameters, Box, Allocators, Tag> *>,
- Translator
->
-{
- typedef Box type;
-};
-
-// element's indexable getter
-
-template <typename Value, typename Translator>
-inline typename Translator::result_type
-element_indexable(Value const& el, Translator const& tr)
-{
- return tr(el);
-}
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, typename Translator>
-inline Box const&
-element_indexable(
- std::pair< Box, node_poly<Value, Parameters, Box, Allocators, Tag> *> const& el,
- Translator const&)
-{
- return el.first;
-}
-
-// nodes elements
-
-template <typename Node>
-struct elements_type
-{
- typedef typename Node::elements_type type;
-};
-
-template <typename Node>
-inline typename elements_type<Node>::type &
-elements(Node & n)
-{
- return n.elements;
-}
-
-template <typename Node>
-inline typename elements_type<Node>::type const&
-elements(Node const& n)
-{
- return n.elements;
-}
-
-// elements derived type
-template <typename Elements, typename NewValue>
-struct container_from_elements_type
-{
- typedef std::vector<NewValue> type;
-};
-
-// allocators
-
-template <typename Allocator, typename Value, typename Parameters, typename Box, typename Tag>
-struct allocators_poly
-{
- typedef Allocator allocator_type;
- typedef typename allocator_type::size_type size_type;
-
- typedef typename allocator_type::template rebind<
- typename internal_node<Value, Parameters, Box, allocators_poly, Tag>::type
- >::other internal_node_allocator_type;
-
- typedef typename allocator_type::template rebind<
- typename leaf<Value, Parameters, Box, allocators_poly, Tag>::type
- >::other leaf_allocator_type;
-
- typedef typename allocator_type::template rebind<
- std::pair<Box, node_poly<Value, Parameters, Box, allocators_poly, Tag> *>
- >::other internal_node_elements_allocator_type;
-
- typedef typename allocator_type::template rebind<
- Value
- >::other leaf_elements_allocator_type;
-
- inline explicit allocators_poly(Allocator alloc)
- : allocator(alloc)
- , internal_node_allocator(allocator)
- , leaf_allocator(allocator)
- , internal_node_elements_allocator(allocator)
- , leaf_elements_allocator(allocator)
- {}
-
- allocator_type allocator;
- internal_node_allocator_type internal_node_allocator;
- leaf_allocator_type leaf_allocator;
- internal_node_elements_allocator_type internal_node_elements_allocator;
- leaf_elements_allocator_type leaf_elements_allocator;
-};
-
-// allocators
-
-template <typename Allocator, typename Value, typename Parameters, typename Box, typename Tag>
-struct allocators
-{
- typedef allocators_poly<Allocator, Value, Parameters, Box, Tag> type;
-};
-
-// create_node_impl
-
-template <typename Node>
-struct create_node_poly
-{
- template <typename RetNode, typename AllocNode, typename AllocElems>
- static inline RetNode * apply(AllocNode & alloc_node, AllocElems & alloc_elems)
- {
- Node * p = alloc_node.allocate(1);
-
- if ( 0 == p )
- throw std::bad_alloc();
-
- try
- {
- alloc_node.construct(p, Node(alloc_elems));
- }
- catch(...)
- {
- alloc_node.deallocate(p, 1);
- throw;
- }
-
- return p;
- }
-};
-
-// destroy_node_impl
-
-template <typename Node>
-struct destroy_node_poly
-{
- template <typename AllocNode, typename BaseNode>
- static inline void apply(AllocNode & alloc_node, BaseNode * n)
- {
- Node * p = rtree::get<Node>(n);
- alloc_node.destroy(p);
- alloc_node.deallocate(p, 1);
- }
-};
-
-// create_node
-
-template <typename Allocators, typename Node>
-struct create_node
-{
- BOOST_MPL_ASSERT_MSG(
- (false),
- NOT_IMPLEMENTED_FOR_THIS_NODE_TYPE,
- (create_node));
-};
-
-template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
-struct create_node<
- Allocators,
- internal_node_poly<Value, Parameters, Box, Allocators, Tag>
->
-{
- static inline typename node<Value, Parameters, Box, Allocators, Tag>::type *
- apply(Allocators & allocators)
- {
- return create_node_poly<
- internal_node_poly<Value, Parameters, Box, Allocators, Tag>
- >::template apply<
- typename node<Value, Parameters, Box, Allocators, Tag>::type
- >(allocators.internal_node_allocator, allocators.internal_node_elements_allocator);
- }
-};
-
-template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
-struct create_node<
- Allocators,
- leaf_poly<Value, Parameters, Box, Allocators, Tag>
->
-{
- static inline typename node<Value, Parameters, Box, Allocators, Tag>::type *
- apply(Allocators & allocators)
- {
- return create_node_poly<
- leaf_poly<Value, Parameters, Box, Allocators, Tag>
- >::template apply<
- typename node<Value, Parameters, Box, Allocators, Tag>::type
- >(allocators.leaf_allocator, allocators.leaf_elements_allocator);
- }
-};
-
-// destroy_node
-
-template <typename Allocators, typename Node>
-struct destroy_node
-{
- BOOST_MPL_ASSERT_MSG(
- (false),
- NOT_IMPLEMENTED_FOR_THIS_NODE_TYPE,
- (destroy_node));
-};
-
-template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
-struct destroy_node<
- Allocators,
- internal_node_poly<Value, Parameters, Box, Allocators, Tag>
->
-{
- static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Allocators, Tag>::type * n)
- {
- destroy_node_poly<
- internal_node_poly<Value, Parameters, Box, Allocators, Tag>
- >::apply(allocators.internal_node_allocator, n);
- }
-};
-
-template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
-struct destroy_node<
- Allocators,
- leaf_poly<Value, Parameters, Box, Allocators, Tag>
->
-{
- static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Allocators, Tag>::type * n)
- {
- destroy_node_poly<
- leaf_poly<Value, Parameters, Box, Allocators, Tag>
- >::apply(allocators.leaf_allocator, n);
- }
-};
-
-}} // namespace detail::rtree
-
-}}} // namespace boost::geometry::index
-
-#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_HPP

Deleted: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default_static.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default_static.hpp 2012-09-30 08:12:34 EDT (Sun, 30 Sep 2012)
+++ (empty file)
@@ -1,130 +0,0 @@
-// Boost.Geometry Index
-//
-// R-tree nodes based on runtime-polymorphism, storing static-size containers
-//
-// Copyright (c) 2011-2012 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_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP
-#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP
-
-#include <boost/geometry/extensions/index/pushable_array.hpp>
-
-namespace boost { namespace geometry { namespace index {
-
-namespace detail { namespace rtree {
-
-template <typename Value, typename Parameters, typename Box, typename Allocators>
-struct internal_node_poly<Value, Parameters, Box, Allocators, node_default_static_tag>
- : public node_poly<Value, Parameters, Box, Allocators, node_default_static_tag>
-{
- typedef index::pushable_array<
- std::pair<
- Box,
- node_poly<Value, Parameters, Box, Allocators, node_default_static_tag> *
- >,
- Parameters::max_elements + 1
- > elements_type;
-
- template <typename Dummy>
- inline internal_node_poly(Dummy) {}
-
- void apply_visitor(visitor_poly<Value, Parameters, Box, Allocators, node_default_static_tag, false> & v) { v(*this); }
- void apply_visitor(visitor_poly<Value, Parameters, Box, Allocators, node_default_static_tag, true> & v) const { v(*this); }
-
- elements_type elements;
-};
-
-template <typename Value, typename Parameters, typename Box, typename Allocators>
-struct leaf_poly<Value, Parameters, Box, Allocators, node_default_static_tag>
- : public node_poly<Value, Parameters, Box, Allocators, node_default_static_tag>
-{
- typedef index::pushable_array<Value, Parameters::max_elements + 1> elements_type;
-
- template <typename Dummy>
- inline leaf_poly(Dummy) {}
-
- void apply_visitor(visitor_poly<Value, Parameters, Box, Allocators, node_default_static_tag, false> & v) { v(*this); }
- void apply_visitor(visitor_poly<Value, Parameters, Box, Allocators, node_default_static_tag, true> & v) const { v(*this); }
-
- elements_type elements;
-};
-
-// elements derived type
-template <typename OldValue, size_t N, typename NewValue>
-struct container_from_elements_type<index::pushable_array<OldValue, N>, NewValue>
-{
- typedef index::pushable_array<NewValue, N> type;
-};
-
-// allocators_poly
-
-template <typename Allocator, typename Value, typename Parameters, typename Box>
-struct allocators_poly<Allocator, Value, Parameters, Box, node_default_static_tag>
-{
- typedef Allocator allocator_type;
- typedef typename allocator_type::size_type size_type;
-
- typedef typename allocator_type::template rebind<
- typename internal_node<Value, Parameters, Box, allocators_poly, node_default_static_tag>::type
- >::other internal_node_allocator_type;
-
- typedef typename allocator_type::template rebind<
- typename leaf<Value, Parameters, Box, allocators_poly, node_default_static_tag>::type
- >::other leaf_allocator_type;
-
- inline explicit allocators_poly(Allocator alloc)
- : allocator(alloc)
- , internal_node_allocator(allocator)
- , leaf_allocator(allocator)
- {}
-
- allocator_type allocator;
- internal_node_allocator_type internal_node_allocator;
- leaf_allocator_type leaf_allocator;
-};
-
-// create_node
-
-template <typename Allocators, typename Value, typename Parameters, typename Box>
-struct create_node<
- Allocators,
- internal_node_poly<Value, Parameters, Box, Allocators, node_default_static_tag>
->
-{
- static inline typename node<Value, Parameters, Box, Allocators, node_default_static_tag>::type *
- apply(Allocators & allocators)
- {
- return create_node_poly<
- internal_node_poly<Value, Parameters, Box, Allocators, node_default_static_tag>
- >::template apply<
- typename node<Value, Parameters, Box, Allocators, node_default_static_tag>::type
- >(allocators.internal_node_allocator, allocators.internal_node_allocator);
- }
-};
-
-template <typename Allocators, typename Value, typename Parameters, typename Box>
-struct create_node<
- Allocators,
- leaf_poly<Value, Parameters, Box, Allocators, node_default_static_tag>
->
-{
- static inline typename node<Value, Parameters, Box, Allocators, node_default_static_tag>::type *
- apply(Allocators & allocators)
- {
- return create_node_poly<
- leaf_poly<Value, Parameters, Box, Allocators, node_default_static_tag>
- >::template apply<
- typename node<Value, Parameters, Box, Allocators, node_default_static_tag>::type
- >(allocators.leaf_allocator, allocators.leaf_allocator);
- }
-};
-
-}} // namespace detail::rtree
-
-}}} // namespace boost::geometry::index
-
-#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP

Deleted: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp 2012-09-30 08:12:34 EDT (Sun, 30 Sep 2012)
+++ (empty file)
@@ -1,159 +0,0 @@
-// Boost.Geometry Index
-//
-// R-tree nodes based on Boost.Variant, storing static-size containers
-//
-// Copyright (c) 2011-2012 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_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP
-#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP
-
-#include <vector>
-#include <boost/variant.hpp>
-
-namespace boost { namespace geometry { namespace index {
-
-namespace detail { namespace rtree {
-
-// nodes default types
-
-template <typename Value, typename Parameters, typename Box, typename Allocators>
-struct internal_node_variant<Value, Parameters, Box, Allocators, node_default_static_variant_tag>
-{
- typedef index::pushable_array<
- std::pair<
- Box,
- typename node<Value, Parameters, Box, Allocators, node_default_static_variant_tag>::type *
- >,
- Parameters::max_elements + 1
- > elements_type;
-
- template <typename Dummy>
- inline internal_node_variant(Dummy) {}
-
- elements_type elements;
-};
-
-template <typename Value, typename Parameters, typename Box, typename Allocators>
-struct leaf_variant<Value, Parameters, Box, Allocators, node_default_static_variant_tag>
-{
- typedef index::pushable_array<Value, Parameters::max_elements + 1> elements_type;
-
- template <typename Dummy>
- inline leaf_variant(Dummy) {}
-
- elements_type elements;
-};
-
-// nodes traits
-
-template <typename Value, typename Parameters, typename Box, typename Allocators>
-struct node<Value, Parameters, Box, Allocators, node_default_static_variant_tag>
-{
- typedef boost::variant<
- leaf_variant<Value, Parameters, Box, Allocators, node_default_static_variant_tag>,
- internal_node_variant<Value, Parameters, Box, Allocators, node_default_static_variant_tag>
- > type;
-};
-
-template <typename Value, typename Parameters, typename Box, typename Allocators>
-struct internal_node<Value, Parameters, Box, Allocators, node_default_static_variant_tag>
-{
- typedef internal_node_variant<Value, Parameters, Box, Allocators, node_default_static_variant_tag> type;
-};
-
-template <typename Value, typename Parameters, typename Box, typename Allocators>
-struct leaf<Value, Parameters, Box, Allocators, node_default_static_variant_tag>
-{
- typedef leaf_variant<Value, Parameters, Box, Allocators, node_default_static_variant_tag> type;
-};
-
-// visitor traits
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, bool IsVisitableConst>
-struct visitor<Value, Parameters, Box, Allocators, node_default_static_variant_tag, IsVisitableConst>
-{
- typedef static_visitor<> type;
-};
-
-// allocators_variant
-
-template <typename Allocator, typename Value, typename Parameters, typename Box>
-struct allocators_variant<Allocator, Value, Parameters, Box, node_default_static_variant_tag>
-{
- typedef Allocator allocator_type;
- typedef typename allocator_type::size_type size_type;
-
- typedef typename allocator_type::template rebind<
- typename node<Value, Parameters, Box, allocators_variant, node_default_static_variant_tag>::type
- >::other node_allocator_type;
-
- typedef typename allocator_type::template rebind<
- std::pair<Box, node_poly<Value, Parameters, Box, allocators_variant, node_default_static_variant_tag> *>
- >::other internal_node_elements_allocator_type;
-
- typedef typename allocator_type::template rebind<
- Value
- >::other leaf_elements_allocator_type;
-
- inline explicit allocators_variant(Allocator alloc)
- : allocator(alloc)
- , node_allocator(allocator)
- {}
-
- allocator_type allocator;
- node_allocator_type node_allocator;
-};
-
-// allocators
-
-template <typename Allocator, typename Value, typename Parameters, typename Box>
-struct allocators<Allocator, Value, Parameters, Box, node_default_static_variant_tag>
-{
- typedef allocators_variant<Allocator, Value, Parameters, Box, node_default_static_variant_tag> type;
-};
-
-// create_node
-
-template <typename Allocators, typename Value, typename Parameters, typename Box>
-struct create_node<
- Allocators,
- internal_node_variant<Value, Parameters, Box, Allocators, node_default_static_variant_tag>
->
-{
- static inline typename node<Value, Parameters, Box, Allocators, node_default_static_variant_tag>::type *
- apply(Allocators & allocators)
- {
- return create_node_variant<
- internal_node_variant<Value, Parameters, Box, Allocators, node_default_static_variant_tag>
- >::template apply<
- typename node<Value, Parameters, Box, Allocators, node_default_static_variant_tag>::type
- >(allocators.node_allocator, allocators.node_allocator);
- }
-};
-
-template <typename Allocators, typename Value, typename Parameters, typename Box>
-struct create_node<
- Allocators,
- leaf_variant<Value, Parameters, Box, Allocators, node_default_static_variant_tag>
->
-{
- static inline typename node<Value, Parameters, Box, Allocators, node_default_static_variant_tag>::type *
- apply(Allocators & allocators)
- {
- return create_node_variant<
- leaf_variant<Value, Parameters, Box, Allocators, node_default_static_variant_tag>
- >::template apply<
- typename node<Value, Parameters, Box, Allocators, node_default_static_variant_tag>::type
- >(allocators.node_allocator, allocators.node_allocator);
- }
-};
-
-}} // namespace detail::rtree
-
-}}} // namespace boost::geometry::index
-
-#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP

Deleted: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp 2012-09-30 08:12:34 EDT (Sun, 30 Sep 2012)
+++ (empty file)
@@ -1,315 +0,0 @@
-// Boost.Geometry Index
-//
-// R-tree nodes based on Boost.Variant, storing std::vectors
-//
-// Copyright (c) 2011-2012 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_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP
-#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP
-
-#include <vector>
-#include <boost/variant.hpp>
-
-namespace boost { namespace geometry { namespace index {
-
-namespace detail { namespace rtree {
-
-// nodes default types
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
-struct internal_node_variant
-{
- typedef std::vector<
- std::pair<
- Box,
- typename node<Value, Parameters, Box, Allocators, Tag>::type *
- >,
- typename Allocators::internal_node_elements_allocator_type
- > elements_type;
-
- inline internal_node_variant(typename Allocators::internal_node_elements_allocator_type & al)
- : elements(al)
- {}
-
- elements_type elements;
-};
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
-struct leaf_variant
-{
- typedef std::vector<
- Value,
- typename Allocators::leaf_elements_allocator_type
- > elements_type;
-
- inline leaf_variant(typename Allocators::leaf_elements_allocator_type & al)
- : elements(al)
- {}
-
- elements_type elements;
-};
-
-// nodes traits
-
-template <typename Value, typename Parameters, typename Box, typename Allocators>
-struct node<Value, Parameters, Box, Allocators, node_default_variant_tag>
-{
- typedef boost::variant<
- leaf_variant<Value, Parameters, Box, Allocators, node_default_variant_tag>,
- internal_node_variant<Value, Parameters, Box, Allocators, node_default_variant_tag>
- > type;
-};
-
-template <typename Value, typename Parameters, typename Box, typename Allocators>
-struct internal_node<Value, Parameters, Box, Allocators, node_default_variant_tag>
-{
- typedef internal_node_variant<Value, Parameters, Box, Allocators, node_default_variant_tag> type;
-};
-
-template <typename Value, typename Parameters, typename Box, typename Allocators>
-struct leaf<Value, Parameters, Box, Allocators, node_default_variant_tag>
-{
- typedef leaf_variant<Value, Parameters, Box, Allocators, node_default_variant_tag> type;
-};
-
-// nodes conversion
-
-template <typename V, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
-inline V & get(
- boost::variant<
- leaf_variant<Value, Parameters, Box, Allocators, Tag>,
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
- > &v
-)
-{
- return boost::get<V>(v);
-}
-
-template <typename V, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
-inline V * get(
- boost::variant<
- leaf_variant<Value, Parameters, Box, Allocators, Tag>,
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
- > *v
-)
-{
- return boost::get<V>(v);
-}
-
-// visitor traits
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, bool IsVisitableConst>
-struct visitor<Value, Parameters, Box, Allocators, node_default_variant_tag, IsVisitableConst>
-{
- typedef static_visitor<> type;
-};
-
-template <typename Visitor, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
-inline void apply_visitor(Visitor & v,
- boost::variant<
- leaf_variant<Value, Parameters, Box, Allocators, Tag>,
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
- > & n)
-{
- boost::apply_visitor(v, n);
-}
-
-template <typename Visitor, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
-inline void apply_visitor(Visitor & v,
- boost::variant<
- leaf_variant<Value, Parameters, Box, Allocators, Tag>,
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
- > const& n)
-{
- boost::apply_visitor(v, n);
-}
-
-// element's indexable type
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, typename Translator>
-struct element_indexable_type<
- std::pair<
- Box,
- boost::variant<
- leaf_variant<Value, Parameters, Box, Allocators, Tag>,
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
- > *
- >,
- Translator
->
-{
- typedef Box type;
-};
-
-// element's indexable getter
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, typename Translator>
-inline Box const&
-element_indexable(std::pair<
- Box,
- boost::variant<
- leaf_variant<Value, Parameters, Box, Allocators, Tag>,
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
- > *
- > const& el,
- Translator const&)
-{
- return el.first;
-}
-
-// allocators
-
-template <typename Allocator, typename Value, typename Parameters, typename Box, typename Tag>
-struct allocators_variant
-{
- typedef Allocator allocator_type;
- typedef typename allocator_type::size_type size_type;
-
- typedef typename allocator_type::template rebind<
- typename node<Value, Parameters, Box, allocators_variant, node_default_variant_tag>::type
- >::other node_allocator_type;
-
- typedef typename allocator_type::template rebind<
- std::pair<Box, node_poly<Value, Parameters, Box, allocators_variant, node_default_variant_tag> *>
- >::other internal_node_elements_allocator_type;
-
- typedef typename allocator_type::template rebind<
- Value
- >::other leaf_elements_allocator_type;
-
- inline explicit allocators_variant(Allocator alloc)
- : allocator(alloc)
- , node_allocator(allocator)
- , internal_node_elements_allocator(allocator)
- , leaf_elements_allocator(allocator)
- {}
-
- allocator_type allocator;
- node_allocator_type node_allocator;
- internal_node_elements_allocator_type internal_node_elements_allocator;
- leaf_elements_allocator_type leaf_elements_allocator;
-};
-
-// allocators
-
-template <typename Allocator, typename Value, typename Parameters, typename Box>
-struct allocators<Allocator, Value, Parameters, Box, node_default_variant_tag>
-{
- typedef allocators_variant<Allocator, Value, Parameters, Box, node_default_variant_tag> type;
-};
-
-// create_node_variant
-
-template <typename Node>
-struct create_node_variant
-{
- template <typename RetNode, typename AllocNode, typename AllocElems>
- static inline RetNode * apply(AllocNode & alloc_node, AllocElems & alloc_elems)
- {
- RetNode * p = alloc_node.allocate(1);
-
- if ( 0 == p )
- throw std::bad_alloc();
-
- try
- {
- alloc_node.construct(p, Node(alloc_elems));
- }
- catch(...)
- {
- alloc_node.deallocate(p, 1);
- throw;
- }
-
- return p;
- }
-};
-
-// destroy_node_variant
-
-template <typename Node>
-struct destroy_node_variant
-{
- template <typename AllocNode, typename BaseNode>
- static inline void apply(AllocNode & alloc_node, BaseNode * n)
- {
- alloc_node.destroy(n);
- alloc_node.deallocate(n, 1);
- }
-};
-
-// create_node
-
-template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
-struct create_node<
- Allocators,
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
->
-{
- static inline typename node<Value, Parameters, Box, Allocators, Tag>::type *
- apply(Allocators & allocators)
- {
- return create_node_variant<
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
- >::template apply<
- typename node<Value, Parameters, Box, Allocators, Tag>::type
- >(allocators.node_allocator, allocators.internal_node_elements_allocator);
- }
-};
-
-template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
-struct create_node<
- Allocators,
- leaf_variant<Value, Parameters, Box, Allocators, Tag>
->
-{
- static inline typename node<Value, Parameters, Box, Allocators, Tag>::type *
- apply(Allocators & allocators)
- {
- return create_node_variant<
- leaf_variant<Value, Parameters, Box, Allocators, Tag>
- >::template apply<
- typename node<Value, Parameters, Box, Allocators, Tag>::type
- >(allocators.node_allocator, allocators.leaf_elements_allocator);
- }
-};
-
-// destroy_node
-
-template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
-struct destroy_node<
- Allocators,
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
->
-{
- static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Allocators, Tag>::type * n)
- {
- destroy_node_variant<
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
- >::apply(allocators.node_allocator, n);
- }
-};
-
-template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
-struct destroy_node<
- Allocators,
- leaf_variant<Value, Parameters, Box, Allocators, Tag>
->
-{
- static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Allocators, Tag>::type * n)
- {
- destroy_node_variant<
- leaf_variant<Value, Parameters, Box, Allocators, Tag>
- >::apply(allocators.node_allocator, n);
- }
-};
-
-}} // namespace detail::rtree
-
-}}} // namespace boost::geometry::index
-
-#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP

Added: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp 2012-09-30 08:12:34 EDT (Sun, 30 Sep 2012)
@@ -0,0 +1,307 @@
+// Boost.Geometry Index
+//
+// R-tree nodes based on Boost.Variant, storing std::vectors
+//
+// Copyright (c) 2011-2012 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_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP
+
+#include <vector>
+#include <boost/variant.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+// nodes default types
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct internal_node_variant
+{
+ typedef std::vector<
+ std::pair<
+ Box,
+ typename node<Value, Parameters, Box, Allocators, Tag>::type *
+ >,
+ typename Allocators::internal_node_elements_allocator_type
+ > elements_type;
+
+ inline internal_node_variant(typename Allocators::internal_node_elements_allocator_type & al)
+ : elements(al)
+ {}
+
+ elements_type elements;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct leaf_variant
+{
+ typedef std::vector<
+ Value,
+ typename Allocators::leaf_elements_allocator_type
+ > elements_type;
+
+ inline leaf_variant(typename Allocators::leaf_elements_allocator_type & al)
+ : elements(al)
+ {}
+
+ elements_type elements;
+};
+
+// nodes traits
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct node<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>
+{
+ typedef boost::variant<
+ leaf_variant<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>,
+ internal_node_variant<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>
+ > type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct internal_node<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>
+{
+ typedef internal_node_variant<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag> type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct leaf<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>
+{
+ typedef leaf_variant<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag> type;
+};
+
+// nodes conversion
+
+template <typename V, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+inline V & get(
+ boost::variant<
+ leaf_variant<Value, Parameters, Box, Allocators, Tag>,
+ internal_node_variant<Value, Parameters, Box, Allocators, Tag>
+ > &v
+)
+{
+ return boost::get<V>(v);
+}
+
+template <typename V, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+inline V * get(
+ boost::variant<
+ leaf_variant<Value, Parameters, Box, Allocators, Tag>,
+ internal_node_variant<Value, Parameters, Box, Allocators, Tag>
+ > *v
+)
+{
+ return boost::get<V>(v);
+}
+
+// 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>
+{
+ typedef static_visitor<> type;
+};
+
+template <typename Visitor, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+inline void apply_visitor(Visitor & v,
+ boost::variant<
+ leaf_variant<Value, Parameters, Box, Allocators, Tag>,
+ internal_node_variant<Value, Parameters, Box, Allocators, Tag>
+ > & n)
+{
+ boost::apply_visitor(v, n);
+}
+
+template <typename Visitor, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+inline void apply_visitor(Visitor & v,
+ boost::variant<
+ leaf_variant<Value, Parameters, Box, Allocators, Tag>,
+ internal_node_variant<Value, Parameters, Box, Allocators, Tag>
+ > const& n)
+{
+ boost::apply_visitor(v, n);
+}
+
+// element's indexable type
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, typename Translator>
+struct element_indexable_type<
+ std::pair<
+ Box,
+ boost::variant<
+ leaf_variant<Value, Parameters, Box, Allocators, Tag>,
+ internal_node_variant<Value, Parameters, Box, Allocators, Tag>
+ > *
+ >,
+ Translator
+>
+{
+ typedef Box type;
+};
+
+// element's indexable getter
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, typename Translator>
+inline Box const&
+element_indexable(std::pair<
+ Box,
+ boost::variant<
+ leaf_variant<Value, Parameters, Box, Allocators, Tag>,
+ internal_node_variant<Value, Parameters, Box, Allocators, Tag>
+ > *
+ > const& el,
+ Translator const&)
+{
+ return el.first;
+}
+
+// allocators
+
+template <typename Allocator, typename Value, typename Parameters, typename Box>
+struct allocators<Allocator, Value, Parameters, Box, node_s_mem_dynamic_tag>
+{
+ typedef Allocator allocator_type;
+ typedef typename allocator_type::size_type size_type;
+
+ typedef typename allocator_type::template rebind<
+ typename node<Value, Parameters, Box, allocators, node_s_mem_dynamic_tag>::type
+ >::other node_allocator_type;
+
+ typedef typename allocator_type::template rebind<
+ std::pair<Box, typename node<Value, Parameters, Box, allocators, node_s_mem_dynamic_tag>::type *>
+ >::other internal_node_elements_allocator_type;
+
+ typedef typename allocator_type::template rebind<
+ Value
+ >::other leaf_elements_allocator_type;
+
+ inline explicit allocators(Allocator alloc)
+ : allocator(alloc)
+ , node_allocator(allocator)
+ , internal_node_elements_allocator(allocator)
+ , leaf_elements_allocator(allocator)
+ {}
+
+ allocator_type allocator;
+ node_allocator_type node_allocator;
+ internal_node_elements_allocator_type internal_node_elements_allocator;
+ leaf_elements_allocator_type leaf_elements_allocator;
+};
+
+// create_node_variant
+
+template <typename Node>
+struct create_node_variant
+{
+ template <typename RetNode, typename AllocNode, typename AllocElems>
+ static inline RetNode * apply(AllocNode & alloc_node, AllocElems & alloc_elems)
+ {
+ RetNode * p = alloc_node.allocate(1);
+
+ if ( 0 == p )
+ throw std::bad_alloc();
+
+ try
+ {
+ alloc_node.construct(p, Node(alloc_elems));
+ }
+ catch(...)
+ {
+ alloc_node.deallocate(p, 1);
+ throw;
+ }
+
+ return p;
+ }
+};
+
+// destroy_node_variant
+
+template <typename Node>
+struct destroy_node_variant
+{
+ template <typename AllocNode, typename BaseNode>
+ static inline void apply(AllocNode & alloc_node, BaseNode * n)
+ {
+ alloc_node.destroy(n);
+ alloc_node.deallocate(n, 1);
+ }
+};
+
+// create_node
+
+template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
+struct create_node<
+ Allocators,
+ internal_node_variant<Value, Parameters, Box, Allocators, Tag>
+>
+{
+ static inline typename node<Value, Parameters, Box, Allocators, Tag>::type *
+ apply(Allocators & allocators)
+ {
+ return create_node_variant<
+ internal_node_variant<Value, Parameters, Box, Allocators, Tag>
+ >::template apply<
+ typename node<Value, Parameters, Box, Allocators, Tag>::type
+ >(allocators.node_allocator, allocators.internal_node_elements_allocator);
+ }
+};
+
+template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
+struct create_node<
+ Allocators,
+ leaf_variant<Value, Parameters, Box, Allocators, Tag>
+>
+{
+ static inline typename node<Value, Parameters, Box, Allocators, Tag>::type *
+ apply(Allocators & allocators)
+ {
+ return create_node_variant<
+ leaf_variant<Value, Parameters, Box, Allocators, Tag>
+ >::template apply<
+ typename node<Value, Parameters, Box, Allocators, Tag>::type
+ >(allocators.node_allocator, allocators.leaf_elements_allocator);
+ }
+};
+
+// destroy_node
+
+template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
+struct destroy_node<
+ Allocators,
+ internal_node_variant<Value, Parameters, Box, Allocators, Tag>
+>
+{
+ static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Allocators, Tag>::type * n)
+ {
+ destroy_node_variant<
+ internal_node_variant<Value, Parameters, Box, Allocators, Tag>
+ >::apply(allocators.node_allocator, n);
+ }
+};
+
+template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
+struct destroy_node<
+ Allocators,
+ leaf_variant<Value, Parameters, Box, Allocators, Tag>
+>
+{
+ static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Allocators, Tag>::type * n)
+ {
+ destroy_node_variant<
+ leaf_variant<Value, Parameters, Box, Allocators, Tag>
+ >::apply(allocators.node_allocator, n);
+ }
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP

Added: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp 2012-09-30 08:12:34 EDT (Sun, 30 Sep 2012)
@@ -0,0 +1,151 @@
+// Boost.Geometry Index
+//
+// R-tree nodes based on Boost.Variant, storing static-size containers
+//
+// Copyright (c) 2011-2012 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_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP
+
+#include <vector>
+#include <boost/variant.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+// nodes default types
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct internal_node_variant<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+{
+ typedef index::pushable_array<
+ std::pair<
+ Box,
+ typename node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>::type *
+ >,
+ Parameters::max_elements + 1
+ > elements_type;
+
+ template <typename Dummy>
+ inline internal_node_variant(Dummy) {}
+
+ elements_type elements;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct leaf_variant<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+{
+ typedef index::pushable_array<Value, Parameters::max_elements + 1> elements_type;
+
+ template <typename Dummy>
+ inline leaf_variant(Dummy) {}
+
+ elements_type elements;
+};
+
+// nodes traits
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+{
+ typedef boost::variant<
+ leaf_variant<Value, Parameters, Box, Allocators, node_s_mem_static_tag>,
+ internal_node_variant<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+ > type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct internal_node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+{
+ typedef internal_node_variant<Value, Parameters, Box, Allocators, node_s_mem_static_tag> type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+{
+ typedef leaf_variant<Value, Parameters, Box, Allocators, node_s_mem_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>
+{
+ typedef static_visitor<> type;
+};
+
+// allocators
+
+template <typename Allocator, typename Value, typename Parameters, typename Box>
+struct allocators<Allocator, Value, Parameters, Box, node_s_mem_static_tag>
+{
+ typedef Allocator allocator_type;
+ typedef typename allocator_type::size_type size_type;
+
+ typedef typename allocator_type::template rebind<
+ typename node<Value, Parameters, Box, allocators, node_s_mem_static_tag>::type
+ >::other node_allocator_type;
+
+ typedef typename allocator_type::template rebind<
+ std::pair<Box, typename node<Value, Parameters, Box, allocators, node_s_mem_static_tag>::type *>
+ >::other internal_node_elements_allocator_type;
+
+ typedef typename allocator_type::template rebind<
+ Value
+ >::other leaf_elements_allocator_type;
+
+ inline explicit allocators(Allocator alloc)
+ : allocator(alloc)
+ , node_allocator(allocator)
+ {}
+
+ allocator_type allocator;
+ node_allocator_type node_allocator;
+};
+
+// create_node
+
+template <typename Allocators, typename Value, typename Parameters, typename Box>
+struct create_node<
+ Allocators,
+ internal_node_variant<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+>
+{
+ static inline typename node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>::type *
+ apply(Allocators & allocators)
+ {
+ return create_node_variant<
+ internal_node_variant<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+ >::template apply<
+ typename node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>::type
+ >(allocators.node_allocator, allocators.node_allocator);
+ }
+};
+
+template <typename Allocators, typename Value, typename Parameters, typename Box>
+struct create_node<
+ Allocators,
+ leaf_variant<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+>
+{
+ static inline typename node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>::type *
+ apply(Allocators & allocators)
+ {
+ return create_node_variant<
+ leaf_variant<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+ >::template apply<
+ typename node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>::type
+ >(allocators.node_allocator, allocators.node_allocator);
+ }
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP

Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/options.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/options.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/options.hpp 2012-09-30 08:12:34 EDT (Sun, 30 Sep 2012)
@@ -33,10 +33,10 @@
 struct rstar_tag {};
 
 // NodeTag
-struct node_default_tag {};
-struct node_default_variant_tag {};
-struct node_default_static_tag {};
-struct node_default_static_variant_tag {};
+struct node_d_mem_dynamic_tag {};
+struct node_d_mem_static_tag {};
+struct node_s_mem_dynamic_tag {};
+struct node_s_mem_static_tag {};
 
 // TODO: awulkiew - implement those:
 //if ( m_min_elems_per_node < 1 )
@@ -216,7 +216,7 @@
         choose_by_content_diff_tag,
         split_default_tag,
         linear_tag,
- node_default_static_tag
+ node_d_mem_static_tag
> type;
 };
 
@@ -229,7 +229,7 @@
         choose_by_content_diff_tag,
         split_default_tag,
         quadratic_tag,
- node_default_static_tag
+ node_d_mem_static_tag
> type;
 };
 
@@ -242,7 +242,7 @@
         choose_by_overlap_diff_tag,
         split_default_tag,
         rstar_tag,
- node_default_static_tag
+ node_d_mem_static_tag
> type;
 };
 
@@ -255,7 +255,7 @@
 // choose_by_content_diff_tag, // change it?
 // split_kmeans_tag,
 // int, // dummy tag - not used for now
-// node_default_static_tag
+// node_d_mem_static_tag
 // > type;
 //};
 
@@ -268,7 +268,7 @@
         choose_by_content_diff_tag,
         split_default_tag,
         linear_tag,
- node_default_tag
+ node_d_mem_dynamic_tag
> type;
 };
 
@@ -281,7 +281,7 @@
         choose_by_content_diff_tag,
         split_default_tag,
         quadratic_tag,
- node_default_tag
+ node_d_mem_dynamic_tag
> type;
 };
 
@@ -294,7 +294,7 @@
         choose_by_overlap_diff_tag,
         split_default_tag,
         rstar_tag,
- node_default_tag
+ node_d_mem_dynamic_tag
> type;
 };
 

Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rtree.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rtree.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rtree.hpp 2012-09-30 08:12:34 EDT (Sun, 30 Sep 2012)
@@ -86,7 +86,7 @@
     typedef typename options_type::node_tag node_tag;
 
     typedef Allocator allocator_type;
- typedef typename detail::rtree::allocators<allocator_type, value_type, typename options_type::parameters_type, box_type, node_tag>::type allocators_type;
+ typedef detail::rtree::allocators<allocator_type, value_type, typename options_type::parameters_type, box_type, node_tag> allocators_type;
     typedef typename allocators_type::size_type size_type;
 
     typedef typename detail::rtree::node<value_type, typename options_type::parameters_type, box_type, allocators_type, node_tag>::type node;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk