13 #ifndef SPATIAL_NODE_HPP 
   14 #define SPATIAL_NODE_HPP 
   18 #include "../spatial.hpp" 
   19 #include "spatial_assert.hpp" 
   20 #include "spatial_mutate.hpp" 
   56     template <
typename Link>
 
   95     template <
typename Link>
 
   97     { 
return (x->
left == x); }
 
  106     template <
typename Link>
 
  110       SPATIAL_ASSERT_CHECK(!
header(x));
 
  111       while (x->
left != 0) x = x->
left; 
return x;
 
  114     template <
typename Link>
 
  117       SPATIAL_ASSERT_CHECK(!
header(x));
 
  118       while (x->
left != 0) x = x->
left; 
return x;
 
  129     template <
typename Link>
 
  133       SPATIAL_ASSERT_CHECK(!
header(x));
 
  137     template <
typename Link>
 
  140       SPATIAL_ASSERT_CHECK(!
header(x));
 
  152     template <
typename Link> Node<Link>*
 
  156     template <
typename Link>
 
  157     inline const Node<Link>*
 
  170     template <
typename Link>
 
  175     template <
typename Link>
 
  176     inline const Node<Link>*
 
  189     template <
typename Link> 
const Node<Link>*
 
  219     struct relaxed_invariant_tag { };
 
  227     template <
typename Link>
 
  228     inline typename Link::invariant_category
 
  230     { 
return typename Link::invariant_category(); }
 
  241     template<
typename Key, 
typename Value>
 
  299     template<
typename Key, 
typename Value>
 
  359     template <
typename Key, 
typename Value>
 
  367     template <
typename Key, 
typename Value>
 
  368     inline const Kdtree_link<Key, Value>*
 
  385     template <
typename Value>
 
  386     inline const typename Kdtree_link<Value, Value>::key_type&
 
  401     template <
typename Key, 
typename Value>
 
  402     inline const typename Kdtree_link<Key, Value>::key_type&
 
  415     template <
typename Key, 
typename Value>
 
  417     inline typename Kdtree_link<Key, Value>::value_type&
 
  423     template <
typename Key, 
typename Value>
 
  424     inline const typename Kdtree_link<Key, Value>::value_type&
 
  438     template <
typename Key, 
typename Value>
 
  440     inline Relaxed_kdtree_link<Key, Value>*
 
  446     template <
typename Key, 
typename Value>
 
  447     inline const Relaxed_kdtree_link<Key, Value>*
 
  464     template <
typename Value>
 
  465     inline const typename Relaxed_kdtree_link<Value, Value>::key_type&
 
  481     template <
typename Key, 
typename Value>
 
  482     inline const typename Relaxed_kdtree_link<Key, Value>::key_type&
 
  496     template <
typename Key, 
typename Value>
 
  498     inline typename Relaxed_kdtree_link<Key, Value>::value_type&
 
  504     template <
typename Key, 
typename Value>
 
  505     inline const typename Relaxed_kdtree_link<Key, Value>::value_type&
 
  522     template <
typename Link>
 
  526     template<
typename Key, 
typename Value>
 
  531     template<
typename Key, 
typename Value>
 
  536       std::swap(
link(a)->weight, 
link(b)->weight);
 
  548     template<
typename Link>
 
  615     template<
typename Link>
 
  621       typedef const typename Link::value_type*   
pointer;
 
  687     template<
typename Link>
 
  692       typedef const typename Link::value_type*  
pointer;
 
  740       SPATIAL_ASSERT_CHECK(!
header(x));
 
  744           while (x->
left != 0) { x = x->
left; }
 
  761       else if (x->
left != 0)
 
  777     template <
typename Link>
 
  783       SPATIAL_ASSERT_CHECK(!
header(a));
 
  784       SPATIAL_ASSERT_CHECK(!
header(b));
 
  798           node_ptr a_left = a->
left;
 
  799           node_ptr a_right = a->
right;
 
  828           node_ptr b_left = b->
