13 #ifndef SPATIAL_PREORDER_HPP
14 #define SPATIAL_PREORDER_HPP
16 #include "../spatial.hpp"
17 #include "spatial_assign.hpp"
23 template <
typename NodePtr,
typename Rank,
typename Query>
24 inline std::pair<NodePtr, dimension_type>
28 NodePtr init_node = node;
30 SPATIAL_ASSERT_CHECK(!
header(node));
31 SPATIAL_ASSERT_CHECK(node != 0);
32 SPATIAL_ASSERT_CHECK(dim < rank());
37 NodePtr left = node->left;
40 if (left->parent != node)
break;
48 return std::make_pair(init_node->parent,
51 SPATIAL_ASSERT_CHECK(dim < rank());
52 SPATIAL_ASSERT_CHECK(node != 0);
53 return std::make_pair(node, dim);
56 template <
typename NodePtr,
typename Rank,
typename Query>
57 inline std::pair<NodePtr, dimension_type>
61 SPATIAL_ASSERT_CHECK(!
header(node));
62 SPATIAL_ASSERT_CHECK(node != 0);
63 SPATIAL_ASSERT_CHECK(dim < rank());
80 NodePtr copy_node = node;
85 if (node->right == copy_node
106 SPATIAL_ASSERT_CHECK(dim < rank());
107 SPATIAL_ASSERT_CHECK(node != 0);
108 return std::make_pair(node, dim);
111 template <
typename NodePtr,
typename Rank,
typename Query>
112 inline std::pair<NodePtr, dimension_type>
116 SPATIAL_ASSERT_CHECK(!
header(node));
117 SPATIAL_ASSERT_CHECK(node != 0);
118 SPATIAL_ASSERT_CHECK(dim < rank());
133 NodePtr prev_node = node;
137 && (prev_node == node->right
154 SPATIAL_ASSERT_CHECK(dim < rank());
155 SPATIAL_ASSERT_CHECK(node != 0);
156 return std::make_pair(node, dim);
159 template <
typename NodePtr,
typename Rank,
typename Query>
160 inline std::pair<NodePtr, dimension_type>
166 SPATIAL_ASSERT_CHECK(node != 0);
167 SPATIAL_ASSERT_CHECK(dim < rank());
168 NodePtr copy_node = node;
174 if (node->right == copy_node
200 SPATIAL_ASSERT_CHECK(dim < rank());
201 SPATIAL_ASSERT_CHECK(node != 0);
202 return std::make_pair(node, dim);
208 #endif // SPATIAL_PREORDER_HPP
bool stop_traversal(typename Container::mode_type::const_node_ptr node, typename Container::rank_type rank, const Equal< Container > &equal)
Return a boolean indicating whether all of x's coordinates are equal to y's coordinates.
bool right_traversal(typename Container::mode_type::const_node_ptr node, dimension_type dim, const Equal< Container > &equal)
std::pair< NodePtr, dimension_type > preorder_decrement(NodePtr node, dimension_type dim, Rank rank, const Query &query)
bool header(const Node< Link > *x)
Check if node is a header node.
std::size_t dimension_type
Defines the type for the dimension as being a size.
void assign(Type1 &first, Type2 &second, const std::pair< Type1, Type2 > &pair)
std::pair< NodePtr, dimension_type > preorder_last(NodePtr node, dimension_type dim, Rank rank, const Query &query)
The main namespace used in the library.
dimension_type decr_dim(Rank rank, dimension_type node_dim)
Decrement dimension node_dim, given rank.
std::pair< NodePtr, dimension_type > preorder_first(NodePtr node, dimension_type dim, Rank rank, const Query &query)
const Node< Link > * preorder_increment(const Node< Link > *x)
Reach the next node in preorder transversal.
dimension_type incr_dim(Rank rank, dimension_type node_dim)
Increment dimension node_dim, given rank.
bool left_traversal(typename Container::mode_type::const_node_ptr node, dimension_type dim, const Equal< Container > &equal, relaxed_invariant_tag)