#include <tree.hh>
Classes | |
| class | breadth_first_queued_iterator |
| Breadth-first iterator, using a queue. More... | |
| class | compare_nodes |
| Comparator class for two nodes of a tree (used for sorting and searching). More... | |
| class | fixed_depth_iterator |
| Iterator which traverses only the nodes at a given depth from the root. More... | |
| class | iterator_base |
| Base class for iterators, only pointers stored, no traversal logic. More... | |
| class | iterator_base_less |
| Comparator class for iterators (compares pointer values; why doesn't this work automatically?). More... | |
| class | leaf_iterator |
| Iterator which traverses only the leaves. More... | |
| class | post_order_iterator |
| Depth-first iterator, first accessing the children, then the node itself. More... | |
| class | pre_order_iterator |
| Depth-first iterator, first accessing the node, then its children. More... | |
| class | sibling_iterator |
| Iterator which traverses only the nodes which are siblings of each other. More... | |
Public Types | |
| typedef breadth_first_queued_iterator | breadth_first_iterator |
| typedef pre_order_iterator | iterator |
| The default iterator types throughout the tree class. | |
| typedef T | value_type |
| Value of the data stored at a node. | |
Public Member Functions | |
| template<typename iter > | |
| iter | append_child (iter position, iter other_position) |
| Append the node (plus its children) at other_position as last/first child of position. | |
| template<typename iter > | |
| iter | append_child (iter position, const T &x) |
| Insert node as last/first child of node pointed to by position. | |
| template<typename iter > | |
| iter | append_child (iter position) |
| Insert empty node as last/first child of node pointed to by position. | |
| template<typename iter > | |
| iter | append_children (iter position, sibling_iterator from, sibling_iterator to) |
| Append the nodes in the from-to range (plus their children) as last/first children of position. | |
| sibling_iterator | begin (const iterator_base &) const |
| Return sibling iterator to the first child of given node. | |
| pre_order_iterator | begin () const |
| Return iterator to the beginning of the tree. | |
| breadth_first_queued_iterator | begin_breadth_first () const |
| Return breadth-first iterator to the first node at a given depth. | |
| fixed_depth_iterator | begin_fixed (const iterator_base &, unsigned int) const |
| Return fixed-depth iterator to the first node at a given depth from the given iterator. | |
| leaf_iterator | begin_leaf () const |
| Return leaf iterator to the first leaf of the tree. | |
| post_order_iterator | begin_post () const |
| Return post-order iterator to the beginning of the tree. | |
| sibling_iterator | child (const iterator_base &position, unsigned int) const |
| Inverse of 'index': return the n-th child of the node at position. | |
| void | clear () |
| Erase all nodes of the tree. | |
| int | depth (const iterator_base &) const |
| Compute the depth to the root. | |
| bool | empty () const |
| Check if tree is empty. | |
| sibling_iterator | end (const iterator_base &) const |
| Return sibling iterator to the end of the children of a given node. | |
| pre_order_iterator | end () const |
| Return iterator to the end of the tree. | |
| breadth_first_queued_iterator | end_breadth_first () const |
| Return breadth-first iterator to end of the nodes at given depth. | |
| fixed_depth_iterator | end_fixed (const iterator_base &, unsigned int) const |
| Return fixed-depth iterator to end of the nodes at given depth from the given iterator. | |
| leaf_iterator | end_leaf () const |
| Return leaf iterator to the last leaf of the tree. | |
| post_order_iterator | end_post () const |
| Return post-order iterator to the end of the tree. | |
| template<typename iter , class BinaryPredicate > | |
| bool | equal (const iter &one, const iter &two, const iter &three, BinaryPredicate) const |
| template<typename iter > | |
| bool | equal (const iter &one, const iter &two, const iter &three) const |
| Compare two ranges of nodes (compares nodes as well as tree structure). | |
| template<typename iter , class BinaryPredicate > | |
| bool | equal_subtree (const iter &one, const iter &two, BinaryPredicate) const |
| template<typename iter > | |
| bool | equal_subtree (const iter &one, const iter &two) const |
| template<typename iter > | |
| iter | erase (iter) |
| Erase element at position pointed to by iterator, return incremented iterator. | |
| void | erase_children (const iterator_base &) |
| Erase all children of the node pointed to by iterator. | |
| template<typename iter > | |
| iter | flatten (iter position) |
| Move all children of node at 'position' to be siblings, returns position. | |
| unsigned int | index (sibling_iterator it) const |
| Determine the index of a node in the range of siblings to which it belongs. | |
| sibling_iterator | insert (sibling_iterator position, const T &x) |
| Specialisation of previous member. | |
| template<typename iter > | |
| iter | insert (iter position, const T &x) |
| Insert node as previous sibling of node pointed to by position. | |
| template<typename iter > | |
| iter | insert_after (iter position, const T &x) |
| Insert node as next sibling of node pointed to by position. | |
| template<typename iter > | |
| iter | insert_subtree (iter position, const iterator_base &subtree) |
| Insert node (with children) pointed to by subtree as previous sibling of node pointed to by position. | |
| template<typename iter > | |
| iter | insert_subtree_after (iter position, const iterator_base &subtree) |
| Insert node (with children) pointed to by subtree as next sibling of node pointed to by position. | |
| bool | is_in_subtree (const iterator_base &position, const iterator_base &begin, const iterator_base &end) const |
| Determine whether node at position is in the subtrees with root in the range. | |
| bool | is_valid (const iterator_base &) const |
| Determine whether the iterator is an 'end' iterator and thus not actually pointing to a node. | |
| int | max_depth (const iterator_base &) const |
| Determine the maximal depth of the tree below a given one. | |
| int | max_depth () const |
| Determine the maximal depth of the tree. | |
| void | merge (sibling_iterator, sibling_iterator, sibling_iterator, sibling_iterator, bool duplicate_leaves=false) |
| Merge with other tree, creating new branches and leaves only if they are not already present. | |
| template<typename iter > | |
| iter | move_after (iter target, iter source) |
| Move 'source' node (plus its children) to become the next sibling of 'target'. | |
| sibling_iterator | move_before (sibling_iterator target, sibling_iterator source) |
| template<typename iter > | |
| iter | move_before (iter target, iter source) |
| Move 'source' node (plus its children) to become the previous sibling of 'target'. | |
| template<typename iter > | |
| iter | move_ontop (iter target, iter source) |
| Move 'source' node (plus its children) to become the node at 'target' (erasing the node at 'target'). | |
| template<typename iter > | |
| iter | next_at_same_depth (iter) const |
| Return iterator to the next node at a given depth. | |
| template<typename iter > | |
| iter | next_sibling (iter) const |
| Return iterator to the next sibling of a node. | |
| unsigned int | number_of_siblings (const iterator_base &) const |
| Count the number of 'next' siblings of node at iterator. | |
| void | operator= (const tree< T, tree_node_allocator > &) |
| template<typename iter > | |
| iter | prepend_child (iter position, iter other_position) |
| template<typename iter > | |
| iter | prepend_child (iter position, const T &x) |
| template<typename iter > | |
| iter | prepend_child (iter position) |
| template<typename iter > | |
| iter | prepend_children (iter position, sibling_iterator from, sibling_iterator to) |
| template<typename iter > | |
| iter | previous_sibling (iter) const |
| Return iterator to the previous sibling of a node. | |
| template<typename iter > | |
| iter | reparent (iter position, iter from) |
| Move all child nodes of 'from' to be children of 'position'. | |
| template<typename iter > | |
| iter | reparent (iter position, sibling_iterator begin, sibling_iterator end) |
| Move nodes in range to be children of 'position'. | |
| sibling_iterator | replace (sibling_iterator orig_begin, sibling_iterator orig_end, sibling_iterator new_begin, sibling_iterator new_end) |
| Replace string of siblings (plus their children) with copy of a new string (with children); see above. | |
| template<typename iter > | |
| iter | replace (iter position, const iterator_base &from) |
| Replace node at 'position' with subtree starting at 'from' (do not erase subtree at 'from'); see above. | |
| template<typename iter > | |
| iter | replace (iter position, const T &x) |
| Replace node at 'position' with other node (keeping same children); 'position' becomes invalid. | |
| pre_order_iterator | set_head (const T &x) |
| Short-hand to insert topmost node in otherwise empty tree. | |
| int | size (const iterator_base &) const |
| Count the total number of nodes below the indicated node (plus one). | |
| int | size () const |
| Count the total number of nodes. | |
| template<class StrictWeakOrdering > | |
| void | sort (sibling_iterator from, sibling_iterator to, StrictWeakOrdering comp, bool deep=false) |
| void | sort (sibling_iterator from, sibling_iterator to, bool deep=false) |
| Sort (std::sort only moves values of nodes, this one moves children as well). | |
| void | subtree (tree &, sibling_iterator from, sibling_iterator to) const |
| tree | subtree (sibling_iterator from, sibling_iterator to) const |
| Extract a new tree formed by the range of siblings plus all their children. | |
| void | swap (iterator, iterator) |
| Exchange two nodes (plus subtrees). | |
| void | swap (sibling_iterator it) |
| Exchange the node (plus subtree) with its sibling node (do nothing if no sibling present). | |
| tree (const tree< T, tree_node_allocator > &) | |
| tree (const iterator_base &) | |
| tree (const T &) | |
| tree () | |
| template<typename iter > | |
| iter | wrap (iter position, const T &x) |
| Replace node with a new node, making the old node a child of the new node. | |
| ~tree () | |
Static Public Member Functions | |
| static unsigned int | number_of_children (const iterator_base &) |
| Count the number of children of node at position. | |
| template<typename iter > | |
| static iter | parent (iter) |
| Return iterator to the parent of a node. | |
Public Attributes | |
| tree_node * | feet |
| tree_node * | head |
Protected Types | |
| typedef tree_node_< T > | tree_node |
Private Member Functions | |
| void | copy_ (const tree< T, tree_node_allocator > &other) |
| void | head_initialise_ () |
Private Attributes | |
| tree_node_allocator | alloc_ |
| typedef breadth_first_queued_iterator tree< T, tree_node_allocator >::breadth_first_iterator |
| typedef pre_order_iterator tree< T, tree_node_allocator >::iterator |
The default iterator types throughout the tree class.
typedef tree_node_<T> tree< T, tree_node_allocator >::tree_node [protected] |
| typedef T tree< T, tree_node_allocator >::value_type |
Value of the data stored at a node.
| tree< T, tree_node_allocator >::tree | ( | const iterator_base & | other | ) | [inline] |
| iter tree< T, tree_node_allocator >::append_child | ( | iter | position, | |
| iter | other_position | |||
| ) | [inline] |
Append the node (plus its children) at other_position as last/first child of position.
References tree< T, tree_node_allocator >::append_child(), tree< T, tree_node_allocator >::head, and tree< T, tree_node_allocator >::replace().
| iter tree< T, tree_node_allocator >::append_child | ( | iter | position, | |
| const T & | x | |||
| ) | [inline] |
Insert node as last/first child of node pointed to by position.
References tree< T, tree_node_allocator >::alloc_, kp::constructor(), tree_node_< T >::data, tree_node_< T >::first_child, tree< T, tree_node_allocator >::head, tree_node_< T >::last_child, tree_node_< T >::next_sibling, tree_node_< T >::parent, and tree_node_< T >::prev_sibling.
| iter tree< T, tree_node_allocator >::append_child | ( | iter | position | ) | [inline] |
Insert empty node as last/first child of node pointed to by position.
References tree< T, tree_node_allocator >::alloc_, kp::constructor(), tree_node_< T >::data, tree_node_< T >::first_child, tree< T, tree_node_allocator >::head, tree_node_< T >::last_child, tree_node_< T >::next_sibling, tree_node_< T >::parent, and tree_node_< T >::prev_sibling.
Referenced by tree< T, tree_node_allocator >::append_child(), tree< T, tree_node_allocator >::merge(), Origin750Parser::readProjectTreeFolder(), and tree< T, tree_node_allocator >::replace().
| iter tree< T, tree_node_allocator >::append_children | ( | iter | position, | |
| sibling_iterator | from, | |||
| sibling_iterator | to | |||
| ) | [inline] |
Append the nodes in the from-to range (plus their children) as last/first children of position.
References tree< T, tree_node_allocator >::head, and tree< T, tree_node_allocator >::insert_subtree().
| tree< T, tree_node_allocator >::sibling_iterator tree< T, tree_node_allocator >::begin | ( | const iterator_base & | pos | ) | const [inline] |
Return sibling iterator to the first child of given node.
References tree< T, tree_node_allocator >::end().
| tree< T, tree_node_allocator >::pre_order_iterator tree< T, tree_node_allocator >::begin | ( | ) | const [inline] |
Return iterator to the beginning of the tree.
References tree< T, tree_node_allocator >::head, and tree_node_< T >::next_sibling.
Referenced by tree< T, tree_node_allocator >::copy_(), tree< T, tree_node_allocator >::empty(), tree< T, tree_node_allocator >::equal_subtree(), tree< T, tree_node_allocator >::max_depth(), Origin750Parser::readProjectTree(), tree< T, tree_node_allocator >::size(), tree< T, tree_node_allocator >::sort(), tree< T, tree_node_allocator >::subtree(), and tree< T, tree_node_allocator >::tree().
| tree< T, tree_node_allocator >::breadth_first_queued_iterator tree< T, tree_node_allocator >::begin_breadth_first | ( | ) | const [inline] |
Return breadth-first iterator to the first node at a given depth.
References tree< T, tree_node_allocator >::head, and tree_node_< T >::next_sibling.
| tree< T, tree_node_allocator >::fixed_depth_iterator tree< T, tree_node_allocator >::begin_fixed | ( | const iterator_base & | pos, | |
| unsigned int | dp | |||
| ) | const [inline] |
Return fixed-depth iterator to the first node at a given depth from the given iterator.
References tree_node_< T >::first_child, tree_node_< T >::next_sibling, and tree_node_< T >::parent.
| tree< T, tree_node_allocator >::leaf_iterator tree< T, tree_node_allocator >::begin_leaf | ( | ) | const [inline] |
Return leaf iterator to the first leaf of the tree.
References tree< T, tree_node_allocator >::feet, tree_node_< T >::first_child, tree< T, tree_node_allocator >::head, and tree_node_< T >::next_sibling.
| tree< T, tree_node_allocator >::post_order_iterator tree< T, tree_node_allocator >::begin_post | ( | ) | const [inline] |
Return post-order iterator to the beginning of the tree.
References tree< T, tree_node_allocator >::feet, tree_node_< T >::first_child, tree< T, tree_node_allocator >::head, and tree_node_< T >::next_sibling.
| tree< T, tree_node_allocator >::sibling_iterator tree< T, tree_node_allocator >::child | ( | const iterator_base & | position, | |
| unsigned int | num | |||
| ) | const [inline] |
Inverse of 'index': return the n-th child of the node at position.
References tree_node_< T >::next_sibling.
| void tree< T, tree_node_allocator >::clear | ( | ) | [inline] |
Erase all nodes of the tree.
References tree< T, tree_node_allocator >::erase(), tree< T, tree_node_allocator >::feet, tree< T, tree_node_allocator >::head, and tree_node_< T >::next_sibling.
Referenced by tree< T, tree_node_allocator >::copy_(), and tree< T, tree_node_allocator >::~tree().
| void tree< T, tree_node_allocator >::copy_ | ( | const tree< T, tree_node_allocator > & | other | ) | [inline, private] |
References tree< T, tree_node_allocator >::begin(), tree< T, tree_node_allocator >::clear(), tree< T, tree_node_allocator >::end(), tree< T, tree_node_allocator >::insert(), tree< T, tree_node_allocator >::replace(), and tree< T, tree_node_allocator >::tree::iterator_base::skip_children().
Referenced by tree< T, tree_node_allocator >::operator=(), and tree< T, tree_node_allocator >::tree().
| int tree< T, tree_node_allocator >::depth | ( | const iterator_base & | it | ) | const [inline] |
Compute the depth to the root.
References tree_node_< T >::parent.
Referenced by Origin750Parser::readProjectTree().
| bool tree< T, tree_node_allocator >::empty | ( | ) | const [inline] |
Check if tree is empty.
References tree< T, tree_node_allocator >::begin(), and tree< T, tree_node_allocator >::end().
| tree< T, tree_node_allocator >::sibling_iterator tree< T, tree_node_allocator >::end | ( | const iterator_base & | pos | ) | const [inline] |
Return sibling iterator to the end of the children of a given node.
References tree< T, tree_node_allocator >::tree::sibling_iterator::parent_.
| tree< T, tree_node_allocator >::pre_order_iterator tree< T, tree_node_allocator >::end | ( | ) | const [inline] |
Return iterator to the end of the tree.
References tree< T, tree_node_allocator >::feet.
Referenced by tree< T, tree_node_allocator >::begin(), tree< T, tree_node_allocator >::copy_(), tree< T, tree_node_allocator >::empty(), tree< T, tree_node_allocator >::equal_subtree(), Origin750Parser::readProjectTree(), tree< T, tree_node_allocator >::reparent(), tree< T, tree_node_allocator >::size(), tree< T, tree_node_allocator >::sort(), and tree< T, tree_node_allocator >::subtree().
| tree< T, tree_node_allocator >::breadth_first_queued_iterator tree< T, tree_node_allocator >::end_breadth_first | ( | ) | const [inline] |
Return breadth-first iterator to end of the nodes at given depth.
| tree< T, tree_node_allocator >::fixed_depth_iterator tree< T, tree_node_allocator >::end_fixed | ( | const iterator_base & | pos, | |
| unsigned int | dp | |||
| ) | const [inline] |
Return fixed-depth iterator to end of the nodes at given depth from the given iterator.
References tree_node_< T >::first_child, and tree_node_< T >::next_sibling.
| tree< T, tree_node_allocator >::leaf_iterator tree< T, tree_node_allocator >::end_leaf | ( | ) | const [inline] |
| tree< T, tree_node_allocator >::post_order_iterator tree< T, tree_node_allocator >::end_post | ( | ) | const [inline] |
| bool tree< T, tree_node_allocator >::equal | ( | const iter & | one, | |
| const iter & | two, | |||
| const iter & | three, | |||
| BinaryPredicate | fun | |||
| ) | const [inline] |
| bool tree< T, tree_node_allocator >::equal | ( | const iter & | one, | |
| const iter & | two, | |||
| const iter & | three | |||
| ) | const [inline] |
Compare two ranges of nodes (compares nodes as well as tree structure).
Referenced by tree< T, tree_node_allocator >::equal_subtree().
| bool tree< T, tree_node_allocator >::equal_subtree | ( | const iter & | one, | |
| const iter & | two, | |||
| BinaryPredicate | fun | |||
| ) | const [inline] |
| bool tree< T, tree_node_allocator >::equal_subtree | ( | const iter & | one, | |
| const iter & | two | |||
| ) | const [inline] |
| iter tree< T, tree_node_allocator >::erase | ( | iter | it | ) | [inline] |
Erase element at position pointed to by iterator, return incremented iterator.
References tree< T, tree_node_allocator >::alloc_, tree_node_< T >::data, kp::destructor(), tree< T, tree_node_allocator >::erase_children(), tree< T, tree_node_allocator >::head, tree_node_< T >::next_sibling, tree_node_< T >::parent, and tree_node_< T >::prev_sibling.
Referenced by tree< T, tree_node_allocator >::clear(), tree< T, tree_node_allocator >::move_ontop(), and tree< T, tree_node_allocator >::replace().
| void tree< T, tree_node_allocator >::erase_children | ( | const iterator_base & | it | ) | [inline] |
Erase all children of the node pointed to by iterator.
References tree< T, tree_node_allocator >::alloc_, tree_node_< T >::data, kp::destructor(), and tree_node_< T >::next_sibling.
Referenced by tree< T, tree_node_allocator >::erase(), and tree< T, tree_node_allocator >::replace().
| iter tree< T, tree_node_allocator >::flatten | ( | iter | position | ) | [inline] |
Move all children of node at 'position' to be siblings, returns position.
References tree_node_< T >::next_sibling, and tree_node_< T >::parent.
| void tree< T, tree_node_allocator >::head_initialise_ | ( | ) | [inline, private] |
References tree< T, tree_node_allocator >::alloc_, tree< T, tree_node_allocator >::feet, tree_node_< T >::first_child, tree< T, tree_node_allocator >::head, tree_node_< T >::last_child, tree_node_< T >::next_sibling, tree_node_< T >::parent, and tree_node_< T >::prev_sibling.
Referenced by tree< T, tree_node_allocator >::tree().
| unsigned int tree< T, tree_node_allocator >::index | ( | sibling_iterator | it | ) | const [inline] |
Determine the index of a node in the range of siblings to which it belongs.
References tree< T, tree_node_allocator >::head, tree< T, tree_node_allocator >::tree::iterator_base::node, tree_node_< T >::parent, and tree_node_< T >::prev_sibling.
| tree< T, tree_node_allocator >::sibling_iterator tree< T, tree_node_allocator >::insert | ( | sibling_iterator | position, | |
| const T & | x | |||
| ) | [inline] |
Specialisation of previous member.
References tree< T, tree_node_allocator >::alloc_, kp::constructor(), tree_node_< T >::data, tree_node_< T >::first_child, tree_node_< T >::last_child, tree_node_< T >::next_sibling, tree< T, tree_node_allocator >::tree::iterator_base::node, tree_node_< T >::parent, tree< T, tree_node_allocator >::tree::sibling_iterator::parent_, tree_node_< T >::prev_sibling, and tree< T, tree_node_allocator >::tree::sibling_iterator::range_last().
| iter tree< T, tree_node_allocator >::insert | ( | iter | position, | |
| const T & | x | |||
| ) | [inline] |
Insert node as previous sibling of node pointed to by position.
References tree< T, tree_node_allocator >::alloc_, kp::constructor(), tree_node_< T >::data, tree< T, tree_node_allocator >::feet, tree_node_< T >::first_child, tree_node_< T >::last_child, tree_node_< T >::next_sibling, tree_node_< T >::parent, and tree_node_< T >::prev_sibling.
Referenced by tree< T, tree_node_allocator >::copy_(), tree< T, tree_node_allocator >::insert_subtree(), tree< T, tree_node_allocator >::set_head(), and tree< T, tree_node_allocator >::wrap().
| iter tree< T, tree_node_allocator >::insert_after | ( | iter | position, | |
| const T & | x | |||
| ) | [inline] |
Insert node as next sibling of node pointed to by position.
References tree< T, tree_node_allocator >::alloc_, kp::constructor(), tree_node_< T >::data, tree_node_< T >::first_child, tree_node_< T >::last_child, tree_node_< T >::next_sibling, tree_node_< T >::parent, and tree_node_< T >::prev_sibling.
Referenced by tree< T, tree_node_allocator >::insert_subtree_after().
| iter tree< T, tree_node_allocator >::insert_subtree | ( | iter | position, | |
| const iterator_base & | subtree | |||
| ) | [inline] |
Insert node (with children) pointed to by subtree as previous sibling of node pointed to by position.
References tree< T, tree_node_allocator >::insert(), and tree< T, tree_node_allocator >::replace().
Referenced by tree< T, tree_node_allocator >::append_children(), tree< T, tree_node_allocator >::merge(), tree< T, tree_node_allocator >::prepend_children(), and tree< T, tree_node_allocator >::replace().
| iter tree< T, tree_node_allocator >::insert_subtree_after | ( | iter | position, | |
| const iterator_base & | subtree | |||
| ) | [inline] |
Insert node (with children) pointed to by subtree as next sibling of node pointed to by position.
References tree< T, tree_node_allocator >::insert_after(), and tree< T, tree_node_allocator >::replace().
| bool tree< T, tree_node_allocator >::is_in_subtree | ( | const iterator_base & | position, | |
| const iterator_base & | begin, | |||
| const iterator_base & | end | |||
| ) | const [inline] |
Determine whether node at position is in the subtrees with root in the range.
| bool tree< T, tree_node_allocator >::is_valid | ( | const iterator_base & | it | ) | const [inline] |
Determine whether the iterator is an 'end' iterator and thus not actually pointing to a node.
References tree< T, tree_node_allocator >::feet, and tree< T, tree_node_allocator >::head.
Referenced by tree< T, tree_node_allocator >::equal().
| int tree< T, tree_node_allocator >::max_depth | ( | const iterator_base & | pos | ) | const [inline] |
Determine the maximal depth of the tree below a given one.
References tree_node_< T >::first_child, tree_node_< T >::next_sibling, and tree_node_< T >::parent.
| int tree< T, tree_node_allocator >::max_depth | ( | ) | const [inline] |
| void tree< T, tree_node_allocator >::merge | ( | sibling_iterator | to1, | |
| sibling_iterator | to2, | |||
| sibling_iterator | from1, | |||
| sibling_iterator | from2, | |||
| bool | duplicate_leaves = false | |||
| ) | [inline] |
Merge with other tree, creating new branches and leaves only if they are not already present.
References tree< T, tree_node_allocator >::append_child(), tree< T, tree_node_allocator >::tree::iterator_base::begin(), tree< T, tree_node_allocator >::tree::iterator_base::end(), tree< T, tree_node_allocator >::insert_subtree(), and tree< T, tree_node_allocator >::parent().
| iter tree< T, tree_node_allocator >::move_after | ( | iter | target, | |
| iter | source | |||
| ) | [inline] |
Move 'source' node (plus its children) to become the next sibling of 'target'.
References tree_node_< T >::next_sibling, tree_node_< T >::parent, and tree_node_< T >::prev_sibling.
| tree< T, tree_node_allocator >::sibling_iterator tree< T, tree_node_allocator >::move_before | ( | sibling_iterator | target, | |
| sibling_iterator | source | |||
| ) | [inline] |
| iter tree< T, tree_node_allocator >::move_before | ( | iter | target, | |
| iter | source | |||
| ) | [inline] |
Move 'source' node (plus its children) to become the previous sibling of 'target'.
References tree_node_< T >::next_sibling, tree_node_< T >::parent, and tree_node_< T >::prev_sibling.
| iter tree< T, tree_node_allocator >::move_ontop | ( | iter | target, | |
| iter | source | |||
| ) | [inline] |
Move 'source' node (plus its children) to become the node at 'target' (erasing the node at 'target').
References tree< T, tree_node_allocator >::erase(), tree_node_< T >::first_child, tree_node_< T >::last_child, tree_node_< T >::next_sibling, tree_node_< T >::parent, and tree_node_< T >::prev_sibling.
| iter tree< T, tree_node_allocator >::next_at_same_depth | ( | iter | position | ) | const [inline] |
Return iterator to the next node at a given depth.
| iter tree< T, tree_node_allocator >::next_sibling | ( | iter | position | ) | const [inline] |
Return iterator to the next sibling of a node.
| unsigned int tree< T, tree_node_allocator >::number_of_children | ( | const iterator_base & | it | ) | [inline, static] |
Count the number of children of node at position.
References tree_node_< T >::next_sibling.
Referenced by tree< T, tree_node_allocator >::equal_subtree().
| unsigned int tree< T, tree_node_allocator >::number_of_siblings | ( | const iterator_base & | it | ) | const [inline] |
Count the number of 'next' siblings of node at iterator.
References tree< T, tree_node_allocator >::feet, tree< T, tree_node_allocator >::head, tree_node_< T >::next_sibling, and tree_node_< T >::prev_sibling.
| void tree< T, tree_node_allocator >::operator= | ( | const tree< T, tree_node_allocator > & | other | ) | [inline] |
References tree< T, tree_node_allocator >::copy_().
| iter tree< T, tree_node_allocator >::parent | ( | iter | position | ) | [inline, static] |
Return iterator to the parent of a node.
Referenced by tree< T, tree_node_allocator >::merge(), and tree< T, tree_node_allocator >::replace().
| iter tree< T, tree_node_allocator >::prepend_child | ( | iter | position, | |
| iter | other_position | |||
| ) | [inline] |
| iter tree< T, tree_node_allocator >::prepend_child | ( | iter | position, | |
| const T & | x | |||
| ) | [inline] |
| iter tree< T, tree_node_allocator >::prepend_child | ( | iter | position | ) | [inline] |
References tree< T, tree_node_allocator >::alloc_, kp::constructor(), tree_node_< T >::data, tree_node_< T >::first_child, tree< T, tree_node_allocator >::head, tree_node_< T >::last_child, tree_node_< T >::next_sibling, tree_node_< T >::parent, and tree_node_< T >::prev_sibling.
Referenced by tree< T, tree_node_allocator >::prepend_child().
| iter tree< T, tree_node_allocator >::prepend_children | ( | iter | position, | |
| sibling_iterator | from, | |||
| sibling_iterator | to | |||
| ) | [inline] |
| iter tree< T, tree_node_allocator >::previous_sibling | ( | iter | position | ) | const [inline] |
Return iterator to the previous sibling of a node.
| iter tree< T, tree_node_allocator >::reparent | ( | iter | position, | |
| iter | from | |||
| ) | [inline] |
Move all child nodes of 'from' to be children of 'position'.
References tree< T, tree_node_allocator >::end(), and tree< T, tree_node_allocator >::reparent().
| iter tree< T, tree_node_allocator >::reparent | ( | iter | position, | |
| sibling_iterator | begin, | |||
| sibling_iterator | end | |||
| ) | [inline] |
Move nodes in range to be children of 'position'.
References tree_node_< T >::last_child, tree_node_< T >::next_sibling, tree< T, tree_node_allocator >::tree::iterator_base::node, tree_node_< T >::parent, and tree_node_< T >::prev_sibling.
Referenced by tree< T, tree_node_allocator >::reparent(), and tree< T, tree_node_allocator >::wrap().
| tree< T, tree_node_allocator >::sibling_iterator tree< T, tree_node_allocator >::replace | ( | sibling_iterator | orig_begin, | |
| sibling_iterator | orig_end, | |||
| sibling_iterator | new_begin, | |||
| sibling_iterator | new_end | |||
| ) | [inline] |
Replace string of siblings (plus their children) with copy of a new string (with children); see above.
References tree< T, tree_node_allocator >::erase(), tree< T, tree_node_allocator >::insert_subtree(), tree_node_< T >::next_sibling, and tree< T, tree_node_allocator >::tree::iterator_base::node.
| iter tree< T, tree_node_allocator >::replace | ( | iter | position, | |
| const iterator_base & | from | |||
| ) | [inline] |
Replace node at 'position' with subtree starting at 'from' (do not erase subtree at 'from'); see above.
References tree< T, tree_node_allocator >::alloc_, tree< T, tree_node_allocator >::append_child(), kp::constructor(), tree_node_< T >::data, kp::destructor(), tree< T, tree_node_allocator >::erase_children(), tree_node_< T >::first_child, tree< T, tree_node_allocator >::head, tree_node_< T >::last_child, tree_node_< T >::next_sibling, tree< T, tree_node_allocator >::parent(), tree_node_< T >::parent, and tree_node_< T >::prev_sibling.
| iter tree< T, tree_node_allocator >::replace | ( | iter | position, | |
| const T & | x | |||
| ) | [inline] |
Replace node at 'position' with other node (keeping same children); 'position' becomes invalid.
References kp::constructor(), and kp::destructor().
Referenced by tree< T, tree_node_allocator >::append_child(), tree< T, tree_node_allocator >::copy_(), tree< T, tree_node_allocator >::insert_subtree(), tree< T, tree_node_allocator >::insert_subtree_after(), tree< T, tree_node_allocator >::prepend_child(), tree< T, tree_node_allocator >::subtree(), and tree< T, tree_node_allocator >::tree().
| tree< T, tree_node_allocator >::pre_order_iterator tree< T, tree_node_allocator >::set_head | ( | const T & | x | ) | [inline] |
Short-hand to insert topmost node in otherwise empty tree.
References tree< T, tree_node_allocator >::feet, tree< T, tree_node_allocator >::head, tree< T, tree_node_allocator >::insert(), and tree_node_< T >::next_sibling.
Referenced by tree< T, tree_node_allocator >::subtree(), and tree< T, tree_node_allocator >::tree().
| int tree< T, tree_node_allocator >::size | ( | const iterator_base & | top | ) | const [inline] |
Count the total number of nodes below the indicated node (plus one).
| int tree< T, tree_node_allocator >::size | ( | ) | const [inline] |
Count the total number of nodes.
References tree< T, tree_node_allocator >::begin(), and tree< T, tree_node_allocator >::end().
| void tree< T, tree_node_allocator >::sort | ( | sibling_iterator | from, | |
| sibling_iterator | to, | |||
| StrictWeakOrdering | comp, | |||
| bool | deep = false | |||
| ) | [inline] |
| void tree< T, tree_node_allocator >::sort | ( | sibling_iterator | from, | |
| sibling_iterator | to, | |||
| bool | deep = false | |||
| ) | [inline] |
Sort (std::sort only moves values of nodes, this one moves children as well).
Referenced by tree< T, tree_node_allocator >::sort().
| void tree< T, tree_node_allocator >::subtree | ( | tree< T, tree_node_allocator > & | tmp, | |
| sibling_iterator | from, | |||
| sibling_iterator | to | |||
| ) | const [inline] |
| tree< T, tree_node_allocator > tree< T, tree_node_allocator >::subtree | ( | sibling_iterator | from, | |
| sibling_iterator | to | |||
| ) | const [inline] |
Extract a new tree formed by the range of siblings plus all their children.
References tree< T, tree_node_allocator >::begin(), tree< T, tree_node_allocator >::end(), tree< T, tree_node_allocator >::replace(), and tree< T, tree_node_allocator >::set_head().
| void tree< T, tree_node_allocator >::swap | ( | iterator | one, | |
| iterator | two | |||
| ) | [inline] |
Exchange two nodes (plus subtrees).
References tree_node_< T >::first_child, tree_node_< T >::last_child, tree_node_< T >::next_sibling, tree< T, tree_node_allocator >::tree::iterator_base::node, tree_node_< T >::parent, tree_node_< T >::prev_sibling, and tree< T, tree_node_allocator >::swap().
| void tree< T, tree_node_allocator >::swap | ( | sibling_iterator | it | ) | [inline] |
Exchange the node (plus subtree) with its sibling node (do nothing if no sibling present).
References tree_node_< T >::next_sibling, tree< T, tree_node_allocator >::tree::iterator_base::node, tree_node_< T >::parent, and tree_node_< T >::prev_sibling.
Referenced by tree< T, tree_node_allocator >::swap().
| iter tree< T, tree_node_allocator >::wrap | ( | iter | position, | |
| const T & | x | |||
| ) | [inline] |
Replace node with a new node, making the old node a child of the new node.
References tree< T, tree_node_allocator >::insert(), and tree< T, tree_node_allocator >::reparent().
tree_node_allocator tree< T, tree_node_allocator >::alloc_ [private] |
Referenced by tree< T, tree_node_allocator >::append_child(), tree< T, tree_node_allocator >::erase(), tree< T, tree_node_allocator >::erase_children(), tree< T, tree_node_allocator >::head_initialise_(), tree< T, tree_node_allocator >::insert(), tree< T, tree_node_allocator >::insert_after(), tree< T, tree_node_allocator >::prepend_child(), tree< T, tree_node_allocator >::replace(), and tree< T, tree_node_allocator >::~tree().
| tree_node * tree< T, tree_node_allocator >::feet |
Referenced by tree< T, tree_node_allocator >::begin_leaf(), tree< T, tree_node_allocator >::begin_post(), tree< T, tree_node_allocator >::clear(), tree< T, tree_node_allocator >::end(), tree< T, tree_node_allocator >::end_leaf(), tree< T, tree_node_allocator >::end_post(), tree< T, tree_node_allocator >::head_initialise_(), tree< T, tree_node_allocator >::insert(), tree< T, tree_node_allocator >::is_valid(), tree< T, tree_node_allocator >::number_of_siblings(), tree< T, tree_node_allocator >::set_head(), and tree< T, tree_node_allocator >::~tree().
| tree_node* tree< T, tree_node_allocator >::head |
Referenced by tree< T, tree_node_allocator >::append_child(), tree< T, tree_node_allocator >::append_children(), tree< T, tree_node_allocator >::begin(), tree< T, tree_node_allocator >::begin_breadth_first(), tree< T, tree_node_allocator >::begin_leaf(), tree< T, tree_node_allocator >::begin_post(), tree< T, tree_node_allocator >::clear(), tree< T, tree_node_allocator >::erase(), tree< T, tree_node_allocator >::head_initialise_(), tree< T, tree_node_allocator >::index(), tree< T, tree_node_allocator >::is_valid(), tree< T, tree_node_allocator >::number_of_siblings(), tree< T, tree_node_allocator >::prepend_child(), tree< T, tree_node_allocator >::prepend_children(), tree< T, tree_node_allocator >::replace(), tree< T, tree_node_allocator >::set_head(), and tree< T, tree_node_allocator >::~tree().
1.5.8