Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84043 - in trunk/boost/geometry/index/detail/rtree: node visitors
From: adam.wulkiewicz_at_[hidden]
Date: 2013-04-25 06:37:59


Author: awulkiew
Date: 2013-04-25 06:37:58 EDT (Thu, 25 Apr 2013)
New Revision: 84043
URL: http://svn.boost.org/trac/boost/changeset/84043

Log:
geometry.index: changed exception type thrown when the allocator returns null node and doesn't throw an exception.
Text files modified:
   trunk/boost/geometry/index/detail/rtree/node/node.hpp | 7 +++++++
   trunk/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp | 2 +-
   trunk/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp | 2 +-
   trunk/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp | 8 ++------
   4 files changed, 11 insertions(+), 8 deletions(-)

Modified: trunk/boost/geometry/index/detail/rtree/node/node.hpp
==============================================================================
--- trunk/boost/geometry/index/detail/rtree/node/node.hpp (original)
+++ trunk/boost/geometry/index/detail/rtree/node/node.hpp 2013-04-25 06:37:58 EDT (Thu, 25 Apr 2013)
@@ -18,6 +18,13 @@
 #include <boost/geometry/index/detail/rtree/node/pairs.hpp>
 #include <boost/geometry/index/detail/rtree/node/auto_deallocator.hpp>
 
+namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree {
+struct node_creation_failed : public std::exception
+{
+ const char * what() { return "rtree node creation failed"; }
+};
+}}}}}
+
 #include <boost/geometry/index/detail/rtree/node/dynamic_visitor.hpp>
 #include <boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp>
 #include <boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp>

Modified: trunk/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp
==============================================================================
--- trunk/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp (original)
+++ trunk/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp 2013-04-25 06:37:58 EDT (Thu, 25 Apr 2013)
@@ -248,7 +248,7 @@
         P p = Al::allocate(alloc_node, 1);
 
         if ( 0 == p )
- throw std::bad_alloc(); // TODO throw different exception
+ throw node_creation_failed();
 
         auto_deallocator<AllocNode> deallocator(alloc_node, p);
 

Modified: trunk/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp
==============================================================================
--- trunk/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp (original)
+++ trunk/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp 2013-04-25 06:37:58 EDT (Thu, 25 Apr 2013)
@@ -168,7 +168,7 @@
         P p = Al::allocate(alloc_node, 1);
 
         if ( 0 == p )
- throw std::bad_alloc();
+ throw node_creation_failed();
 
         auto_deallocator<AllocNode> deallocator(alloc_node, p);
 

Modified: trunk/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp
==============================================================================
--- trunk/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp (original)
+++ trunk/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp 2013-04-25 06:37:58 EDT (Thu, 25 Apr 2013)
@@ -15,8 +15,8 @@
 
 namespace detail { namespace rtree { namespace visitors {
 
-// TODO: awulkiew - maby it's a good idea to check if curr_mindist < comp_mindist and then check predicates
-// in store() or break store to 2 functions e.g. should_store() and store()
+// TODO: awulkiew - maybe it's a good idea to check if curr_mindist < comp_mindist and then check predicates
+// in store() or divide store() into 2 functions e.g. should_store() and store()
 // - well not with this algorithm of storing k-th neighbor
 
 //template <typename Value, typename Translator, typename Point>
@@ -139,8 +139,6 @@
     std::vector< std::pair<distance_type, Value> > m_neighbors;
 };
 
-// TODO: awulkiew - add additional pruning before adding nodes to the ABL
-
 template <
     typename Value,
     typename Options,
@@ -188,8 +186,6 @@
         , m_result(r)
     {}
 
- //TODO: awulkiew - consider this approach: store one, global vector of active branches, add branches only if mindist is ok
-
     inline void operator()(internal_node const& n)
     {
         typedef typename rtree::elements_type<internal_node>::type elements_type;


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