|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Preorder iterator on the nodes of a binary tree. More...
#include <tpl_binNodeUtils.H>
Public Member Functions | |
| void | swap (BinNodePrefixIterator &it) noexcept |
Swap thiswith it | |
| BinNodePrefixIterator ()=default | |
| BinNodePrefixIterator (Node *r) noexcept | |
Initialize an iterator on the first node in preorder for the tree with root r | |
| BinNodePrefixIterator (const BinNodePrefixIterator &it) | |
| BinNodePrefixIterator (BinNodePrefixIterator &&it) noexcept | |
| void | reset_first () noexcept |
| Reset the iterator to the first node in preorder sense. | |
| void | reset_last () noexcept |
| Reset the iterator to the last node in preorder. | |
| void | end () noexcept |
| Put the iterator in end state. | |
| BinNodePrefixIterator & | operator= (const BinNodePrefixIterator &it) |
| BinNodePrefixIterator & | operator= (BinNodePrefixIterator &&it) noexcept |
| bool | has_curr () const noexcept |
Return true if iterator has current node. | |
| Node * | get_curr_ne () const noexcept |
| Return the current link guaranteeing no exception. Be careful. | |
| Node * | get_curr () const |
| Return a pointer to current node. | |
| void | next_ne () noexcept |
| Move the iterator one position forward guaranteeing no exception. | |
| void | next () |
| Move the iterator one position forward. | |
Static Private Member Functions | |
| static Node * | last (Node *p) noexcept |
Private Attributes | |
| Node * | root = nullptr |
| Node * | curr = Node::NullPtr |
| ArrayStack< Node * > | s |
Preorder iterator on the nodes of a binary tree.
This class export a full iterator for the nodes of a binary tree where the visit order corresponds to a preorder sense.
Definition at line 2477 of file tpl_binNodeUtils.H.
|
default |
|
inlinenoexcept |
Initialize an iterator on the first node in preorder for the tree with root r
Definition at line 2496 of file tpl_binNodeUtils.H.
|
inline |
Definition at line 2502 of file tpl_binNodeUtils.H.
|
inlinenoexcept |
Definition at line 2508 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::swap().
|
inlinenoexcept |
Put the iterator in end state.
Definition at line 2548 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::curr, Aleph::ArrayStack< T >::empty(), and Aleph::BinNodePrefixIterator< Node >::s.
|
inline |
Return a pointer to current node.
Definition at line 2578 of file tpl_binNodeUtils.H.
References ah_overflow_error_if, Aleph::BinNodePrefixIterator< Node >::get_curr_ne(), Aleph::BinNodePrefixIterator< Node >::has_curr(), and Aleph::maps().
|
inlinenoexcept |
Return the current link guaranteeing no exception. Be careful.
Definition at line 2575 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::curr.
Referenced by Aleph::BinNodePrefixIterator< Node >::get_curr().
|
inlinenoexcept |
Return true if iterator has current node.
Definition at line 2572 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::curr.
Referenced by Aleph::BinNodePrefixIterator< Node >::get_curr(), Aleph::BinNodePrefixIterator< Node >::next(), Aleph::prefix_for_each(), and Aleph::prefix_traverse().
|
inlinestaticprivatenoexcept |
Definition at line 2522 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::last(), Aleph::LLINK(), and Aleph::RLINK().
Referenced by Aleph::BinNodePrefixIterator< Node >::last(), and Aleph::BinNodePrefixIterator< Node >::reset_last().
|
inline |
Move the iterator one position forward.
Definition at line 2610 of file tpl_binNodeUtils.H.
References ah_overflow_error_if, Aleph::BinNodePrefixIterator< Node >::has_curr(), Aleph::maps(), and Aleph::BinNodePrefixIterator< Node >::next_ne().
|
inlinenoexcept |
Move the iterator one position forward guaranteeing no exception.
Be careful.
Definition at line 2586 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::curr, Aleph::ArrayStack< T >::is_empty(), l, Aleph::LLINK(), Aleph::ArrayStack< T >::pop(), Aleph::ArrayStack< T >::push(), Aleph::RLINK(), and Aleph::BinNodePrefixIterator< Node >::s.
Referenced by Aleph::BinNodePrefixIterator< Node >::next().
|
inlinenoexcept |
Definition at line 2565 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::swap().
|
inline |
Definition at line 2554 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::curr, Aleph::BinNodePrefixIterator< Node >::root, and Aleph::BinNodePrefixIterator< Node >::s.
|
inlinenoexcept |
Reset the iterator to the first node in preorder sense.
Definition at line 2514 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::curr, Aleph::ArrayStack< T >::empty(), Aleph::BinNodePrefixIterator< Node >::root, and Aleph::BinNodePrefixIterator< Node >::s.
|
inlinenoexcept |
Reset the iterator to the last node in preorder.
Definition at line 2535 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::curr, Aleph::ArrayStack< T >::empty(), Aleph::BinNodePrefixIterator< Node >::last(), Aleph::BinNodePrefixIterator< Node >::root, and Aleph::BinNodePrefixIterator< Node >::s.
|
inlinenoexcept |
Swap thiswith it
Definition at line 2485 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::curr, Aleph::BinNodePrefixIterator< Node >::root, Aleph::BinNodePrefixIterator< Node >::s, and Aleph::ArrayStack< T >::swap().
Referenced by Aleph::BinNodePrefixIterator< Node >::BinNodePrefixIterator(), and Aleph::BinNodePrefixIterator< Node >::operator=().
|
private |
Definition at line 2480 of file tpl_binNodeUtils.H.
Referenced by Aleph::BinNodePrefixIterator< Node >::end(), Aleph::BinNodePrefixIterator< Node >::get_curr_ne(), Aleph::BinNodePrefixIterator< Node >::has_curr(), Aleph::BinNodePrefixIterator< Node >::next_ne(), Aleph::BinNodePrefixIterator< Node >::operator=(), Aleph::BinNodePrefixIterator< Node >::reset_first(), Aleph::BinNodePrefixIterator< Node >::reset_last(), and Aleph::BinNodePrefixIterator< Node >::swap().
Definition at line 2479 of file tpl_binNodeUtils.H.
Referenced by Aleph::BinNodePrefixIterator< Node >::operator=(), Aleph::BinNodePrefixIterator< Node >::reset_first(), Aleph::BinNodePrefixIterator< Node >::reset_last(), and Aleph::BinNodePrefixIterator< Node >::swap().
|
private |
Definition at line 2481 of file tpl_binNodeUtils.H.
Referenced by Aleph::BinNodePrefixIterator< Node >::end(), Aleph::BinNodePrefixIterator< Node >::next_ne(), Aleph::BinNodePrefixIterator< Node >::operator=(), Aleph::BinNodePrefixIterator< Node >::reset_first(), Aleph::BinNodePrefixIterator< Node >::reset_last(), and Aleph::BinNodePrefixIterator< Node >::swap().