Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82864 - in sandbox-branches/geometry/index: boost/geometry/index/detail boost/geometry/index/detail/rtree/node boost/geometry/index/detail/rtree/visitors test/rtree
From: adam.wulkiewicz_at_[hidden]
Date: 2013-02-13 20:11:19


Author: awulkiew
Date: 2013-02-13 20:11:17 EST (Wed, 13 Feb 2013)
New Revision: 82864
URL: http://svn.boost.org/trac/boost/changeset/82864

Log:
rtree non-std allocators support implemented.
interprocess test added.
Text files modified:
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp | 4 +
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp | 4 +
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/copy.hpp | 7 +
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/remove.hpp | 14 ++-
   sandbox-branches/geometry/index/boost/geometry/index/detail/varray.hpp | 20 +++---
   sandbox-branches/geometry/index/test/rtree/Jamfile.v2 | 22 +++---
   sandbox-branches/geometry/index/test/rtree/rtree_interprocess.cpp | 73 +++++++++-------------
   sandbox-branches/geometry/index/test/rtree/test_rtree.hpp | 126 +++++++++++++++++++++++----------------
   sandbox-branches/geometry/index/test/rtree/test_rtree_exceptions.hpp | 20 ++++--
   9 files changed, 156 insertions(+), 134 deletions(-)

Modified: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp 2013-02-13 20:11:17 EST (Wed, 13 Feb 2013)
@@ -189,6 +189,10 @@
 
     typedef typename allocator_type::template rebind<
         typename internal_node<Value, Parameters, Box, allocators, node_d_mem_dynamic_tag>::type
+ >::other::pointer internal_node_pointer;
+
+ typedef typename allocator_type::template rebind<
+ typename internal_node<Value, Parameters, Box, allocators, node_d_mem_dynamic_tag>::type
>::other internal_node_allocator_type;
 
     typedef typename allocator_type::template rebind<

Modified: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp 2013-02-13 20:11:17 EST (Wed, 13 Feb 2013)
@@ -110,6 +110,10 @@
 
     typedef typename allocator_type::template rebind<
         typename internal_node<Value, Parameters, Box, allocators, node_d_mem_static_tag>::type
+ >::other::pointer internal_node_pointer;
+
+ typedef typename allocator_type::template rebind<
+ typename internal_node<Value, Parameters, Box, allocators, node_d_mem_static_tag>::type
>::other internal_node_allocator_type;
 
     typedef typename allocator_type::template rebind<

Modified: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/copy.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/copy.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/copy.hpp 2013-02-13 20:11:17 EST (Wed, 13 Feb 2013)
@@ -28,6 +28,7 @@
     typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
 
     typedef rtree::node_auto_ptr<Value, Options, Translator, Box, Allocators> node_auto_ptr;
+ typedef typename Allocators::node_pointer node_pointer;
 
     explicit inline copy(Allocators & allocators)
         : result(0)
