PPL
1.2
|
#include <CO_Tree_defs.hh>
Public Member Functions | |
tree_iterator (CO_Tree &tree) | |
Constructs a tree_iterator pointing at the root node of the specified tree. More... | |
tree_iterator (CO_Tree &tree, dimension_type i) | |
Constructs a tree_iterator pointing at the specified node of the tree. More... | |
tree_iterator (const iterator &itr, CO_Tree &tree) | |
Constructs a tree_iterator from an iterator. More... | |
tree_iterator & | operator= (const tree_iterator &itr) |
The assignment operator. More... | |
tree_iterator & | operator= (const iterator &itr) |
The assignment operator from an iterator. More... | |
bool | operator== (const tree_iterator &itr) const |
Compares *this with itr . More... | |
bool | operator!= (const tree_iterator &itr) const |
Compares *this with itr . More... | |
void | get_root () |
Makes the iterator point to the root of tree . More... | |
void | get_left_child () |
Makes the iterator point to the left child of the current node. More... | |
void | get_right_child () |
Makes the iterator point to the right child of the current node. More... | |
void | get_parent () |
Makes the iterator point to the parent of the current node. More... | |
void | go_down_searching_key (dimension_type key) |
Searches for an element with key key in the subtree rooted at *this . More... | |
void | follow_left_children_with_value () |
Follows left children with a value, until it arrives at a leaf or at a node with no value. More... | |
void | follow_right_children_with_value () |
Follows right children with a value, until it arrives at a leaf or at a node with no value. More... | |
bool | is_root () const |
Returns true if the pointed node is the root node. More... | |
bool | is_right_child () const |
Returns true if the pointed node has a parent and is its right child. More... | |
bool | is_leaf () const |
Returns true if the pointed node is a leaf of the complete tree. More... | |
data_type & | operator* () |
Returns the key and value of the current node. More... | |
Coefficient_traits::const_reference | operator* () const |
Returns the key and value of the current node. More... | |
dimension_type & | index () |
Returns a reference to the index of the element pointed to by *this . More... | |
dimension_type | index () const |
Returns the index of the element pointed to by *this . More... | |
dimension_type | key () const |
Returns the index of the node pointed to by *this . More... | |
dimension_type | dfs_index () const |
Returns the index of the current node in the DFS layout of the complete tree. More... | |
dimension_type | get_offset () const |
Returns 2^h, with h the height of the current node in the tree, counting from 0. More... | |
height_t | depth () const |
Returns the depth of the current node in the complete tree. More... | |
Public Attributes | |
CO_Tree & | tree |
The tree containing the element pointed to by this iterator. More... | |
Private Member Functions | |
bool | OK () const |
Checks the internal invariant. More... | |
Private Attributes | |
dimension_type | i |
The index of the current node in the DFS layout of the complete tree. More... | |
dimension_type | offset |
This is 2^h, with h the height of the current node in the tree, counting from 0. More... | |
Definition at line 1329 of file CO_Tree_defs.hh.
|
inlineexplicit |
Constructs a tree_iterator pointing at the root node of the specified tree.
tree | The tree to which the new iterator will point to. It must not be empty. |
Definition at line 699 of file CO_Tree_inlines.hh.
References get_root(), OK(), Parma_Polyhedra_Library::CO_Tree::reserved_size, and tree.
|
inline |
Constructs a tree_iterator pointing at the specified node of the tree.
tree | The tree to which the new iterator will point to. It must not be empty. |
i | The index of the element in tree to which the new iterator will point to. |
Definition at line 707 of file CO_Tree_inlines.hh.
References i, Parma_Polyhedra_Library::least_significant_one_mask(), offset, OK(), Parma_Polyhedra_Library::CO_Tree::reserved_size, and tree.
|
inline |
Constructs a tree_iterator from an iterator.
itr | The iterator that will be converted into a tree_iterator. It must not be end(). |
tree | The tree to which the new iterator will point to. It must not be empty. |
Definition at line 717 of file CO_Tree_inlines.hh.
References OK(), Parma_Polyhedra_Library::CO_Tree::reserved_size, and tree.
|
inline |
Returns the depth of the current node in the complete tree.
This method takes time.
Definition at line 868 of file CO_Tree_inlines.hh.
References Parma_Polyhedra_Library::CO_Tree::integer_log2().
Referenced by Parma_Polyhedra_Library::CO_Tree::dump_subtree(), Parma_Polyhedra_Library::CO_Tree::insert(), and Parma_Polyhedra_Library::CO_Tree::rebalance().
|
inline |
Returns the index of the current node in the DFS layout of the complete tree.
Definition at line 858 of file CO_Tree_inlines.hh.
Referenced by Parma_Polyhedra_Library::CO_Tree::count_used_in_subtree(), Parma_Polyhedra_Library::CO_Tree::iterator::operator=(), operator=(), and Parma_Polyhedra_Library::CO_Tree::rebalance().
|
inline |
Follows left children with a value, until it arrives at a leaf or at a node with no value.
This method takes time.
Definition at line 786 of file CO_Tree_inlines.hh.
References Parma_Polyhedra_Library::least_significant_one_mask(), Parma_Polyhedra_Library::CO_Tree::OK(), and Parma_Polyhedra_Library::CO_Tree::unused_index.
Referenced by Parma_Polyhedra_Library::CO_Tree::erase().
|
inline |
Follows right children with a value, until it arrives at a leaf or at a node with no value.
This method takes time.
Definition at line 802 of file CO_Tree_inlines.hh.
References Parma_Polyhedra_Library::least_significant_one_mask(), Parma_Polyhedra_Library::CO_Tree::OK(), and Parma_Polyhedra_Library::CO_Tree::unused_index.
Referenced by Parma_Polyhedra_Library::CO_Tree::erase().
|
inline |
Makes the iterator point to the left child of the current node.
This method takes time.
Definition at line 758 of file CO_Tree_inlines.hh.
References Parma_Polyhedra_Library::CO_Tree::OK().
Referenced by Parma_Polyhedra_Library::CO_Tree::CO_Tree(), Parma_Polyhedra_Library::CO_Tree::dump_subtree(), Parma_Polyhedra_Library::CO_Tree::erase(), Parma_Polyhedra_Library::CO_Tree::insert_precise_aux(), Parma_Polyhedra_Library::CO_Tree::move_data_from(), and Parma_Polyhedra_Library::CO_Tree::rebalance().
|
inline |
Returns 2^h, with h the height of the current node in the tree, counting from 0.
Thus leaves have offset 1. This is faster than depth(), so it is useful to compare node depths.
This method takes time.
Definition at line 863 of file CO_Tree_inlines.hh.
Referenced by Parma_Polyhedra_Library::CO_Tree::count_used_in_subtree(), Parma_Polyhedra_Library::CO_Tree::erase(), Parma_Polyhedra_Library::CO_Tree::insert(), and Parma_Polyhedra_Library::CO_Tree::rebalance().
|
inline |
Makes the iterator point to the parent of the current node.
This method takes time.
Definition at line 776 of file CO_Tree_inlines.hh.
References Parma_Polyhedra_Library::CO_Tree::OK().
Referenced by Parma_Polyhedra_Library::CO_Tree::CO_Tree(), Parma_Polyhedra_Library::CO_Tree::dump_subtree(), Parma_Polyhedra_Library::CO_Tree::erase(), Parma_Polyhedra_Library::CO_Tree::move_data_from(), and Parma_Polyhedra_Library::CO_Tree::rebalance().
|
inline |
Makes the iterator point to the right child of the current node.
This method takes time.
Definition at line 767 of file CO_Tree_inlines.hh.
References Parma_Polyhedra_Library::CO_Tree::OK().
Referenced by Parma_Polyhedra_Library::CO_Tree::CO_Tree(), Parma_Polyhedra_Library::CO_Tree::dump_subtree(), Parma_Polyhedra_Library::CO_Tree::erase(), Parma_Polyhedra_Library::CO_Tree::insert_precise_aux(), Parma_Polyhedra_Library::CO_Tree::move_data_from(), and Parma_Polyhedra_Library::CO_Tree::rebalance().
|
inline |
Makes the iterator point to the root of tree
.
The values of all fields (beside tree) are overwritten.
This method takes time.
Definition at line 751 of file CO_Tree_inlines.hh.
References Parma_Polyhedra_Library::CO_Tree::OK().
Referenced by Parma_Polyhedra_Library::CO_Tree::erase(), Parma_Polyhedra_Library::CO_Tree::insert_precise_aux(), and tree_iterator().
void Parma_Polyhedra_Library::CO_Tree::tree_iterator::go_down_searching_key | ( | dimension_type | key | ) |
Searches for an element with key key
in the subtree rooted at *this
.
key | The searched for key. |
After this method, *this points to the found node (if it exists) or to the node that would be his parent (otherwise).
This method takes time.
Definition at line 1417 of file CO_Tree.cc.
Referenced by Parma_Polyhedra_Library::CO_Tree::erase(), Parma_Polyhedra_Library::CO_Tree::insert(), Parma_Polyhedra_Library::CO_Tree::insert_precise(), and Parma_Polyhedra_Library::CO_Tree::insert_precise_aux().
|
inline |
Returns a reference to the index of the element pointed to by *this
.
*this
. Definition at line 848 of file CO_Tree_inlines.hh.
Referenced by Parma_Polyhedra_Library::CO_Tree::CO_Tree(), Parma_Polyhedra_Library::CO_Tree::dump_subtree(), Parma_Polyhedra_Library::CO_Tree::erase(), Parma_Polyhedra_Library::CO_Tree::insert(), Parma_Polyhedra_Library::CO_Tree::insert_in_empty_tree(), Parma_Polyhedra_Library::CO_Tree::insert_precise(), Parma_Polyhedra_Library::CO_Tree::insert_precise_aux(), Parma_Polyhedra_Library::CO_Tree::move_data_from(), Parma_Polyhedra_Library::CO_Tree::rebalance(), and Parma_Polyhedra_Library::CO_Tree::structure_OK().
|
inline |
Returns the index of the element pointed to by *this
.
*this
. Definition at line 853 of file CO_Tree_inlines.hh.
|
inline |
Returns true if the pointed node is a leaf of the complete tree.
This method takes time.
Definition at line 833 of file CO_Tree_inlines.hh.
Referenced by Parma_Polyhedra_Library::CO_Tree::dump_subtree(), Parma_Polyhedra_Library::CO_Tree::erase(), Parma_Polyhedra_Library::CO_Tree::insert_precise_aux(), and Parma_Polyhedra_Library::CO_Tree::rebalance().
|
inline |
Returns true if the pointed node has a parent and is its right child.
This method takes time.
Definition at line 825 of file CO_Tree_inlines.hh.
Referenced by Parma_Polyhedra_Library::CO_Tree::rebalance().
|
inline |
Returns true if the pointed node is the root node.
This method takes time.
Definition at line 818 of file CO_Tree_inlines.hh.
dimension_type Parma_Polyhedra_Library::CO_Tree::tree_iterator::key | ( | ) | const |
Returns the index of the node pointed to by *this
.
*this
, or unused_index if the current node does not contain a valid element.
|
private |
Checks the internal invariant.
Definition at line 1401 of file CO_Tree.cc.
Referenced by tree_iterator().
|
inline |
Compares *this with itr
.
itr | The iterator that will compared with *this. |
Definition at line 746 of file CO_Tree_inlines.hh.
|
inline |
Returns the key and value of the current node.
Definition at line 838 of file CO_Tree_inlines.hh.
|
inline |
Returns the key and value of the current node.
Definition at line 843 of file CO_Tree_inlines.hh.
|
inline |
The assignment operator.
itr | The iterator that will be assigned into *this. |
Definition at line 725 of file CO_Tree_inlines.hh.
References i, offset, and tree.
|
inline |
The assignment operator from an iterator.
itr | The iterator that will be assigned into *this. |
Definition at line 733 of file CO_Tree_inlines.hh.
References dfs_index(), and Parma_Polyhedra_Library::least_significant_one_mask().
|
inline |
Compares *this with itr
.
itr | The iterator that will compared with *this. |
Definition at line 741 of file CO_Tree_inlines.hh.
References i.
|
private |
The index of the current node in the DFS layout of the complete tree.
Definition at line 1525 of file CO_Tree_defs.hh.
Referenced by operator=(), operator==(), and tree_iterator().
|
private |
This is 2^h, with h the height of the current node in the tree, counting from 0.
Thus leaves have offset 1. This is equal to (i & -i), and is only stored to increase performance.
Definition at line 1534 of file CO_Tree_defs.hh.
Referenced by operator=(), and tree_iterator().
CO_Tree& Parma_Polyhedra_Library::CO_Tree::tree_iterator::tree |
The tree containing the element pointed to by this iterator.
Definition at line 1495 of file CO_Tree_defs.hh.
Referenced by Parma_Polyhedra_Library::CO_Tree::count_used_in_subtree(), Parma_Polyhedra_Library::CO_Tree::iterator::operator=(), operator=(), and tree_iterator().