left;
 
  829           node_ptr b_right = b->
right;
 
  871     template <
typename Link> 
inline const Node<Link>*
 
  890 #endif // SPATIAL_NODE_HPP 
Node_iterator(node_ptr x)
Build and assign an interator to a link pointer. 
strict_invariant_tag invariant_category
The category of invariant associated with this mode. 
Link::value_type * pointer
Self & operator++()
Moves the iterator to the next node in preorder transversal. 
Self & operator++()
Moves the iterator to the next node in inorder transversal. 
const Link::value_type * pointer
Link::const_node_ptr node_ptr
Preorder_node_iterator< Link > Self
std::ptrdiff_t difference_type
A bidirectional iterator traversing all node in the tree in inorder traversal. 
Node_iterator< Link > Self
A bidirectional iterator traversing all node in the tree in inorder traversal. 
Value value_type
The link to the value type. 
Link::const_node_ptr node_ptr
node_ptr node
The node pointed to by the iterator. 
const Node< link_type > * const_node_ptr
The constant node pointer deduced from the mode. 
reference operator*()
Dereferance the iterator: return the value of the node. 
Const_node_iterator< Link > Self
const Node< link_type > * const_node_ptr
The constant node pointer deduced from the mode. 
bool operator!=(const Self &x) const 
Check if 2 iterators are different: pointing at different nodes. 
Const_node_iterator(const iterator &it)
Convert an iterator into a constant iterator. 
Self & operator++()
Moves the iterator to the next node in inorder transversal. 
Link::invariant_category invariant_category(const Node< Link > *)
For a given node, this function returns the invariant category of the node. 
Node< link_type > * node_ptr
The node pointer type deduced from the mode. 
const Link::value_type * pointer
Self operator++(int)
Moves the iterator to the next node in inorder transversal and returns the iterator value before the ...
mutate< typename Link::value_type >::type value_type
The basic node for any tree in the library. 
Relaxed_kdtree_link< Key, Value > link_type
The link type, which is also itself, since mode are also contained in this type. 
Node_iterator()
Create an uninintialized iterator. 
Kdtree_link< Key, Value > & operator=(const Kdtree_link< Key, Value > &)
The link_type is a non-assignable type, because the key it contains is a constant type...
Value value
The value of the node, required by the Link Mode concept. 
std::ptrdiff_t difference_type
Link::value_type & reference
Relaxed_kdtree_link< Key, Value > & operator=(const Relaxed_kdtree_link< Key, Value > &)
The link_type is a non-assignable type, because the key it contains is a constant type...
const link_type * const_link_ptr
The constant link pointer which is often used, has a dedicated type. 
bool operator==(const Self &x) const 
Check if 2 iterators are equal: pointing at the same node. 
Node< Link > * maximum(Node< Link > *x)
Reach the left most node. 
link_type * link_ptr
The link pointer which is often used, has a dedicated type. 
Node * left
A pointer to the left child node of the current node. 
const Kdtree_link< Key, Value >::value_type & const_value(const Node< Kdtree_link< Key, Value > > *node)
This function converts a pointer on a node into a value for a Kdtree_link type. 
std::bidirectional_iterator_tag iterator_category
const Kdtree_link< Value, Value >::key_type & const_key(const Node< Kdtree_link< Value, Value > > *node)
This function converts a pointer on a node into a key for a Kdtree_link type. 
Kdtree_link< Key, Value > link_type
The link to the node type, which is the node itself, since link information are also contained in thi...
const link_type * const_link_ptr
The constant link pointer which is often used, has a dedicated type. 
Node_iterator< Link > iterator
bool header(const Node< Link > *x)
Check if node is a header node. 
Link link_type
The link type that indicate how to reach the key and/or the value from the node. 
Node< Link > * minimum(Node< Link > *x)
Reach the left most node. 
Const_node_iterator(node_ptr x)
Build and assign an interator to a link pointer. 
Self & operator--()
Moves the iterator to the previous node in inorder transversal. 
bool operator==(const Self &x) const 
Check if 2 iterators are equal: pointing at the same node. 
Preorder_node_iterator(node_ptr x)
Build and assign an interator to a link pointer. 
Value value_type
The link to the value type. 
node_ptr node
The node pointed to by the iterator. 
link_type * link_ptr
The link pointer which is often used, has a dedicated type. 
Preorder_node_iterator()
Create an uninintialized iterator. 
Kdtree_link()
Default constructor. 
std::size_t weight_type
Defines weight as being a size. 
const Link::value_type & reference
relaxed_invariant_tag invariant_category
The category of invariant with associated with this mode. 
weight_type weight
The weight is equal to 1 plus the amount of child nodes below the current node. 
reference operator*()
Dereferance the iterator: return the value of the node. 
bool operator==(const Self &x) const 
Check if 2 iterators are equal: pointing at the same node. 
const Kdtree_link< Key, Value > * const_link(const Node< Kdtree_link< Key, Value > > *node)
This function converts a pointer on a node into a link for a Kdtree_link type. 
Key key_type
The link to the key type. 
Define a weighted link type for the relaxed k-d tree. 
Const_node_iterator()
Create an uninintialized iterator. 
pointer operator->()
Dereferance the iterator: return the pointer to the value of the node. 
Self operator++(int)
Moves the iterator to the next node in preorder transversal and returns the iterator value before the...
The category of invariants for a k-d tree node: strict or relaxed. 
node_ptr node
The node pointed to by the iterator. 
Self & operator--()
Moves the iterator to the previous node in inorder transversal. 
Node< Link > * increment(Node< Link > *x)
Reach the next node in symetric transversal order. 
Define the link type for a Kdtree that contains the value member. 
Self operator--(int)
Moves the iterator to the previous node in inorder transversal and returns the iterator value before ...
The main namespace used in the library. 
const Link::value_type & reference
A forward iterator that iterates through the node of the container in preorder transversal. 
Node< link_type > * node_ptr
The node pointer type deduced from the mode. 
void swap_node(Node< Kdtree_link< Key, Value > > *&a, Node< Kdtree_link< Key, Value > > *&b)
Swaps nodes position in the tree. 
Value value
The value of the node, required by the Link Mode concept. 
pointer operator->()
Dereferance the iterator: return the pointer to the value of the node. 
Node * right
A pointer to the right child node of the current node. 
reference operator*()
Dereferance the iterator: return the value of the node. 
void swap_node_aux(Node< Link > *a, Node< Link > *b)
Swaps nodes position in the tree. 
Kdtree_link< Key, Value > * link(Node< Kdtree_link< Key, Value > > *node)
This function converts a pointer on a node into a link for a Kdtree_link type. 
mutate< typename Link::value_type >::type value_type
Kdtree_link< Key, Value >::value_type & value(Node< Kdtree_link< Key, Value > > *node)
This function converts a pointer on a node into a value for a Kdtree_link type. 
std::forward_iterator_tag iterator_category
Self operator--(int)
Moves the iterator to the previous node in inorder transversal and returns the iterator value before ...
bool operator!=(const Self &x) const 
Check if 2 iterators are different: pointing at different nodes. 
mutate< typename Link::value_type >::type value_type
Node< Link > * decrement(Node< Link > *x)
Reach the previous node in symetric transversal order. 
Node * parent
A pointer to the parent of the current node. 
bool operator!=(const Self &x) const 
Check if 2 iterators are different: pointing at different nodes. 
Self operator++(int)
Moves the iterator to the next node in inorder transversal and returns the iterator value before the ...
Key key_type
The link to the key type. 
pointer operator->()
Dereferance the iterator: return the pointer to the value of the node. 
std::ptrdiff_t difference_type
const Node< Link > * preorder_increment(const Node< Link > *x)
Reach the next node in preorder transversal. 
std::bidirectional_iterator_tag iterator_category
Relaxed_kdtree_link()
Constructs an empty, uninitialized object.