|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Bidirectional iterator for traversing hash table entries. More...
#include <hashDry.H>
Public Member Functions | |
| void | reset_first () noexcept |
| Positions the iterator at the first entry. | |
| void | reset_last () noexcept |
| Positions the iterator at the last entry. | |
| void | end () noexcept |
| Positions the iterator at the end (past-the-last element). | |
| constexpr long | get_pos () const noexcept |
| Returns the current logical position. | |
| Key & | get_curr_ne () noexcept |
| Returns a reference to the current entry without checking. | |
| const Key & | get_curr_ne () const noexcept |
| Returns a const reference to the current entry without checking. | |
| Key & | get_curr () |
| Returns a reference to the current entry with bounds checking. | |
| const Key & | get_curr () const |
| Returns a const reference to the current entry with bounds checking. | |
| bool | has_curr () const noexcept |
| Checks if the iterator is at a valid position. | |
| constexpr bool | is_last () const noexcept |
| Checks if the iterator is at the last entry. | |
| void | next () |
| Advances to the next entry with bounds checking. | |
| void | next_ne () noexcept |
| Advances to the next entry without bounds checking. | |
| void | prev_ne () |
| Moves to the previous entry without bounds checking. | |
| void | prev () |
| Moves to the previous entry with bounds checking. | |
| Iterator () noexcept=default | |
| Default constructor creates an "end" iterator. | |
| Iterator (const HashTbl &table) noexcept | |
| Constructs an iterator positioned at the first entry. | |
| void | del () |
| Deletes the current entry and advances to the next. | |
Private Member Functions | |
| bool | check () const noexcept |
| Validates iterator state (debug only). | |
| void | locate_next_available_entry_ne () noexcept |
| Advances to next entry without bounds checking. | |
| void | locate_prev_available_entry_ne () |
| Moves to previous entry without bounds checking. | |
| void | locate_next_available_entry () |
| Advances to next entry with bounds checking. | |
| void | locate_prev_available_entry () |
| Moves to previous entry with bounds checking. | |
Private Attributes | |
| HashTbl * | table_ptr = nullptr |
| Pointer to the hash table being iterated. | |
| long | curr_idx = 0 |
| Current bucket index. | |
| long | ordinal = 0 |
| Logical position (0-based count of visited entries). | |
Bidirectional iterator for traversing hash table entries.
This iterator provides sequential access to all BUSY (occupied) buckets in the hash table. Iteration order is based on internal bucket positions and is not related to key ordering.
|
defaultnoexcept |
Default constructor creates an "end" iterator.
|
inlinenoexcept |
Constructs an iterator positioned at the first entry.
| table | The hash table to iterate over. |
Definition at line 859 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::reset_first().
|
inlineprivatenoexcept |
Validates iterator state (debug only).
Definition at line 655 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::curr_idx, Aleph::maps(), OhashCommon< HashTbl, Key >::Iterator::ordinal, and OhashCommon< HashTbl, Key >::Iterator::table_ptr.
Referenced by OhashCommon< HashTbl, Key >::Iterator::get_curr(), OhashCommon< HashTbl, Key >::Iterator::locate_next_available_entry_ne(), OhashCommon< HashTbl, Key >::Iterator::locate_prev_available_entry_ne(), OhashCommon< HashTbl, Key >::Iterator::reset_first(), and OhashCommon< HashTbl, Key >::Iterator::reset_last().
Deletes the current entry and advances to the next.
Removes the current entry from the table. After deletion, the iterator is positioned at the next entry (if any).
| std::overflow_error | If not at a valid position. |
Definition at line 875 of file hashDry.H.
References ah_overflow_error_if, OhashCommon< HashTbl, Key >::Iterator::curr_idx, OhashCommon< HashTbl, Key >::Iterator::has_curr(), Aleph::maps(), and OhashCommon< HashTbl, Key >::Iterator::table_ptr.
|
inlinenoexcept |
Positions the iterator at the end (past-the-last element).
After calling this, has_curr() will return false.
Definition at line 759 of file hashDry.H.
References put_itor_at_the_end().
|
inline |
Returns a reference to the current entry with bounds checking.
| std::overflow_error | If iterator is past the end. |
| std::underflow_error | If iterator is before the beginning. |
Definition at line 793 of file hashDry.H.
References ah_overflow_error_if, ah_underflow_error_if, OhashCommon< HashTbl, Key >::Iterator::check(), OhashCommon< HashTbl, Key >::Iterator::get_curr_ne(), Aleph::maps(), OhashCommon< HashTbl, Key >::Iterator::ordinal, and OhashCommon< HashTbl, Key >::Iterator::table_ptr.
Referenced by OhashCommon< HashTbl, Key >::Iterator::get_curr().
|
inline |
Returns a const reference to the current entry with bounds checking.
| std::overflow_error | If iterator is past the end. |
| std::underflow_error | If iterator is before the beginning. |
Definition at line 811 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::get_curr().
|
inlinenoexcept |
Returns a const reference to the current entry without checking.
Definition at line 783 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::get_curr_ne().
|
inlinenoexcept |
Returns a reference to the current entry without checking.
Definition at line 773 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::curr_idx, Aleph::maps(), and OhashCommon< HashTbl, Key >::Iterator::table_ptr.
Referenced by OhashCommon< HashTbl, Key >::Iterator::get_curr(), and OhashCommon< HashTbl, Key >::Iterator::get_curr_ne().
|
inlineconstexprnoexcept |
Returns the current logical position.
Definition at line 767 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::ordinal.
|
inlinenoexcept |
Checks if the iterator is at a valid position.
Definition at line 819 of file hashDry.H.
References Aleph::maps(), OhashCommon< HashTbl, Key >::Iterator::ordinal, Aleph::HTList::size(), and OhashCommon< HashTbl, Key >::Iterator::table_ptr.
Referenced by OhashCommon< HashTbl, Key >::Iterator::del().
|
inlineconstexprnoexcept |
Checks if the iterator is at the last entry.
Definition at line 830 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::ordinal, Aleph::HTList::size(), and OhashCommon< HashTbl, Key >::Iterator::table_ptr.
|
inlineprivate |
Advances to next entry with bounds checking.
| std::overflow_error | If already at end. |
Definition at line 689 of file hashDry.H.
References ah_overflow_error_if, OhashCommon< HashTbl, Key >::Iterator::locate_next_available_entry_ne(), OhashCommon< HashTbl, Key >::Iterator::ordinal, and OhashCommon< HashTbl, Key >::Iterator::table_ptr.
Referenced by OhashCommon< HashTbl, Key >::Iterator::next().
|
inlineprivatenoexcept |
Advances to next entry without bounds checking.
Definition at line 665 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::check(), OhashCommon< HashTbl, Key >::Iterator::curr_idx, Aleph::maps(), OhashCommon< HashTbl, Key >::Iterator::ordinal, and OhashCommon< HashTbl, Key >::Iterator::table_ptr.
Referenced by OhashCommon< HashTbl, Key >::Iterator::locate_next_available_entry(), and OhashCommon< HashTbl, Key >::Iterator::next_ne().
|
inlineprivate |
Moves to previous entry with bounds checking.
| std::underflow_error | If already at beginning. |
Definition at line 699 of file hashDry.H.
References ah_underflow_error_if, OhashCommon< HashTbl, Key >::Iterator::locate_prev_available_entry_ne(), and OhashCommon< HashTbl, Key >::Iterator::ordinal.
Referenced by OhashCommon< HashTbl, Key >::Iterator::prev().
|
inlineprivate |
Moves to previous entry without bounds checking.
Definition at line 677 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::check(), OhashCommon< HashTbl, Key >::Iterator::curr_idx, Aleph::maps(), OhashCommon< HashTbl, Key >::Iterator::ordinal, and OhashCommon< HashTbl, Key >::Iterator::table_ptr.
Referenced by OhashCommon< HashTbl, Key >::Iterator::locate_prev_available_entry(), and OhashCommon< HashTbl, Key >::Iterator::prev_ne().
Advances to the next entry with bounds checking.
| std::overflow_error | If already at end. |
Definition at line 835 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::locate_next_available_entry().
|
inlinenoexcept |
Advances to the next entry without bounds checking.
Definition at line 840 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::locate_next_available_entry_ne().
Moves to the previous entry with bounds checking.
| std::underflow_error | If already at beginning. |
Definition at line 850 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::locate_prev_available_entry().
|
inline |
Moves to the previous entry without bounds checking.
Definition at line 845 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::locate_prev_available_entry_ne().
|
inlinenoexcept |
Positions the iterator at the first entry.
Resets the iterator to point to the first BUSY bucket in the table. If the table is empty, the iterator is positioned at end().
Definition at line 713 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::check(), OhashCommon< HashTbl, Key >::Iterator::curr_idx, Aleph::maps(), OhashCommon< HashTbl, Key >::Iterator::ordinal, and OhashCommon< HashTbl, Key >::Iterator::table_ptr.
Referenced by OhashCommon< HashTbl, Key >::Iterator::Iterator().
|
inlinenoexcept |
Positions the iterator at the last entry.
Resets the iterator to point to the last BUSY bucket in the table. If the table is empty, the iterator is positioned before begin().
Definition at line 737 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::check(), OhashCommon< HashTbl, Key >::Iterator::curr_idx, Aleph::maps(), OhashCommon< HashTbl, Key >::Iterator::ordinal, and OhashCommon< HashTbl, Key >::Iterator::table_ptr.
|
private |
Current bucket index.
Definition at line 649 of file hashDry.H.
Referenced by OhashCommon< HashTbl, Key >::Iterator::check(), OhashCommon< HashTbl, Key >::Iterator::del(), OhashCommon< HashTbl, Key >::Iterator::get_curr_ne(), OhashCommon< HashTbl, Key >::Iterator::locate_next_available_entry_ne(), OhashCommon< HashTbl, Key >::Iterator::locate_prev_available_entry_ne(), OhashCommon< HashTbl, Key >::Iterator::reset_first(), and OhashCommon< HashTbl, Key >::Iterator::reset_last().
|
private |
Logical position (0-based count of visited entries).
Definition at line 650 of file hashDry.H.
Referenced by OhashCommon< HashTbl, Key >::Iterator::check(), OhashCommon< HashTbl, Key >::Iterator::get_curr(), OhashCommon< HashTbl, Key >::Iterator::get_pos(), OhashCommon< HashTbl, Key >::Iterator::has_curr(), OhashCommon< HashTbl, Key >::Iterator::is_last(), OhashCommon< HashTbl, Key >::Iterator::locate_next_available_entry(), OhashCommon< HashTbl, Key >::Iterator::locate_next_available_entry_ne(), OhashCommon< HashTbl, Key >::Iterator::locate_prev_available_entry(), OhashCommon< HashTbl, Key >::Iterator::locate_prev_available_entry_ne(), OhashCommon< HashTbl, Key >::Iterator::reset_first(), and OhashCommon< HashTbl, Key >::Iterator::reset_last().
|
private |
Pointer to the hash table being iterated.
Definition at line 648 of file hashDry.H.
Referenced by OhashCommon< HashTbl, Key >::Iterator::check(), OhashCommon< HashTbl, Key >::Iterator::del(), OhashCommon< HashTbl, Key >::Iterator::get_curr(), OhashCommon< HashTbl, Key >::Iterator::get_curr_ne(), OhashCommon< HashTbl, Key >::Iterator::has_curr(), OhashCommon< HashTbl, Key >::Iterator::is_last(), OhashCommon< HashTbl, Key >::Iterator::locate_next_available_entry(), OhashCommon< HashTbl, Key >::Iterator::locate_next_available_entry_ne(), OhashCommon< HashTbl, Key >::Iterator::locate_prev_available_entry_ne(), OhashCommon< HashTbl, Key >::Iterator::reset_first(), and OhashCommon< HashTbl, Key >::Iterator::reset_last().