Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator Class Reference

Iterator on nodes of the tree. More...

#include <tpl_treapRk.H>

Collaboration diagram for Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator:
[legend]

Public Member Functions

 Iterator () noexcept
 
 Iterator (const Gen_Treap_Rk &__tree) noexcept
 Initialize an iterator on __tree
 
 Iterator (const Gen_Treap_Rk &__tree, Node *__curr) noexcept
 Initialize an iterator starting from node __curr
 
 Iterator (const Gen_Treap_Rk &__tree, const size_t pos) noexcept
 Initialize an iterator starting from the iorder position pos
 
 Iterator (const Iterator &itor) noexcept
 
Iteratoroperator= (const Iterator &itor) noexcept
 
void reset_first () noexcept
 Reset the iterator to the first position.
 
void reset_last () noexcept
 Reset the iterator to the last position.
 
void end () noexcept
 Put the iterator in the end state.
 
void reset_to_key (const Key &key) noexcept
 Put the iterator to a node according to specific key.
 
void reset_to_node (Node *node) noexcept
 Put the current node to a specific node.
 
void reset_to_pos (const size_t pos) noexcept
 Put the current to the position pos.
 
Nodeget_curr_ne () const noexcept
 Return the current node.
 
Nodeget_curr () const noexcept
 
size_t get_current_position () const
 return the position of current node
 
size_t get_pos () const
 
bool has_curr () const noexcept
 Return true if iterator has current node.
 
void prev ()
 Move the iterator one position backward.
 
void next_ne () noexcept
 
void next ()
 Move the iterator one position forward.
 
Nodedel ()
 Remove the current node and move the iterator one position forward.
 
bool operator== (const Iterator &itor) const noexcept
 Return true if this is equal to itor
 
bool operator!= (const Iterator &itor) const
 Return true if this is not equal to itor
 
bool verify (Gen_Treap_Rk *r) const noexcept
 
bool verify (const Iterator &it) const noexcept
 

Protected Attributes

Gen_Treap_Rktree_ptr
 
Nodecurr
 
int curr_pos
 

Static Protected Attributes

static constexpr int Pos_Not_Current = -1
 
static constexpr int Pos_Empty_Container = -2
 
static constexpr int Pos_Not_Updated = -3
 

Private Member Functions

bool is_container_empty () const noexcept
 
bool pos_updated () const noexcept
 
bool curr_updated () const noexcept
 
bool is_updated () const noexcept
 
void update_pos () const noexcept
 
void update_curr () const noexcept
 

Detailed Description

template<template< class > class NodeType, class Key, class Compare>
class Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator

Iterator on nodes of the tree.

The visit order is inorder.

Definition at line 755 of file tpl_treapRk.H.

Constructor & Destructor Documentation

◆ Iterator() [1/5]

template<template< class > class NodeType, class Key , class Compare >
Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::Iterator ( )
inlinenoexcept

Definition at line 810 of file tpl_treapRk.H.

◆ Iterator() [2/5]

◆ Iterator() [3/5]

template<template< class > class NodeType, class Key , class Compare >
Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::Iterator ( const Gen_Treap_Rk __tree,
Node __curr 
)
inlinenoexcept

Initialize an iterator starting from node __curr

Definition at line 824 of file tpl_treapRk.H.

◆ Iterator() [4/5]

template<template< class > class NodeType, class Key , class Compare >
Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::Iterator ( const Gen_Treap_Rk __tree,
const size_t  pos 
)
inlinenoexcept

Initialize an iterator starting from the iorder position pos

Definition at line 832 of file tpl_treapRk.H.

◆ Iterator() [5/5]

template<template< class > class NodeType, class Key , class Compare >
Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::Iterator ( const Iterator itor)
inlinenoexcept

Definition at line 839 of file tpl_treapRk.H.

Member Function Documentation

◆ curr_updated()

◆ del()

◆ end()

template<template< class > class NodeType, class Key , class Compare >
void Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::end ( )
inlinenoexcept

Put the iterator in the end state.

Definition at line 873 of file tpl_treapRk.H.

References put_itor_at_the_end().

◆ get_curr()

template<template< class > class NodeType, class Key , class Compare >
Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::get_curr ( ) const
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 919 of file tpl_treapRk.H.

References Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::get_curr_ne().

◆ get_curr_ne()

◆ get_current_position()

template<template< class > class NodeType, class Key , class Compare >
Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::get_current_position ( ) const
inline

return the position of current node

Returns
current position
Exceptions
underflow_errorif the iterator has not current node after a prev() operation
overflow_errorif the iterator has not current node after a next() operation

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 932 of file tpl_treapRk.H.

References ah_range_error_if, Aleph::COUNT(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_pos, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::getRoot(), Aleph::maps(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::pos_updated(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::tree_ptr, and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::update_pos().

Referenced by Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::get_pos().

◆ get_pos()

template<template< class > class NodeType, class Key , class Compare >
size_t Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::get_pos ( ) const
inline

◆ has_curr()

◆ is_container_empty()

◆ is_updated()

template<template< class > class NodeType, class Key , class Compare >
bool Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::is_updated ( ) const
inlineprivatenoexcept

◆ next()

template<template< class > class NodeType, class Key , class Compare >
void Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::next ( )
inline

Move the iterator one position forward.

Throws overflow_error if there is no current

Definition at line 974 of file tpl_treapRk.H.

References ah_underflow_error_if, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::has_curr(), Aleph::maps(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::next_ne().

◆ next_ne()

◆ operator!=()

template<template< class > class NodeType, class Key , class Compare >
bool Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::operator!= ( const Iterator itor) const
inline

Return true if this is not equal to itor

Definition at line 1019 of file tpl_treapRk.H.

References Aleph::maps().

◆ operator=()

◆ operator==()

◆ pos_updated()

◆ prev()

template<template< class > class NodeType, class Key , class Compare >
void Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::prev ( )
inline

◆ reset_first()

◆ reset_last()

◆ reset_to_key()

template<template< class > class NodeType, class Key , class Compare >
void Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_to_key ( const Key &  key)
inlinenoexcept

Put the iterator to a node according to specific key.

If key is not present, then the iterator is put on the node

Parameters
[in]keyto guide the position
Exceptions
domain_errorif the key is not contained in the tree.

Definition at line 885 of file tpl_treapRk.H.

References Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_pos, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::find_position(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::tree_ptr.

◆ reset_to_node()

template<template< class > class NodeType, class Key , class Compare >
void Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_to_node ( Node node)
inlinenoexcept

Put the current node to a specific node.

Parameters
[in]nodeto put as current
Note
Obviously the node must belong to the tree

Definition at line 896 of file tpl_treapRk.H.

References Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr, and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_pos.

◆ reset_to_pos()

template<template< class > class NodeType, class Key , class Compare >
void Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_to_pos ( const size_t  pos)
inlinenoexcept

◆ update_curr()

◆ update_pos()

◆ verify() [1/2]

template<template< class > class NodeType, class Key , class Compare >
bool Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::verify ( const Iterator it) const
inlinenoexcept

◆ verify() [2/2]

Member Data Documentation

◆ curr

◆ curr_pos

◆ Pos_Empty_Container

◆ Pos_Not_Current

template<template< class > class NodeType, class Key , class Compare >
constexpr int Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::Pos_Not_Current = -1
staticconstexprprotected

◆ Pos_Not_Updated

template<template< class > class NodeType, class Key , class Compare >
constexpr int Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::Pos_Not_Updated = -3
staticconstexprprotected

◆ tree_ptr


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