Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80774 - in sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree: . visitors
From: adam.wulkiewicz_at_[hidden]
Date: 2012-09-30 07:40:10


Author: awulkiew
Date: 2012-09-30 07:40:09 EDT (Sun, 30 Sep 2012)
New Revision: 80774
URL: http://svn.boost.org/trac/boost/changeset/80774

Log:
NodeProxy create() template member replaced by template function.
Text files modified:
   sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node_proxy.hpp | 40 +++++++++++++++++++++++++++-------------
   sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/rtree.hpp | 2 +-
   sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/copy.hpp | 4 ++--
   sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/destroy.hpp | 4 ++--
   sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/insert.hpp | 4 ++--
   sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/remove.hpp | 6 +++---
   6 files changed, 37 insertions(+), 23 deletions(-)

Modified: sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node_proxy.hpp
==============================================================================
--- sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node_proxy.hpp (original)
+++ sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/node_proxy.hpp 2012-09-30 07:40:09 EDT (Sun, 30 Sep 2012)
@@ -57,18 +57,6 @@
         , m_allocators(allocator)
     {}
 
- template <typename Node>
- node * create()
- {
- return detail::rtree::create_node<allocators_type, Node>::apply(m_allocators);
- }
-
- template <typename Node>
- void destroy(node * n)
- {
- return detail::rtree::destroy_node<allocators_type, Node>::apply(m_allocators, n);
- }
-
     // HMMMM - trzeba zwracac uwage na translator::return_type
 // template <typename Element>
 // typename element_indexable_type<Element>::type const&
@@ -120,7 +108,12 @@
         return m_translator;
     }
 
- allocator_type allocator() const
+ allocators_type & allocators()
+ {
+ return m_allocators;
+ }
+
+ allocator_type & allocator()
     {
         return m_allocators.allocator;
     }
@@ -131,6 +124,27 @@
     allocators_type m_allocators;
 };
 
+template <typename Node, typename Value, typename Parameters, typename Translator, typename Allocator>
+typename node_proxy<Value, Parameters, Translator, Allocator>::node *
+ create(node_proxy<Value, Parameters, Translator, Allocator> & np)
+{
+ return detail::rtree::create_node<
+ typename node_proxy<Value, Parameters, Translator, Allocator>::allocators_type,
+ Node
+ >::apply(np.allocators());
+}
+
+template <typename Node, typename Value, typename Parameters, typename Translator, typename Allocator>
+void destroy(
+ typename node_proxy<Value, Parameters, Translator, Allocator>::node * n,
+ node_proxy<Value, Parameters, Translator, Allocator> & np)
+{
+ return detail::rtree::destroy_node<
+ typename node_proxy<Value, Parameters, Translator, Allocator>::allocators_type,
+ Node
+ >::apply(np.allocators(), n);
+}
+
 }}}}} // namespace boost::geometry::index::detail::rtree
 
 #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_PROXY_HPP

Modified: sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/rtree.hpp
==============================================================================
--- sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/rtree.hpp (original)
+++ sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/rtree.hpp 2012-09-30 07:40:09 EDT (Sun, 30 Sep 2012)
@@ -588,7 +588,7 @@
     {
         assert(0 == m_root);
 
- m_root = m_node_proxy.template create_node<leaf>();
+ m_root = detail::rtree::create<leaf>(m_node_proxy);
         m_values_count = 0;
         m_leafs_level = 0;
     }

Modified: sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/copy.hpp
==============================================================================
--- sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/copy.hpp (original)
+++ sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/copy.hpp 2012-09-30 07:40:09 EDT (Sun, 30 Sep 2012)
@@ -41,7 +41,7 @@
 
     inline void operator()(internal_node & n)
     {
- node * new_node = m_node_proxy.template create<internal_node>();
+ node * new_node = rtree::create<internal_node>(m_node_proxy);
 
         typedef typename rtree::elements_type<internal_node>::type elements_type;
         elements_type & elements = rtree::elements(n);
@@ -61,7 +61,7 @@
 
     inline void operator()(leaf & l)
     {
- node * new_node = m_node_proxy.template create<leaf>();
+ node * new_node = rtree::create<leaf>(m_node_proxy);
         
         typedef typename rtree::elements_type<leaf>::type elements_type;
         elements_type & elements = rtree::elements(l);

Modified: sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/destroy.hpp
==============================================================================
--- sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/destroy.hpp (original)
+++ sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/destroy.hpp 2012-09-30 07:40:09 EDT (Sun, 30 Sep 2012)
@@ -55,14 +55,14 @@
             rtree::apply_visitor(*this, *m_current_node);
         }
 
- m_node_proxy.template destroy<internal_node>(node_to_destroy);
+ rtree::destroy<internal_node>(node_to_destroy, m_node_proxy);
     }
 
     inline void operator()(leaf & l)
     {
         BOOST_GEOMETRY_INDEX_ASSERT(&l == rtree::get<leaf>(m_current_node), "invalid pointers");
 
- m_node_proxy.template destroy<leaf>(m_current_node);
+ rtree::destroy<leaf>(m_current_node, m_node_proxy);
     }
 
 private:

Modified: sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/insert.hpp
==============================================================================
--- sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/insert.hpp (original)
+++ sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/insert.hpp 2012-09-30 07:40:09 EDT (Sun, 30 Sep 2012)
@@ -130,7 +130,7 @@
                              NodeProxy & node_proxy)
     {
         // create additional node
- node * second_node = node_proxy.template create<Node>();
+ node * second_node = rtree::create<Node>(node_proxy);
         Node & n2 = rtree::get<Node>(*second_node);
 
         // redistribute elements
@@ -287,7 +287,7 @@
             BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get<Node>(m_root_node), "node should be the root");
 
             // create new root and add nodes
- node * new_root = m_node_proxy.template create<internal_node>();
+ node * new_root = rtree::create<internal_node>(m_node_proxy);
 
             rtree::elements(rtree::get<internal_node>(*new_root)).push_back(std::make_pair(n_box, m_root_node));
             rtree::elements(rtree::get<internal_node>(*new_root)).push_back(additional_nodes[0]);

Modified: sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/remove.hpp
==============================================================================
--- sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/remove.hpp (original)
+++ sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/remove.hpp 2012-09-30 07:40:09 EDT (Sun, 30 Sep 2012)
@@ -128,13 +128,13 @@
                     {
                         reinsert_elements(rtree::get<leaf>(*it->second), it->first);
 
- m_node_proxy.template destroy<leaf>(it->second);
+ index::detail::rtree::destroy<leaf>(it->second, m_node_proxy);
                     }
                     else
                     {
                         reinsert_elements(rtree::get<internal_node>(*it->second), it->first);
 
- m_node_proxy.template destroy<internal_node>(it->second);
+ rtree::destroy<internal_node>(it->second, m_node_proxy);
                     }
                 }
 
@@ -145,7 +145,7 @@
                     m_root_node = rtree::elements(n)[0].second;
                     --m_leafs_level;
 
- m_node_proxy.template destroy<internal_node>(root_to_destroy);
+ rtree::destroy<internal_node>(root_to_destroy, m_node_proxy);
                 }
             }
         }


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