Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81739 - in sandbox-branches/geometry/index_dev: boost/geometry/extensions/index test/rtree
From: adam.wulkiewicz_at_[hidden]
Date: 2012-12-06 08:17:28


Author: awulkiew
Date: 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
New Revision: 81739
URL: http://svn.boost.org/trac/boost/changeset/81739

Log:
Added test for Value being boost::shared_ptr<obj<Indexable>>.
Added:
   sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_d_rt.cpp (contents, props changed)
   sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_f_rt.cpp (contents, props changed)
   sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_i_rt.cpp (contents, props changed)
   sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_tt_rt.cpp (contents, props changed)
   sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_d_rt.cpp (contents, props changed)
   sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_f_rt.cpp (contents, props changed)
   sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_i_rt.cpp (contents, props changed)
   sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_tt_rt.cpp (contents, props changed)
Text files modified:
   sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/inserter.hpp | 6 ++--
   sandbox-branches/geometry/index_dev/test/rtree/Jamfile.v2 | 8 +++++
   sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_d.cpp | 1
   sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_f.cpp | 1
   sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_i.cpp | 1
   sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_tt.cpp | 1
   sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_d.cpp | 1
   sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_f.cpp | 1
   sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_i.cpp | 1
   sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_tt.cpp | 1
   sandbox-branches/geometry/index_dev/test/rtree/test_rtree.hpp | 58 ++++++++++++++++++++++++++++++++++++++++
   11 files changed, 69 insertions(+), 11 deletions(-)

Modified: sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/inserter.hpp
==============================================================================
--- sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/inserter.hpp (original)
+++ sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/inserter.hpp 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
@@ -23,12 +23,12 @@
     typedef Container container_type;
 
     inline explicit insert_iterator(Container & c)
- : container(c)
+ : container(&c)
     {}
     
     insert_iterator & operator=(typename Container::value_type const& value)
     {
- container.insert(value);
+ container->insert(value);
         return *this;
     }
 
@@ -48,7 +48,7 @@
     }
 
 private:
- Container & container;
+ Container * container;
 };
 
 template <typename Container>

Modified: sandbox-branches/geometry/index_dev/test/rtree/Jamfile.v2
==============================================================================
--- sandbox-branches/geometry/index_dev/test/rtree/Jamfile.v2 (original)
+++ sandbox-branches/geometry/index_dev/test/rtree/Jamfile.v2 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
@@ -17,6 +17,10 @@
     [ run rtree2d_quadratic_f.cpp ]
     [ run rtree2d_quadratic_d.cpp ]
     [ run rtree2d_quadratic_tt.cpp ]
+ [ run rtree2d_quadratic_i_rt.cpp ]
+ [ run rtree2d_quadratic_f_rt.cpp ]
+ [ run rtree2d_quadratic_d_rt.cpp ]
+ [ run rtree2d_quadratic_tt_rt.cpp ]
 
     [ run rtree2d_rstar_i.cpp ]
     [ run rtree2d_rstar_f.cpp ]
@@ -36,6 +40,10 @@
     [ run rtree3d_quadratic_f.cpp ]
     [ run rtree3d_quadratic_d.cpp ]
     [ run rtree3d_quadratic_tt.cpp ]
+ [ run rtree3d_quadratic_i_rt.cpp ]
+ [ run rtree3d_quadratic_f_rt.cpp ]
+ [ run rtree3d_quadratic_d_rt.cpp ]
+ [ run rtree3d_quadratic_tt_rt.cpp ]
 
     [ run rtree3d_rstar_i.cpp ]
     [ run rtree3d_rstar_f.cpp ]

Modified: sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_d.cpp
==============================================================================
--- sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_d.cpp (original)
+++ sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_d.cpp 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
@@ -18,7 +18,6 @@
     typedef bg::model::point<double, 2, bg::cs::cartesian> P2dc;
 
     test_rtree<P2dc, bgi::quadratic<4, 2> >();
- test_rtree<P2dc>(bgi::runtime::quadratic(4, 2));
     
     return 0;
 }

