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

Defines a pointer to a specific location in the cache. More...

#include <ringfilecache.H>

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

Public Member Functions

 Pointer ()=default
 
 Pointer (const RingFileCache &cache, const size_t __pos=0)
 Construct a pointer to the current head (oldest item in the cache)
 
Pointer operator++ () noexcept
 Prefix increment: advance one position (with wraparound)
 
Pointer operator++ (int) noexcept
 Postfix increment: advance one position (with wraparound)
 
Pointer operator-- () noexcept
 Prefix decrement: move back one position (with wraparound)
 
Pointer operator-- (int) noexcept
 Postfix decrement: move back one position (with wraparound)
 
Pointeroperator+= (const long val) noexcept
 Advance by val positions (with wraparound)
 
Pointeroperator-= (const long val) noexcept
 Move back by val positions (with wraparound)
 
Pointer operator+ (const long val) const noexcept
 Return a new Pointer advanced by val positions.
 
Pointer operator- (const long val) const noexcept
 Return a new Pointer moved back by val positions.
 
size_t get_pos_respect_to_head () const noexcept
 Offset of this pointer relative to the current head of the cache.
 
size_t get_pos () const noexcept
 Alias of get_pos_respect_to_head()
 

Private Member Functions

void validate_position (const size_t pos) const
 
void increase_pos (const long delta=1) noexcept
 
void decrease_pos (const long delta=1) noexcept
 

Private Attributes

RingFileCachecache_ptr = nullptr
 
size_t pos = 0
 

Friends

class RingFileCache
 

Detailed Description

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

Defines a pointer to a specific location in the cache.

Cache entries can be read or written through a pointer object that moves circularly over the storage.

Definition at line 405 of file ringfilecache.H.

Constructor & Destructor Documentation

◆ Pointer() [1/2]

template<typename T >
RingFileCache< T >::Pointer::Pointer ( )
default

◆ Pointer() [2/2]

template<typename T >
RingFileCache< T >::Pointer::Pointer ( const RingFileCache cache,
const size_t  __pos = 0 
)
inline

Construct a pointer to the current head (oldest item in the cache)

Parameters
[in]cachethe cache
[in]__posoffset relative to the current head of cache

Definition at line 457 of file ringfilecache.H.

Member Function Documentation

◆ decrease_pos()

◆ get_pos()

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

◆ get_pos_respect_to_head()

template<typename T >
size_t RingFileCache< T >::Pointer::get_pos_respect_to_head ( ) const
inlinenoexcept

Offset of this pointer relative to the current head of the cache.

Definition at line 522 of file ringfilecache.H.

References RingFileCache< T >::Pointer::cache_ptr, RingFileCache< T >::dim, RingFileCache< T >::head, and RingFileCache< T >::Pointer::pos.

Referenced by RingFileCache< T >::Pointer::get_pos(), and RingFileCache< T >::read_from().

◆ increase_pos()

◆ operator+()

template<typename T >
Pointer RingFileCache< T >::Pointer::operator+ ( const long  val) const
inlinenoexcept

Return a new Pointer advanced by val positions.

Definition at line 506 of file ringfilecache.H.

References Aleph::maps().

◆ operator++() [1/2]

template<typename T >
Pointer RingFileCache< T >::Pointer::operator++ ( )
inlinenoexcept

Prefix increment: advance one position (with wraparound)

Definition at line 462 of file ringfilecache.H.

References RingFileCache< T >::Pointer::increase_pos().

◆ operator++() [2/2]

template<typename T >
Pointer RingFileCache< T >::Pointer::operator++ ( int  )
inlinenoexcept

Postfix increment: advance one position (with wraparound)

Definition at line 469 of file ringfilecache.H.

References RingFileCache< T >::Pointer::increase_pos(), and Aleph::maps().

◆ operator+=()

template<typename T >
Pointer & RingFileCache< T >::Pointer::operator+= ( const long  val)
inlinenoexcept

Advance by val positions (with wraparound)

Definition at line 492 of file ringfilecache.H.

References RingFileCache< T >::Pointer::increase_pos().

◆ operator-()

template<typename T >
Pointer RingFileCache< T >::Pointer::operator- ( const long  val) const
inlinenoexcept

Return a new Pointer moved back by val positions.

Definition at line 514 of file ringfilecache.H.

References Aleph::maps().

◆ operator--() [1/2]

template<typename T >
Pointer RingFileCache< T >::Pointer::operator-- ( )
inlinenoexcept

Prefix decrement: move back one position (with wraparound)

Definition at line 477 of file ringfilecache.H.

References RingFileCache< T >::Pointer::decrease_pos().

◆ operator--() [2/2]

template<typename T >
Pointer RingFileCache< T >::Pointer::operator-- ( int  )
inlinenoexcept

Postfix decrement: move back one position (with wraparound)

Definition at line 484 of file ringfilecache.H.

References RingFileCache< T >::Pointer::decrease_pos(), and Aleph::maps().

◆ operator-=()

template<typename T >
Pointer & RingFileCache< T >::Pointer::operator-= ( const long  val)
inlinenoexcept

Move back by val positions (with wraparound)

Definition at line 499 of file ringfilecache.H.

References RingFileCache< T >::Pointer::decrease_pos().

◆ validate_position()

template<typename T >
void RingFileCache< T >::Pointer::validate_position ( const size_t  pos) const
inlineprivate

Friends And Related Symbol Documentation

◆ RingFileCache

template<typename T >
friend class RingFileCache
friend

Definition at line 407 of file ringfilecache.H.

Member Data Documentation

◆ cache_ptr

◆ pos


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