@@ -36,7 +37,7 @@
 
     inline void operator()(internal_node & n)
     {
- node * raw_new_node = rtree::create_node<Allocators, internal_node>::apply(m_allocators); // MAY THROW, STRONG (N: alloc)
+ node_pointer raw_new_node = rtree::create_node<Allocators, internal_node>::apply(m_allocators); // MAY THROW, STRONG (N: alloc)
         node_auto_ptr new_node(raw_new_node, m_allocators);
 
         typedef typename rtree::elements_type<internal_node>::type elements_type;
@@ -63,7 +64,7 @@
 
     inline void operator()(leaf & l)
     {
- node * raw_new_node = rtree::create_node<Allocators, leaf>::apply(m_allocators); // MAY THROW, STRONG (N: alloc)
+ node_pointer raw_new_node = rtree::create_node<Allocators, leaf>::apply(m_allocators); // MAY THROW, STRONG (N: alloc)
         node_auto_ptr new_node(raw_new_node, m_allocators);
 
         typedef typename rtree::elements_type<leaf>::type elements_type;
@@ -81,7 +82,7 @@
         new_node.release();
     }
 
- node * result;
+ node_pointer result;
 
 private:
     Allocators & m_allocators;

Modified: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/remove.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/remove.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/remove.hpp 2013-02-13 20:11:17 EST (Wed, 13 Feb 2013)
@@ -34,9 +34,11 @@
     typedef typename rtree::leaf<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
 
     typedef rtree::node_auto_ptr<Value, Options, Translator, Box, Allocators> node_auto_ptr;
+ typedef typename Allocators::node_pointer node_pointer;
+ typedef typename Allocators::internal_node_pointer internal_node_pointer;
 
 public:
- inline remove(node* & root,
+ inline remove(node_pointer & root,
                   size_t & leafs_level,
                   Box & root_box,
                   Value const& value,
@@ -121,7 +123,7 @@
                 // shorten the tree
                 if ( rtree::elements(n).size() == 1 )
                 {
- node * root_to_destroy = m_root_node;
+ node_pointer root_to_destroy = m_root_node;
                     m_root_node = rtree::elements(n)[0].second;
                     --m_leafs_level;
 
@@ -174,12 +176,12 @@
 
 private:
 
- typedef std::vector< std::pair<size_t, node*> > UnderflowNodes;
+ typedef std::vector< std::pair<size_t, node_pointer> > UnderflowNodes;
 
     void traverse_apply_visitor(internal_node &n, size_t choosen_node_index)
     {
         // save previous traverse inputs and set new ones
- internal_node * parent_bckup = m_parent;
+ internal_node_pointer parent_bckup = m_parent;
         size_t current_child_index_bckup = m_current_child_index;
         size_t current_level_bckup = m_current_level;
 
@@ -308,7 +310,7 @@
     Translator const& m_translator;
     Allocators & m_allocators;
 
- node* & m_root_node;
+ node_pointer & m_root_node;
     Box & m_root_box;
     size_t & m_leafs_level;
 
@@ -316,7 +318,7 @@
     UnderflowNodes m_underflowed_nodes;
 
     // traversing input parameters
- internal_node *m_parent;
+ internal_node_pointer m_parent;
     size_t m_current_child_index;
     size_t m_current_level;
 

Modified: sandbox-branches/geometry/index/boost/geometry/index/detail/varray.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/index/detail/varray.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/varray.hpp 2013-02-13 20:11:17 EST (Wed, 13 Feb 2013)
@@ -552,7 +552,7 @@
>::type
         use_memcpy;
         
- this->copy_dispatch(first, last, dst, use_memcpy()); // may throw
+ this->copy_dispatch(&(*first), &(*last), &(*dst), use_memcpy()); // may throw
     }
 
     void copy_dispatch(const value_type * first, const value_type * last, value_type * dst,
@@ -583,7 +583,7 @@
>::type
         use_memcpy;
 
- this->uninitialized_copy_dispatch(first, last, dst, use_memcpy()); // may throw
+ this->uninitialized_copy_dispatch(&(*first), &(*last), &(*dst), use_memcpy()); // may throw
     }
 
     void uninitialized_copy_dispatch(const value_type * first, const value_type * last, value_type * dst,
@@ -607,11 +607,11 @@
         typedef typename
             mpl::and_<
                 has_trivial_copy<value_type>,
- is_same<Value, value_type>
+ is_same<V, value_type>
>::type
         use_memcpy;
 
- uninitialized_fill_dispatch(dst, v, use_memcpy()); // may throw
+ uninitialized_fill_dispatch(&(*dst), v, use_memcpy()); // may throw
     }
 
     void uninitialized_fill_dispatch(value_type * ptr, value_type const& v,
@@ -633,7 +633,7 @@
 
     void move(iterator first, iterator last, iterator dst)
     {
- this->move_dispatch(first, last, dst, has_trivial_assign<value_type>()); // may throw
+ this->move_dispatch(&(*first), &(*last), &(*dst), has_trivial_assign<value_type>()); // may throw
     }
 
     void move_dispatch(value_type * first, value_type * last, value_type * dst,
@@ -652,7 +652,7 @@
 
     void move_backward(iterator first, iterator last, iterator dst)
     {
- this->move_backward_dispatch(first, last, dst, has_trivial_assign<value_type>()); // may throw
+ this->move_backward_dispatch(&(*first), &(*last), &(*dst), has_trivial_assign<value_type>()); // may throw
     }
 
     void move_backward_dispatch(value_type * first, value_type * last, value_type * dst,
@@ -673,7 +673,7 @@
     template <typename V>
     void fill(iterator dst, V const& v)
     {
- fill_dispatch(dst, v, has_trivial_assign<value_type>()); // may throw
+ fill_dispatch(&(*dst), v, has_trivial_assign<value_type>()); // may throw
     }
 
     void fill_dispatch(value_type * ptr, value_type const& v,
@@ -695,7 +695,7 @@
 
     void destroy(iterator first, iterator last)
     {
- this->destroy_dispatch(first, last, has_trivial_destructor<value_type>());
+ this->destroy_dispatch(&(*first), &(*last), has_trivial_destructor<value_type>());
     }
 
     void destroy_dispatch(value_type * /*first*/, value_type * /*last*/,
@@ -713,7 +713,7 @@
 
     void destroy(iterator it)
     {
- this->destroy_dispatch(it, has_trivial_destructor<value_type>());
+ this->destroy_dispatch(&(*it), has_trivial_destructor<value_type>());
     }
 
     void destroy_dispatch(value_type * /*ptr*/,
@@ -730,7 +730,7 @@
 
     void construct(iterator first, iterator last)
     {
- this->construct_dispatch(first, last, has_trivial_constructor<value_type>()); // may throw
+ this->construct_dispatch(&(*first), &(*last), has_trivial_constructor<value_type>()); // may throw
     }
 
     void construct_dispatch(value_type * /*first*/, value_type * /*last*/,

Modified: sandbox-branches/geometry/index/test/rtree/Jamfile.v2
==============================================================================
--- sandbox-branches/geometry/index/test/rtree/Jamfile.v2 (original)
+++ sandbox-branches/geometry/index/test/rtree/Jamfile.v2 2013-02-13 20:11:17 EST (Wed, 13 Feb 2013)
@@ -13,14 +13,14 @@
     [ run rtree_exceptions.cpp ]
     ;
     
-#test-suite boost-geometry-index-rtree_interprocess
-# : [ run rtree_interprocess.cpp /boost/thread//boost_thread
-# : # additional args
-# : # test-files
-# : # requirements
-# <toolset>acc:<linkflags>-lrt
-# <toolset>acc-pa_risc:<linkflags>-lrt
-# <toolset>gcc-mingw:<linkflags>"-lole32 -loleaut32 -lpsapi -ladvapi32"
-# <host-os>hpux,<toolset>gcc:<linkflags>"-Wl,+as,mpas"
-# ] : <threading>multi
-# ;
\ No newline at end of file
+test-suite boost-geometry-index-rtree_interprocess
+ : [ run rtree_interprocess.cpp /boost/thread//boost_thread
+ : # additional args
+ : # test-files
+ : # requirements
+ <toolset>acc:<linkflags>-lrt
+ <toolset>acc-pa_risc:<linkflags>-lrt
+ <toolset>gcc-mingw:<linkflags>"-lole32 -loleaut32 -lpsapi -ladvapi32"
+ <host-os>hpux,<toolset>gcc:<linkflags>"-Wl,+as,mpas"
+ ] : <threading>multi
+ ;
\ No newline at end of file

Modified: sandbox-branches/geometry/index/test/rtree/rtree_interprocess.cpp
==============================================================================
--- sandbox-branches/geometry/index/test/rtree/rtree_interprocess.cpp (original)
+++ sandbox-branches/geometry/index/test/rtree/rtree_interprocess.cpp 2013-02-13 20:11:17 EST (Wed, 13 Feb 2013)
@@ -16,7 +16,7 @@
 #include <boost/interprocess/managed_shared_memory.hpp>
 #include <boost/interprocess/allocators/allocator.hpp>
 
-template <typename Value, typename Parameters>
+template <typename Point, typename Parameters>
 void test_rtree_interprocess(Parameters const& parameters = Parameters())
 {
     namespace bi = boost::interprocess;
@@ -27,58 +27,43 @@
     } remover;
 
     bi::managed_shared_memory segment(bi::create_only, "shmem", 65535);
- typedef bi::allocator<Value, bi::managed_shared_memory::segment_manager> shmem_alloc;
+ typedef bi::allocator<Point, bi::managed_shared_memory::segment_manager> shmem_alloc;
 
- typedef bgi::rtree<Value, Parameters, bgi::translator::def<Value>, shmem_alloc> Tree;
+ test_rtree_for_box<Point>(parameters, shmem_alloc(segment.get_segment_manager()));
 
- Tree * tree = segment.construct<Tree>("Tree")(parameters, bgi::translator::def<Value>(), shmem_alloc(segment.get_segment_manager()));
- typedef typename Tree::bounds_type B;
-
- std::vector<Value> input;
- B qbox;
-
- generate_rtree(*tree, input, qbox);
+ //typedef bgi::rtree<Value, Parameters, bgi::translator::def<Value>, shmem_alloc> Tree;
 
- test_intersects(*tree, input, qbox);
- test_disjoint(*tree, input, qbox);
- test_covered_by(*tree, input, qbox);
- test_overlaps(*tree, input, qbox);
- //test_touches(*tree, input, qbox);
- test_within(*tree, input, qbox);
-
- typedef typename bgi::detail::traits::point_type<B>::type P;
- P pt;
- bg::centroid(qbox, pt);
+ //Tree * tree = segment.construct<Tree>("Tree")(parameters, bgi::translator::def<Value>(), shmem_alloc(segment.get_segment_manager()));
+ //typedef typename Tree::bounds_type B;
+ //
+ //std::vector<Value> input;
+ //B qbox;
+ //
+ //generate_rtree(*tree, input, qbox);
+
+ //test_intersects(*tree, input, qbox);
+ //test_disjoint(*tree, input, qbox);
+ //test_covered_by(*tree, input, qbox);
+ //test_overlaps(*tree, input, qbox);
+ ////test_touches(*tree, input, qbox);
+ //test_within(*tree, input, qbox);
+
+ //typedef typename bgi::detail::traits::point_type<B>::type P;
+ //P pt;
+ //bg::centroid(qbox, pt);
 
- test_nearest_query_k(*tree, input, pt, 10);
- test_nearest_query_not_found(*tree, generate_outside_point<P>::apply());
+ //test_nearest_query_k(*tree, input, pt, 10);
+ //test_nearest_query_not_found(*tree, generate_outside_point<P>::apply());
 
- segment.destroy_ptr(tree);
+ //segment.destroy_ptr(tree);
 }
 
 int test_main(int, char* [])
 {
- typedef bg::model::point<double, 2, bg::cs::cartesian> P2d;
- typedef bg::model::box<P2d> B2d;
- typedef std::pair<B2d, int> PB2d;
-
- //test_rtree_interprocess<P2d>(bgi::linear<32, 8>());
- test_rtree_interprocess<P2d>(bgi::runtime::linear(32, 8));
- /*test_rtree_interprocess<B2d>(bgi::quadratic<32, 8>());
- test_rtree_interprocess<B2d>(bgi::runtime::quadratic(32, 8));
- test_rtree_interprocess<PB2d>(bgi::rstar<32, 8>());
- test_rtree_interprocess<PB2d>(bgi::runtime::rstar(32, 8));
-
- typedef bg::model::point<float, 3, bg::cs::cartesian> P3f;
- typedef bg::model::box<P3f> B3f;
- typedef std::pair<B3f, int> PB3f;
-
- test_rtree_interprocess<P3f>(bgi::linear<32, 8>());
- test_rtree_interprocess<P3f>(bgi::runtime::linear(32, 8));
- test_rtree_interprocess<B3f>(bgi::quadratic<32, 8>());
- test_rtree_interprocess<B3f>(bgi::runtime::quadratic(32, 8));
- test_rtree_interprocess<PB3f>(bgi::rstar<32, 8>());
- test_rtree_interprocess<PB3f>(bgi::runtime::rstar(32, 8));*/
+ typedef bg::model::point<float, 2, bg::cs::cartesian> P2f;
 
+ test_rtree_interprocess<P2f>(bgi::linear<32, 8>());
+ test_rtree_interprocess<P2f>(bgi::runtime::linear(32, 8));
+
     return 0;
 }

Modified: sandbox-branches/geometry/index/test/rtree/test_rtree.hpp
==============================================================================
--- sandbox-branches/geometry/index/test/rtree/test_rtree.hpp (original)
+++ sandbox-branches/geometry/index/test/rtree/test_rtree.hpp 2013-02-13 20:11:17 EST (Wed, 13 Feb 2013)
@@ -850,7 +850,7 @@
     tree.query(qbox, std::back_inserter(expected_output));
 
     // copy constructor
- Rtree t1(tree, tree.get_allocator());
+ Rtree t1(tree);
 
     BOOST_CHECK(tree.empty() == t1.empty());
     BOOST_CHECK(tree.size() == t1.size());
@@ -993,10 +993,10 @@
 
 // rtree removing
 
-template <typename Value, typename Algo, typename Box>
-void test_remove(bgi::rtree<Value, Algo> & tree, Box const& qbox)
+template <typename Rtree, typename Box>
+void test_remove(Rtree & tree, Box const& qbox)
 {
- typedef bgi::rtree<Value, Algo> T;
+ typedef typename Rtree::value_type Value;
 
     std::vector<Value> values_to_remove;
     tree.query(qbox, std::back_inserter(values_to_remove));
@@ -1008,11 +1008,11 @@
     size_t expected_size_after_remove = tree.size() - values_to_remove.size();
 
     // Add value which is not stored in the Rtree
- Value outsider = generate_value_outside<T>();
+ Value outsider = generate_value_outside<Rtree>();
     values_to_remove.push_back(outsider);
     
     {
- T t(tree);
+ Rtree t(tree);
         size_t r = 0;
         BOOST_FOREACH(Value const& v, values_to_remove)
             r += t.remove(v);
@@ -1024,7 +1024,7 @@
         test_compare_outputs(t, output, expected_output);
     }
     {
- T t(tree);
+ Rtree t(tree);
         size_t r = t.remove(values_to_remove.begin(), values_to_remove.end());
         BOOST_CHECK( r == expected_removed_count );
         std::vector<Value> output;
@@ -1034,7 +1034,7 @@
         test_compare_outputs(t, output, expected_output);
     }
     {
- T t(tree);
+ Rtree t(tree);
         size_t r = t.remove(values_to_remove);
         BOOST_CHECK( r == expected_removed_count );
         std::vector<Value> output;
@@ -1045,7 +1045,7 @@
     }
 
     {
- T t(tree);
+ Rtree t(tree);
         size_t r = 0;
         BOOST_FOREACH(Value const& v, values_to_remove)
             r += bgi::remove(t, v);
@@ -1057,7 +1057,7 @@
         test_compare_outputs(t, output, expected_output);
     }
     {
- T t(tree);
+ Rtree t(tree);
         size_t r = bgi::remove(t, values_to_remove.begin(), values_to_remove.end());
         BOOST_CHECK( r == expected_removed_count );
         std::vector<Value> output;
@@ -1067,7 +1067,7 @@
         test_compare_outputs(t, output, expected_output);
     }
     {
- T t(tree);
+ Rtree t(tree);
         size_t r = bgi::remove(t, values_to_remove);
         BOOST_CHECK( r == expected_removed_count );
         std::vector<Value> output;
@@ -1078,18 +1078,16 @@
     }
 }
 
-template <typename Value, typename Algo, typename Box>
-void test_clear(bgi::rtree<Value, Algo> & tree, std::vector<Value> const& input, Box const& qbox)
+template <typename Rtree, typename Value, typename Box>
+void test_clear(Rtree & tree, std::vector<Value> const& input, Box const& qbox)
 {
- typedef bgi::rtree<Value, Algo> T;
-
     std::vector<Value> values_to_remove;
     tree.query(qbox, std::back_inserter(values_to_remove));
     BOOST_CHECK(0 < values_to_remove.size());
 
     //clear
     {
- T t(tree);
+ Rtree t(tree);
 
         std::vector<Value> expected_output;
         t.query(bgi::intersects(qbox), std::back_inserter(expected_output));
@@ -1108,15 +1106,17 @@
 // run all tests for a single Algorithm and single rtree
 // defined by Value
 
-template <typename Value, typename Parameters>
-void test_rtree_by_value(Parameters const& parameters)
+template <typename Value, typename Parameters, typename Allocator>
+void test_rtree_by_value(Parameters const& parameters, Allocator const& allocator)
 {
- typedef bgi::rtree<Value, Parameters> Tree;
+ typedef bgi::translator::def<Value> T;
+ typedef typename Allocator::template rebind<Value>::other A;
+ typedef bgi::rtree<Value, Parameters, T, A> Tree;
     typedef typename Tree::box_type B;
 
     // not empty tree test
 
- Tree tree(parameters);
+ Tree tree(parameters, T(), allocator);
     std::vector<Value> input;
     B qbox;
 
@@ -1144,7 +1144,7 @@
 
     // empty tree test
 
- Tree empty_tree(parameters);
+ Tree empty_tree(parameters, T(), allocator);
     std::vector<Value> empty_input;
 
     test_intersects(empty_tree, empty_input, qbox);
@@ -1160,14 +1160,17 @@
 
 // rtree inserting and removing of counting_value
 
-template <typename Indexable, typename Parameters>
-void test_count_rtree_values(Parameters const& parameters)
+template <typename Indexable, typename Parameters, typename Allocator>
+void test_count_rtree_values(Parameters const& parameters, Allocator const& allocator)
 {
     typedef counting_value<Indexable> Value;
- typedef bgi::rtree<Value, Parameters> Tree;
+
+ typedef bgi::translator::def<Value> T;
+ typedef typename Allocator::template rebind<Value>::other A;
+ typedef bgi::rtree<Value, Parameters, T, A> Tree;
     typedef typename Tree::box_type B;
 
- Tree t(parameters);
+ Tree t(parameters, T(), allocator);
     std::vector<Value> input;
     B qbox;
 
@@ -1199,14 +1202,17 @@
 
 // rtree count
 
-template <typename Indexable, typename Parameters>
-void test_rtree_count(Parameters const& parameters)
+template <typename Indexable, typename Parameters, typename Allocator>
+void test_rtree_count(Parameters const& parameters, Allocator const& allocator)
 {
     typedef std::pair<Indexable, int> Value;
- typedef bgi::rtree<Value, Parameters> Tree;
+
+ typedef bgi::translator::def<Value> T;
+ typedef typename Allocator::template rebind<Value>::other A;
+ typedef bgi::rtree<Value, Parameters, T, A> Tree;
     typedef typename Tree::box_type B;
 
- Tree t(parameters);
+ Tree t(parameters, T(), allocator);
     std::vector<Value> input;
     B qbox;
 
@@ -1228,17 +1234,19 @@
 
 // test rtree box
 
-template <typename Value, typename Parameters>
-void test_rtree_bounds(Parameters const& parameters)
+template <typename Value, typename Parameters, typename Allocator>
+void test_rtree_bounds(Parameters const& parameters, Allocator const& allocator)
 {
- typedef bgi::rtree<Value, Parameters> Tree;
+ typedef bgi::translator::def<Value> T;
+ typedef typename Allocator::template rebind<Value>::other A;
+ typedef bgi::rtree<Value, Parameters, T, A> Tree;
     typedef typename Tree::box_type B;
     typedef typename bg::traits::point_type<B>::type P;
 
     B b;
     bg::assign_inverse(b);
 
- Tree t(parameters);
+ Tree t(parameters, T(), allocator);
     std::vector<Value> input;
     B qbox;
 
@@ -1283,45 +1291,57 @@
 // run all tests for one Algorithm for some number of rtrees
 // defined by some number of Values constructed from given Point
 
-template<typename Point, typename Parameters>
-void test_rtree_for_point(Parameters const& parameters = Parameters())
+template<typename Point, typename Parameters, typename Allocator>
+void test_rtree_for_point(Parameters const& parameters, Allocator const& allocator)
 {
     typedef std::pair<Point, int> PairP;
     typedef boost::tuple<Point, int, int> TupleP;
     typedef boost::shared_ptr< test_object<Point> > SharedPtrP;
     typedef value_no_dctor<Point> VNoDCtor;
 
- test_rtree_by_value<Point, Parameters>(parameters);
- test_rtree_by_value<PairP, Parameters>(parameters);
- test_rtree_by_value<TupleP, Parameters>(parameters);
-
- test_rtree_by_value<SharedPtrP, Parameters>(parameters);
- test_rtree_by_value<VNoDCtor, Parameters>(parameters);
+ test_rtree_by_value<Point, Parameters>(parameters, allocator);
+ test_rtree_by_value<PairP, Parameters>(parameters, allocator);
+ test_rtree_by_value<TupleP, Parameters>(parameters, allocator);
 
- test_count_rtree_values<Point>(parameters);
+ test_rtree_by_value<SharedPtrP, Parameters>(parameters, allocator);
+ test_rtree_by_value<VNoDCtor, Parameters>(parameters, allocator);
 
- test_rtree_count<Point>(parameters);
- test_rtree_bounds<Point>(parameters);
+ test_count_rtree_values<Point>(parameters, allocator);
+
+ test_rtree_count<Point>(parameters, allocator);
+ test_rtree_bounds<Point>(parameters, allocator);
 }
 
-template<typename Point, typename Parameters>
-void test_rtree_for_box(Parameters const& parameters = Parameters())
+template<typename Point, typename Parameters, typename Allocator>
+void test_rtree_for_box(Parameters const& parameters, Allocator const& allocator)
 {
     typedef bg::model::box<Point> Box;
     typedef std::pair<Box, int> PairB;
     typedef boost::tuple<Box, int, int> TupleB;
     typedef value_no_dctor<Box> VNoDCtor;
 
- test_rtree_by_value<Box, Parameters>(parameters);
- test_rtree_by_value<PairB, Parameters>(parameters);
- test_rtree_by_value<TupleB, Parameters>(parameters);
+ test_rtree_by_value<Box, Parameters>(parameters, allocator);
+ test_rtree_by_value<PairB, Parameters>(parameters, allocator);
+ test_rtree_by_value<TupleB, Parameters>(parameters, allocator);
 
- test_rtree_by_value<VNoDCtor, Parameters>(parameters);
+ test_rtree_by_value<VNoDCtor, Parameters>(parameters, allocator);
 
- test_count_rtree_values<Box>(parameters);
+ test_count_rtree_values<Box>(parameters, allocator);
 
- test_rtree_count<Box>(parameters);
- test_rtree_bounds<Box>(parameters);
+ test_rtree_count<Box>(parameters, allocator);
+ test_rtree_bounds<Box>(parameters, allocator);
+}
+
+template<typename Point, typename Parameters>
+void test_rtree_for_point(Parameters const& parameters)
+{
+ test_rtree_for_point<Point>(parameters, std::allocator<int>());
+}
+
+template<typename Point, typename Parameters>
+void test_rtree_for_box(Parameters const& parameters)
+{
+ test_rtree_for_box<Point>(parameters, std::allocator<int>());
 }
 
 #endif

Modified: sandbox-branches/geometry/index/test/rtree/test_rtree_exceptions.hpp
==============================================================================
--- sandbox-branches/geometry/index/test/rtree/test_rtree_exceptions.hpp (original)
+++ sandbox-branches/geometry/index/test/rtree/test_rtree_exceptions.hpp 2013-02-13 20:11:17 EST (Wed, 13 Feb 2013)
@@ -78,7 +78,7 @@
     typedef throwing_varray<
         std::pair<
             Box,
- dynamic_node<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag> *
+ typename Allocators::node_pointer
>,
         Parameters::max_elements + 1
> elements_type;
@@ -152,6 +152,14 @@
     typedef typename allocator_type::size_type size_type;
 
     typedef typename allocator_type::template rebind<
+ typename node<Value, Parameters, Box, allocators, node_throwing_d_mem_static_tag>::type
+ >::other::pointer node_pointer;
+
+ typedef typename allocator_type::template rebind<
+ typename internal_node<Value, Parameters, Box, allocators, node_throwing_d_mem_static_tag>::type
+ >::other::pointer internal_node_pointer;
+
+ typedef typename allocator_type::template rebind<
         typename internal_node<Value, Parameters, Box, allocators, node_throwing_d_mem_static_tag>::type
>::other internal_node_allocator_type;
 
@@ -226,15 +234,14 @@
     dynamic_internal_node<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag>
>
 {
- static inline dynamic_node<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag> *
+ static inline typename Allocators::node_pointer
     apply(Allocators & allocators)
     {
         // throw if counter meets max count
         throwing_node_settings::throw_if_required();
 
         return create_dynamic_node<
- dynamic_node<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag>,
- dynamic_internal_node<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag>
+ typename Allocators::node_pointer
>::template apply(allocators.internal_node_allocator, allocators.internal_node_allocator);
     }
 };
@@ -245,15 +252,14 @@
     dynamic_leaf<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag>
>
 {
- static inline typename node<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag>::type *
+ static inline typename Allocators::node_pointer
     apply(Allocators & allocators)
     {
         // throw if counter meets max count
         throwing_node_settings::throw_if_required();
 
         return create_dynamic_node<
- dynamic_node<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag>,
- dynamic_leaf<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag>
+ typename Allocators::node_pointer
>::template apply(allocators.leaf_allocator, allocators.leaf_allocator);
     }
 };


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