Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::BinNodeInfixIterator< Node > Class Template Reference

Inorder iterator on the nodes of a binary tree. More...

#include <tpl_binNodeUtils.H>

Inheritance diagram for Aleph::BinNodeInfixIterator< Node >:
[legend]
Collaboration diagram for Aleph::BinNodeInfixIterator< Node >:
[legend]

Public Member Functions

bool is_in_first () const noexcept
 Return true if the iterator is on the first node.
 
bool is_last () const noexcept
 
void swap (BinNodeInfixIterator &it) noexcept
 
 BinNodeInfixIterator ()=default
 
 BinNodeInfixIterator (Node *r) noexcept
 Initialize an iterator on the first node inorder.
 
 BinNodeInfixIterator (const BinNodeInfixIterator &it)
 
 BinNodeInfixIterator (BinNodeInfixIterator &&it) noexcept
 
void reset_first () noexcept
 Reset the iterator to the first node inorder.
 
void reset_last () noexcept
 Reset the iterator to the first node inorder.
 
void end () noexcept
 
BinNodeInfixIteratoroperator= (const BinNodeInfixIterator &it)
 
BinNodeInfixIteratoroperator= (BinNodeInfixIterator &&it) noexcept
 
bool has_curr () const noexcept
 Return true the iterator has current node.
 
Nodeget_curr_ne () const noexcept
 Return the current link guaranteeing no exception. Be careful.
 
Nodeget_curr () const
 Return the current node. Throw overflow_error if there is no current.
 
size_t get_pos () const
 Return the current position of iterator. Only valid if has_curr() == true.
 
void next_ne () noexcept
 
void next ()
 Move the iterator one position forward.
 

Private Member Functions

Nodeadvance_to_min (Node *r) noexcept
 
void init () noexcept
 

Static Private Member Functions

static Nodeadvance_to_max (Node *r) noexcept
 

Private Attributes

Noderoot = Node::NullPtr
 
Nodecurr = Node::NullPtr
 
long pos = 0
 
ArrayStack< Node * > s
 

Detailed Description

template<class Node>
class Aleph::BinNodeInfixIterator< Node >

Inorder 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 inorder sense.

Definition at line 2684 of file tpl_binNodeUtils.H.

Constructor & Destructor Documentation

◆ BinNodeInfixIterator() [1/4]

◆ BinNodeInfixIterator() [2/4]

template<class Node >
Aleph::BinNodeInfixIterator< Node >::BinNodeInfixIterator ( Node r)
inlinenoexcept

Initialize an iterator on the first node inorder.

Definition at line 2739 of file tpl_binNodeUtils.H.

References Aleph::BinNodeInfixIterator< Node >::init().

◆ BinNodeInfixIterator() [3/4]

◆ BinNodeInfixIterator() [4/4]

Member Function Documentation

◆ advance_to_max()

template<class Node >
static Node * Aleph::BinNodeInfixIterator< Node >::advance_to_max ( Node r)
inlinestaticprivatenoexcept

Definition at line 2701 of file tpl_binNodeUtils.H.

References Aleph::RLINK().

Referenced by Aleph::BinNodeInfixIterator< Node >::reset_last().

◆ advance_to_min()

◆ end()

◆ get_curr()

template<class Node >
Node * Aleph::BinNodeInfixIterator< Node >::get_curr ( ) const
inline

Return the current node. Throw overflow_error if there is no current.

Definition at line 2808 of file tpl_binNodeUtils.H.

References ah_overflow_error_if, Aleph::BinNodeInfixIterator< Node >::curr, Aleph::BinNodeInfixIterator< Node >::has_curr(), and Aleph::maps().

◆ get_curr_ne()

template<class Node >
Node * Aleph::BinNodeInfixIterator< Node >::get_curr_ne ( ) const
inlinenoexcept

Return the current link guaranteeing no exception. Be careful.

Definition at line 2805 of file tpl_binNodeUtils.H.

References Aleph::BinNodeInfixIterator< Node >::curr.

Referenced by TEST().

◆ get_pos()

template<class Node >
size_t Aleph::BinNodeInfixIterator< Node >::get_pos ( ) const
inline

Return the current position of iterator. Only valid if has_curr() == true.

Definition at line 2815 of file tpl_binNodeUtils.H.

References Aleph::BinNodeInfixIterator< Node >::pos.

◆ has_curr()

◆ init()

◆ is_in_first()

template<class Node >
bool Aleph::BinNodeInfixIterator< Node >::is_in_first ( ) const
inlinenoexcept

◆ is_last()

◆ next()

template<class Node >
void Aleph::BinNodeInfixIterator< Node >::next ( )
inline

Move the iterator one position forward.

Throw overflow_error if there is no current

Definition at line 2835 of file tpl_binNodeUtils.H.

References ah_overflow_error_if, Aleph::BinNodeInfixIterator< Node >::has_curr(), Aleph::maps(), and Aleph::BinNodeInfixIterator< Node >::next_ne().

◆ next_ne()

◆ operator=() [1/2]

◆ operator=() [2/2]

◆ reset_first()

template<class Node >
void Aleph::BinNodeInfixIterator< Node >::reset_first ( )
inlinenoexcept

Reset the iterator to the first node inorder.

Definition at line 2754 of file tpl_binNodeUtils.H.

References Aleph::ArrayStack< T >::empty(), Aleph::BinNodeInfixIterator< Node >::init(), and Aleph::BinNodeInfixIterator< Node >::s.

◆ reset_last()

◆ swap()

Member Data Documentation

◆ curr

◆ pos

◆ root

◆ s


The documentation for this class was generated from the following file: