Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80750 - sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node
From: adam.wulkiewicz_at_[hidden]
Date: 2012-09-28 19:27:13


Author: awulkiew
Date: 2012-09-28 19:27:12 EDT (Fri, 28 Sep 2012)
New Revision: 80750
URL: http://svn.boost.org/trac/boost/changeset/80750

Log:
rtree node xxx_poly visitor and node types renamed to dynamic_xxx and moved to dynamic_visitor.hpp
Added:
   sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp (contents, props changed)
Text files modified:
   sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node/node_default.hpp | 100 ++++++++++++---------------------------
   sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node/node_default_static.hpp | 31 ++++++------
   sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp | 2
   sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp | 2
   4 files changed, 50 insertions(+), 85 deletions(-)

Added: sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp 2012-09-28 19:27:12 EDT (Fri, 28 Sep 2012)
@@ -0,0 +1,70 @@
+// Boost.Geometry Index
+//
+// R-tree nodes dynamic visitor and nodes base type
+//
+// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.
+//
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_DYNAMIC_VISITOR_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_DYNAMIC_VISITOR_HPP
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+// visitor forward declaration
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, bool IsVisitableConst>
+struct dynamic_visitor;
+
+// node
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct dynamic_node
+{
+ virtual ~dynamic_node() {}
+ virtual void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, Tag, false> &) = 0;
+ virtual void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, Tag, true> &) const = 0;
+};
+
+// nodes variants forward declarations
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct dynamic_internal_node;
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct dynamic_leaf;
+
+// visitor
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct dynamic_visitor<Value, Parameters, Box, Allocators, Tag, true>
+{
+ typedef dynamic_internal_node<Value, Parameters, Box, Allocators, Tag> internal_node;
+ typedef dynamic_leaf<Value, Parameters, Box, Allocators, Tag> leaf;
+
+ virtual ~dynamic_visitor() {}
+
+ virtual void operator()(internal_node const&) = 0;
+ virtual void operator()(leaf const&) = 0;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct dynamic_visitor<Value, Parameters, Box, Allocators, Tag, false>
+{
+ typedef dynamic_internal_node<Value, Parameters, Box, Allocators, Tag> internal_node;
+ typedef dynamic_leaf<Value, Parameters, Box, Allocators, Tag> leaf;
+
+ virtual ~dynamic_visitor() {}
+
+ virtual void operator()(internal_node &) = 0;
+ virtual void operator()(leaf &) = 0;
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_DYNAMIC_VISITOR_HPP

Modified: sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node/node_default.hpp
==============================================================================
--- sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node/node_default.hpp (original)
+++ sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node/node_default.hpp 2012-09-28 19:27:12 EDT (Fri, 28 Sep 2012)
@@ -13,56 +13,46 @@
 
 #include <vector>
 
+#include <boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp>
+
 namespace boost { namespace geometry { namespace index {
 
 namespace detail { namespace rtree {
 
-// visitor forward declaration
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, bool IsVisitableConst>
-struct visitor_poly;
-
-// nodes types
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
-struct node_poly
-{
- virtual ~node_poly() {}
- virtual void apply_visitor(visitor_poly<Value, Parameters, Box, Allocators, Tag, false> &) = 0;
- virtual void apply_visitor(visitor_poly<Value, Parameters, Box, Allocators, Tag, true> &) const = 0;
-};
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
-struct internal_node_poly : public node_poly<Value, Parameters, Box, Allocators, Tag>
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct dynamic_internal_node<Value, Parameters, Box, Allocators, node_default_tag>
+ : public dynamic_node<Value, Parameters, Box, Allocators, node_default_tag>
 {
     typedef std::vector<
- std::pair<Box, node_poly<Value, Parameters, Box, Allocators, Tag> *>,
+ std::pair<Box, dynamic_node<Value, Parameters, Box, Allocators, node_default_tag> *>,
         typename Allocators::internal_node_elements_allocator_type
> elements_type;
 
- inline internal_node_poly(typename Allocators::internal_node_elements_allocator_type & al)
+ inline dynamic_internal_node(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); }
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_default_tag, false> & v) { v(*this); }
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_default_tag, true> & v) const { v(*this); }
 
     elements_type elements;
 };
 
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
-struct leaf_poly : public node_poly<Value, Parameters, Box, Allocators, Tag>
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct dynamic_leaf<Value, Parameters, Box, Allocators, node_default_tag>
+ : public dynamic_node<Value, Parameters, Box, Allocators, node_default_tag>
 {
     typedef std::vector<
         Value,
         typename Allocators::leaf_elements_allocator_type
> elements_type;
 
- inline leaf_poly(typename Allocators::leaf_elements_allocator_type & al)
+ inline dynamic_leaf(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); }
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_default_tag, false> & v) { v(*this); }
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_default_tag, true> & v) const { v(*this); }
 
     elements_type elements;
 };
@@ -72,69 +62,43 @@
 template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
 struct node
 {
- typedef node_poly<Value, Parameters, Box, Allocators, Tag> type;
+ typedef dynamic_node<Value, Parameters, Box, Allocators, Tag> type;
 };
 
 template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
 struct internal_node
 {
- typedef internal_node_poly<Value, Parameters, Box, Allocators, Tag> type;
+ typedef dynamic_internal_node<Value, Parameters, Box, Allocators, Tag> type;
 };
 
 template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
 struct leaf
 {
- typedef leaf_poly<Value, Parameters, Box, Allocators, Tag> type;
+ typedef dynamic_leaf<Value, Parameters, Box, Allocators, Tag> type;
 };
 
 // nodes conversion
 
 template <typename Derived, typename Parameters, typename Value, typename Box, typename Allocators, typename Tag>
-inline Derived & get(node_poly<Value, Parameters, Box, Allocators, Tag> & n)
+inline Derived & get(dynamic_node<Value, Parameters, Box, Allocators, Tag> & n)
 {
     assert(dynamic_cast<Derived*>(&n));
     return static_cast<Derived&>(n);
 }
 
 template <typename Derived, typename Parameters, typename Value, typename Box, typename Allocators, typename Tag>
-inline Derived * get(node_poly<Value, Parameters, Box, Allocators, Tag> * n)
+inline Derived * get(dynamic_node<Value, Parameters, Box, Allocators, Tag> * n)
 {
     assert(dynamic_cast<Derived*>(n));
     return static_cast<Derived*>(n);
 }
 
-// visitor
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
-struct visitor_poly<Value, Parameters, Box, Allocators, Tag, true>
-{
- typedef typename internal_node<Value, Parameters, Box, Allocators, Tag>::type internal_node;
- typedef typename leaf<Value, Parameters, Box, Allocators, Tag>::type leaf;
-
- virtual ~visitor_poly() {}
-
- virtual void operator()(internal_node const&) = 0;
- virtual void operator()(leaf const&) = 0;
-};
-
-template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
-struct visitor_poly<Value, Parameters, Box, Allocators, Tag, false>
-{
- typedef typename internal_node<Value, Parameters, Box, Allocators, Tag>::type internal_node;
- typedef typename leaf<Value, Parameters, Box, Allocators, Tag>::type leaf;
-
- virtual ~visitor_poly() {}
-
- virtual void operator()(internal_node &) = 0;
- virtual void operator()(leaf &) = 0;
-};
-
 // visitor traits
 
 template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, bool IsVisitableConst>
 struct visitor
 {
- typedef visitor_poly<Value, Parameters, Box, Allocators, Tag, IsVisitableConst> type;
+ typedef dynamic_visitor<Value, Parameters, Box, Allocators, Tag, IsVisitableConst> type;
 };
 
 template <typename Visitor, typename Visitable>
@@ -153,7 +117,7 @@
 
 template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, typename Translator>
 struct element_indexable_type<
- std::pair<Box, node_poly<Value, Parameters, Box, Allocators, Tag> *>,
+ std::pair<Box, dynamic_node<Value, Parameters, Box, Allocators, Tag> *>,
     Translator
>
 {
@@ -172,7 +136,7 @@
 template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, typename Translator>
 inline Box const&
 element_indexable(
- std::pair< Box, node_poly<Value, Parameters, Box, Allocators, Tag> *> const& el,
+ std::pair< Box, dynamic_node<Value, Parameters, Box, Allocators, Tag> *> const& el,
     Translator const&)
 {
     return el.first;
@@ -224,7 +188,7 @@
>::other leaf_allocator_type;
 
     typedef typename allocator_type::template rebind<
- std::pair<Box, node_poly<Value, Parameters, Box, allocators_poly, Tag> *>
+ std::pair<Box, dynamic_node<Value, Parameters, Box, allocators_poly, Tag> *>
>::other internal_node_elements_allocator_type;
 
     typedef typename allocator_type::template rebind<
@@ -309,14 +273,14 @@
 template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
 struct create_node<
     Allocators,
- internal_node_poly<Value, Parameters, Box, Allocators, Tag>
+ dynamic_internal_node<Value, Parameters, Box, Allocators, Tag>
>
 {
     static inline typename node<Value, Parameters, Box, Allocators, Tag>::type *
     apply(Allocators & allocators)
     {
         return create_node_poly<
- internal_node_poly<Value, Parameters, Box, Allocators, Tag>
+ dynamic_internal_node<Value, Parameters, Box, Allocators, Tag>
>::template apply<
             typename node<Value, Parameters, Box, Allocators, Tag>::type
>(allocators.internal_node_allocator, allocators.internal_node_elements_allocator);
@@ -326,14 +290,14 @@
 template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
 struct create_node<
     Allocators,
- leaf_poly<Value, Parameters, Box, Allocators, Tag>
+ dynamic_leaf<Value, Parameters, Box, Allocators, Tag>
>
 {
     static inline typename node<Value, Parameters, Box, Allocators, Tag>::type *
     apply(Allocators & allocators)
     {
         return create_node_poly<
- leaf_poly<Value, Parameters, Box, Allocators, Tag>
+ dynamic_leaf<Value, Parameters, Box, Allocators, Tag>
>::template apply<
             typename node<Value, Parameters, Box, Allocators, Tag>::type
>(allocators.leaf_allocator, allocators.leaf_elements_allocator);
@@ -354,13 +318,13 @@
 template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
 struct destroy_node<
     Allocators,
- internal_node_poly<Value, Parameters, Box, Allocators, Tag>
+ dynamic_internal_node<Value, Parameters, Box, Allocators, Tag>
>
 {
     static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Allocators, Tag>::type * n)
     {
         destroy_node_poly<
- internal_node_poly<Value, Parameters, Box, Allocators, Tag>
+ dynamic_internal_node<Value, Parameters, Box, Allocators, Tag>
>::apply(allocators.internal_node_allocator, n);
     }
 };
@@ -368,13 +332,13 @@
 template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
 struct destroy_node<
     Allocators,
- leaf_poly<Value, Parameters, Box, Allocators, Tag>
+ dynamic_leaf<Value, Parameters, Box, Allocators, Tag>
>
 {
     static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Allocators, Tag>::type * n)
     {
         destroy_node_poly<
- leaf_poly<Value, Parameters, Box, Allocators, Tag>
+ dynamic_leaf<Value, Parameters, Box, Allocators, Tag>
>::apply(allocators.leaf_allocator, n);
     }
 };

Modified: sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node/node_default_static.hpp
==============================================================================
--- sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node/node_default_static.hpp (original)
+++ sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node/node_default_static.hpp 2012-09-28 19:27:12 EDT (Fri, 28 Sep 2012)
@@ -11,6 +11,7 @@
 #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP
 #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP
 
+#include <boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp>
 #include <boost/geometry/extensions/index/pushable_array.hpp>
 
 namespace boost { namespace geometry { namespace index {
@@ -18,37 +19,37 @@
 namespace detail { namespace rtree {
 
 template <typename Value, typename Parameters, typename Box, typename Allocators>
-struct internal_node_poly<Value, Parameters, Box, Allocators, node_default_static_tag>
- : public node_poly<Value, Parameters, Box, Allocators, node_default_static_tag>
+struct dynamic_internal_node<Value, Parameters, Box, Allocators, node_default_static_tag>
+ : public dynamic_node<Value, Parameters, Box, Allocators, node_default_static_tag>
 {
     typedef index::pushable_array<
         std::pair<
             Box,
- node_poly<Value, Parameters, Box, Allocators, node_default_static_tag> *
+ dynamic_node<Value, Parameters, Box, Allocators, node_default_static_tag> *
>,
                 Parameters::max_elements + 1
> elements_type;
 
     template <typename Dummy>
- inline internal_node_poly(Dummy) {}
+ inline dynamic_internal_node(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); }
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_default_static_tag, false> & v) { v(*this); }
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_default_static_tag, true> & v) const { v(*this); }
 
     elements_type elements;
 };
 
 template <typename Value, typename Parameters, typename Box, typename Allocators>
-struct leaf_poly<Value, Parameters, Box, Allocators, node_default_static_tag>
- : public node_poly<Value, Parameters, Box, Allocators, node_default_static_tag>
+struct dynamic_leaf<Value, Parameters, Box, Allocators, node_default_static_tag>
+ : public dynamic_node<Value, Parameters, Box, Allocators, node_default_static_tag>
 {
     typedef index::pushable_array<Value, Parameters::max_elements + 1> elements_type;
 
     template <typename Dummy>
- inline leaf_poly(Dummy) {}
+ inline dynamic_leaf(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); }
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_default_static_tag, false> & v) { v(*this); }
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_default_static_tag, true> & v) const { v(*this); }
 
     elements_type elements;
 };
@@ -92,14 +93,14 @@
 template <typename Allocators, typename Value, typename Parameters, typename Box>
 struct create_node<
     Allocators,
- internal_node_poly<Value, Parameters, Box, Allocators, node_default_static_tag>
+ dynamic_internal_node<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>
+ dynamic_internal_node<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);
@@ -109,14 +110,14 @@
 template <typename Allocators, typename Value, typename Parameters, typename Box>
 struct create_node<
     Allocators,
- leaf_poly<Value, Parameters, Box, Allocators, node_default_static_tag>
+ dynamic_leaf<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>
+ dynamic_leaf<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);

Modified: sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp
==============================================================================
--- sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp (original)
+++ sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp 2012-09-28 19:27:12 EDT (Fri, 28 Sep 2012)
@@ -92,7 +92,7 @@
>::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> *>
+ std::pair<Box, typename node<Value, Parameters, Box, allocators_variant, node_default_static_variant_tag>::type *>
>::other internal_node_elements_allocator_type;
 
     typedef typename allocator_type::template rebind<

Modified: sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp
==============================================================================
--- sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp (original)
+++ sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp 2012-09-28 19:27:12 EDT (Fri, 28 Sep 2012)
@@ -174,7 +174,7 @@
>::other node_allocator_type;
 
     typedef typename allocator_type::template rebind<
- std::pair<Box, node_poly<Value, Parameters, Box, allocators_variant, node_default_variant_tag> *>
+ std::pair<Box, typename node<Value, Parameters, Box, allocators_variant, node_default_variant_tag>::type *>
>::other internal_node_elements_allocator_type;
 
     typedef typename allocator_type::template rebind<


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