Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
RingFileCache< T >::Iterator Class Reference

#include <ringfilecache.H>

Collaboration diagram for RingFileCache< T >::Iterator:
[legend]

Public Member Functions

size_t get_pos () const noexcept
 Logical offset from the head (number of elements already visited)
 
bool has_curr () const
 True if the iterator currently refers to a valid element.
 
 Iterator (const RingFileCache< T > &cache, const size_t offset=0)
 Construct an iterator positioned offset entries forward from the oldest cache entry.
 
T get_curr_ne () const noexcept
 Return the current element (no bounds check). Undefined if exhausted.
 
T get_curr () const
 Return the current element.
 
void next_ne () noexcept
 Advance to the next element without checking bounds. Safe to call when exhausted.
 
void next ()
 Advance to the next element.
 

Private Member Functions

void set_curr_pointer ()
 
void increase_pos ()
 
void load_curr ()
 

Private Attributes

RingFileCache< T > * cache_ptr = nullptr
 
T curr {}
 
size_t pos = 0
 
size_t curr_pos = 0
 

Detailed Description

template<typename T>
class RingFileCache< T >::Iterator

Definition at line 967 of file ringfilecache.H.

Constructor & Destructor Documentation

◆ Iterator()

template<typename T >
RingFileCache< T >::Iterator::Iterator ( const RingFileCache< T > &  cache,
const size_t  offset = 0 
)
inline

Construct an iterator positioned offset entries forward from the oldest cache entry.

Parameters
[in]cachethe cache on which to iterate
[in]offsethow many positions from the oldest cache entry

Definition at line 1005 of file ringfilecache.H.

References RingFileCache< T >::Iterator::cache_ptr, RingFileCache< T >::Iterator::load_curr(), Aleph::maps(), and RingFileCache< T >::Iterator::pos.

Member Function Documentation

◆ get_curr()

template<typename T >
T RingFileCache< T >::Iterator::get_curr ( ) const
inline

Return the current element.

Returns
the element at the current iterator position
Exceptions
overflow_errorif the iterator is exhausted

Definition at line 1026 of file ringfilecache.H.

References ah_overflow_error_if, RingFileCache< T >::Iterator::get_curr_ne(), RingFileCache< T >::Iterator::has_curr(), and Aleph::maps().

Referenced by RingFileCache< T >::read_from().

◆ get_curr_ne()

template<typename T >
T RingFileCache< T >::Iterator::get_curr_ne ( ) const
inlinenoexcept

Return the current element (no bounds check). Undefined if exhausted.

Definition at line 1019 of file ringfilecache.H.

References RingFileCache< T >::Iterator::curr.

Referenced by RingFileCache< T >::Iterator::get_curr(), and RingFileCache< T >::read_from().

◆ get_pos()

template<typename T >
size_t RingFileCache< T >::Iterator::get_pos ( ) const
inlinenoexcept

Logical offset from the head (number of elements already visited)

Definition at line 994 of file ringfilecache.H.

References RingFileCache< T >::Iterator::pos.

◆ has_curr()

◆ increase_pos()

◆ load_curr()

◆ next()

template<typename T >
void RingFileCache< T >::Iterator::next ( )
inline

Advance to the next element.

Exceptions
overflow_errorif the iterator is already exhausted

Definition at line 1045 of file ringfilecache.H.

References ah_overflow_error_if, RingFileCache< T >::Iterator::has_curr(), Aleph::maps(), and RingFileCache< T >::Iterator::next_ne().

◆ next_ne()

template<typename T >
void RingFileCache< T >::Iterator::next_ne ( )
inlinenoexcept

◆ set_curr_pointer()

template<typename T >
void RingFileCache< T >::Iterator::set_curr_pointer ( )
inlineprivate

Member Data Documentation

◆ cache_ptr

◆ curr

template<typename T >
T RingFileCache< T >::Iterator::curr {}
private

◆ curr_pos

template<typename T >
size_t RingFileCache< T >::Iterator::curr_pos = 0
private

◆ pos


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