diff options
Diffstat (limited to 'libs/geometry/index/test/rtree')
91 files changed, 4302 insertions, 0 deletions
diff --git a/libs/geometry/index/test/rtree/Jamfile.v2 b/libs/geometry/index/test/rtree/Jamfile.v2 new file mode 100644 index 000000000..d906c8880 --- /dev/null +++ b/libs/geometry/index/test/rtree/Jamfile.v2 @@ -0,0 +1,11 @@ +# Boost.Geometry Index +# +# Copyright (c) 2011-2013 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) + +build-project exceptions ; +build-project interprocess ; +build-project generated ; diff --git a/libs/geometry/index/test/rtree/exceptions/Jamfile.v2 b/libs/geometry/index/test/rtree/exceptions/Jamfile.v2 new file mode 100644 index 000000000..c8b42604c --- /dev/null +++ b/libs/geometry/index/test/rtree/exceptions/Jamfile.v2 @@ -0,0 +1,21 @@ +# Boost.Geometry Index +# +# Copyright (c) 2011-2013 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) + +rule test_all +{ + local all_rules = ; + + for local fileb in [ glob *.cpp ] + { + all_rules += [ run $(fileb) ] ; + } + + return $(all_rules) ; +} + +test-suite boost-geometry-index-rtree-exceptions : [ test_all r ] ; diff --git a/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_lin.cpp b/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_lin.cpp new file mode 100644 index 000000000..74c0ba6d0 --- /dev/null +++ b/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_lin.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/exceptions/test_exceptions.hpp> + +int test_main(int, char* []) +{ + test_rtree_value_exceptions< bgi::linear<4, 2> >(); + test_rtree_value_exceptions(bgi::dynamic_linear(4, 2)); + + test_rtree_elements_exceptions< bgi::linear_throwing<4, 2> >(); + + return 0; +} diff --git a/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_qua.cpp b/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_qua.cpp new file mode 100644 index 000000000..5dde64a8d --- /dev/null +++ b/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_qua.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/exceptions/test_exceptions.hpp> + +int test_main(int, char* []) +{ + test_rtree_value_exceptions< bgi::quadratic<4, 2> >(); + test_rtree_value_exceptions(bgi::dynamic_quadratic(4, 2)); + + test_rtree_elements_exceptions< bgi::quadratic_throwing<4, 2> >(); + + return 0; +} diff --git a/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_rst.cpp b/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_rst.cpp new file mode 100644 index 000000000..c09e2d378 --- /dev/null +++ b/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_rst.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/exceptions/test_exceptions.hpp> + +int test_main(int, char* []) +{ + test_rtree_value_exceptions< bgi::rstar<4, 2> >(); + test_rtree_value_exceptions(bgi::dynamic_rstar(4, 2)); + + test_rtree_elements_exceptions< bgi::rstar_throwing<4, 2> >(); + + return 0; +} diff --git a/libs/geometry/index/test/rtree/exceptions/test_exceptions.hpp b/libs/geometry/index/test/rtree/exceptions/test_exceptions.hpp new file mode 100644 index 000000000..25f9fb844 --- /dev/null +++ b/libs/geometry/index/test/rtree/exceptions/test_exceptions.hpp @@ -0,0 +1,193 @@ +// Boost.Geometry Index +// +// R-tree nodes based on runtime-polymorphism, storing static-size containers +// test version throwing exceptions on creation +// +// Copyright (c) 2011-2013 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_INDEX_TEST_RTREE_EXCEPTIONS_HPP +#define BOOST_GEOMETRY_INDEX_TEST_RTREE_EXCEPTIONS_HPP + +#include <rtree/test_rtree.hpp> + +#include <rtree/exceptions/test_throwing.hpp> +#include <rtree/exceptions/test_throwing_node.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +// test value exceptions +template <typename Parameters> +void test_rtree_value_exceptions(Parameters const& parameters = Parameters()) +{ + typedef std::pair<bg::model::point<float, 2, bg::cs::cartesian>, throwing_value> Value; + typedef bgi::rtree<Value, Parameters> Tree; + typedef typename Tree::bounds_type B; + + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls((std::numeric_limits<size_t>::max)()); + std::vector<Value> input; + B qbox; + generate::input<2>::apply(input, qbox); + + for ( size_t i = 0 ; i < 50 ; i += 2 ) + { + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls(10000); + + Tree tree(parameters); + + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls(i); + + BOOST_CHECK_THROW( tree.insert(input.begin(), input.end()), throwing_value_copy_exception ); + } + + for ( size_t i = 0 ; i < 20 ; i += 1 ) + { + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls(i); + + BOOST_CHECK_THROW( Tree tree(input.begin(), input.end(), parameters), throwing_value_copy_exception ); + } + + for ( size_t i = 0 ; i < 10 ; i += 1 ) + { + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls(10000); + + Tree tree(parameters); + + tree.insert(input.begin(), input.end()); + + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls(i); + + BOOST_CHECK_THROW( tree.remove(input.begin(), input.end()), throwing_value_copy_exception ); + } + + for ( size_t i = 0 ; i < 20 ; i += 2 ) + { + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls(10000); + + Tree tree(parameters); + + tree.insert(input.begin(), input.end()); + + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls(i); + + BOOST_CHECK_THROW( Tree tree2(tree), throwing_value_copy_exception ); + } + + for ( size_t i = 0 ; i < 20 ; i += 2 ) + { + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls(10000); + + Tree tree(parameters); + Tree tree2(parameters); + + tree.insert(input.begin(), input.end()); + + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls(i); + + BOOST_CHECK_THROW(tree2 = tree, throwing_value_copy_exception ); + } +} + +// test value exceptions +template <typename Parameters> +void test_rtree_elements_exceptions(Parameters const& parameters = Parameters()) +{ + typedef std::pair<bg::model::point<float, 2, bg::cs::cartesian>, throwing_value> Value; + typedef bgi::rtree<Value, Parameters> Tree; + typedef typename Tree::bounds_type B; + + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls((std::numeric_limits<size_t>::max)()); + + std::vector<Value> input; + B qbox; + generate::input<2>::apply(input, qbox, 2); + + for ( size_t i = 0 ; i < 100 ; i += 2 ) + { + throwing_varray_settings::reset_calls_counter(); + throwing_varray_settings::set_max_calls(10000); + + Tree tree(parameters); + + throwing_varray_settings::reset_calls_counter(); + throwing_varray_settings::set_max_calls(i); + + BOOST_CHECK_THROW( tree.insert(input.begin(), input.end()), throwing_varray_exception ); + } + + for ( size_t i = 0 ; i < 100 ; i += 2 ) + { + throwing_varray_settings::reset_calls_counter(); + throwing_varray_settings::set_max_calls(i); + + throwing_nodes_stats::reset_counters(); + + BOOST_CHECK_THROW( Tree tree(input.begin(), input.end(), parameters), throwing_varray_exception ); + + BOOST_CHECK_EQUAL(throwing_nodes_stats::internal_nodes_count(), 0u); + BOOST_CHECK_EQUAL(throwing_nodes_stats::leafs_count(), 0u); + } + + for ( size_t i = 0 ; i < 50 ; i += 2 ) + { + throwing_varray_settings::reset_calls_counter(); + throwing_varray_settings::set_max_calls(10000); + + Tree tree(parameters); + + tree.insert(input.begin(), input.end()); + + throwing_varray_settings::reset_calls_counter(); + throwing_varray_settings::set_max_calls(i); + + BOOST_CHECK_THROW( tree.remove(input.begin(), input.end()), throwing_varray_exception ); + } + + for ( size_t i = 0 ; i < 50 ; i += 2 ) + { + throwing_varray_settings::reset_calls_counter(); + throwing_varray_settings::set_max_calls(10000); + + Tree tree(parameters); + + tree.insert(input.begin(), input.end()); + + throwing_varray_settings::reset_calls_counter(); + throwing_varray_settings::set_max_calls(i); + + BOOST_CHECK_THROW( Tree tree2(tree), throwing_varray_exception ); + } + + for ( size_t i = 0 ; i < 50 ; i += 2 ) + { + throwing_varray_settings::reset_calls_counter(); + throwing_varray_settings::set_max_calls(10000); + + Tree tree(parameters); + Tree tree2(parameters); + + tree.insert(input.begin(), input.end()); + + throwing_varray_settings::reset_calls_counter(); + throwing_varray_settings::set_max_calls(i); + + BOOST_CHECK_THROW(tree2 = tree, throwing_varray_exception ); + } +} + +#endif // BOOST_GEOMETRY_INDEX_TEST_RTREE_EXCEPTIONS_HPP diff --git a/libs/geometry/index/test/rtree/exceptions/test_throwing.hpp b/libs/geometry/index/test/rtree/exceptions/test_throwing.hpp new file mode 100644 index 000000000..dc621c0b3 --- /dev/null +++ b/libs/geometry/index/test/rtree/exceptions/test_throwing.hpp @@ -0,0 +1,138 @@ +// Boost.Geometry Index +// +// Throwing objects implementation +// +// Copyright (c) 2011-2013 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_INDEX_TEST_THROWING_HPP +#define BOOST_GEOMETRY_INDEX_TEST_THROWING_HPP + +// value + +struct throwing_value_copy_exception : public std::exception +{ + const char * what() const throw() { return "value copy failed."; } +}; + +struct throwing_value +{ + explicit throwing_value(int v = 0) + : value(v) + {} + + bool operator==(throwing_value const& v) const + { + return value == v.value; + } + + throwing_value(throwing_value const& v) + { + throw_if_required(); + + value = v.value; + } + + throwing_value & operator=(throwing_value const& v) + { + throw_if_required(); + + value = v.value; + return *this; + } + + void throw_if_required() + { + // throw if counter meets max count + if ( get_max_calls_ref() <= get_calls_counter_ref() ) + throw throwing_value_copy_exception(); + else + ++get_calls_counter_ref(); + } + + static void reset_calls_counter() { get_calls_counter_ref() = 0; } + static void set_max_calls(size_t mc) { get_max_calls_ref() = mc; } + + static size_t & get_calls_counter_ref() { static size_t cc = 0; return cc; } + static size_t & get_max_calls_ref() { static size_t mc = (std::numeric_limits<size_t>::max)(); return mc; } + + int value; +}; + +namespace generate { +template <typename T, typename C> +struct value< std::pair<bg::model::point<T, 2, C>, throwing_value> > +{ + typedef bg::model::point<T, 2, C> P; + typedef std::pair<P, throwing_value> R; + static R apply(int x, int y) + { + return std::make_pair(P(x, y), throwing_value(x + y * 100)); + } +}; +} // namespace generate + +#include <boost/geometry/index/detail/varray.hpp> + +struct throwing_varray_exception : public std::exception +{ + const char * what() const throw() { return "static vector exception."; } +}; + +struct throwing_varray_settings +{ + static void throw_if_required() + { + // throw if counter meets max count + if ( get_max_calls_ref() <= get_calls_counter_ref() ) + throw throwing_varray_exception(); + else + ++get_calls_counter_ref(); + } + + static void reset_calls_counter() { get_calls_counter_ref() = 0; } + static void set_max_calls(size_t mc) { get_max_calls_ref() = mc; } + + static size_t & get_calls_counter_ref() { static size_t cc = 0; return cc; } + static size_t & get_max_calls_ref() { static size_t mc = (std::numeric_limits<size_t>::max)(); return mc; } +}; + +template <typename Element, size_t Capacity> +class throwing_varray + : public boost::geometry::index::detail::varray<Element, Capacity> +{ + typedef boost::geometry::index::detail::varray<Element, Capacity> container; + +public: + typedef typename container::value_type value_type; + typedef typename container::size_type size_type; + typedef typename container::iterator iterator; + typedef typename container::const_iterator const_iterator; + typedef typename container::reverse_iterator reverse_iterator; + typedef typename container::const_reverse_iterator const_reverse_iterator; + typedef typename container::reference reference; + typedef typename container::const_reference const_reference; + + inline void resize(size_type s) + { + throwing_varray_settings::throw_if_required(); + container::resize(s); + } + + inline void reserve(size_type s) + { + throwing_varray_settings::throw_if_required(); + container::reserve(s); + } + + void push_back(Element const& v) + { + throwing_varray_settings::throw_if_required(); + container::push_back(v); + } +}; + +#endif // BOOST_GEOMETRY_INDEX_TEST_THROWING_HPP diff --git a/libs/geometry/index/test/rtree/exceptions/test_throwing_node.hpp b/libs/geometry/index/test/rtree/exceptions/test_throwing_node.hpp new file mode 100644 index 000000000..cbbb3b76d --- /dev/null +++ b/libs/geometry/index/test/rtree/exceptions/test_throwing_node.hpp @@ -0,0 +1,325 @@ +// Boost.Geometry Index +// +// R-tree nodes based on runtime-polymorphism, storing static-size containers +// test version throwing exceptions on creation +// +// Copyright (c) 2011-2013 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_INDEX_TEST_RTREE_THROWING_NODE_HPP +#define BOOST_GEOMETRY_INDEX_TEST_RTREE_THROWING_NODE_HPP + +#include <boost/geometry/index/detail/rtree/node/dynamic_visitor.hpp> + +#include <rtree/exceptions/test_throwing.hpp> + +struct throwing_nodes_stats +{ + static void reset_counters() { get_internal_nodes_counter_ref() = 0; get_leafs_counter_ref() = 0; } + static size_t internal_nodes_count() { return get_internal_nodes_counter_ref(); } + static size_t leafs_count() { return get_leafs_counter_ref(); } + + static size_t & get_internal_nodes_counter_ref() { static size_t cc = 0; return cc; } + static size_t & get_leafs_counter_ref() { static size_t cc = 0; return cc; } +}; + +namespace boost { namespace geometry { namespace index { + +template <size_t MaxElements, size_t MinElements> +struct linear_throwing : public linear<MaxElements, MinElements> {}; + +template <size_t MaxElements, size_t MinElements> +struct quadratic_throwing : public quadratic<MaxElements, MinElements> {}; + +template <size_t MaxElements, size_t MinElements, size_t OverlapCostThreshold = 0, size_t ReinsertedElements = detail::default_rstar_reinserted_elements_s<MaxElements>::value> +struct rstar_throwing : public rstar<MaxElements, MinElements, OverlapCostThreshold, ReinsertedElements> {}; + +namespace detail { namespace rtree { + +// options implementation (from options.hpp) + +struct node_throwing_d_mem_static_tag {}; + +template <size_t MaxElements, size_t MinElements> +struct options_type< linear_throwing<MaxElements, MinElements> > +{ + typedef options< + linear_throwing<MaxElements, MinElements>, + insert_default_tag, choose_by_content_diff_tag, split_default_tag, linear_tag, + node_throwing_d_mem_static_tag + > type; +}; + +template <size_t MaxElements, size_t MinElements> +struct options_type< quadratic_throwing<MaxElements, MinElements> > +{ + typedef options< + quadratic_throwing<MaxElements, MinElements>, + insert_default_tag, choose_by_content_diff_tag, split_default_tag, quadratic_tag, + node_throwing_d_mem_static_tag + > type; +}; + +template <size_t MaxElements, size_t MinElements, size_t OverlapCostThreshold, size_t ReinsertedElements> +struct options_type< rstar_throwing<MaxElements, MinElements, OverlapCostThreshold, ReinsertedElements> > +{ + typedef options< + rstar_throwing<MaxElements, MinElements, OverlapCostThreshold, ReinsertedElements>, + insert_reinsert_tag, choose_by_overlap_diff_tag, split_default_tag, rstar_tag, + node_throwing_d_mem_static_tag + > type; +}; + +}} // namespace detail::rtree + +// node implementation + +namespace detail { namespace rtree { + +template <typename Value, typename Parameters, typename Box, typename Allocators> +struct dynamic_internal_node<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag> + : public dynamic_node<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag> +{ + typedef throwing_varray< + rtree::ptr_pair<Box, typename Allocators::node_pointer>, + Parameters::max_elements + 1 + > elements_type; + + template <typename Dummy> + inline dynamic_internal_node(Dummy const&) { throwing_nodes_stats::get_internal_nodes_counter_ref()++; } + inline ~dynamic_internal_node() { throwing_nodes_stats::get_internal_nodes_counter_ref()--; } + + void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag, false> & v) { v(*this); } + void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag, true> & v) const { v(*this); } + + elements_type elements; + +private: + dynamic_internal_node(dynamic_internal_node const&); + dynamic_internal_node & operator=(dynamic_internal_node const&); +}; + +template <typename Value, typename Parameters, typename Box, typename Allocators> +struct dynamic_leaf<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag> + : public dynamic_node<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag> +{ + typedef throwing_varray<Value, Parameters::max_elements + 1> elements_type; + + template <typename Dummy> + inline dynamic_leaf(Dummy const&) { throwing_nodes_stats::get_leafs_counter_ref()++; } + inline ~dynamic_leaf() { throwing_nodes_stats::get_leafs_counter_ref()--; } + + void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag, false> & v) { v(*this); } + void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag, true> & v) const { v(*this); } + + elements_type elements; + +private: + dynamic_leaf(dynamic_leaf const&); + dynamic_leaf & operator=(dynamic_leaf const&); +}; + +// elements derived type +template <typename OldValue, size_t N, typename NewValue> +struct container_from_elements_type<throwing_varray<OldValue, N>, NewValue> +{ + typedef throwing_varray<NewValue, N> type; +}; + +// nodes traits + +template <typename Value, typename Parameters, typename Box, typename Allocators> +struct node<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag> +{ + typedef dynamic_node<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag> type; +}; + +template <typename Value, typename Parameters, typename Box, typename Allocators> +struct internal_node<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag> +{ + typedef dynamic_internal_node<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag> type; +}; + +template <typename Value, typename Parameters, typename Box, typename Allocators> +struct leaf<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag> +{ + typedef dynamic_leaf<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag> type; +}; + +template <typename Value, typename Parameters, typename Box, typename Allocators, bool IsVisitableConst> +struct visitor<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag, IsVisitableConst> +{ + typedef dynamic_visitor<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag, IsVisitableConst> type; +}; + +// allocators + +template <typename Allocator, typename Value, typename Parameters, typename Box> +class allocators<Allocator, Value, Parameters, Box, node_throwing_d_mem_static_tag> + : public Allocator::template rebind< + typename internal_node< + Value, Parameters, Box, + allocators<Allocator, Value, Parameters, Box, node_throwing_d_mem_static_tag>, + node_throwing_d_mem_static_tag + >::type + >::other + , Allocator::template rebind< + typename leaf< + Value, Parameters, Box, + allocators<Allocator, Value, Parameters, Box, node_throwing_d_mem_static_tag>, + node_throwing_d_mem_static_tag + >::type + >::other +{ + typedef typename Allocator::template rebind< + Value + >::other value_allocator_type; + +public: + typedef Allocator allocator_type; + + typedef Value value_type; + typedef value_type & reference; + typedef const value_type & const_reference; + typedef typename value_allocator_type::size_type size_type; + typedef typename value_allocator_type::difference_type difference_type; + typedef typename value_allocator_type::pointer pointer; + typedef typename value_allocator_type::const_pointer const_pointer; + + typedef typename Allocator::template rebind< + typename node<Value, Parameters, Box, allocators, node_throwing_d_mem_static_tag>::type + >::other::pointer node_pointer; + + typedef typename Allocator::template rebind< + typename internal_node<Value, Parameters, Box, allocators, node_throwing_d_mem_static_tag>::type + >::other::pointer internal_node_pointer; + + typedef typename Allocator::template rebind< + typename internal_node<Value, Parameters, Box, allocators, node_throwing_d_mem_static_tag>::type + >::other internal_node_allocator_type; + + typedef typename Allocator::template rebind< + typename leaf<Value, Parameters, Box, allocators, node_throwing_d_mem_static_tag>::type + >::other leaf_allocator_type; + + inline allocators() + : internal_node_allocator_type() + , leaf_allocator_type() + {} + + template <typename Alloc> + inline explicit allocators(Alloc const& alloc) + : internal_node_allocator_type(alloc) + , leaf_allocator_type(alloc) + {} + + inline allocators(BOOST_FWD_REF(allocators) a) + : internal_node_allocator_type(boost::move(a.internal_node_allocator())) + , leaf_allocator_type(boost::move(a.leaf_allocator())) + {} + + inline allocators & operator=(BOOST_FWD_REF(allocators) a) + { + internal_node_allocator() = ::boost::move(a.internal_node_allocator()); + leaf_allocator() = ::boost::move(a.leaf_allocator()); + return *this; + } + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + inline allocators & operator=(allocators const& a) + { + internal_node_allocator() = a.internal_node_allocator(); + leaf_allocator() = a.leaf_allocator(); + return *this; + } +#endif + + void swap(allocators & a) + { + boost::swap(internal_node_allocator(), a.internal_node_allocator()); + boost::swap(leaf_allocator(), a.leaf_allocator()); + } + + bool operator==(allocators const& a) const { return leaf_allocator() == a.leaf_allocator(); } + template <typename Alloc> + bool operator==(Alloc const& a) const { return leaf_allocator() == leaf_allocator_type(a); } + + Allocator allocator() const { return Allocator(leaf_allocator()); } + + internal_node_allocator_type & internal_node_allocator() { return *this; } + internal_node_allocator_type const& internal_node_allocator() const { return *this; } + leaf_allocator_type & leaf_allocator() { return *this; } + leaf_allocator_type const& leaf_allocator() const { return *this; } +}; + +struct node_bad_alloc : public std::exception +{ + const char * what() const throw() { return "internal node creation failed."; } +}; + +struct throwing_node_settings +{ + static void throw_if_required() + { + // throw if counter meets max count + if ( get_max_calls_ref() <= get_calls_counter_ref() ) + throw node_bad_alloc(); + else + ++get_calls_counter_ref(); + } + + static void reset_calls_counter() { get_calls_counter_ref() = 0; } + static void set_max_calls(size_t mc) { get_max_calls_ref() = mc; } + + static size_t & get_calls_counter_ref() { static size_t cc = 0; return cc; } + static size_t & get_max_calls_ref() { static size_t mc = (std::numeric_limits<size_t>::max)(); return mc; } +}; + +// create_node + +template <typename Allocators, typename Value, typename Parameters, typename Box> +struct create_node< + Allocators, + dynamic_internal_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< + typename Allocators::node_pointer, + dynamic_internal_node<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag> + >::apply(allocators.internal_node_allocator()); + } +}; + +template <typename Allocators, typename Value, typename Parameters, typename Box> +struct create_node< + Allocators, + dynamic_leaf<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< + typename Allocators::node_pointer, + dynamic_leaf<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag> + >::apply(allocators.leaf_allocator()); + } +}; + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_INDEX_TEST_RTREE_THROWING_NODE_HPP diff --git a/libs/geometry/index/test/rtree/generated/Jamfile.v2 b/libs/geometry/index/test/rtree/generated/Jamfile.v2 new file mode 100644 index 000000000..b3ac64804 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/Jamfile.v2 @@ -0,0 +1,22 @@ +# Boost.Geometry Index +# +# Copyright (c) 2011-2013 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) + +rule test_all +{ + local all_rules = ; + + for local fileb in [ glob *.cpp ] + { + all_rules += [ run $(fileb) ] ; + } + + return $(all_rules) ; +} + +test-suite boost-geometry-index-rtree-generated : [ test_all r ] ; + diff --git a/libs/geometry/index/test/rtree/generated/rtree_dlin_add_b2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dlin_add_b2d.cpp new file mode 100644 index 000000000..312a7ba55 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dlin_add_b2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable; + testset::additional<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dlin_add_b3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dlin_add_b3d.cpp new file mode 100644 index 000000000..fbcb002ee --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dlin_add_b3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable; + testset::additional<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dlin_add_p2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dlin_add_p2d.cpp new file mode 100644 index 000000000..222010ff4 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dlin_add_p2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable; + testset::additional<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dlin_add_p3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dlin_add_p3d.cpp new file mode 100644 index 000000000..4af7feded --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dlin_add_p3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable; + testset::additional<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dlin_mod_b2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dlin_mod_b2d.cpp new file mode 100644 index 000000000..aad24a95e --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dlin_mod_b2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable; + testset::modifiers<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dlin_mod_b3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dlin_mod_b3d.cpp new file mode 100644 index 000000000..3520fcfa5 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dlin_mod_b3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable; + testset::modifiers<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dlin_mod_p2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dlin_mod_p2d.cpp new file mode 100644 index 000000000..56895487b --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dlin_mod_p2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable; + testset::modifiers<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dlin_mod_p3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dlin_mod_p3d.cpp new file mode 100644 index 000000000..90e51c399 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dlin_mod_p3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable; + testset::modifiers<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dlin_que_b2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dlin_que_b2d.cpp new file mode 100644 index 000000000..df167f6c6 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dlin_que_b2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable; + testset::queries<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dlin_que_b3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dlin_que_b3d.cpp new file mode 100644 index 000000000..ddac379f9 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dlin_que_b3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable; + testset::queries<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dlin_que_p2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dlin_que_p2d.cpp new file mode 100644 index 000000000..e66c79d9e --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dlin_que_p2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable; + testset::queries<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dlin_que_p3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dlin_que_p3d.cpp new file mode 100644 index 000000000..5ef00c062 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dlin_que_p3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable; + testset::queries<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dqua_add_b2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dqua_add_b2d.cpp new file mode 100644 index 000000000..cd917bcf6 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dqua_add_b2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable; + testset::additional<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dqua_add_b3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dqua_add_b3d.cpp new file mode 100644 index 000000000..af1afdea7 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dqua_add_b3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable; + testset::additional<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dqua_add_p2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dqua_add_p2d.cpp new file mode 100644 index 000000000..ea21920cb --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dqua_add_p2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable; + testset::additional<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dqua_add_p3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dqua_add_p3d.cpp new file mode 100644 index 000000000..bfbd66bd0 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dqua_add_p3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable; + testset::additional<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dqua_mod_b2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dqua_mod_b2d.cpp new file mode 100644 index 000000000..4462102a0 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dqua_mod_b2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable; + testset::modifiers<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dqua_mod_b3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dqua_mod_b3d.cpp new file mode 100644 index 000000000..e5a21b780 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dqua_mod_b3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable; + testset::modifiers<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dqua_mod_p2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dqua_mod_p2d.cpp new file mode 100644 index 000000000..1e8112dbb --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dqua_mod_p2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable; + testset::modifiers<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dqua_mod_p3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dqua_mod_p3d.cpp new file mode 100644 index 000000000..75cce976e --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dqua_mod_p3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable; + testset::modifiers<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dqua_que_b2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dqua_que_b2d.cpp new file mode 100644 index 000000000..47995d1bb --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dqua_que_b2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable; + testset::queries<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dqua_que_b3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dqua_que_b3d.cpp new file mode 100644 index 000000000..73c89d9ad --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dqua_que_b3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable; + testset::queries<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dqua_que_p2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dqua_que_p2d.cpp new file mode 100644 index 000000000..4683774f3 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dqua_que_p2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable; + testset::queries<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_dqua_que_p3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_dqua_que_p3d.cpp new file mode 100644 index 000000000..a5cae4ebb --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_dqua_que_p3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable; + testset::queries<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_drst_add_b2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_drst_add_b2d.cpp new file mode 100644 index 000000000..9093a91ee --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_drst_add_b2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable; + testset::additional<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_drst_add_b3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_drst_add_b3d.cpp new file mode 100644 index 000000000..75cf1db8c --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_drst_add_b3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable; + testset::additional<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_drst_add_p2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_drst_add_p2d.cpp new file mode 100644 index 000000000..7595a41c4 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_drst_add_p2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable; + testset::additional<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_drst_add_p3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_drst_add_p3d.cpp new file mode 100644 index 000000000..934625270 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_drst_add_p3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable; + testset::additional<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_drst_mod_b2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_drst_mod_b2d.cpp new file mode 100644 index 000000000..f3495061b --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_drst_mod_b2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable; + testset::modifiers<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_drst_mod_b3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_drst_mod_b3d.cpp new file mode 100644 index 000000000..cf2490353 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_drst_mod_b3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable; + testset::modifiers<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_drst_mod_p2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_drst_mod_p2d.cpp new file mode 100644 index 000000000..886be52cf --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_drst_mod_p2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable; + testset::modifiers<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_drst_mod_p3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_drst_mod_p3d.cpp new file mode 100644 index 000000000..a597f6691 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_drst_mod_p3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable; + testset::modifiers<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_drst_que_b2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_drst_que_b2d.cpp new file mode 100644 index 000000000..2e46885db --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_drst_que_b2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable; + testset::queries<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_drst_que_b3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_drst_que_b3d.cpp new file mode 100644 index 000000000..3ea5e8f66 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_drst_que_b3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable; + testset::queries<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_drst_que_p2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_drst_que_p2d.cpp new file mode 100644 index 000000000..bab080776 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_drst_que_p2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable; + testset::queries<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_drst_que_p3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_drst_que_p3d.cpp new file mode 100644 index 000000000..efd0e34ee --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_drst_que_p3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable; + testset::queries<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_lin_add_b2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_lin_add_b2d.cpp new file mode 100644 index 000000000..668a3a7c6 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_lin_add_b2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable; + testset::additional<Indexable>(bgi::linear<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_lin_add_b3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_lin_add_b3d.cpp new file mode 100644 index 000000000..b1c8d1080 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_lin_add_b3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable; + testset::additional<Indexable>(bgi::linear<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_lin_add_p2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_lin_add_p2d.cpp new file mode 100644 index 000000000..5a3a4c328 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_lin_add_p2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable; + testset::additional<Indexable>(bgi::linear<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_lin_add_p3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_lin_add_p3d.cpp new file mode 100644 index 000000000..dee2c17f3 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_lin_add_p3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable; + testset::additional<Indexable>(bgi::linear<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_lin_mod_b2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_lin_mod_b2d.cpp new file mode 100644 index 000000000..a55700ab3 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_lin_mod_b2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable; + testset::modifiers<Indexable>(bgi::linear<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_lin_mod_b3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_lin_mod_b3d.cpp new file mode 100644 index 000000000..47cc47866 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_lin_mod_b3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable; + testset::modifiers<Indexable>(bgi::linear<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_lin_mod_p2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_lin_mod_p2d.cpp new file mode 100644 index 000000000..a5ae7e41f --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_lin_mod_p2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable; + testset::modifiers<Indexable>(bgi::linear<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_lin_mod_p3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_lin_mod_p3d.cpp new file mode 100644 index 000000000..6272a2f87 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_lin_mod_p3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable; + testset::modifiers<Indexable>(bgi::linear<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_lin_que_b2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_lin_que_b2d.cpp new file mode 100644 index 000000000..a43437557 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_lin_que_b2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable; + testset::queries<Indexable>(bgi::linear<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_lin_que_b3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_lin_que_b3d.cpp new file mode 100644 index 000000000..dff1647e0 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_lin_que_b3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable; + testset::queries<Indexable>(bgi::linear<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_lin_que_p2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_lin_que_p2d.cpp new file mode 100644 index 000000000..305d29ab8 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_lin_que_p2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable; + testset::queries<Indexable>(bgi::linear<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_lin_que_p3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_lin_que_p3d.cpp new file mode 100644 index 000000000..9e948ab1d --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_lin_que_p3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable; + testset::queries<Indexable>(bgi::linear<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_qua_add_b2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_qua_add_b2d.cpp new file mode 100644 index 000000000..2623bacae --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_qua_add_b2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable; + testset::additional<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_qua_add_b3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_qua_add_b3d.cpp new file mode 100644 index 000000000..314832fb4 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_qua_add_b3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable; + testset::additional<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_qua_add_p2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_qua_add_p2d.cpp new file mode 100644 index 000000000..6f19d402a --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_qua_add_p2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable; + testset::additional<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_qua_add_p3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_qua_add_p3d.cpp new file mode 100644 index 000000000..c2f6bc8a5 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_qua_add_p3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable; + testset::additional<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_qua_mod_b2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_qua_mod_b2d.cpp new file mode 100644 index 000000000..c66720405 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_qua_mod_b2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable; + testset::modifiers<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_qua_mod_b3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_qua_mod_b3d.cpp new file mode 100644 index 000000000..0230c9b97 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_qua_mod_b3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable; + testset::modifiers<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_qua_mod_p2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_qua_mod_p2d.cpp new file mode 100644 index 000000000..4c07b4bb3 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_qua_mod_p2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable; + testset::modifiers<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_qua_mod_p3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_qua_mod_p3d.cpp new file mode 100644 index 000000000..44779b25e --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_qua_mod_p3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable; + testset::modifiers<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_qua_que_b2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_qua_que_b2d.cpp new file mode 100644 index 000000000..86753b749 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_qua_que_b2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable; + testset::queries<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_qua_que_b3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_qua_que_b3d.cpp new file mode 100644 index 000000000..74dc69945 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_qua_que_b3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable; + testset::queries<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_qua_que_p2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_qua_que_p2d.cpp new file mode 100644 index 000000000..fb4660e0e --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_qua_que_p2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable; + testset::queries<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_qua_que_p3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_qua_que_p3d.cpp new file mode 100644 index 000000000..f5806c7f4 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_qua_que_p3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable; + testset::queries<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_rst_add_b2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_rst_add_b2d.cpp new file mode 100644 index 000000000..97fb92f47 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_rst_add_b2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable; + testset::additional<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_rst_add_b3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_rst_add_b3d.cpp new file mode 100644 index 000000000..7e0171b59 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_rst_add_b3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable; + testset::additional<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_rst_add_p2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_rst_add_p2d.cpp new file mode 100644 index 000000000..6fb31af48 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_rst_add_p2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable; + testset::additional<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_rst_add_p3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_rst_add_p3d.cpp new file mode 100644 index 000000000..b02e09fbc --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_rst_add_p3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable; + testset::additional<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_rst_mod_b2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_rst_mod_b2d.cpp new file mode 100644 index 000000000..3315296e8 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_rst_mod_b2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable; + testset::modifiers<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_rst_mod_b3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_rst_mod_b3d.cpp new file mode 100644 index 000000000..96884543d --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_rst_mod_b3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable; + testset::modifiers<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_rst_mod_p2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_rst_mod_p2d.cpp new file mode 100644 index 000000000..c0cab5ea4 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_rst_mod_p2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable; + testset::modifiers<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_rst_mod_p3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_rst_mod_p3d.cpp new file mode 100644 index 000000000..5ad0fdd79 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_rst_mod_p3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable; + testset::modifiers<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_rst_que_b2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_rst_que_b2d.cpp new file mode 100644 index 000000000..2f16ef275 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_rst_que_b2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable; + testset::queries<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_rst_que_b3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_rst_que_b3d.cpp new file mode 100644 index 000000000..1943ccc16 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_rst_que_b3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable; + testset::queries<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_rst_que_p2d.cpp b/libs/geometry/index/test/rtree/generated/rtree_rst_que_p2d.cpp new file mode 100644 index 000000000..492a20832 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_rst_que_p2d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable; + testset::queries<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/generated/rtree_rst_que_p3d.cpp b/libs/geometry/index/test/rtree/generated/rtree_rst_que_p3d.cpp new file mode 100644 index 000000000..5f152ecc3 --- /dev/null +++ b/libs/geometry/index/test/rtree/generated/rtree_rst_que_p3d.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable; + testset::queries<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>()); + return 0; +} diff --git a/libs/geometry/index/test/rtree/interprocess/Jamfile.v2 b/libs/geometry/index/test/rtree/interprocess/Jamfile.v2 new file mode 100644 index 000000000..be709a43b --- /dev/null +++ b/libs/geometry/index/test/rtree/interprocess/Jamfile.v2 @@ -0,0 +1,29 @@ +# Boost.Geometry Index +# +# Copyright (c) 2011-2013 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) + +rule test_all +{ + local all_rules = ; + + for local fileb in [ glob *.cpp ] + { + all_rules += [ run $(fileb) /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" + ] ; + } + + return $(all_rules) ; +} + +test-suite boost-geometry-index-rtree-interprocess : [ test_all r ] : <threading>multi ; diff --git a/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_linear.cpp b/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_linear.cpp new file mode 100644 index 000000000..1a6077f41 --- /dev/null +++ b/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_linear.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/interprocess/test_interprocess.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<float, 2, bg::cs::cartesian> P2f; + + testset::interprocess::modifiers<P2f>(bgi::linear<32, 8>()); + testset::interprocess::additional<P2f>(bgi::linear<32, 8>()); + + return 0; +} diff --git a/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_linear_dyn.cpp b/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_linear_dyn.cpp new file mode 100644 index 000000000..4823bbb57 --- /dev/null +++ b/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_linear_dyn.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/interprocess/test_interprocess.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<float, 2, bg::cs::cartesian> P2f; + + testset::interprocess::modifiers<P2f>(bgi::dynamic_linear(32, 8)); + testset::interprocess::additional<P2f>(bgi::dynamic_linear(32, 8)); + + return 0; +} diff --git a/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_quadratic.cpp b/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_quadratic.cpp new file mode 100644 index 000000000..8a8bea0e8 --- /dev/null +++ b/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_quadratic.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/interprocess/test_interprocess.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<float, 2, bg::cs::cartesian> P2f; + + testset::interprocess::modifiers<P2f>(bgi::quadratic<32, 8>()); + testset::interprocess::additional<P2f>(bgi::quadratic<32, 8>()); + + return 0; +} diff --git a/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_quadratic_dyn.cpp b/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_quadratic_dyn.cpp new file mode 100644 index 000000000..b7710ef4b --- /dev/null +++ b/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_quadratic_dyn.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/interprocess/test_interprocess.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<float, 2, bg::cs::cartesian> P2f; + + testset::interprocess::modifiers<P2f>(bgi::dynamic_quadratic(32, 8)); + testset::interprocess::additional<P2f>(bgi::dynamic_quadratic(32, 8)); + + return 0; +} diff --git a/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_rstar.cpp b/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_rstar.cpp new file mode 100644 index 000000000..8402bb0fc --- /dev/null +++ b/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_rstar.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/interprocess/test_interprocess.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<float, 2, bg::cs::cartesian> P2f; + + testset::interprocess::modifiers<P2f>(bgi::rstar<32, 8>()); + testset::interprocess::additional<P2f>(bgi::rstar<32, 8>()); + + return 0; +} diff --git a/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_rstar_dyn.cpp b/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_rstar_dyn.cpp new file mode 100644 index 000000000..52c81e958 --- /dev/null +++ b/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_rstar_dyn.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/interprocess/test_interprocess.hpp> + +int test_main(int, char* []) +{ + typedef bg::model::point<float, 2, bg::cs::cartesian> P2f; + + testset::interprocess::modifiers<P2f>(bgi::dynamic_rstar(32, 8)); + testset::interprocess::additional<P2f>(bgi::dynamic_rstar(32, 8)); + + return 0; +} diff --git a/libs/geometry/index/test/rtree/interprocess/test_interprocess.hpp b/libs/geometry/index/test/rtree/interprocess/test_interprocess.hpp new file mode 100644 index 000000000..471f9fa15 --- /dev/null +++ b/libs/geometry/index/test/rtree/interprocess/test_interprocess.hpp @@ -0,0 +1,84 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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) + +#include <rtree/test_rtree.hpp> + +#include <boost/geometry/geometries/point.hpp> +#include <boost/geometry/geometries/box.hpp> + +#include <boost/interprocess/managed_shared_memory.hpp> +#include <boost/interprocess/allocators/allocator.hpp> + +template <typename Point, typename Parameters> +void test_rtree_interprocess(Parameters const& parameters = Parameters()) +{ + namespace bi = boost::interprocess; + struct shm_remove + { + shm_remove() { bi::shared_memory_object::remove("shmem"); } + ~shm_remove(){ bi::shared_memory_object::remove("shmem"); } + } remover; + + bi::managed_shared_memory segment(bi::create_only, "shmem", 65535); + typedef bi::allocator<Point, bi::managed_shared_memory::segment_manager> shmem_alloc; + + test_rtree_for_box<Point>(parameters, shmem_alloc(segment.get_segment_manager())); +} + +namespace testset { namespace interprocess { + +template <typename Indexable, typename Parameters> +void modifiers(Parameters const& parameters = Parameters()) +{ + namespace bi = boost::interprocess; + struct shm_remove + { + shm_remove() { bi::shared_memory_object::remove("shmem"); } + ~shm_remove(){ bi::shared_memory_object::remove("shmem"); } + } remover; + + bi::managed_shared_memory segment(bi::create_only, "shmem", 65535); + typedef bi::allocator<Indexable, bi::managed_shared_memory::segment_manager> shmem_alloc; + + testset::modifiers<Indexable>(parameters, shmem_alloc(segment.get_segment_manager())); +} + +template <typename Indexable, typename Parameters> +void queries(Parameters const& parameters = Parameters()) +{ + namespace bi = boost::interprocess; + struct shm_remove + { + shm_remove() { bi::shared_memory_object::remove("shmem"); } + ~shm_remove(){ bi::shared_memory_object::remove("shmem"); } + } remover; + + bi::managed_shared_memory segment(bi::create_only, "shmem", 65535); + typedef bi::allocator<Indexable, bi::managed_shared_memory::segment_manager> shmem_alloc; + + testset::queries<Indexable>(parameters, shmem_alloc(segment.get_segment_manager())); +} + +template <typename Indexable, typename Parameters> +void additional(Parameters const& parameters = Parameters()) +{ + namespace bi = boost::interprocess; + struct shm_remove + { + shm_remove() { bi::shared_memory_object::remove("shmem"); } + ~shm_remove(){ bi::shared_memory_object::remove("shmem"); } + } remover; + + bi::managed_shared_memory segment(bi::create_only, "shmem", 65535); + typedef bi::allocator<Indexable, bi::managed_shared_memory::segment_manager> shmem_alloc; + + testset::additional<Indexable>(parameters, shmem_alloc(segment.get_segment_manager())); +} + +}}
\ No newline at end of file diff --git a/libs/geometry/index/test/rtree/rtree_test_generator.cpp b/libs/geometry/index/test/rtree/rtree_test_generator.cpp new file mode 100644 index 000000000..4d44fd22e --- /dev/null +++ b/libs/geometry/index/test/rtree/rtree_test_generator.cpp @@ -0,0 +1,99 @@ +// Boost.Geometry Index +// Rtree tests generator + +// Copyright (c) 2011-2013 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) + +#include <fstream> +#include <vector> +#include <string> +#include <boost/foreach.hpp> +#include <boost/tuple/tuple.hpp> + +int main() +{ + typedef boost::tuple<std::string, std::string> CT; + std::vector<CT> coordinate_types; + coordinate_types.push_back(boost::make_tuple("double", "d")); + //coordinate_types.push_back(boost::make_tuple("int", "i")); + //coordinate_types.push_back(boost::make_tuple("float", "f")); + + std::vector<std::string> dimensions; + dimensions.push_back("2"); + dimensions.push_back("3"); + + typedef boost::tuple<std::string, std::string> P; + std::vector<P> parameters; + parameters.push_back(boost::make_tuple("bgi::linear<5, 2>()", "lin")); + parameters.push_back(boost::make_tuple("bgi::dynamic_linear(5, 2)", "dlin")); + parameters.push_back(boost::make_tuple("bgi::quadratic<5, 2>()", "qua")); + parameters.push_back(boost::make_tuple("bgi::dynamic_quadratic(5, 2)", "dqua")); + parameters.push_back(boost::make_tuple("bgi::rstar<5, 2>()", "rst")); + parameters.push_back(boost::make_tuple("bgi::dynamic_rstar(5, 2)","drst")); + + std::vector<std::string> indexables; + indexables.push_back("p"); + indexables.push_back("b"); + + typedef std::pair<std::string, std::string> TS; + std::vector<TS> testsets; + testsets.push_back(std::make_pair("testset::modifiers", "mod")); + testsets.push_back(std::make_pair("testset::queries", "que")); + testsets.push_back(std::make_pair("testset::additional", "add")); + + BOOST_FOREACH(P const& p, parameters) + { + BOOST_FOREACH(TS const& ts, testsets) + { + BOOST_FOREACH(std::string const& i, indexables) + { + BOOST_FOREACH(std::string const& d, dimensions) + { + BOOST_FOREACH(CT const& c, coordinate_types) + { + std::string filename = std::string() + + "rtree_" + boost::get<1>(p) + '_' + ts.second + '_' + i + d + boost::get<1>(c) + ".cpp"; + + std::ofstream f(filename.c_str(), std::ios::trunc); + + f << + "// Boost.Geometry Index\n" << + "// Unit Test\n" << + "\n" << + "// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.\n" << + "\n" << + "// Use, modification and distribution is subject to the Boost Software License,\n" << + "// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at\n" << + "// http://www.boost.org/LICENSE_1_0.txt)\n" << + "\n"; + + f << + "#include <rtree/test_rtree.hpp>\n" << + "\n" << + "#include <boost/geometry/geometries/point.hpp>\n" << + "#include <boost/geometry/geometries/box.hpp>\n" << + "\n"; + + std::string point_type = std::string("bg::model::point<") + boost::get<0>(c) + ", " + d + ", bg::cs::cartesian>"; + std::string box_type = std::string("bg::model::box< ") + point_type + " >"; + std::string indexable_type = (i == "p" ? point_type : box_type); + + f << + "int test_main(int, char* [])\n" << + "{\n" << + " typedef " << indexable_type << " Indexable;\n" << + " " << ts.first << "<Indexable>(" << boost::get<0>(p) << ", std::allocator<int>());\n" << + " return 0;\n" << + "}\n"; + } + } + } + + } + } + + return 0; +} diff --git a/libs/geometry/index/test/rtree/test_rtree.hpp b/libs/geometry/index/test/rtree/test_rtree.hpp new file mode 100644 index 000000000..de15f6913 --- /dev/null +++ b/libs/geometry/index/test/rtree/test_rtree.hpp @@ -0,0 +1,1760 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 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_INDEX_TEST_RTREE_HPP +#define BOOST_GEOMETRY_INDEX_TEST_RTREE_HPP + +#include <boost/foreach.hpp> +#include <vector> +#include <algorithm> + +#include <geometry_index_test_common.hpp> + +// TEST +//#define BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL +//#define BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS +#include <boost/geometry/index/rtree.hpp> + +#include <boost/geometry/index/detail/rtree/utilities/are_levels_ok.hpp> +#include <boost/geometry/index/detail/rtree/utilities/are_boxes_ok.hpp> + +//#include <boost/geometry/geometries/ring.hpp> +//#include <boost/geometry/geometries/polygon.hpp> + +namespace generate { + +// Set point's coordinates + +template <typename Point> +struct outside_point +{}; + +template <typename T, typename C> +struct outside_point< bg::model::point<T, 2, C> > +{ + typedef bg::model::point<T, 2, C> P; + static P apply() + { + return P(13, 26); + } +}; + +template <typename T, typename C> +struct outside_point< bg::model::point<T, 3, C> > +{ + typedef bg::model::point<T, 3, C> P; + static P apply() + { + return P(13, 26, 13); + } +}; + +// Default value generation + +template <typename Value> +struct value_default +{ + static Value apply(){ return Value(); } +}; + +// Values, input and rtree generation + +template <typename Value> +struct value +{}; + +template <typename T, typename C> +struct value< bg::model::point<T, 2, C> > +{ + typedef bg::model::point<T, 2, C> P; + static P apply(int x, int y) + { + return P(x, y); + } +}; + +template <typename T, typename C> +struct value< bg::model::box< bg::model::point<T, 2, C> > > +{ + typedef bg::model::point<T, 2, C> P; + typedef bg::model::box<P> B; + static B apply(int x, int y) + { + return B(P(x, y), P(x + 2, y + 3)); + } +}; + +template <typename T, typename C> +struct value< std::pair<bg::model::point<T, 2, C>, int> > +{ + typedef bg::model::point<T, 2, C> P; + typedef std::pair<P, int> R; + static R apply(int x, int y) + { + return std::make_pair(P(x, y), x + y * 100); + } +}; + +template <typename T, typename C> +struct value< std::pair<bg::model::box< bg::model::point<T, 2, C> >, int> > +{ + typedef bg::model::point<T, 2, C> P; + typedef bg::model::box<P> B; + typedef std::pair<B, int> R; + static R apply(int x, int y) + { + return std::make_pair(B(P(x, y), P(x + 2, y + 3)), x + y * 100); + } +}; + +template <typename T, typename C> +struct value< boost::tuple<bg::model::point<T, 2, C>, int, int> > +{ + typedef bg::model::point<T, 2, C> P; + typedef boost::tuple<P, int, int> R; + static R apply(int x, int y) + { + return boost::make_tuple(P(x, y), x + y * 100, 0); + } +}; + +template <typename T, typename C> +struct value< boost::tuple<bg::model::box< bg::model::point<T, 2, C> >, int, int> > +{ + typedef bg::model::point<T, 2, C> P; + typedef bg::model::box<P> B; + typedef boost::tuple<B, int, int> R; + static R apply(int x, int y) + { + return boost::make_tuple(B(P(x, y), P(x + 2, y + 3)), x + y * 100, 0); + } +}; + +template <typename T, typename C> +struct value< bg::model::point<T, 3, C> > +{ + typedef bg::model::point<T, 3, C> P; + static P apply(int x, int y, int z) + { + return P(x, y, z); + } +}; + +template <typename T, typename C> +struct value< bg::model::box< bg::model::point<T, 3, C> > > +{ + typedef bg::model::point<T, 3, C> P; + typedef bg::model::box<P> B; + static B apply(int x, int y, int z) + { + return B(P(x, y, z), P(x + 2, y + 3, z + 4)); + } +}; + +template <typename T, typename C> +struct value< std::pair<bg::model::point<T, 3, C>, int> > +{ + typedef bg::model::point<T, 3, C> P; + typedef std::pair<P, int> R; + static R apply(int x, int y, int z) + { + return std::make_pair(P(x, y, z), x + y * 100 + z * 10000); + } +}; + +template <typename T, typename C> +struct value< std::pair<bg::model::box< bg::model::point<T, 3, C> >, int> > +{ + typedef bg::model::point<T, 3, C> P; + typedef bg::model::box<P> B; + typedef std::pair<B, int> R; + static R apply(int x, int y, int z) + { + return std::make_pair(B(P(x, y, z), P(x + 2, y + 3, z + 4)), x + y * 100 + z * 10000); + } +}; + +template <typename T, typename C> +struct value< boost::tuple<bg::model::point<T, 3, C>, int, int> > +{ + typedef bg::model::point<T, 3, C> P; + typedef boost::tuple<P, int, int> R; + static R apply(int x, int y, int z) + { + return boost::make_tuple(P(x, y, z), x + y * 100 + z * 10000, 0); + } +}; + +template <typename T, typename C> +struct value< boost::tuple<bg::model::box< bg::model::point<T, 3, C> >, int, int> > +{ + typedef bg::model::point<T, 3, C> P; + typedef bg::model::box<P> B; + typedef boost::tuple<B, int, int> R; + static R apply(int x, int y, int z) + { + return boost::make_tuple(B(P(x, y, z), P(x + 2, y + 3, z + 4)), x + y * 100 + z * 10000, 0); + } +}; + +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +template <typename T, typename C> +struct value< std::tuple<bg::model::point<T, 2, C>, int, int> > +{ + typedef bg::model::point<T, 2, C> P; + typedef std::tuple<P, int, int> R; + static R apply(int x, int y) + { + return std::make_tuple(P(x, y), x + y * 100, 0); + } +}; + +template <typename T, typename C> +struct value< std::tuple<bg::model::box< bg::model::point<T, 2, C> >, int, int> > +{ + typedef bg::model::point<T, 2, C> P; + typedef bg::model::box<P> B; + typedef std::tuple<B, int, int> R; + static R apply(int x, int y) + { + return std::make_tuple(B(P(x, y), P(x + 2, y + 3)), x + y * 100, 0); + } +}; + +template <typename T, typename C> +struct value< std::tuple<bg::model::point<T, 3, C>, int, int> > +{ + typedef bg::model::point<T, 3, C> P; + typedef std::tuple<P, int, int> R; + static R apply(int x, int y, int z) + { + return std::make_tuple(P(x, y, z), x + y * 100 + z * 10000, 0); + } +}; + +template <typename T, typename C> +struct value< std::tuple<bg::model::box< bg::model::point<T, 3, C> >, int, int> > +{ + typedef bg::model::point<T, 3, C> P; + typedef bg::model::box<P> B; + typedef std::tuple<B, int, int> R; + static R apply(int x, int y, int z) + { + return std::make_tuple(B(P(x, y, z), P(x + 2, y + 3, z + 4)), x + y * 100 + z * 10000, 0); + } +}; + +#endif // #if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +} // namespace generate + +// shared_ptr value + +template <typename Indexable> +struct test_object +{ + test_object(Indexable const& indexable_) : indexable(indexable_) {} + Indexable indexable; +}; + +namespace boost { namespace geometry { namespace index { + +template <typename Indexable> +struct indexable< boost::shared_ptr< test_object<Indexable> > > +{ + typedef boost::shared_ptr< test_object<Indexable> > value_type; + typedef Indexable const& result_type; + + result_type operator()(value_type const& value) const + { + return value->indexable; + } +}; + +}}} + +namespace generate { + +template <typename T, typename C> +struct value< boost::shared_ptr<test_object<bg::model::point<T, 2, C> > > > +{ + typedef bg::model::point<T, 2, C> P; + typedef test_object<P> O; + typedef boost::shared_ptr<O> R; + + static R apply(int x, int y) + { + return R(new O(P(x, y))); + } +}; + +template <typename T, typename C> +struct value< boost::shared_ptr<test_object<bg::model::point<T, 3, C> > > > +{ + typedef bg::model::point<T, 3, C> P; + typedef test_object<P> O; + typedef boost::shared_ptr<O> R; + + static R apply(int x, int y, int z) + { + return R(new O(P(x, y, z))); + } +}; + +template <typename T, typename C> +struct value< boost::shared_ptr<test_object<bg::model::box<bg::model::point<T, 2, C> > > > > +{ + typedef bg::model::point<T, 2, C> P; + typedef bg::model::box<P> B; + typedef test_object<B> O; + typedef boost::shared_ptr<O> R; + + static R apply(int x, int y) + { + return R(new O(B(P(x, y), P(x + 2, y + 3)))); + } +}; + +template <typename T, typename C> +struct value< boost::shared_ptr<test_object<bg::model::box<bg::model::point<T, 3, C> > > > > +{ + typedef bg::model::point<T, 3, C> P; + typedef bg::model::box<P> B; + typedef test_object<B> O; + typedef boost::shared_ptr<O> R; + + static R apply(int x, int y, int z) + { + return R(new O(B(P(x, y, z), P(x + 2, y + 3, z + 4)))); + } +}; + +} //namespace generate + +// counting value + +template <typename Indexable> +struct counting_value +{ + counting_value() { counter()++; } + counting_value(Indexable const& i) : indexable(i) { counter()++; } + counting_value(counting_value const& c) : indexable(c.indexable) { counter()++; } + ~counting_value() { counter()--; } + + static size_t & counter() { static size_t c = 0; return c; } + Indexable indexable; +}; + +namespace boost { namespace geometry { namespace index { + +template <typename Indexable> +struct indexable< counting_value<Indexable> > +{ + typedef counting_value<Indexable> value_type; + typedef Indexable const& result_type; + result_type operator()(value_type const& value) const + { + return value.indexable; + } +}; + +template <typename Indexable> +struct equal_to< counting_value<Indexable> > +{ + typedef counting_value<Indexable> value_type; + typedef bool result_type; + bool operator()(value_type const& v1, value_type const& v2) const + { + return boost::geometry::equals(v1.indexable, v2.indexable); + } +}; + +}}} + +namespace generate { + +template <typename T, typename C> +struct value< counting_value<bg::model::point<T, 2, C> > > +{ + typedef bg::model::point<T, 2, C> P; + typedef counting_value<P> R; + static R apply(int x, int y) { return R(P(x, y)); } +}; + +template <typename T, typename C> +struct value< counting_value<bg::model::point<T, 3, C> > > +{ + typedef bg::model::point<T, 3, C> P; + typedef counting_value<P> R; + static R apply(int x, int y, int z) { return R(P(x, y, z)); } +}; + +template <typename T, typename C> +struct value< counting_value<bg::model::box<bg::model::point<T, 2, C> > > > +{ + typedef bg::model::point<T, 2, C> P; + typedef bg::model::box<P> B; + typedef counting_value<B> R; + static R apply(int x, int y) { return R(B(P(x, y), P(x+2, y+3))); } +}; + +template <typename T, typename C> +struct value< counting_value<bg::model::box<bg::model::point<T, 3, C> > > > +{ + typedef bg::model::point<T, 3, C> P; + typedef bg::model::box<P> B; + typedef counting_value<B> R; + static R apply(int x, int y, int z) { return R(B(P(x, y, z), P(x+2, y+3, z+4))); } +}; + +} // namespace generate + +// value without default constructor + +template <typename Indexable> +struct value_no_dctor +{ + value_no_dctor(Indexable const& i) : indexable(i) {} + Indexable indexable; +}; + +namespace boost { namespace geometry { namespace index { + +template <typename Indexable> +struct indexable< value_no_dctor<Indexable> > +{ + typedef value_no_dctor<Indexable> value_type; + typedef Indexable const& result_type; + result_type operator()(value_type const& value) const + { + return value.indexable; + } +}; + +template <typename Indexable> +struct equal_to< value_no_dctor<Indexable> > +{ + typedef value_no_dctor<Indexable> value_type; + typedef bool result_type; + bool operator()(value_type const& v1, value_type const& v2) const + { + return boost::geometry::equals(v1.indexable, v2.indexable); + } +}; + +}}} + +namespace generate { + +template <typename Indexable> +struct value_default< value_no_dctor<Indexable> > +{ + static value_no_dctor<Indexable> apply() { return value_no_dctor<Indexable>(Indexable()); } +}; + +template <typename T, typename C> +struct value< value_no_dctor<bg::model::point<T, 2, C> > > +{ + typedef bg::model::point<T, 2, C> P; + typedef value_no_dctor<P> R; + static R apply(int x, int y) { return R(P(x, y)); } +}; + +template <typename T, typename C> +struct value< value_no_dctor<bg::model::point<T, 3, C> > > +{ + typedef bg::model::point<T, 3, C> P; + typedef value_no_dctor<P> R; + static R apply(int x, int y, int z) { return R(P(x, y, z)); } +}; + +template <typename T, typename C> +struct value< value_no_dctor<bg::model::box<bg::model::point<T, 2, C> > > > +{ + typedef bg::model::point<T, 2, C> P; + typedef bg::model::box<P> B; + typedef value_no_dctor<B> R; + static R apply(int x, int y) { return R(B(P(x, y), P(x+2, y+3))); } +}; + +template <typename T, typename C> +struct value< value_no_dctor<bg::model::box<bg::model::point<T, 3, C> > > > +{ + typedef bg::model::point<T, 3, C> P; + typedef bg::model::box<P> B; + typedef value_no_dctor<B> R; + static R apply(int x, int y, int z) { return R(B(P(x, y, z), P(x+2, y+3, z+4))); } +}; + +// generate input + +template <size_t Dimension> +struct input +{}; + +template <> +struct input<2> +{ + template <typename Value, typename Box> + static void apply(std::vector<Value> & input, Box & qbox, int size = 1) + { + BOOST_GEOMETRY_INDEX_ASSERT(0 < size, "the value must be greather than 0"); + + for ( int i = 0 ; i < 12 * size ; i += 3 ) + { + for ( int j = 1 ; j < 25 * size ; j += 4 ) + { + input.push_back( generate::value<Value>::apply(i, j) ); + } + } + + typedef typename bg::traits::point_type<Box>::type P; + + qbox = Box(P(3, 0), P(10, 9)); + } +}; + +template <> +struct input<3> +{ + template <typename Value, typename Box> + static void apply(std::vector<Value> & input, Box & qbox, int size = 1) + { + BOOST_GEOMETRY_INDEX_ASSERT(0 < size, "the value must be greather than 0"); + + for ( int i = 0 ; i < 12 * size ; i += 3 ) + { + for ( int j = 1 ; j < 25 * size ; j += 4 ) + { + for ( int k = 2 ; k < 12 * size ; k += 5 ) + { + input.push_back( generate::value<Value>::apply(i, j, k) ); + } + } + } + + typedef typename bg::traits::point_type<Box>::type P; + + qbox = Box(P(3, 0, 3), P(10, 9, 11)); + } +}; + +// generate_value_outside + +template <typename Value, size_t Dimension> +struct value_outside_impl +{}; + +template <typename Value> +struct value_outside_impl<Value, 2> +{ + static Value apply() + { + //TODO - for size > 1 in generate_input<> this won't be outside + return generate::value<Value>::apply(13, 26); + } +}; + +template <typename Value> +struct value_outside_impl<Value, 3> +{ + static Value apply() + { + //TODO - for size > 1 in generate_input<> this won't be outside + return generate::value<Value>::apply(13, 26, 13); + } +}; + +template <typename Rtree> +inline typename Rtree::value_type +value_outside() +{ + typedef typename Rtree::value_type V; + typedef typename Rtree::indexable_type I; + + return value_outside_impl<V, bg::dimension<I>::value>::apply(); +} + +template<typename Rtree, typename Elements, typename Box> +void rtree(Rtree & tree, Elements & input, Box & qbox) +{ + typedef typename Rtree::indexable_type I; + + generate::input< + bg::dimension<I>::value + >::apply(input, qbox); + + tree.insert(input.begin(), input.end()); +} + +} // namespace generate + +namespace basictest { + +// low level test functions + +template <typename Rtree, typename Iter, typename Value> +Iter find(Rtree const& rtree, Iter first, Iter last, Value const& value) +{ + for ( ; first != last ; ++first ) + if ( rtree.value_eq()(value, *first) ) + return first; + return first; +} + +template <typename Rtree, typename Value> +void compare_outputs(Rtree const& rtree, std::vector<Value> const& output, std::vector<Value> const& expected_output) +{ + bool are_sizes_ok = (expected_output.size() == output.size()); + BOOST_CHECK( are_sizes_ok ); + if ( are_sizes_ok ) + { + BOOST_FOREACH(Value const& v, expected_output) + { + BOOST_CHECK(find(rtree, output.begin(), output.end(), v) != output.end() ); + } + } +} + +template <typename Rtree, typename Range1, typename Range2> +void exactly_the_same_outputs(Rtree const& rtree, Range1 const& output, Range2 const& expected_output) +{ + size_t s1 = std::distance(output.begin(), output.end()); + size_t s2 = std::distance(expected_output.begin(), expected_output.end()); + BOOST_CHECK(s1 == s2); + + if ( s1 == s2 ) + { + typename Range1::const_iterator it1 = output.begin(); + typename Range2::const_iterator it2 = expected_output.begin(); + for ( ; it1 != output.end() && it2 != expected_output.end() ; ++it1, ++it2 ) + { + if ( !rtree.value_eq()(*it1, *it2) ) + { + BOOST_CHECK(false && "rtree.translator().equals(*it1, *it2)"); + break; + } + } + } +} + +// spatial query + +template <typename Rtree, typename Value, typename Predicates> +void spatial_query(Rtree & rtree, Predicates const& pred, std::vector<Value> const& expected_output) +{ + BOOST_CHECK( bgi::detail::rtree::utilities::are_levels_ok(rtree) ); + if ( !rtree.empty() ) + BOOST_CHECK( bgi::detail::rtree::utilities::are_boxes_ok(rtree) ); + + std::vector<Value> output; + size_t n = rtree.query(pred, std::back_inserter(output)); + + BOOST_CHECK( expected_output.size() == n ); + compare_outputs(rtree, output, expected_output); + + std::vector<Value> output2; + size_t n2 = query(rtree, pred, std::back_inserter(output2)); + + BOOST_CHECK( n == n2 ); + exactly_the_same_outputs(rtree, output, output2); + + exactly_the_same_outputs(rtree, output, rtree | bgi::adaptors::queried(pred)); + +#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL + std::vector<Value> output3; + std::copy(rtree.qbegin(pred), rtree.qend(pred), std::back_inserter(output3)); + + compare_outputs(rtree, output3, expected_output); + +#ifdef BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS + { + typedef typename Rtree::const_query_iterator QI; + QI first = rtree.qbegin(pred); + QI last = rtree.qend(pred); + std::vector<Value> output4; + std::copy(first, last, std::back_inserter(output4)); + compare_outputs(rtree, output4, expected_output); + } +#endif +#endif +} + +// rtree specific queries tests + +template <typename Rtree, typename Value, typename Box> +void intersects(Rtree const& tree, std::vector<Value> const& input, Box const& qbox) +{ + std::vector<Value> expected_output; + + BOOST_FOREACH(Value const& v, input) + if ( bg::intersects(tree.indexable_get()(v), qbox) ) + expected_output.push_back(v); + + //spatial_query(tree, qbox, expected_output); + spatial_query(tree, bgi::intersects(qbox), expected_output); + spatial_query(tree, !bgi::disjoint(qbox), expected_output); + + /*typedef bg::traits::point_type<Box>::type P; + bg::model::ring<P> qring; + bg::convert(qbox, qring); + spatial_query(tree, bgi::intersects(qring), expected_output); + spatial_query(tree, !bgi::disjoint(qring), expected_output); + bg::model::polygon<P> qpoly; + bg::convert(qbox, qpoly); + spatial_query(tree, bgi::intersects(qpoly), expected_output); + spatial_query(tree, !bgi::disjoint(qpoly), expected_output);*/ +} + +template <typename Rtree, typename Value, typename Box> +void disjoint(Rtree const& tree, std::vector<Value> const& input, Box const& qbox) +{ + std::vector<Value> expected_output; + + BOOST_FOREACH(Value const& v, input) + if ( bg::disjoint(tree.indexable_get()(v), qbox) ) + expected_output.push_back(v); + + spatial_query(tree, bgi::disjoint(qbox), expected_output); + spatial_query(tree, !bgi::intersects(qbox), expected_output); + + /*typedef bg::traits::point_type<Box>::type P; + bg::model::ring<P> qring; + bg::convert(qbox, qring); + spatial_query(tree, bgi::disjoint(qring), expected_output); + bg::model::polygon<P> qpoly; + bg::convert(qbox, qpoly); + spatial_query(tree, bgi::disjoint(qpoly), expected_output);*/ +} + +#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL + +template <typename Tag> +struct contains_impl +{ + template <typename Rtree, typename Value, typename Box> + static void apply(Rtree const& tree, std::vector<Value> const& input, Box const& qbox) + { + std::vector<Value> expected_output; + + BOOST_FOREACH(Value const& v, input) + if ( bg::within(qbox, tree.indexable_get()(v)) ) + expected_output.push_back(v); + + spatial_query(tree, bgi::contains(qbox), expected_output); + + /*typedef bg::traits::point_type<Box>::type P; + bg::model::ring<P> qring; + bg::convert(qbox, qring); + spatial_query(tree, bgi::contains(qring), expected_output); + bg::model::polygon<P> qpoly; + bg::convert(qbox, qpoly); + spatial_query(tree, bgi::contains(qpoly), expected_output);*/ + } +}; + +template <> +struct contains_impl<bg::point_tag> +{ + template <typename Rtree, typename Value, typename Box> + static void apply(Rtree const& /*tree*/, std::vector<Value> const& /*input*/, Box const& /*qbox*/) + {} +}; + +template <typename Rtree, typename Value, typename Box> +void contains(Rtree const& tree, std::vector<Value> const& input, Box const& qbox) +{ + contains_impl< + typename bg::tag< + typename Rtree::indexable_type + >::type + >::apply(tree, input, qbox); +} + +#endif // BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL + +template <typename Rtree, typename Value, typename Box> +void covered_by(Rtree const& tree, std::vector<Value> const& input, Box const& qbox) +{ + std::vector<Value> expected_output; + + BOOST_FOREACH(Value const& v, input) + if ( bg::covered_by(tree.indexable_get()(v), qbox) ) + expected_output.push_back(v); + + spatial_query(tree, bgi::covered_by(qbox), expected_output); + + /*typedef bg::traits::point_type<Box>::type P; + bg::model::ring<P> qring; + bg::convert(qbox, qring); + spatial_query(tree, bgi::covered_by(qring), expected_output); + bg::model::polygon<P> qpoly; + bg::convert(qbox, qpoly); + spatial_query(tree, bgi::covered_by(qpoly), expected_output);*/ +} + +#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL + +template <typename Tag> +struct covers_impl +{ + template <typename Rtree, typename Value, typename Box> + static void apply(Rtree const& tree, std::vector<Value> const& input, Box const& qbox) + { + std::vector<Value> expected_output; + + BOOST_FOREACH(Value const& v, input) + if ( bg::covered_by(qbox, tree.indexable_get()(v)) ) + expected_output.push_back(v); + + spatial_query(tree, bgi::covers(qbox), expected_output); + + /*typedef bg::traits::point_type<Box>::type P; + bg::model::ring<P> qring; + bg::convert(qbox, qring); + spatial_query(tree, bgi::covers(qring), expected_output); + bg::model::polygon<P> qpoly; + bg::convert(qbox, qpoly); + spatial_query(tree, bgi::covers(qpoly), expected_output);*/ + } +}; + +template <> +struct covers_impl<bg::point_tag> +{ + template <typename Rtree, typename Value, typename Box> + static void apply(Rtree const& /*tree*/, std::vector<Value> const& /*input*/, Box const& /*qbox*/) + {} +}; + +template <typename Rtree, typename Value, typename Box> +void covers(Rtree const& tree, std::vector<Value> const& input, Box const& qbox) +{ + covers_impl< + typename bg::tag< + typename Rtree::indexable_type + >::type + >::apply(tree, input, qbox); +} + +#endif // BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL + +template <typename Tag> +struct overlaps_impl +{ + template <typename Rtree, typename Value, typename Box> + static void apply(Rtree const& tree, std::vector<Value> const& input, Box const& qbox) + { + std::vector<Value> expected_output; + + BOOST_FOREACH(Value const& v, input) + if ( bg::overlaps(tree.indexable_get()(v), qbox) ) + expected_output.push_back(v); + + spatial_query(tree, bgi::overlaps(qbox), expected_output); + + /*typedef bg::traits::point_type<Box>::type P; + bg::model::ring<P> qring; + bg::convert(qbox, qring); + spatial_query(tree, bgi::overlaps(qring), expected_output); + bg::model::polygon<P> qpoly; + bg::convert(qbox, qpoly); + spatial_query(tree, bgi::overlaps(qpoly), expected_output);*/ + } +}; + +template <> +struct overlaps_impl<bg::point_tag> +{ + template <typename Rtree, typename Value, typename Box> + static void apply(Rtree const& /*tree*/, std::vector<Value> const& /*input*/, Box const& /*qbox*/) + {} +}; + +template <typename Rtree, typename Value, typename Box> +void overlaps(Rtree const& tree, std::vector<Value> const& input, Box const& qbox) +{ + overlaps_impl< + typename bg::tag< + typename Rtree::indexable_type + >::type + >::apply(tree, input, qbox); +} + +//template <typename Tag, size_t Dimension> +//struct touches_impl +//{ +// template <typename Rtree, typename Value, typename Box> +// static void apply(Rtree const& tree, std::vector<Value> const& input, Box const& qbox) +// {} +//}; +// +//template <> +//struct touches_impl<bg::box_tag, 2> +//{ +// template <typename Rtree, typename Value, typename Box> +// static void apply(Rtree const& tree, std::vector<Value> const& input, Box const& qbox) +// { +// std::vector<Value> expected_output; +// +// BOOST_FOREACH(Value const& v, input) +// if ( bg::touches(tree.translator()(v), qbox) ) +// expected_output.push_back(v); +// +// spatial_query(tree, bgi::touches(qbox), expected_output); +// } +//}; +// +//template <typename Rtree, typename Value, typename Box> +//void touches(Rtree const& tree, std::vector<Value> const& input, Box const& qbox) +//{ +// touches_impl< +// bgi::traits::tag<typename Rtree::indexable_type>::type, +// bgi::traits::dimension<typename Rtree::indexable_type>::value +// >::apply(tree, input, qbox); +//} + +template <typename Rtree, typename Value, typename Box> +void within(Rtree const& tree, std::vector<Value> const& input, Box const& qbox) +{ + std::vector<Value> expected_output; + + BOOST_FOREACH(Value const& v, input) + if ( bg::within(tree.indexable_get()(v), qbox) ) + expected_output.push_back(v); + + spatial_query(tree, bgi::within(qbox), expected_output); + + /*typedef bg::traits::point_type<Box>::type P; + bg::model::ring<P> qring; + bg::convert(qbox, qring); + spatial_query(tree, bgi::within(qring), expected_output); + bg::model::polygon<P> qpoly; + bg::convert(qbox, qpoly); + spatial_query(tree, bgi::within(qpoly), expected_output);*/ +} + +// rtree nearest queries + +template <typename Rtree, typename Point> +struct NearestKLess +{ + typedef typename bg::default_distance_result<Point, typename Rtree::indexable_type>::type D; + + template <typename Value> + bool operator()(std::pair<D, Value> const& p1, std::pair<D, Value> const& p2) const + { + return p1.first < p2.first; + } +}; + +template <typename Rtree, typename Point> +struct NearestKTransform +{ + typedef typename bg::default_distance_result<Point, typename Rtree::indexable_type>::type D; + + template <typename Value> + Value const& operator()(std::pair<D, Value> const& p) const + { + return p.second; + } +}; + +template <typename Rtree, typename Value, typename Point, typename Distance> +void compare_nearest_outputs(Rtree const& rtree, std::vector<Value> const& output, std::vector<Value> const& expected_output, Point const& pt, Distance greatest_distance) +{ + // check output + bool are_sizes_ok = (expected_output.size() == output.size()); + BOOST_CHECK( are_sizes_ok ); + if ( are_sizes_ok ) + { + BOOST_FOREACH(Value const& v, output) + { + // TODO - perform explicit check here? + // should all objects which are closest be checked and should exactly the same be found? + + if ( find(rtree, expected_output.begin(), expected_output.end(), v) == expected_output.end() ) + { + Distance d = bgi::detail::comparable_distance_near(pt, rtree.indexable_get()(v)); + BOOST_CHECK(d == greatest_distance); + } + } + } +} + +template <typename Rtree, typename Value, typename Point> +void nearest_query_k(Rtree const& rtree, std::vector<Value> const& input, Point const& pt, unsigned int k) +{ + // TODO: Nearest object may not be the same as found by the rtree if distances are equal + // All objects with the same closest distance should be picked + + typedef typename bg::default_distance_result<Point, typename Rtree::indexable_type>::type D; + + std::vector< std::pair<D, Value> > test_output; + + // calculate test output - k closest values pairs + BOOST_FOREACH(Value const& v, input) + { + D d = bgi::detail::comparable_distance_near(pt, rtree.indexable_get()(v)); + + if ( test_output.size() < k ) + test_output.push_back(std::make_pair(d, v)); + else + { + std::sort(test_output.begin(), test_output.end(), NearestKLess<Rtree, Point>()); + if ( d < test_output.back().first ) + test_output.back() = std::make_pair(d, v); + } + } + + // caluclate biggest distance + std::sort(test_output.begin(), test_output.end(), NearestKLess<Rtree, Point>()); + D greatest_distance = 0; + if ( !test_output.empty() ) + greatest_distance = test_output.back().first; + + // transform test output to vector of values + std::vector<Value> expected_output(test_output.size(), generate::value_default<Value>::apply()); + std::transform(test_output.begin(), test_output.end(), expected_output.begin(), NearestKTransform<Rtree, Point>()); + + // calculate output using rtree + std::vector<Value> output; + rtree.query(bgi::nearest(pt, k), std::back_inserter(output)); + + // check output + compare_nearest_outputs(rtree, output, expected_output, pt, greatest_distance); + + exactly_the_same_outputs(rtree, output, rtree | bgi::adaptors::queried(bgi::nearest(pt, k))); + + std::vector<Value> output2(k, generate::value_default<Value>::apply()); + typename Rtree::size_type found_count = rtree.query(bgi::nearest(pt, k), output2.begin()); + output2.resize(found_count, generate::value_default<Value>::apply()); + + exactly_the_same_outputs(rtree, output, output2); + +#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL + std::vector<Value> output3; + std::copy(rtree.qbegin(bgi::nearest(pt, k)), rtree.qend(bgi::nearest(pt, k)), std::back_inserter(output3)); + + compare_nearest_outputs(rtree, output3, expected_output, pt, greatest_distance); + +#ifdef BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS + { + typedef typename Rtree::const_query_iterator QI; + QI first = rtree.qbegin(bgi::nearest(pt, k)); + QI last = rtree.qend(bgi::nearest(pt, k)); + std::vector<Value> output4; + std::copy(first, last, std::back_inserter(output4)); + compare_nearest_outputs(rtree, output4, expected_output, pt, greatest_distance); + } +#endif +#endif +} + +// rtree nearest not found + +struct AlwaysFalse +{ + template <typename Value> + bool operator()(Value const& ) const { return false; } +}; + +template <typename Rtree, typename Point> +void nearest_query_not_found(Rtree const& rtree, Point const& pt) +{ + typedef typename Rtree::value_type Value; + + std::vector<Value> output_v; + size_t n_res = rtree.query(bgi::nearest(pt, 5) && bgi::satisfies(AlwaysFalse()), std::back_inserter(output_v)); + BOOST_CHECK(output_v.size() == n_res); + BOOST_CHECK(n_res < 5); +} + +template <typename Value> +bool satisfies_fun(Value const& ) { return true; } + +struct satisfies_obj +{ + template <typename Value> + bool operator()(Value const& ) const { return true; } +}; + +template <typename Rtree, typename Value> +void satisfies(Rtree const& rtree, std::vector<Value> const& input) +{ + std::vector<Value> result; + rtree.query(bgi::satisfies(satisfies_obj()), std::back_inserter(result)); + BOOST_CHECK(result.size() == input.size()); + result.clear(); + rtree.query(!bgi::satisfies(satisfies_obj()), std::back_inserter(result)); + BOOST_CHECK(result.size() == 0); + + result.clear(); + rtree.query(bgi::satisfies(satisfies_fun<Value>), std::back_inserter(result)); + BOOST_CHECK(result.size() == input.size()); + result.clear(); + rtree.query(!bgi::satisfies(satisfies_fun<Value>), std::back_inserter(result)); + BOOST_CHECK(result.size() == 0); + +#ifndef BOOST_NO_CXX11_LAMBDAS + result.clear(); + rtree.query(bgi::satisfies([](Value const&){ return true; }), std::back_inserter(result)); + BOOST_CHECK(result.size() == input.size()); + result.clear(); + rtree.query(!bgi::satisfies([](Value const&){ return true; }), std::back_inserter(result)); + BOOST_CHECK(result.size() == 0); +#endif +} + +// rtree copying and moving + +template <typename Rtree, typename Box> +void copy_swap_move(Rtree const& tree, Box const& qbox) +{ + typedef typename Rtree::value_type Value; + typedef typename Rtree::parameters_type Params; + + size_t s = tree.size(); + Params params = tree.parameters(); + + std::vector<Value> expected_output; + tree.query(bgi::intersects(qbox), std::back_inserter(expected_output)); + + // copy constructor + Rtree t1(tree); + + BOOST_CHECK(tree.empty() == t1.empty()); + BOOST_CHECK(tree.size() == t1.size()); + BOOST_CHECK(t1.parameters().get_max_elements() == params.get_max_elements()); + BOOST_CHECK(t1.parameters().get_min_elements() == params.get_min_elements()); + + std::vector<Value> output; + t1.query(bgi::intersects(qbox), std::back_inserter(output)); + exactly_the_same_outputs(t1, output, expected_output); + + // copying assignment operator + t1 = tree; + + BOOST_CHECK(tree.empty() == t1.empty()); + BOOST_CHECK(tree.size() == t1.size()); + BOOST_CHECK(t1.parameters().get_max_elements() == params.get_max_elements()); + BOOST_CHECK(t1.parameters().get_min_elements() == params.get_min_elements()); + + output.clear(); + t1.query(bgi::intersects(qbox), std::back_inserter(output)); + exactly_the_same_outputs(t1, output, expected_output); + + Rtree t2(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); + t2.swap(t1); + BOOST_CHECK(tree.empty() == t2.empty()); + BOOST_CHECK(tree.size() == t2.size()); + BOOST_CHECK(true == t1.empty()); + BOOST_CHECK(0 == t1.size()); + // those fails e.g. on darwin 4.2.1 because it can't copy base obejcts properly + BOOST_CHECK(t1.parameters().get_max_elements() == params.get_max_elements()); + BOOST_CHECK(t1.parameters().get_min_elements() == params.get_min_elements()); + BOOST_CHECK(t2.parameters().get_max_elements() == params.get_max_elements()); + BOOST_CHECK(t2.parameters().get_min_elements() == params.get_min_elements()); + + output.clear(); + t1.query(bgi::intersects(qbox), std::back_inserter(output)); + BOOST_CHECK(output.empty()); + + output.clear(); + t2.query(bgi::intersects(qbox), std::back_inserter(output)); + exactly_the_same_outputs(t2, output, expected_output); + t2.swap(t1); + // those fails e.g. on darwin 4.2.1 because it can't copy base obejcts properly + BOOST_CHECK(t1.parameters().get_max_elements() == params.get_max_elements()); + BOOST_CHECK(t1.parameters().get_min_elements() == params.get_min_elements()); + BOOST_CHECK(t2.parameters().get_max_elements() == params.get_max_elements()); + BOOST_CHECK(t2.parameters().get_min_elements() == params.get_min_elements()); + + // moving constructor + Rtree t3(boost::move(t1), tree.get_allocator()); + + BOOST_CHECK(t3.size() == s); + BOOST_CHECK(t1.size() == 0); + BOOST_CHECK(t3.parameters().get_max_elements() == params.get_max_elements()); + BOOST_CHECK(t3.parameters().get_min_elements() == params.get_min_elements()); + + output.clear(); + t3.query(bgi::intersects(qbox), std::back_inserter(output)); + exactly_the_same_outputs(t3, output, expected_output); + + // moving assignment operator + t1 = boost::move(t3); + + BOOST_CHECK(t1.size() == s); + BOOST_CHECK(t3.size() == 0); + BOOST_CHECK(t1.parameters().get_max_elements() == params.get_max_elements()); + BOOST_CHECK(t1.parameters().get_min_elements() == params.get_min_elements()); + + output.clear(); + t1.query(bgi::intersects(qbox), std::back_inserter(output)); + exactly_the_same_outputs(t1, output, expected_output); + + //TODO - test SWAP + + ::boost::ignore_unused_variable_warning(params); +} + +template <typename I, typename O> +inline void my_copy(I first, I last, O out) +{ + for ( ; first != last ; ++first, ++out ) + *out = *first; +} + +// rtree creation and insertion + +template <typename Rtree, typename Value, typename Box> +void create_insert(Rtree const& tree, std::vector<Value> const& input, Box const& qbox) +{ + std::vector<Value> expected_output; + tree.query(bgi::intersects(qbox), std::back_inserter(expected_output)); + + { + Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); + BOOST_FOREACH(Value const& v, input) + t.insert(v); + BOOST_CHECK(tree.size() == t.size()); + std::vector<Value> output; + t.query(bgi::intersects(qbox), std::back_inserter(output)); + exactly_the_same_outputs(t, output, expected_output); + } + { + Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); + //std::copy(input.begin(), input.end(), bgi::inserter(t)); + my_copy(input.begin(), input.end(), bgi::inserter(t)); // to suppress MSVC warnings + BOOST_CHECK(tree.size() == t.size()); + std::vector<Value> output; + t.query(bgi::intersects(qbox), std::back_inserter(output)); + exactly_the_same_outputs(t, output, expected_output); + } + { + Rtree t(input.begin(), input.end(), tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); + BOOST_CHECK(tree.size() == t.size()); + std::vector<Value> output; + t.query(bgi::intersects(qbox), std::back_inserter(output)); + compare_outputs(t, output, expected_output); + } + { + Rtree t(input, tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); + BOOST_CHECK(tree.size() == t.size()); + std::vector<Value> output; + t.query(bgi::intersects(qbox), std::back_inserter(output)); + compare_outputs(t, output, expected_output); + } + { + Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); + t.insert(input.begin(), input.end()); + BOOST_CHECK(tree.size() == t.size()); + std::vector<Value> output; + t.query(bgi::intersects(qbox), std::back_inserter(output)); + exactly_the_same_outputs(t, output, expected_output); + } + { + Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); + t.insert(input); + BOOST_CHECK(tree.size() == t.size()); + std::vector<Value> output; + t.query(bgi::intersects(qbox), std::back_inserter(output)); + exactly_the_same_outputs(t, output, expected_output); + } + + { + Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); + BOOST_FOREACH(Value const& v, input) + bgi::insert(t, v); + BOOST_CHECK(tree.size() == t.size()); + std::vector<Value> output; + bgi::query(t, bgi::intersects(qbox), std::back_inserter(output)); + exactly_the_same_outputs(t, output, expected_output); + } + { + Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); + bgi::insert(t, input.begin(), input.end()); + BOOST_CHECK(tree.size() == t.size()); + std::vector<Value> output; + bgi::query(t, bgi::intersects(qbox), std::back_inserter(output)); + exactly_the_same_outputs(t, output, expected_output); + } + { + Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); + bgi::insert(t, input); + BOOST_CHECK(tree.size() == t.size()); + std::vector<Value> output; + bgi::query(t, bgi::intersects(qbox), std::back_inserter(output)); + exactly_the_same_outputs(t, output, expected_output); + } +} + +// rtree removing + +template <typename Rtree, typename Box> +void remove(Rtree const& tree, Box const& qbox) +{ + typedef typename Rtree::value_type Value; + + std::vector<Value> values_to_remove; + tree.query(bgi::intersects(qbox), std::back_inserter(values_to_remove)); + BOOST_CHECK(0 < values_to_remove.size()); + + std::vector<Value> expected_output; + tree.query(bgi::disjoint(qbox), std::back_inserter(expected_output)); + size_t expected_removed_count = values_to_remove.size(); + 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<Rtree>(); + values_to_remove.push_back(outsider); + + { + Rtree t(tree); + size_t r = 0; + BOOST_FOREACH(Value const& v, values_to_remove) + r += t.remove(v); + BOOST_CHECK( r == expected_removed_count ); + std::vector<Value> output; + t.query(bgi::disjoint(qbox), std::back_inserter(output)); + BOOST_CHECK( t.size() == expected_size_after_remove ); + BOOST_CHECK( output.size() == tree.size() - expected_removed_count ); + compare_outputs(t, output, expected_output); + } + { + 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; + t.query(bgi::disjoint(qbox), std::back_inserter(output)); + BOOST_CHECK( t.size() == expected_size_after_remove ); + BOOST_CHECK( output.size() == tree.size() - expected_removed_count ); + compare_outputs(t, output, expected_output); + } + { + Rtree t(tree); + size_t r = t.remove(values_to_remove); + BOOST_CHECK( r == expected_removed_count ); + std::vector<Value> output; + t.query(bgi::disjoint(qbox), std::back_inserter(output)); + BOOST_CHECK( t.size() == expected_size_after_remove ); + BOOST_CHECK( output.size() == tree.size() - expected_removed_count ); + compare_outputs(t, output, expected_output); + } + + { + Rtree t(tree); + size_t r = 0; + BOOST_FOREACH(Value const& v, values_to_remove) + r += bgi::remove(t, v); + BOOST_CHECK( r == expected_removed_count ); + std::vector<Value> output; + bgi::query(t, bgi::disjoint(qbox), std::back_inserter(output)); + BOOST_CHECK( t.size() == expected_size_after_remove ); + BOOST_CHECK( output.size() == tree.size() - expected_removed_count ); + compare_outputs(t, output, expected_output); + } + { + 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; + bgi::query(t, bgi::disjoint(qbox), std::back_inserter(output)); + BOOST_CHECK( t.size() == expected_size_after_remove ); + BOOST_CHECK( output.size() == tree.size() - expected_removed_count ); + compare_outputs(t, output, expected_output); + } + { + Rtree t(tree); + size_t r = bgi::remove(t, values_to_remove); + BOOST_CHECK( r == expected_removed_count ); + std::vector<Value> output; + bgi::query(t, bgi::disjoint(qbox), std::back_inserter(output)); + BOOST_CHECK( t.size() == expected_size_after_remove ); + BOOST_CHECK( output.size() == tree.size() - expected_removed_count ); + compare_outputs(t, output, expected_output); + } +} + +template <typename Rtree, typename Value, typename Box> +void clear(Rtree const& tree, std::vector<Value> const& input, Box const& qbox) +{ + std::vector<Value> values_to_remove; + tree.query(bgi::intersects(qbox), std::back_inserter(values_to_remove)); + BOOST_CHECK(0 < values_to_remove.size()); + + //clear + { + Rtree t(tree); + + std::vector<Value> expected_output; + t.query(bgi::intersects(qbox), std::back_inserter(expected_output)); + size_t s = t.size(); + t.clear(); + BOOST_CHECK(t.empty()); + BOOST_CHECK(t.size() == 0); + t.insert(input); + BOOST_CHECK(t.size() == s); + std::vector<Value> output; + t.query(bgi::intersects(qbox), std::back_inserter(output)); + exactly_the_same_outputs(t, output, expected_output); + } +} + +// rtree queries + +template <typename Rtree, typename Value, typename Box> +void queries(Rtree const& tree, std::vector<Value> const& input, Box const& qbox) +{ + basictest::intersects(tree, input, qbox); + basictest::disjoint(tree, input, qbox); + basictest::covered_by(tree, input, qbox); + basictest::overlaps(tree, input, qbox); + //basictest::touches(tree, input, qbox); + basictest::within(tree, input, qbox); +#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL + basictest::contains(tree, input, qbox); + basictest::covers(tree, input, qbox); +#endif + + typedef typename bg::point_type<Box>::type P; + P pt; + bg::centroid(qbox, pt); + + basictest::nearest_query_k(tree, input, pt, 10); + basictest::nearest_query_not_found(tree, generate::outside_point<P>::apply()); + + basictest::satisfies(tree, input); +} + +// rtree creation and modification + +template <typename Rtree, typename Value, typename Box> +void modifiers(Rtree const& tree, std::vector<Value> const& input, Box const& qbox) +{ + basictest::copy_swap_move(tree, qbox); + basictest::create_insert(tree, input, qbox); + basictest::remove(tree, qbox); + basictest::clear(tree, input, qbox); +} + +} // namespace basictest + +template <typename Value, typename Parameters, typename Allocator> +void test_rtree_queries(Parameters const& parameters, Allocator const& allocator) +{ + typedef bgi::indexable<Value> I; + typedef bgi::equal_to<Value> E; + typedef typename Allocator::template rebind<Value>::other A; + typedef bgi::rtree<Value, Parameters, I, E, A> Tree; + typedef typename Tree::bounds_type B; + + Tree tree(parameters, I(), E(), allocator); + std::vector<Value> input; + B qbox; + + generate::rtree(tree, input, qbox); + + basictest::queries(tree, input, qbox); + + Tree empty_tree(parameters, I(), E(), allocator); + std::vector<Value> empty_input; + + basictest::queries(empty_tree, empty_input, qbox); +} + +template <typename Value, typename Parameters, typename Allocator> +void test_rtree_modifiers(Parameters const& parameters, Allocator const& allocator) +{ + typedef bgi::indexable<Value> I; + typedef bgi::equal_to<Value> E; + typedef typename Allocator::template rebind<Value>::other A; + typedef bgi::rtree<Value, Parameters, I, E, A> Tree; + typedef typename Tree::bounds_type B; + + Tree tree(parameters, I(), E(), allocator); + std::vector<Value> input; + B qbox; + + generate::rtree(tree, input, qbox); + + basictest::modifiers(tree, input, qbox); + + Tree empty_tree(parameters, I(), E(), allocator); + std::vector<Value> empty_input; + + basictest::copy_swap_move(empty_tree, qbox); +} + +// run all tests for a single Algorithm and single rtree +// defined by Value + +template <typename Value, typename Parameters, typename Allocator> +void test_rtree_by_value(Parameters const& parameters, Allocator const& allocator) +{ + test_rtree_queries<Value>(parameters, allocator); + test_rtree_modifiers<Value>(parameters, allocator); +} + +// rtree inserting and removing of counting_value + +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::indexable<Value> I; + typedef bgi::equal_to<Value> E; + typedef typename Allocator::template rebind<Value>::other A; + typedef bgi::rtree<Value, Parameters, I, E, A> Tree; + typedef typename Tree::bounds_type B; + + Tree t(parameters, I(), E(), allocator); + std::vector<Value> input; + B qbox; + + generate::rtree(t, input, qbox); + + size_t rest_count = input.size(); + + BOOST_CHECK(t.size() + rest_count == Value::counter()); + + std::vector<Value> values_to_remove; + t.query(bgi::intersects(qbox), std::back_inserter(values_to_remove)); + + rest_count += values_to_remove.size(); + + BOOST_CHECK(t.size() + rest_count == Value::counter()); + + size_t values_count = Value::counter(); + + BOOST_FOREACH(Value const& v, values_to_remove) + { + size_t r = t.remove(v); + --values_count; + + BOOST_CHECK(1 == r); + BOOST_CHECK(Value::counter() == values_count); + BOOST_CHECK(t.size() + rest_count == values_count); + } +} + +// rtree count + +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::indexable<Value> I; + typedef bgi::equal_to<Value> E; + typedef typename Allocator::template rebind<Value>::other A; + typedef bgi::rtree<Value, Parameters, I, E, A> Tree; + typedef typename Tree::bounds_type B; + + Tree t(parameters, I(), E(), allocator); + std::vector<Value> input; + B qbox; + + generate::rtree(t, input, qbox); + + BOOST_CHECK(t.count(input[0]) == 1); + BOOST_CHECK(t.count(input[0].first) == 1); + + t.insert(input[0]); + + BOOST_CHECK(t.count(input[0]) == 2); + BOOST_CHECK(t.count(input[0].first) == 2); + + t.insert(std::make_pair(input[0].first, -1)); + + BOOST_CHECK(t.count(input[0]) == 2); + BOOST_CHECK(t.count(input[0].first) == 3); +} + +// test rtree box + +template <typename Value, typename Parameters, typename Allocator> +void test_rtree_bounds(Parameters const& parameters, Allocator const& allocator) +{ + typedef bgi::indexable<Value> I; + typedef bgi::equal_to<Value> E; + typedef typename Allocator::template rebind<Value>::other A; + typedef bgi::rtree<Value, Parameters, I, E, A> Tree; + typedef typename Tree::bounds_type B; + typedef typename bg::traits::point_type<B>::type P; + + B b; + bg::assign_inverse(b); + + Tree t(parameters, I(), E(), allocator); + std::vector<Value> input; + B qbox; + + BOOST_CHECK(bg::equals(t.bounds(), b)); + + generate::rtree(t, input, qbox); + + BOOST_FOREACH(Value const& v, input) + bg::expand(b, t.indexable_get()(v)); + + BOOST_CHECK(bg::equals(t.bounds(), b)); + BOOST_CHECK(bg::equals(t.bounds(), bgi::bounds(t))); + + size_t s = input.size(); + while ( s/2 < input.size() && !input.empty() ) + { + t.remove(input.back()); + input.pop_back(); + } + + bg::assign_inverse(b); + BOOST_FOREACH(Value const& v, input) + bg::expand(b, t.indexable_get()(v)); + + BOOST_CHECK(bg::equals(t.bounds(), b)); + + Tree t2(t); + BOOST_CHECK(bg::equals(t2.bounds(), b)); + t2.clear(); + t2 = t; + BOOST_CHECK(bg::equals(t2.bounds(), b)); + t2.clear(); + t2 = boost::move(t); + BOOST_CHECK(bg::equals(t2.bounds(), b)); + + t.clear(); + + bg::assign_inverse(b); + BOOST_CHECK(bg::equals(t.bounds(), b)); +} + +template <typename Indexable, typename Parameters, typename Allocator> +void test_rtree_additional(Parameters const& parameters, Allocator const& allocator) +{ + test_count_rtree_values<Indexable>(parameters, allocator); + test_rtree_count<Indexable>(parameters, allocator); + test_rtree_bounds<Indexable>(parameters, allocator); +} + +// 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, 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, allocator); + test_rtree_by_value<PairP, Parameters>(parameters, allocator); + test_rtree_by_value<TupleP, Parameters>(parameters, allocator); + + test_rtree_by_value<SharedPtrP, Parameters>(parameters, allocator); + test_rtree_by_value<VNoDCtor, Parameters>(parameters, allocator); + + test_rtree_additional<Point>(parameters, allocator); + +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + typedef std::tuple<Point, int, int> StdTupleP; + test_rtree_by_value<StdTupleP, Parameters>(parameters, allocator); +#endif +} + +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, allocator); + test_rtree_by_value<PairB, Parameters>(parameters, allocator); + test_rtree_by_value<TupleB, Parameters>(parameters, allocator); + + test_rtree_by_value<VNoDCtor, Parameters>(parameters, allocator); + + test_rtree_additional<Box>(parameters, allocator); + +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + typedef std::tuple<Box, int, int> StdTupleB; + test_rtree_by_value<StdTupleB, Parameters>(parameters, allocator); +#endif +} + +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>()); +} + +namespace testset { + +template<typename Indexable, typename Parameters, typename Allocator> +void modifiers(Parameters const& parameters, Allocator const& allocator) +{ + typedef std::pair<Indexable, int> Pair; + typedef boost::tuple<Indexable, int, int> Tuple; + typedef boost::shared_ptr< test_object<Indexable> > SharedPtr; + typedef value_no_dctor<Indexable> VNoDCtor; + + test_rtree_modifiers<Indexable>(parameters, allocator); + test_rtree_modifiers<Pair>(parameters, allocator); + test_rtree_modifiers<Tuple>(parameters, allocator); + + test_rtree_modifiers<SharedPtr>(parameters, allocator); + test_rtree_modifiers<VNoDCtor>(parameters, allocator); + +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + typedef std::tuple<Indexable, int, int> StdTuple; + test_rtree_modifiers<StdTuple>(parameters, allocator); +#endif +} + +template<typename Indexable, typename Parameters, typename Allocator> +void queries(Parameters const& parameters, Allocator const& allocator) +{ + typedef std::pair<Indexable, int> Pair; + typedef boost::tuple<Indexable, int, int> Tuple; + typedef boost::shared_ptr< test_object<Indexable> > SharedPtr; + typedef value_no_dctor<Indexable> VNoDCtor; + + test_rtree_queries<Indexable>(parameters, allocator); + test_rtree_queries<Pair>(parameters, allocator); + test_rtree_queries<Tuple>(parameters, allocator); + + test_rtree_queries<SharedPtr>(parameters, allocator); + test_rtree_queries<VNoDCtor>(parameters, allocator); + +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + typedef std::tuple<Indexable, int, int> StdTuple; + test_rtree_queries<StdTuple>(parameters, allocator); +#endif +} + +template<typename Indexable, typename Parameters, typename Allocator> +void additional(Parameters const& parameters, Allocator const& allocator) +{ + test_rtree_additional<Indexable, Parameters>(parameters, allocator); +} + +} // namespace testset + +#endif // BOOST_GEOMETRY_INDEX_TEST_RTREE_HPP |