|
Aleph-w 7.10.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 (HashTbl &table) noexcept | |
| Constructs an iterator positioned at the first entry. | |
| Iterator (const HashTbl &)=delete | |
| A constant table is iterated through Const_Iterator. | |
| 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 modifiable hash table to iterate over. |
Definition at line 1201 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::reset_first().
|
delete |
A constant table is iterated through Const_Iterator.
|
inlineprivatenoexcept |
Validates iterator state (debug only).
Definition at line 997 of file hashDry.H.
References Aleph::and, OhashCommon< HashTbl, Key >::Iterator::curr_idx, 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().
|
inline |
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, or at the end if the entry was the last one.
| std::overflow_error | If not at a valid position. |
Definition at line 1221 of file hashDry.H.
References ah_overflow_error_if, OhashCommon< HashTbl, Key >::Iterator::curr_idx, OhashCommon< HashTbl, Key >::Iterator::has_curr(), OhashCommon< HashTbl, Key >::Iterator::ordinal, 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 1101 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 1135 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(), 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 1153 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 1125 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 1115 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::curr_idx, 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 1109 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::ordinal.
|
inlinenoexcept |
Checks if the iterator is at a valid position.
Definition at line 1161 of file hashDry.H.
References Aleph::and, OhashCommon< HashTbl, Key >::Iterator::ordinal, 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 1172 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::ordinal, 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 1031 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 1007 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::check(), OhashCommon< HashTbl, Key >::Iterator::curr_idx, 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 1041 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 1019 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::check(), OhashCommon< HashTbl, Key >::Iterator::curr_idx, 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().
|
inline |
Advances to the next entry with bounds checking.
| std::overflow_error | If already at end. |
Definition at line 1177 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 1182 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::locate_next_available_entry_ne().
|
inline |
Moves to the previous entry with bounds checking.
| std::underflow_error | If already at beginning. |
Definition at line 1192 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 1187 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 1055 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::check(), OhashCommon< HashTbl, Key >::Iterator::curr_idx, 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 1079 of file hashDry.H.
References OhashCommon< HashTbl, Key >::Iterator::check(), OhashCommon< HashTbl, Key >::Iterator::curr_idx, OhashCommon< HashTbl, Key >::Iterator::ordinal, and OhashCommon< HashTbl, Key >::Iterator::table_ptr.
|
private |
Current bucket index.
Definition at line 991 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 992 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_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 990 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().