|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r74647 - in sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree: . node visitors
From: adam.wulkiewicz_at_[hidden]
Date: 2011-10-02 08:43:00
Author: awulkiew
Date: 2011-10-02 08:42:59 EDT (Sun, 02 Oct 2011)
New Revision: 74647
URL: http://svn.boost.org/trac/boost/changeset/74647
Log:
boost::variant based nodes with static-size elements containers added
Added:
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp (contents, props changed)
Text files modified:
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node.hpp | 1 +
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default_static.hpp | 5 ++++-
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/options.hpp | 1 +
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rtree.hpp | 1 +
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/destroy.hpp | 4 +---
5 files changed, 8 insertions(+), 4 deletions(-)
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-02 08:42:59 EDT (Sun, 02 Oct 2011)
@@ -14,5 +14,6 @@
#include <boost/geometry/extensions/index/rtree/node/node_default_variant.hpp>
#include <boost/geometry/extensions/index/rtree/node/node_default_static.hpp>
+#include <boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp>
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP
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-02 08:42:59 EDT (Sun, 02 Oct 2011)
@@ -21,7 +21,10 @@
: public node_poly<Value, Parameters, Box, node_default_static_tag>
{
typedef index::pushable_array<
- std::pair<Box, node_poly<Value, Parameters, Box, node_default_static_tag> *>,
+ std::pair<
+ Box,
+ node_poly<Value, Parameters, Box, node_default_static_tag> *
+ >,
Parameters::max_elements + 1
> elements_type;
Added: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp 2011-10-02 08:42:59 EDT (Sun, 02 Oct 2011)
@@ -0,0 +1,78 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Boost.Index - R-tree variant nodes with static-size containers
+//
+// Copyright 2011 Adam Wulkiewicz.
+// 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>
+struct internal_node_variant<Value, Parameters, Box, node_default_static_variant_tag>
+{
+ typedef index::pushable_array<
+ std::pair<
+ Box,
+ typename node<Value, Parameters, Box, node_default_static_variant_tag>::type *
+ >,
+ Parameters::max_elements + 1
+ > elements_type;
+
+ elements_type elements;
+};
+
+template <typename Value, typename Parameters, typename Box>
+struct leaf_variant<Value, Parameters, Box, node_default_static_variant_tag>
+{
+ typedef index::pushable_array<Value, Parameters::max_elements + 1> elements_type;
+ elements_type elements;
+};
+
+// nodes traits
+
+template <typename Value, typename Parameters, typename Box>
+struct node<Value, Parameters, Box, 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>
+ > type;
+};
+
+template <typename Value, typename Parameters, typename Box>
+struct internal_node<Value, Parameters, Box, node_default_static_variant_tag>
+{
+ typedef internal_node_variant<Value, Parameters, Box, node_default_static_variant_tag> type;
+};
+
+template <typename Value, typename Parameters, typename Box>
+struct leaf<Value, Parameters, Box, node_default_static_variant_tag>
+{
+ typedef leaf_variant<Value, Parameters, Box, 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>
+{
+ typedef static_visitor<> type;
+};
+
+}} // 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 2011-10-02 08:42:59 EDT (Sun, 02 Oct 2011)
@@ -32,6 +32,7 @@
struct node_default_tag {};
struct node_default_variant_tag {};
struct node_default_static_tag {};
+struct node_default_static_variant_tag {};
// TODO: awulkiew - implement those:
//if ( m_min_elems_per_node < 1 )
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-02 08:42:59 EDT (Sun, 02 Oct 2011)
@@ -274,6 +274,7 @@
{
detail::rtree::visitors::destroy<value_type, options_type, translator_type, box_type> del_v;
detail::rtree::apply_visitor(del_v, *t.m_root);
+ detail::rtree::delete_node(t.m_root);
t.m_root = 0;
t.m_values_count = 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-02 08:42:59 EDT (Sun, 02 Oct 2011)
@@ -31,14 +31,12 @@
it != elements.end(); ++it)
{
rtree::apply_visitor(*this, *it->second);
+ rtree::delete_node(it->second);
}
-
- rtree::delete_node(&n);
}
inline void operator()(leaf &n)
{
- rtree::delete_node(&n);
}
};
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