[prev in list] [next in list] [prev in thread] [next in thread]
List: boost-commit
Subject: [Boost-commit] svn:boost r80782 - sandbox-branches/geometry/index/boost/geometry/extensions/index/rt
From: adam.wulkiewicz () gmail ! com
Date: 2012-09-30 12:54:26
Message-ID: 20120930125426.B536B2F80A4 () wowbagger ! osl ! iu ! edu
[Download RAW message or body]
Author: awulkiew
Date: 2012-09-30 08:54:25 EDT (Sun, 30 Sep 2012)
New Revision: 80782
URL: http://svn.boost.org/trac/boost/changeset/80782
Log:
code related to nodes visitation moved to XXX_visitor.hpp
Added:
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/static_visitor.hpp \
(contents, props changed) Text files modified:
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp \
| 24 +++++++++++ \
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node.hpp \
| 4 \
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp \
| 22 ---------- \
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp \
| 87 ++++++++++----------------------------- \
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp \
| 29 ++++++------ 5 files changed, 63 insertions(+), \
103 deletions(-)
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp 2012-09-30 \
08:54:25 EDT (Sun, 30 Sep 2012) @@ -63,6 +63,30 @@
virtual void operator()(leaf &) = 0;
};
+// nodes conversion
+
+template <typename Derived, typename Parameters, typename Value, typename Box, \
typename Allocators, typename Tag> +inline Derived & get(dynamic_node<Value, \
Parameters, Box, Allocators, Tag> & n) +{
+ assert(dynamic_cast<Derived*>(&n));
+ return static_cast<Derived&>(n);
+}
+
+template <typename Derived, typename Parameters, typename Value, typename Box, \
typename Allocators, typename Tag> +inline Derived * get(dynamic_node<Value, \
Parameters, Box, Allocators, Tag> * n) +{
+ assert(dynamic_cast<Derived*>(n));
+ return static_cast<Derived*>(n);
+}
+
+// apply visitor
+
+template <typename Visitor, typename Visitable>
+inline void apply_visitor(Visitor &v, Visitable & n)
+{
+ n.apply_visitor(v);
+}
+
}} // namespace detail::rtree
}}} // namespace boost::geometry::index
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node.hpp 2012-09-30 \
08:54:25 EDT (Sun, 30 Sep 2012) @@ -14,9 +14,9 @@
#include <boost/geometry/extensions/index/rtree/node/concept.hpp>
#include <boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp>
-#include <boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp>
-
#include <boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp>
+
+#include <boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp>
#include <boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp>
#include <boost/geometry/algorithms/expand.hpp>
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp 2012-09-30 \
08:54:25 EDT (Sun, 30 Sep 2012) @@ -77,22 +77,6 @@
typedef dynamic_leaf<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag> \
type; };
-// nodes conversion
-
-template <typename Derived, typename Parameters, typename Value, typename Box, \
typename Allocators, typename Tag>
-inline Derived & get(dynamic_node<Value, Parameters, Box, Allocators, Tag> & n)
-{
- assert(dynamic_cast<Derived*>(&n));
- return static_cast<Derived&>(n);
-}
-
-template <typename Derived, typename Parameters, typename Value, typename Box, \
typename Allocators, typename Tag>
-inline Derived * get(dynamic_node<Value, Parameters, Box, Allocators, Tag> * n)
-{
- assert(dynamic_cast<Derived*>(n));
- return static_cast<Derived*>(n);
-}
-
// visitor traits
template <typename Value, typename Parameters, typename Box, typename Allocators, \
bool IsVisitableConst> @@ -101,12 +85,6 @@
typedef dynamic_visitor<Value, Parameters, Box, Allocators, \
node_d_mem_dynamic_tag, IsVisitableConst> type; };
-template <typename Visitor, typename Visitable>
-inline void apply_visitor(Visitor &v, Visitable & n)
-{
- n.apply_visitor(v);
-}
-
// element's indexable type
template <typename Value, typename Translator>
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp 2012-09-30 \
08:54:25 EDT (Sun, 30 Sep 2012) @@ -12,7 +12,8 @@
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP
#include <vector>
-#include <boost/variant.hpp>
+
+#include <boost/geometry/extensions/index/rtree/node/static_visitor.hpp>
namespace boost { namespace geometry { namespace index {
@@ -21,7 +22,7 @@
// nodes default types
template <typename Value, typename Parameters, typename Box, typename Allocators, \
typename Tag>
-struct internal_node_variant
+struct static_internal_node
{
typedef std::vector<
std::pair<
@@ -31,7 +32,7 @@
typename Allocators::internal_node_elements_allocator_type
> elements_type;
- inline internal_node_variant(typename \
Allocators::internal_node_elements_allocator_type & al) + inline \
static_internal_node(typename Allocators::internal_node_elements_allocator_type & al) \
: elements(al) {}
@@ -39,14 +40,14 @@
};
template <typename Value, typename Parameters, typename Box, typename Allocators, \
typename Tag>
-struct leaf_variant
+struct static_leaf
{
typedef std::vector<
Value,
typename Allocators::leaf_elements_allocator_type
> elements_type;
- inline leaf_variant(typename Allocators::leaf_elements_allocator_type & al)
+ inline static_leaf(typename Allocators::leaf_elements_allocator_type & al)
: elements(al)
{}
@@ -59,47 +60,23 @@
struct node<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>
{
typedef boost::variant<
- leaf_variant<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>,
- internal_node_variant<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>
+ static_leaf<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>,
+ static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>
> type;
};
template <typename Value, typename Parameters, typename Box, typename Allocators>
struct internal_node<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>
{
- typedef internal_node_variant<Value, Parameters, Box, Allocators, \
node_s_mem_dynamic_tag> type; + typedef static_internal_node<Value, Parameters, \
Box, Allocators, node_s_mem_dynamic_tag> type; };
template <typename Value, typename Parameters, typename Box, typename Allocators>
struct leaf<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>
{
- typedef leaf_variant<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag> \
type; + typedef static_leaf<Value, Parameters, Box, Allocators, \
node_s_mem_dynamic_tag> type; };
-// nodes conversion
-
-template <typename V, typename Value, typename Parameters, typename Box, typename \
Allocators, typename Tag>
-inline V & get(
- boost::variant<
- leaf_variant<Value, Parameters, Box, Allocators, Tag>,
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
- > &v
-)
-{
- return boost::get<V>(v);
-}
-
-template <typename V, typename Value, typename Parameters, typename Box, typename \
Allocators, typename Tag>
-inline V * get(
- boost::variant<
- leaf_variant<Value, Parameters, Box, Allocators, Tag>,
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
- > *v
-)
-{
- return boost::get<V>(v);
-}
-
// visitor traits
template <typename Value, typename Parameters, typename Box, typename Allocators, \
bool IsVisitableConst> @@ -108,26 +85,6 @@
typedef static_visitor<> type;
};
-template <typename Visitor, typename Value, typename Parameters, typename Box, \
typename Allocators, typename Tag>
-inline void apply_visitor(Visitor & v,
- boost::variant<
- leaf_variant<Value, Parameters, Box, Allocators, Tag>,
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
- > & n)
-{
- boost::apply_visitor(v, n);
-}
-
-template <typename Visitor, typename Value, typename Parameters, typename Box, \
typename Allocators, typename Tag>
-inline void apply_visitor(Visitor & v,
- boost::variant<
- leaf_variant<Value, Parameters, Box, Allocators, Tag>,
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
- > const& n)
-{
- boost::apply_visitor(v, n);
-}
-
// element's indexable type
template <typename Value, typename Parameters, typename Box, typename Allocators, \
typename Tag, typename Translator> @@ -135,8 +92,8 @@
std::pair<
Box,
boost::variant<
- leaf_variant<Value, Parameters, Box, Allocators, Tag>,
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
+ static_leaf<Value, Parameters, Box, Allocators, Tag>,
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
> *
>,
Translator
@@ -152,8 +109,8 @@
element_indexable(std::pair<
Box,
boost::variant<
- leaf_variant<Value, Parameters, Box, Allocators, Tag>,
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
+ static_leaf<Value, Parameters, Box, Allocators, Tag>,
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
> *
> const& el,
Translator const&)
@@ -239,14 +196,14 @@
template <typename Allocators, typename Value, typename Parameters, typename Box, \
typename Tag> struct create_node<
Allocators,
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
>
{
static inline typename node<Value, Parameters, Box, Allocators, Tag>::type *
apply(Allocators & allocators)
{
return create_node_variant<
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
>::template apply<
typename node<Value, Parameters, Box, Allocators, Tag>::type
>(allocators.node_allocator, allocators.internal_node_elements_allocator);
@@ -256,14 +213,14 @@
template <typename Allocators, typename Value, typename Parameters, typename Box, \
typename Tag> struct create_node<
Allocators,
- leaf_variant<Value, Parameters, Box, Allocators, Tag>
+ static_leaf<Value, Parameters, Box, Allocators, Tag>
>
{
static inline typename node<Value, Parameters, Box, Allocators, Tag>::type *
apply(Allocators & allocators)
{
return create_node_variant<
- leaf_variant<Value, Parameters, Box, Allocators, Tag>
+ static_leaf<Value, Parameters, Box, Allocators, Tag>
>::template apply<
typename node<Value, Parameters, Box, Allocators, Tag>::type
>(allocators.node_allocator, allocators.leaf_elements_allocator);
@@ -275,13 +232,13 @@
template <typename Allocators, typename Value, typename Parameters, typename Box, \
typename Tag> struct destroy_node<
Allocators,
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
>
{
static inline void apply(Allocators & allocators, typename node<Value, \
Parameters, Box, Allocators, Tag>::type * n) {
destroy_node_variant<
- internal_node_variant<Value, Parameters, Box, Allocators, Tag>
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
>::apply(allocators.node_allocator, n);
}
};
@@ -289,13 +246,13 @@
template <typename Allocators, typename Value, typename Parameters, typename Box, \
typename Tag> struct destroy_node<
Allocators,
- leaf_variant<Value, Parameters, Box, Allocators, Tag>
+ static_leaf<Value, Parameters, Box, Allocators, Tag>
>
{
static inline void apply(Allocators & allocators, typename node<Value, \
Parameters, Box, Allocators, Tag>::type * n) {
destroy_node_variant<
- leaf_variant<Value, Parameters, Box, Allocators, Tag>
+ static_leaf<Value, Parameters, Box, Allocators, Tag>
>::apply(allocators.node_allocator, n);
}
};
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp 2012-09-30 \
08:54:25 EDT (Sun, 30 Sep 2012) @@ -11,8 +11,9 @@
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP
-#include <vector>
-#include <boost/variant.hpp>
+#include <boost/geometry/extensions/index/pushable_array.hpp>
+
+#include <boost/geometry/extensions/index/rtree/node/static_visitor.hpp>
namespace boost { namespace geometry { namespace index {
@@ -21,7 +22,7 @@
// nodes default types
template <typename Value, typename Parameters, typename Box, typename Allocators>
-struct internal_node_variant<Value, Parameters, Box, Allocators, \
node_s_mem_static_tag> +struct static_internal_node<Value, Parameters, Box, \
Allocators, node_s_mem_static_tag> {
typedef index::pushable_array<
std::pair<
@@ -32,18 +33,18 @@
> elements_type;
template <typename Dummy>
- inline internal_node_variant(Dummy) {}
+ inline static_internal_node(Dummy) {}
elements_type elements;
};
template <typename Value, typename Parameters, typename Box, typename Allocators>
-struct leaf_variant<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+struct static_leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
{
typedef index::pushable_array<Value, Parameters::max_elements + 1> \
elements_type;
template <typename Dummy>
- inline leaf_variant(Dummy) {}
+ inline static_leaf(Dummy) {}
elements_type elements;
};
@@ -54,21 +55,21 @@
struct node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
{
typedef boost::variant<
- leaf_variant<Value, Parameters, Box, Allocators, node_s_mem_static_tag>,
- internal_node_variant<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+ static_leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag>,
+ static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
> type;
};
template <typename Value, typename Parameters, typename Box, typename Allocators>
struct internal_node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
{
- typedef internal_node_variant<Value, Parameters, Box, Allocators, \
node_s_mem_static_tag> type; + typedef static_internal_node<Value, Parameters, \
Box, Allocators, node_s_mem_static_tag> type; };
template <typename Value, typename Parameters, typename Box, typename Allocators>
struct leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
{
- typedef leaf_variant<Value, Parameters, Box, Allocators, node_s_mem_static_tag> \
type; + typedef static_leaf<Value, Parameters, Box, Allocators, \
node_s_mem_static_tag> type; };
// visitor traits
@@ -113,14 +114,14 @@
template <typename Allocators, typename Value, typename Parameters, typename Box>
struct create_node<
Allocators,
- internal_node_variant<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+ static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
>
{
static inline typename node<Value, Parameters, Box, Allocators, \
node_s_mem_static_tag>::type * apply(Allocators & allocators)
{
return create_node_variant<
- internal_node_variant<Value, Parameters, Box, Allocators, \
node_s_mem_static_tag> + static_internal_node<Value, Parameters, Box, \
Allocators, node_s_mem_static_tag> >::template apply<
typename node<Value, Parameters, Box, Allocators, \
node_s_mem_static_tag>::type >(allocators.node_allocator, \
allocators.node_allocator); @@ -130,14 +131,14 @@
template <typename Allocators, typename Value, typename Parameters, typename Box>
struct create_node<
Allocators,
- leaf_variant<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+ static_leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
>
{
static inline typename node<Value, Parameters, Box, Allocators, \
node_s_mem_static_tag>::type * apply(Allocators & allocators)
{
return create_node_variant<
- leaf_variant<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+ static_leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
>::template apply<
typename node<Value, Parameters, Box, Allocators, \
node_s_mem_static_tag>::type >(allocators.node_allocator, \
allocators.node_allocator);
Added: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/static_visitor.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/node/static_visitor.hpp 2012-09-30 \
08:54:25 EDT (Sun, 30 Sep 2012) @@ -0,0 +1,76 @@
+// Boost.Geometry Index
+//
+// R-tree nodes static visitor related code
+//
+// 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)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_STATIC_VISITOR_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_STATIC_VISITOR_HPP
+
+#include <boost/variant.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+// nodes variants forward declarations
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, \
typename Tag> +struct static_internal_node;
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, \
typename Tag> +struct static_leaf;
+
+// nodes conversion
+
+template <typename V, typename Value, typename Parameters, typename Box, typename \
Allocators, typename Tag> +inline V & get(
+ boost::variant<
+ static_leaf<Value, Parameters, Box, Allocators, Tag>,
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
+ > & v)
+{
+ return boost::get<V>(v);
+}
+
+template <typename V, typename Value, typename Parameters, typename Box, typename \
Allocators, typename Tag> +inline V * get(
+ boost::variant<
+ static_leaf<Value, Parameters, Box, Allocators, Tag>,
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
+ > *v)
+{
+ return boost::get<V>(v);
+}
+
+// apply visitor
+
+template <typename Visitor, typename Value, typename Parameters, typename Box, \
typename Allocators, typename Tag> +inline void apply_visitor(Visitor & v,
+ boost::variant<
+ static_leaf<Value, Parameters, Box, Allocators, Tag>,
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
+ > & n)
+{
+ boost::apply_visitor(v, n);
+}
+
+template <typename Visitor, typename Value, typename Parameters, typename Box, \
typename Allocators, typename Tag> +inline void apply_visitor(Visitor & v,
+ boost::variant<
+ static_leaf<Value, Parameters, Box, Allocators, Tag>,
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
+ > const& n)
+{
+ boost::apply_visitor(v, n);
+}
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_STATIC_VISITOR_HPP
_______________________________________________
Boost-commit mailing list
Boost-commit@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-commit
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic