|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r74675 - in sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree: . linear node quadratic rstar visitors
From: adam.wulkiewicz_at_[hidden]
Date: 2011-10-03 16:31:00
Author: awulkiew
Date: 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
New Revision: 74675
URL: http://svn.boost.org/trac/boost/changeset/74675
Log:
Allocators used in nodes children containers creation.
Text files modified:
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp | 10 +-
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node.hpp | 28 +++++
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default.hpp | 194 ++++++++++++++++++++-------------------
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default_static.hpp | 91 ++++++++++++++++--
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp | 112 ++++++++++++++++++----
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp | 164 +++++++++++++++++++--------------
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp | 10 +-
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp | 10 +-
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/insert.hpp | 30 +++---
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp | 10 +-
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rtree.hpp | 20 ++--
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp | 18 ++-
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp | 18 ++-
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/children_box.hpp | 8
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/copy.hpp | 8
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/destroy.hpp | 8
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp | 27 +++--
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/insert.hpp | 42 ++++----
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp | 8
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/nearest.hpp | 9 +
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/print.hpp | 24 ++--
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/query.hpp | 10 +-
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/remove.hpp | 10 +-
23 files changed, 536 insertions(+), 333 deletions(-)
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -168,12 +168,12 @@
// from void split_node(node_pointer const& n, node_pointer& n1, node_pointer& n2) const
-template <typename Value, typename Options, typename Translator, typename Box>
-struct redistribute_elements<Value, Options, Translator, Box, linear_tag>
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+struct redistribute_elements<Value, Options, Translator, Box, Allocators, linear_tag>
{
- typedef typename rtree::node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type node;
- typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
typedef typename Options::parameters_type parameters_type;
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 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -16,4 +16,32 @@
#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/algorithms/expand.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+// elements box
+
+template <typename Box, typename FwdIter, typename Translator>
+inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr)
+{
+ BOOST_GEOMETRY_INDEX_ASSERT(first != last, "Can't calculate element's box");
+
+ Box result;
+
+ geometry::convert(element_indexable(*first, tr), result);
+ ++first;
+
+ for ( ; first != last ; ++first )
+ geometry::expand(result, element_indexable(*first, tr));
+
+ return result;
+}
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP
Modified: 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 (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -12,81 +12,91 @@
#include <vector>
-#include <boost/geometry/algorithms/expand.hpp>
-
namespace boost { namespace geometry { namespace index {
namespace detail { namespace rtree {
// visitor forward declaration
-template <typename Value, typename Parameters, typename Box, typename Tag, bool IsVisitableConst>
+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 Tag>
+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, Tag, false> &) = 0;
- virtual void apply_visitor(visitor_poly<Value, Parameters, Box, Tag, true> &) const = 0;
+ 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 Tag>
-struct internal_node_poly : public node_poly<Value, Parameters, Box, Tag>
+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, Tag> *>
+ std::pair<Box, node_poly<Value, Parameters, Box, Allocators, Tag> *>,
+ typename Allocators::internal_node_elements_allocator_type
> elements_type;
- void apply_visitor(visitor_poly<Value, Parameters, Box, Tag, false> & v) { v(*this); }
- void apply_visitor(visitor_poly<Value, Parameters, Box, Tag, true> & v) const { v(*this); }
+ 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 Tag>
-struct leaf_poly : public node_poly<Value, Parameters, Box, Tag>
+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> elements_type;
+ typedef std::vector<
+ Value,
+ typename Allocators::leaf_elements_allocator_type
+ > elements_type;
- void apply_visitor(visitor_poly<Value, Parameters, Box, Tag, false> & v) { v(*this); }
- void apply_visitor(visitor_poly<Value, Parameters, Box, Tag, true> & v) const { v(*this); }
+ 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 Tag>
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
struct node
{
- typedef node_poly<Value, Parameters, Box, Tag> type;
+ typedef node_poly<Value, Parameters, Box, Allocators, Tag> type;
};
-template <typename Value, typename Parameters, typename Box, typename Tag>
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
struct internal_node
{
- typedef internal_node_poly<Value, Parameters, Box, Tag> type;
+ typedef internal_node_poly<Value, Parameters, Box, Allocators, Tag> type;
};
-template <typename Value, typename Parameters, typename Box, typename Tag>
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
struct leaf
{
- typedef leaf_poly<Value, Parameters, Box, Tag> type;
+ typedef leaf_poly<Value, Parameters, Box, Allocators, Tag> type;
};
// nodes conversion
-template <typename Derived, typename Parameters, typename Value, typename Box, typename Tag>
-inline Derived & get(node_poly<Value, Parameters, Box, Tag> & 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);
}
-template <typename Derived, typename Parameters, typename Value, typename Box, typename Tag>
-inline Derived * get(node_poly<Value, Parameters, Box, Tag> * 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);
@@ -94,11 +104,11 @@
// visitor
-template <typename Value, typename Parameters, typename Box, typename Tag>
-struct visitor_poly<Value, Parameters, Box, Tag, true>
+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, Tag>::type internal_node;
- typedef typename leaf<Value, Parameters, Box, Tag>::type leaf;
+ 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() {}
@@ -106,11 +116,11 @@
virtual void operator()(leaf const&) = 0;
};
-template <typename Value, typename Parameters, typename Box, typename Tag>
-struct visitor_poly<Value, Parameters, Box, Tag, false>
+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, Tag>::type internal_node;
- typedef typename leaf<Value, Parameters, Box, Tag>::type leaf;
+ 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() {}
@@ -120,10 +130,10 @@
// visitor traits
-template <typename Value, typename Parameters, typename Box, typename Tag, bool IsVisitableConst>
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, bool IsVisitableConst>
struct visitor
{
- typedef visitor_poly<Value, Parameters, Box, Tag, IsVisitableConst> type;
+ typedef visitor_poly<Value, Parameters, Box, Allocators, Tag, IsVisitableConst> type;
};
template <typename Visitor, typename Visitable>
@@ -140,9 +150,9 @@
typedef typename Translator::indexable_type type;
};
-template <typename Value, typename Parameters, typename Box, typename Tag, typename Translator>
+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, Tag> *>,
+ std::pair<Box, node_poly<Value, Parameters, Box, Allocators, Tag> *>,
Translator
>
{
@@ -158,10 +168,10 @@
return tr(el);
}
-template <typename Value, typename Parameters, typename Box, typename Tag, typename Translator>
+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, Tag> *> const& el,
+ std::pair< Box, node_poly<Value, Parameters, Box, Allocators, Tag> *> const& el,
Translator const&)
{
return el.first;
@@ -189,79 +199,73 @@
return n.elements;
}
-// elements box
-
-template <typename Box, typename FwdIter, typename Translator>
-inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr)
-{
- BOOST_GEOMETRY_INDEX_ASSERT(first != last, "Can't calculate element's box");
-
- Box result;
-
- geometry::convert(element_indexable(*first, tr), result);
- ++first;
-
- for ( ; first != last ; ++first )
- geometry::expand(result, element_indexable(*first, tr));
-
- return result;
-}
-
// allocators
-template <typename Value, typename Parameters, typename Box, typename Tag, typename Allocator>
+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, Tag>::type
+ 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, Tag>::type
+ 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 Value, typename Parameters, typename Box, typename Tag, typename Allocator>
+template <typename Allocator, typename Value, typename Parameters, typename Box, typename Tag>
struct allocators
{
- typedef allocators_poly<Value, Parameters, Box, Tag, Allocator> type;
+ typedef allocators_poly<Allocator, Value, Parameters, Box, Tag> type;
};
-// create_node_poly
+// create_node_impl
-template <typename Allocator, typename Node>
+template <typename Node>
struct create_node_poly
{
- template <typename RetNode>
- static inline RetNode * apply(Allocator & allocator)
+ template <typename RetNode, typename AllocNode, typename AllocElems>
+ static inline RetNode * apply(AllocNode & alloc_node, AllocElems & alloc_elems)
{
- Node * p = allocator.allocate(1);
+ Node * p = alloc_node.allocate(1);
if ( 0 == p )
throw std::bad_alloc();
try
{
- allocator.construct(p, Node());
+ alloc_node.construct(p, Node(alloc_elems));
}
catch(...)
{
- allocator.deallocate(p, 1);
+ alloc_node.deallocate(p, 1);
throw;
}
@@ -269,17 +273,17 @@
}
};
-// destroy_node_poly
+// destroy_node_impl
-template <typename Allocator, typename Node>
+template <typename Node>
struct destroy_node_poly
{
- template <typename BaseNode>
- static inline void apply(Allocator & allocator, BaseNode * n)
+ template <typename AllocNode, typename BaseNode>
+ static inline void apply(AllocNode & alloc_node, BaseNode * n)
{
Node * p = rtree::get<Node>(n);
- allocator.destroy(p);
- allocator.deallocate(p, 1);
+ alloc_node.destroy(p);
+ alloc_node.deallocate(p, 1);
}
};
@@ -297,34 +301,34 @@
template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
struct create_node<
Allocators,
- internal_node_poly<Value, Parameters, Box, Tag>
+ internal_node_poly<Value, Parameters, Box, Allocators, Tag>
>
{
- static inline typename node<Value, Parameters, Box, Tag>::type * apply(Allocators & allocators)
+ static inline typename node<Value, Parameters, Box, Allocators, Tag>::type *
+ apply(Allocators & allocators)
{
return create_node_poly<
- typename Allocators::internal_node_allocator_type,
- internal_node_poly<Value, Parameters, Box, Tag>
+ internal_node_poly<Value, Parameters, Box, Allocators, Tag>
>::template apply<
- typename node<Value, Parameters, Box, Tag>::type
- >(allocators.internal_node_allocator);
+ 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, Tag>
+ leaf_poly<Value, Parameters, Box, Allocators, Tag>
>
{
- static inline typename node<Value, Parameters, Box, Tag>::type * apply(Allocators & allocators)
+ static inline typename node<Value, Parameters, Box, Allocators, Tag>::type *
+ apply(Allocators & allocators)
{
return create_node_poly<
- typename Allocators::leaf_allocator_type,
- leaf_poly<Value, Parameters, Box, Tag>
+ leaf_poly<Value, Parameters, Box, Allocators, Tag>
>::template apply<
- typename node<Value, Parameters, Box, Tag>::type
- >(allocators.leaf_allocator);
+ typename node<Value, Parameters, Box, Allocators, Tag>::type
+ >(allocators.leaf_allocator, allocators.leaf_elements_allocator);
}
};
@@ -342,14 +346,13 @@
template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
struct destroy_node<
Allocators,
- internal_node_poly<Value, Parameters, Box, Tag>
+ internal_node_poly<Value, Parameters, Box, Allocators, Tag>
>
{
- static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Tag>::type * n)
+ static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Allocators, Tag>::type * n)
{
destroy_node_poly<
- typename Allocators::internal_node_allocator_type,
- internal_node_poly<Value, Parameters, Box, Tag>
+ internal_node_poly<Value, Parameters, Box, Allocators, Tag>
>::apply(allocators.internal_node_allocator, n);
}
};
@@ -357,14 +360,13 @@
template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
struct destroy_node<
Allocators,
- leaf_poly<Value, Parameters, Box, Tag>
+ leaf_poly<Value, Parameters, Box, Allocators, Tag>
>
{
- static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Tag>::type * n)
+ static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Allocators, Tag>::type * n)
{
destroy_node_poly<
- typename Allocators::leaf_allocator_type,
- leaf_poly<Value, Parameters, Box, Tag>
+ leaf_poly<Value, Parameters, Box, Allocators, Tag>
>::apply(allocators.leaf_allocator, n);
}
};
Modified: 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 (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default_static.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -16,36 +16,105 @@
namespace detail { namespace rtree {
-template <typename Value, typename Parameters, typename Box>
-struct internal_node_poly<Value, Parameters, Box, node_default_static_tag>
- : public node_poly<Value, Parameters, Box, node_default_static_tag>
+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, node_default_static_tag> *
+ node_poly<Value, Parameters, Box, Allocators, node_default_static_tag> *
>,
Parameters::max_elements + 1
> elements_type;
- void apply_visitor(visitor_poly<Value, Parameters, Box, node_default_static_tag, false> & v) { v(*this); }
- void apply_visitor(visitor_poly<Value, Parameters, Box, node_default_static_tag, true> & v) const { v(*this); }
+ 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>
-struct leaf_poly<Value, Parameters, Box, node_default_static_tag>
- : public node_poly<Value, Parameters, Box, node_default_static_tag>
+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;
- void apply_visitor(visitor_poly<Value, Parameters, Box, node_default_static_tag, false> & v) { v(*this); }
- void apply_visitor(visitor_poly<Value, Parameters, Box, node_default_static_tag, true> & v) const { v(*this); }
+ 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;
};
+// 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
Modified: 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 (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -19,64 +19,136 @@
// nodes default types
-template <typename Value, typename Parameters, typename Box>
-struct internal_node_variant<Value, Parameters, Box, node_default_static_variant_tag>
+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, node_default_static_variant_tag>::type *
+ 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>
-struct leaf_variant<Value, Parameters, Box, node_default_static_variant_tag>
+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>
-struct node<Value, Parameters, Box, node_default_static_variant_tag>
+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, node_default_static_variant_tag>,
- internal_node_variant<Value, Parameters, Box, node_default_static_variant_tag>
+ 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>
-struct internal_node<Value, Parameters, Box, node_default_static_variant_tag>
+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, node_default_static_variant_tag> type;
+ typedef internal_node_variant<Value, Parameters, Box, Allocators, node_default_static_variant_tag> type;
};
-template <typename Value, typename Parameters, typename Box>
-struct leaf<Value, Parameters, Box, node_default_static_variant_tag>
+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, node_default_static_variant_tag> type;
+ typedef leaf_variant<Value, Parameters, Box, Allocators, node_default_static_variant_tag> type;
};
// visitor traits
-template <typename Value, typename Parameters, typename Box, bool IsVisitableConst>
-struct visitor<Value, Parameters, Box, node_default_static_variant_tag, IsVisitableConst>
+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 Value, typename Parameters, typename Box, typename Allocator>
-struct allocators<Value, Parameters, Box, node_default_static_variant_tag, Allocator>
+template <typename Allocator, typename Value, typename Parameters, typename Box>
+struct allocators<Allocator, Value, Parameters, Box, node_default_static_variant_tag>
{
- typedef allocators_variant<Value, Parameters, Box, node_default_static_variant_tag, Allocator> type;
+ 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
Modified: 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 (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -19,67 +19,80 @@
// nodes default types
-template <typename Value, typename Parameters, typename Box, typename Tag>
+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, Tag>::type *
- >
+ 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 Tag>
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
struct leaf_variant
{
- typedef std::vector<Value> elements_type;
+ 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>
-struct node<Value, Parameters, Box, node_default_variant_tag>
+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, node_default_variant_tag>,
- internal_node_variant<Value, Parameters, Box, node_default_variant_tag>
+ 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>
-struct internal_node<Value, Parameters, Box, node_default_variant_tag>
+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, node_default_variant_tag> type;
+ typedef internal_node_variant<Value, Parameters, Box, Allocators, node_default_variant_tag> type;
};
-template <typename Value, typename Parameters, typename Box>
-struct leaf<Value, Parameters, Box, node_default_variant_tag>
+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, node_default_variant_tag> type;
+ typedef leaf_variant<Value, Parameters, Box, Allocators, node_default_variant_tag> type;
};
// nodes conversion
-template <typename V, typename Value, typename Parameters, typename Box, typename Tag>
+template <typename V, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
inline V & get(
boost::variant<
- leaf_variant<Value, Parameters, Box, Tag>,
- internal_node_variant<Value, Parameters, Box, Tag>
+ 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 Tag>
+template <typename V, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
inline V * get(
boost::variant<
- leaf_variant<Value, Parameters, Box, Tag>,
- internal_node_variant<Value, Parameters, Box, Tag>
+ leaf_variant<Value, Parameters, Box, Allocators, Tag>,
+ internal_node_variant<Value, Parameters, Box, Allocators, Tag>
> *v
)
{
@@ -88,27 +101,27 @@
// visitor traits
-template <typename Value, typename Parameters, typename Box, bool IsVisitableConst>
-struct visitor<Value, Parameters, Box, node_default_variant_tag, IsVisitableConst>
+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 Tag>
+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, Tag>,
- internal_node_variant<Value, Parameters, Box, Tag>
+ 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 Tag>
+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, Tag>,
- internal_node_variant<Value, Parameters, Box, Tag>
+ leaf_variant<Value, Parameters, Box, Allocators, Tag>,
+ internal_node_variant<Value, Parameters, Box, Allocators, Tag>
> const& n)
{
boost::apply_visitor(v, n);
@@ -116,13 +129,13 @@
// element's indexable type
-template <typename Value, typename Parameters, typename Box, typename Tag, typename Translator>
+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, Tag>,
- internal_node_variant<Value, Parameters, Box, Tag>
+ leaf_variant<Value, Parameters, Box, Allocators, Tag>,
+ internal_node_variant<Value, Parameters, Box, Allocators, Tag>
> *
>,
Translator
@@ -133,13 +146,13 @@
// element's indexable getter
-template <typename Value, typename Parameters, typename Box, typename Tag, typename Translator>
+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, Tag>,
- internal_node_variant<Value, Parameters, Box, Tag>
+ leaf_variant<Value, Parameters, Box, Allocators, Tag>,
+ internal_node_variant<Value, Parameters, Box, Allocators, Tag>
> *
> const& el,
Translator const&)
@@ -149,53 +162,65 @@
// allocators
-template <typename Value, typename Parameters, typename Box, typename Tag, typename Allocator>
+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, node_default_variant_tag>::type
+ 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 Value, typename Parameters, typename Box, typename Allocator>
-struct allocators<Value, Parameters, Box, node_default_variant_tag, Allocator>
+template <typename Allocator, typename Value, typename Parameters, typename Box>
+struct allocators<Allocator, Value, Parameters, Box, node_default_variant_tag>
{
- typedef allocators_variant<Value, Parameters, Box, node_default_variant_tag, Allocator> type;
+ typedef allocators_variant<Allocator, Value, Parameters, Box, node_default_variant_tag> type;
};
// create_node_variant
-template <typename Allocator, typename Node>
+template <typename Node>
struct create_node_variant
{
- template <typename RetNode>
- static inline RetNode * apply(Allocator & allocator)
+ template <typename RetNode, typename AllocNode, typename AllocElems>
+ static inline RetNode * apply(AllocNode & alloc_node, AllocElems & alloc_elems)
{
- RetNode * p = allocator.allocate(1);
+ RetNode * p = alloc_node.allocate(1);
if ( 0 == p )
throw std::bad_alloc();
try
{
- allocator.construct(p, Node());
+ alloc_node.construct(p, Node(alloc_elems));
}
catch(...)
{
- allocator.deallocate(p, 1);
+ alloc_node.deallocate(p, 1);
throw;
}
@@ -205,14 +230,14 @@
// destroy_node_variant
-template <typename Allocator, typename Node>
+template <typename Node>
struct destroy_node_variant
{
- template <typename BaseNode>
- static inline void apply(Allocator & allocator, BaseNode * n)
+ template <typename AllocNode, typename BaseNode>
+ static inline void apply(AllocNode & alloc_node, BaseNode * n)
{
- allocator.destroy(n);
- allocator.deallocate(n, 1);
+ alloc_node.destroy(n);
+ alloc_node.deallocate(n, 1);
}
};
@@ -221,35 +246,34 @@
template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
struct create_node<
Allocators,
- internal_node_variant<Value, Parameters, Box, Tag>
+ internal_node_variant<Value, Parameters, Box, Allocators, Tag>
>
{
- static inline typename node<Value, Parameters, Box, Tag>::type *
+ static inline typename node<Value, Parameters, Box, Allocators, Tag>::type *
apply(Allocators & allocators)
{
return create_node_variant<
- typename Allocators::node_allocator_type,
- internal_node_variant<Value, Parameters, Box, Tag>
+ internal_node_variant<Value, Parameters, Box, Allocators, Tag>
>::template apply<
- typename node<Value, Parameters, Box, Tag>::type
- >(allocators.node_allocator);
+ 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, Tag>
+ leaf_variant<Value, Parameters, Box, Allocators, Tag>
>
{
- static inline typename node<Value, Parameters, Box, Tag>::type * apply(Allocators & allocators)
+ static inline typename node<Value, Parameters, Box, Allocators, Tag>::type *
+ apply(Allocators & allocators)
{
return create_node_variant<
- typename Allocators::node_allocator_type,
- leaf_variant<Value, Parameters, Box, Tag>
+ leaf_variant<Value, Parameters, Box, Allocators, Tag>
>::template apply<
- typename node<Value, Parameters, Box, Tag>::type
- >(allocators.node_allocator);
+ typename node<Value, Parameters, Box, Allocators, Tag>::type
+ >(allocators.node_allocator, allocators.leaf_elements_allocator);
}
};
@@ -258,14 +282,13 @@
template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
struct destroy_node<
Allocators,
- internal_node_variant<Value, Parameters, Box, Tag>
+ internal_node_variant<Value, Parameters, Box, Allocators, Tag>
>
{
- static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Tag>::type * n)
+ static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Allocators, Tag>::type * n)
{
destroy_node_variant<
- typename Allocators::node_allocator_type,
- internal_node_variant<Value, Parameters, Box, Tag>
+ internal_node_variant<Value, Parameters, Box, Allocators, Tag>
>::apply(allocators.node_allocator, n);
}
};
@@ -273,14 +296,13 @@
template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
struct destroy_node<
Allocators,
- leaf_variant<Value, Parameters, Box, Tag>
+ leaf_variant<Value, Parameters, Box, Allocators, Tag>
>
{
- static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Tag>::type * n)
+ static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Allocators, Tag>::type * n)
{
destroy_node_variant<
- typename Allocators::node_allocator_type,
- leaf_variant<Value, Parameters, Box, Tag>
+ leaf_variant<Value, Parameters, Box, Allocators, Tag>
>::apply(allocators.node_allocator, n);
}
};
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -75,14 +75,14 @@
} // namespace quadratic
-template <typename Value, typename Options, typename Translator, typename Box>
-struct redistribute_elements<Value, Options, Translator, Box, quadratic_tag>
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+struct redistribute_elements<Value, Options, Translator, Box, Allocators, quadratic_tag>
{
typedef typename Options::parameters_type parameters_type;
- typedef typename rtree::node<Value, parameters_type, Box, typename Options::node_tag>::type node;
- typedef typename rtree::internal_node<Value, parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
typedef typename index::default_content_result<Box>::type content_type;
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -27,12 +27,12 @@
namespace detail {
-template <typename Value, typename Options, typename Box>
-class choose_next_node<Value, Options, Box, choose_by_overlap_diff_tag>
+template <typename Value, typename Options, typename Box, typename Allocators>
+class choose_next_node<Value, Options, Box, Allocators, choose_by_overlap_diff_tag>
{
- typedef typename rtree::node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type node;
- typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
typedef typename rtree::elements_type<internal_node>::type children_type;
typedef typename children_type::value_type child_type;
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/insert.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/insert.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/insert.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -20,13 +20,13 @@
namespace rstar {
-template <typename Value, typename Options, typename Translator, typename Box>
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
class remove_elements_to_reinsert
{
public:
- typedef typename rtree::node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type node;
- typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
typedef typename Options::parameters_type parameters_type;
@@ -103,19 +103,19 @@
}
};
-template <size_t InsertIndex, typename Element, typename Value, typename Options, typename Box>
+template <size_t InsertIndex, typename Element, typename Value, typename Options, typename Box, typename Allocators>
struct level_insert_elements_type
{
typedef typename rtree::elements_type<
- typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type
+ typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type
>::type type;
};
-template <typename Value, typename Options, typename Box>
-struct level_insert_elements_type<0, Value, Value, Options, Box>
+template <typename Value, typename Options, typename Box, typename Allocators>
+struct level_insert_elements_type<0, Value, Value, Options, Box, Allocators>
{
typedef typename rtree::elements_type<
- typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type
+ typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type
>::type type;
};
@@ -128,7 +128,7 @@
typedef typename base::internal_node internal_node;
typedef typename base::leaf leaf;
- typedef typename level_insert_elements_type<InsertIndex, Element, Value, Options, Box>::type elements_type;
+ typedef typename level_insert_elements_type<InsertIndex, Element, Value, Options, Box, Allocators>::type elements_type;
typedef typename Options::parameters_type parameters_type;
inline level_insert_base(node* & root,
@@ -154,7 +154,7 @@
// node isn't root node
if ( base::m_parent )
{
- rstar::remove_elements_to_reinsert<Value, Options, Translator, Box>::apply(
+ rstar::remove_elements_to_reinsert<Value, Options, Translator, Box, Allocators>::apply(
result_elements, n,
base::m_parent, base::m_current_child_index,
base::m_tr);
@@ -355,13 +355,13 @@
// R*-tree insert visitor
template <typename Element, typename Value, typename Options, typename Translator, typename Box, typename Allocators>
class insert<Element, Value, Options, Translator, Box, Allocators, insert_reinsert_tag>
- : public rtree::visitor<Value, typename Options::parameters_type, Box, typename Options::node_tag, false>::type
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, false>::type
, index::nonassignable
{
private:
- typedef typename rtree::node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type node;
- typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
public:
inline insert(node* & root,
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -308,12 +308,12 @@
} // namespace rstar
-template <typename Value, typename Options, typename Translator, typename Box>
-struct redistribute_elements<Value, Options, Translator, Box, rstar_tag>
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+struct redistribute_elements<Value, Options, Translator, Box, Allocators, rstar_tag>
{
- typedef typename rtree::node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type node;
- typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
typedef typename Options::parameters_type parameters_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 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -59,8 +59,6 @@
// TODO change remove() to erase() or just add erase() ?
// erase works on iterators of this container so this may be confusing with remove(ValIt, ValIt)
-// TODO delete unneeded nodes types (using vectors) and change the name of currently used one to node_default
-
template <
typename Value,
typename Parameters,
@@ -75,18 +73,18 @@
typedef Translator translator_type;
typedef typename translator_type::indexable_type indexable_type;
typedef typename index::default_box_type<indexable_type>::type box_type;
-
+
typedef typename detail::rtree::options_type<Parameters>::type options_type;
typedef typename options_type::node_tag node_tag;
- typedef typename detail::rtree::node<value_type, typename options_type::parameters_type, box_type, node_tag>::type node;
- typedef typename detail::rtree::internal_node<value_type, typename options_type::parameters_type, box_type, node_tag>::type internal_node;
- typedef typename detail::rtree::leaf<value_type, typename options_type::parameters_type, box_type, node_tag>::type leaf;
-
typedef Allocator allocator_type;
- typedef typename detail::rtree::allocators<value_type, typename options_type::parameters_type, box_type, node_tag, allocator_type>::type allocators_type;
+ typedef typename detail::rtree::allocators<allocator_type, value_type, typename options_type::parameters_type, box_type, node_tag>::type 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;
+ typedef typename detail::rtree::internal_node<value_type, typename options_type::parameters_type, box_type, allocators_type, node_tag>::type internal_node;
+ typedef typename detail::rtree::leaf<value_type, typename options_type::parameters_type, box_type, allocators_type, node_tag>::type leaf;
+
inline explicit rtree(translator_type const& translator = translator_type(), Allocator allocator = std::allocator<value_type>())
: m_values_count(0)
, m_root(0)
@@ -220,7 +218,7 @@
template <typename Predicates, typename OutIter>
inline size_type query(Predicates const& pred, OutIter out_it) const
{
- detail::rtree::visitors::query<value_type, options_type, translator_type, box_type, Predicates, OutIter>
+ detail::rtree::visitors::query<value_type, options_type, translator_type, box_type, allocators_type, Predicates, OutIter>
find_v(m_translator, pred, out_it);
detail::rtree::apply_visitor(find_v, *m_root);
@@ -277,7 +275,7 @@
return result;
}
- detail::rtree::visitors::children_box<value_type, options_type, translator_type, box_type>
+ detail::rtree::visitors::children_box<value_type, options_type, translator_type, box_type, allocators_type>
children_box_v(m_translator);
detail::rtree::apply_visitor(children_box_v, *m_root);
@@ -356,6 +354,7 @@
options_type,
translator_type,
box_type,
+ allocators_type,
DistancesPredicates,
Predicates,
result_type
@@ -385,6 +384,7 @@
options_type,
translator_type,
box_type,
+ allocators_type,
DistancesPredicates,
Predicates,
result_type
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -17,13 +17,13 @@
namespace detail { namespace rtree { namespace visitors {
-template <typename Value, typename Options, typename Translator, typename Box>
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
class are_boxes_ok
- : public rtree::visitor<Value, typename Options::parameters_type, Box, typename Options::node_tag, true>::type
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
, index::nonassignable
{
- typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
public:
inline are_boxes_ok(Translator const& tr)
@@ -109,15 +109,17 @@
}}} // namespace detail::rtree::visitors
-template <typename Value, typename Options, typename Translator>
-bool are_boxes_ok(rtree<Value, Options, Translator> const& tree)
+template <typename Value, typename Options, typename Translator, typename Allocator>
+bool are_boxes_ok(rtree<Value, Options, Translator, Allocator> const& tree)
{
- typedef rtree<Value, Options, Translator> rt;
+ typedef rtree<Value, Options, Translator, Allocator> rt;
detail::rtree::visitors::are_boxes_ok<
typename rt::value_type,
typename rt::options_type,
typename rt::translator_type,
- typename rt::box_type> v(tree.translator());
+ typename rt::box_type,
+ typename rt::allocators_type
+ > v(tree.translator());
tree.apply_visitor(v);
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -16,13 +16,13 @@
namespace detail { namespace rtree { namespace visitors {
-template <typename Value, typename Options, typename Translator, typename Box>
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
class are_levels_ok
- : public rtree::visitor<Value, typename Options::parameters_type, Box, typename Options::node_tag, true>::type
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
, index::nonassignable
{
- typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
public:
inline are_levels_ok(Translator const& tr)
@@ -87,15 +87,17 @@
}}} // namespace detail::rtree::visitors
-template <typename Value, typename Options, typename Translator>
-bool are_levels_ok(rtree<Value, Options, Translator> const& tree)
+template <typename Value, typename Options, typename Translator, typename Allocator>
+bool are_levels_ok(rtree<Value, Options, Translator, Allocator> const& tree)
{
- typedef rtree<Value, Options, Translator> rt;
+ typedef rtree<Value, Options, Translator, Allocator> rt;
detail::rtree::visitors::are_levels_ok<
typename rt::value_type,
typename rt::options_type,
typename rt::translator_type,
- typename rt::box_type> v(tree.translator());
+ typename rt::box_type,
+ typename rt::allocators_type
+ > v(tree.translator());
tree.apply_visitor(v);
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/children_box.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/children_box.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/children_box.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -16,13 +16,13 @@
namespace detail { namespace rtree { namespace visitors {
-template <typename Value, typename Options, typename Translator, typename Box>
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
class children_box
- : public rtree::visitor<Value, typename Options::parameters_type, Box, typename Options::node_tag, true>::type
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
, index::nonassignable
{
- typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
public:
inline children_box(Translator const& tr)
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/copy.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/copy.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/copy.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -18,13 +18,13 @@
template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
class copy
- : public rtree::visitor<Value, typename Options::parameters_type, Box, typename Options::node_tag, false>::type
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, false>::type
, boost::noncopyable
{
public:
- typedef typename rtree::node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type node;
- typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
explicit inline copy(Allocators & allocators)
: result(0)
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/destroy.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/destroy.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/destroy.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -18,13 +18,13 @@
template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
class destroy
- : public rtree::visitor<Value, typename Options::parameters_type, Box, typename Options::node_tag, false>::type
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, false>::type
, boost::noncopyable
{
public:
- typedef typename rtree::node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type node;
- typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
inline destroy(node * root_node, Allocators & allocators)
: m_current_node(root_node)
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -93,11 +93,11 @@
} // namespace detail
-template <typename Value, typename Options, typename Translator, typename Box>
-struct gl_draw : public rtree::visitor<Value, typename Options::parameters_type, Box, typename Options::node_tag, true>::type
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+struct gl_draw : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
{
- typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
inline gl_draw(Translator const& t,
size_t level_first = 0,
@@ -186,21 +186,24 @@
}}} // namespace detail::rtree::visitors
-template <typename Value, typename Options, typename Translator>
-void gl_draw(rtree<Value, Options, Translator> const& tree,
+template <typename Value, typename Options, typename Translator, typename Allocator>
+void gl_draw(rtree<Value, Options, Translator, Allocator> const& tree,
size_t level_first = 0,
size_t level_last = std::numeric_limits<size_t>::max(),
typename index::traits::coordinate_type<
- typename rtree<Value, Options, Translator>::box_type
+ typename rtree<Value, Options, Translator, Allocator>::box_type
>::type z_coord_level_multiplier = 1
)
{
- typedef typename rtree<Value, Options, Translator>::value_type value_type;
- typedef typename rtree<Value, Options, Translator>::options_type options_type;
- typedef typename rtree<Value, Options, Translator>::translator_type translator_type;
- typedef typename rtree<Value, Options, Translator>::box_type box_type;
+ typedef rtree<Value, Options, Translator, Allocator> rtree_type;
- detail::rtree::visitors::gl_draw<value_type, options_type, translator_type, box_type>
+ typedef typename rtree_type::value_type value_type;
+ typedef typename rtree_type::options_type options_type;
+ typedef typename rtree_type::translator_type translator_type;
+ typedef typename rtree_type::box_type box_type;
+ typedef typename rtree_type::allocators_type allocators_type;
+
+ detail::rtree::visitors::gl_draw<value_type, options_type, translator_type, box_type, allocators_type>
gl_draw_v(tree.translator(), level_first, level_last, z_coord_level_multiplier);
tree.apply_visitor(gl_draw_v);
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/insert.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/insert.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/insert.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -21,15 +21,15 @@
namespace detail {
// Default choose_next_node
-template <typename Value, typename Options, typename Box, typename ChooseNextNodeTag>
+template <typename Value, typename Options, typename Box, typename Allocators, typename ChooseNextNodeTag>
struct choose_next_node;
-template <typename Value, typename Options, typename Box>
-struct choose_next_node<Value, Options, Box, choose_by_content_diff_tag>
+template <typename Value, typename Options, typename Box, typename Allocators>
+struct choose_next_node<Value, Options, Box, Allocators, choose_by_content_diff_tag>
{
- typedef typename rtree::node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type node;
- typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
typedef typename rtree::elements_type<internal_node>::type children_type;
@@ -80,28 +80,28 @@
// ----------------------------------------------------------------------- //
// Not implemented here
-template <typename Value, typename Options, typename Translator, typename Box, typename RedistributeTag>
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators, typename RedistributeTag>
struct redistribute_elements;
// ----------------------------------------------------------------------- //
// Split algorithm
-template <typename Value, typename Options, typename Translator, typename Box, typename SplitTag>
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators, typename SplitTag>
class split;
// Default split algorithm
-template <typename Value, typename Options, typename Translator, typename Box>
-class split<Value, Options, Translator, Box, split_default_tag>
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+class split<Value, Options, Translator, Box, Allocators, split_default_tag>
{
protected:
- typedef typename rtree::node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type node;
- typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
typedef typename Options::parameters_type parameters_type;
public:
- template <typename Node, typename Allocators>
+ template <typename Node>
static inline void apply(node* & root_node,
size_t & leafs_level,
Node & n,
@@ -116,7 +116,7 @@
// redistribute elements
Box box1, box2;
- redistribute_elements<Value, Options, Translator, Box, typename Options::redistribute_tag>::
+ redistribute_elements<Value, Options, Translator, Box, Allocators, typename Options::redistribute_tag>::
apply(n, n2, box1, box2, tr);
// check numbers of elements
@@ -157,13 +157,13 @@
// Default insert visitor
template <typename Element, typename Value, typename Options, typename Translator, typename Box, typename Allocators>
class insert
- : public rtree::visitor<Value, typename Options::parameters_type, Box, typename Options::node_tag, false>::type
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, false>::type
, index::nonassignable
{
protected:
- typedef typename rtree::node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type node;
- typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
typedef typename Options::parameters_type parameters_type;
@@ -196,7 +196,7 @@
inline void traverse(Visitor & visitor, internal_node & n)
{
// choose next node
- size_t choosen_node_index = detail::choose_next_node<Value, Options, Box, typename Options::choose_next_node_tag>::
+ size_t choosen_node_index = detail::choose_next_node<Value, Options, Box, Allocators, typename Options::choose_next_node_tag>::
apply(n, rtree::element_indexable(m_element, m_tr), m_leafs_level - m_current_level);
// expand the node to contain value
@@ -248,7 +248,7 @@
template <typename Node>
inline void split(Node & n) const
{
- detail::split<Value, Options, Translator, Box, typename Options::split_tag>::apply(m_root_node, m_leafs_level, n, m_parent, m_current_child_index, m_tr, m_allocators);
+ detail::split<Value, Options, Translator, Box, Allocators, typename Options::split_tag>::apply(m_root_node, m_leafs_level, n, m_parent, m_current_child_index, m_tr, m_allocators);
}
// TODO: awulkiew - implement dispatchable split::apply to enable additional nodes creation
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -16,11 +16,11 @@
namespace detail { namespace rtree { namespace visitors {
-template <typename Value, typename Options, typename Box>
-struct is_leaf : public rtree::visitor<Value, typename Options::parameters_type, Box, typename Options::node_tag, true>::type
+template <typename Value, typename Options, typename Box, typename Allocators>
+struct is_leaf : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
{
- typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
inline void operator()(internal_node const&)
{
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/nearest.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/nearest.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/nearest.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -141,18 +141,19 @@
typename Options,
typename Translator,
typename Box,
+ typename Allocators,
typename DistancesPredicates,
typename Predicates,
typename Result
>
class nearest
- : public rtree::visitor<Value, typename Options::parameters_type, Box, typename Options::node_tag, true>::type
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
, index::nonassignable
{
public:
- typedef typename rtree::node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type node;
- typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
typedef index::detail::distances_calc<DistancesPredicates, Box, rtree::node_tag> node_distances_calc;
typedef typename node_distances_calc::result_type node_distances_type;
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/print.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/print.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/print.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -111,11 +111,11 @@
} // namespace detail
-template <typename Value, typename Options, typename Translator, typename Box>
-struct print : public rtree::visitor<Value, typename Options::parameters_type, Box, typename Options::node_tag, true>::type
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+struct print : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
{
- typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
inline print(std::ostream & o, Translator const& t)
: os(o), tr(t), level(0)
@@ -178,14 +178,16 @@
}}} // namespace detail::rtree::visitors
-template <typename Value, typename Options, typename Translator>
-std::ostream & operator<<(std::ostream & os, rtree<Value, Options, Translator> const& tree)
+template <typename Value, typename Options, typename Translator, typename Allocator>
+std::ostream & operator<<(std::ostream & os, rtree<Value, Options, Translator, Allocator> const& tree)
{
- typedef typename rtree<Value, Options, Translator>::value_type value_type;
- typedef typename rtree<Value, Options, Translator>::options_type options_type;
- typedef typename rtree<Value, Options, Translator>::translator_type translator_type;
- typedef typename rtree<Value, Options, Translator>::box_type box_type;
- detail::rtree::visitors::print<value_type, options_type, translator_type, box_type> print_v(os, tree.translator());
+ typedef rtree<Value, Options, Translator, Allocator> rtree_type;
+ typedef typename rtree_type::value_type value_type;
+ typedef typename rtree_type::options_type options_type;
+ typedef typename rtree_type::translator_type translator_type;
+ typedef typename rtree_type::box_type box_type;
+ typedef typename rtree_type::allocators_type allocators_type;
+ detail::rtree::visitors::print<value_type, options_type, translator_type, box_type, allocators_type> print_v(os, tree.translator());
tree.apply_visitor(print_v);
return os;
}
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/query.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/query.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/query.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -16,14 +16,14 @@
namespace detail { namespace rtree { namespace visitors {
-template <typename Value, typename Options, typename Translator, typename Box, typename Predicates, typename OutIter>
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators, typename Predicates, typename OutIter>
struct query
- : public rtree::visitor<Value, typename Options::parameters_type, Box, typename Options::node_tag, true>::type
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
, index::nonassignable
{
- typedef typename rtree::node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type node;
- typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
inline query(Translator const& t, Predicates const& p, OutIter out_it)
: tr(t), pred(p), out_iter(out_it), found_count(0)
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/remove.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/remove.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/remove.hpp 2011-10-03 16:30:53 EDT (Mon, 03 Oct 2011)
@@ -23,12 +23,12 @@
// Default remove algorithm
template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
class remove
- : public rtree::visitor<Value, typename Options::parameters_type, Box, typename Options::node_tag, false>::type
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, false>::type
, index::nonassignable
{
- typedef typename rtree::node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type node;
- typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
- typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type leaf;
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
typedef typename Options::parameters_type parameters_type;
@@ -114,7 +114,7 @@
for ( typename std::vector< std::pair<size_t, node*> >::reverse_iterator it = m_underflowed_nodes.rbegin();
it != m_underflowed_nodes.rend() ; ++it )
{
- is_leaf<Value, Options, Box> ilv;
+ is_leaf<Value, Options, Box, Allocators> ilv;
rtree::apply_visitor(ilv, *it->second);
if ( ilv.result )
{
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