1 // Boost.Geometry Index
3 // R-tree node elements access
5 // Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland.
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_ELEMENTS_HPP
12 #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_ELEMENTS_HPP
14 #include <boost/container/vector.hpp>
15 #include <boost/geometry/algorithms/detail/expand_by_epsilon.hpp>
16 #include <boost/geometry/index/detail/varray.hpp>
17 #include <boost/geometry/index/detail/rtree/node/pairs.hpp>
19 namespace boost { namespace geometry { namespace index {
21 namespace detail { namespace rtree {
23 // element's indexable type
25 template <typename Element, typename Translator>
26 struct element_indexable_type
28 typedef typename indexable_type<Translator>::type type;
31 template <typename First, typename Pointer, typename Translator>
32 struct element_indexable_type<
33 rtree::ptr_pair<First, Pointer>,
42 template <typename Element>
43 struct is_leaf_element
45 static const bool value = true;
48 template <typename First, typename Pointer>
49 struct is_leaf_element< rtree::ptr_pair<First, Pointer> >
51 static const bool value = false;
54 // element's indexable getter
56 template <typename Element, typename Translator>
57 typename result_type<Translator>::type
58 element_indexable(Element const& el, Translator const& tr)
63 template <typename First, typename Pointer, typename Translator>
65 element_indexable(rtree::ptr_pair<First, Pointer> const& el, Translator const& /*tr*/)
72 template <typename Node>
75 typedef typename Node::elements_type type;
78 template <typename Node>
79 inline typename elements_type<Node>::type &
85 template <typename Node>
86 inline typename elements_type<Node>::type const&
87 elements(Node const& n)
92 // elements derived type
94 template <typename Elements, typename NewValue>
95 struct container_from_elements_type
97 typedef boost::container::vector<NewValue> type;
100 template <typename OldValue, size_t N, typename NewValue>
101 struct container_from_elements_type<detail::varray<OldValue, N>, NewValue>
103 typedef detail::varray<NewValue, N> type;
106 }} // namespace detail::rtree
108 }}} // namespace boost::geometry::index
110 #endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_ELEMENTS_HPP