Added: sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_d_rt.cpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_d_rt.cpp 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
@@ -0,0 +1,23 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <rtree/test_rtree.hpp>
+
+#include <boost/geometry/geometries/point_xy.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> P2dc;
+
+ test_rtree<P2dc>(bgi::runtime::quadratic(4, 2));
+
+ return 0;
+}

Modified: sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_f.cpp
==============================================================================
--- sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_f.cpp (original)
+++ sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_f.cpp 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
@@ -18,7 +18,6 @@
     typedef bg::model::point<float, 2, bg::cs::cartesian> P2fc;
     
     test_rtree<P2fc, bgi::quadratic<4, 2> >();
- test_rtree<P2fc>(bgi::runtime::quadratic(4, 2));
     
     return 0;
 }

Added: sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_f_rt.cpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_f_rt.cpp 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
@@ -0,0 +1,23 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <rtree/test_rtree.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<float, 2, bg::cs::cartesian> P2fc;
+
+ test_rtree<P2fc>(bgi::runtime::quadratic(4, 2));
+
+ return 0;
+}

Modified: sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_i.cpp
==============================================================================
--- sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_i.cpp (original)
+++ sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_i.cpp 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
@@ -18,7 +18,6 @@
     typedef bg::model::point<int, 2, bg::cs::cartesian> P2ic;
     
     test_rtree<P2ic, bgi::quadratic<4, 2> >();
- test_rtree<P2ic>(bgi::runtime::quadratic(4, 2));
     
     return 0;
 }

Added: sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_i_rt.cpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_i_rt.cpp 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
@@ -0,0 +1,23 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <rtree/test_rtree.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> P2ic;
+
+ test_rtree<P2ic>(bgi::runtime::quadratic(4, 2));
+
+ return 0;
+}

Modified: sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_tt.cpp
==============================================================================
--- sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_tt.cpp (original)
+++ sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_tt.cpp 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
@@ -20,7 +20,6 @@
     typedef bg::model::point<ttmath_big, 2, bg::cs::cartesian> P2ttmc;
 
     test_rtree<P2ttmc, bgi::quadratic<4, 2> >();
- test_rtree<P2ttmc>(bgi::runtime::quadratic(4, 2));
 #endif
 
     return 0;

Added: sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_tt_rt.cpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index_dev/test/rtree/rtree2d_quadratic_tt_rt.cpp 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
@@ -0,0 +1,26 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <rtree/test_rtree.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+
+int test_main(int, char* [])
+{
+
+#ifdef HAVE_TTMATH
+ typedef bg::model::point<ttmath_big, 2, bg::cs::cartesian> P2ttmc;
+
+ test_rtree<P2ttmc>(bgi::runtime::quadratic(4, 2));
+#endif
+
+ return 0;
+}

Modified: sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_d.cpp
==============================================================================
--- sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_d.cpp (original)
+++ sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_d.cpp 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
@@ -18,7 +18,6 @@
     typedef bg::model::point<double, 3, bg::cs::cartesian> P3dc;
 
     test_rtree<P3dc, bgi::quadratic<4, 2> >();
- test_rtree<P3dc>(bgi::runtime::quadratic(4, 2));
 
     return 0;
 }

Added: sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_d_rt.cpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_d_rt.cpp 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
@@ -0,0 +1,23 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <rtree/test_rtree.hpp>
+
+#include <boost/geometry/geometries/point_xy.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> P3dc;
+
+ test_rtree<P3dc>(bgi::runtime::quadratic(4, 2));
+
+ return 0;
+}

Modified: sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_f.cpp
==============================================================================
--- sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_f.cpp (original)
+++ sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_f.cpp 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
@@ -18,7 +18,6 @@
     typedef bg::model::point<float, 3, bg::cs::cartesian> P3fc;
     
     test_rtree<P3fc, bgi::quadratic<4, 2> >();
- test_rtree<P3fc>(bgi::runtime::quadratic(4, 2));
     
     return 0;
 }

Added: sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_f_rt.cpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_f_rt.cpp 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
@@ -0,0 +1,23 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <rtree/test_rtree.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<float, 3, bg::cs::cartesian> P3fc;
+
+ test_rtree<P3fc>(bgi::runtime::quadratic(4, 2));
+
+ return 0;
+}

Modified: sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_i.cpp
==============================================================================
--- sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_i.cpp (original)
+++ sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_i.cpp 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
@@ -18,7 +18,6 @@
     typedef bg::model::point<int, 3, bg::cs::cartesian> P3ic;
     
     test_rtree<P3ic, bgi::quadratic<4, 2> >();
- test_rtree<P3ic>(bgi::runtime::quadratic(4, 2));
 
     return 0;
 }

Added: sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_i_rt.cpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_i_rt.cpp 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
@@ -0,0 +1,23 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <rtree/test_rtree.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<int, 3, bg::cs::cartesian> P3ic;
+
+ test_rtree<P3ic>(bgi::runtime::quadratic(4, 2));
+
+ return 0;
+}

Modified: sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_tt.cpp
==============================================================================
--- sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_tt.cpp (original)
+++ sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_tt.cpp 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
@@ -20,7 +20,6 @@
     typedef bg::model::point<ttmath_big, 3, bg::cs::cartesian> P3ttmc;
 
     test_rtree<P3ttmc, bgi::quadratic<4, 2> >();
- test_rtree<P3ttmc>(bgi::runtime::quadratic(4, 2));
 #endif
 
     return 0;

Added: sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_tt_rt.cpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index_dev/test/rtree/rtree3d_quadratic_tt_rt.cpp 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
@@ -0,0 +1,26 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <rtree/test_rtree.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+
+int test_main(int, char* [])
+{
+
+#ifdef HAVE_TTMATH
+ typedef bg::model::point<ttmath_big, 3, bg::cs::cartesian> P3ttmc;
+
+ test_rtree<P3ttmc>(bgi::runtime::quadratic(4, 2));
+#endif
+
+ return 0;
+}

Modified: sandbox-branches/geometry/index_dev/test/rtree/test_rtree.hpp
==============================================================================
--- sandbox-branches/geometry/index_dev/test/rtree/test_rtree.hpp (original)
+++ sandbox-branches/geometry/index_dev/test/rtree/test_rtree.hpp 2012-12-06 08:17:26 EST (Thu, 06 Dec 2012)
@@ -187,6 +187,62 @@
     }
 };
 
+// shared_ptr value
+
+template <typename Indexable>
+struct test_object
+{
+ test_object(Indexable const& indexable_) : indexable(indexable_) {}
+ Indexable indexable;
+};
+
+namespace boost { namespace geometry { namespace index { namespace translator {
+
+template <typename Indexable>
+struct def< 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;
+ }
+
+ bool equals(value_type const& v1, value_type const& v2) const
+ {
+ return v1 == v2;
+ }
+};
+
+}}}}
+
+template <typename T, typename C>
+struct generate_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;
+
+ static boost::shared_ptr<O> apply(int x, int y)
+ {
+ return boost::shared_ptr<O>(new O(P(x, y)));
+ }
+};
+
+template <typename T, typename C>
+struct generate_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;
+
+ static boost::shared_ptr<O> apply(int x, int y, int z)
+ {
+ return boost::shared_ptr<O>(new O(P(x, y, z)));
+ }
+};
+
+// generate input
+
 template <size_t Dimension>
 struct generate_input
 {};
@@ -874,6 +930,7 @@
     typedef std::pair<Point, int> PairP;
     typedef boost::tuple<Point, int, int> TupleP;
     typedef boost::tuple<Box, int, int> TupleB;
+ typedef boost::shared_ptr< test_object<Point> > SharedPtrP;
 
     test_rtree_by_value<Point, Parameters>(parameters);
     test_rtree_by_value<Box, Parameters>(parameters);
@@ -881,6 +938,7 @@
     test_rtree_by_value<PairP, Parameters>(parameters);
     test_rtree_by_value<TupleP, Parameters>(parameters);
     test_rtree_by_value<TupleB, Parameters>(parameters);
+ test_rtree_by_value<SharedPtrP, Parameters>(parameters);
 }
 
 #endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk