Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
LruCounter< T > Class Template Reference

Create an instance of this type for each object whose age needs to be measured with the GlobalLruCounter. More...

#include <LruCounter.hxx>

Public Member Functions

unsigned value ()
 
void tick (const GlobalLruCounter &global)
 Increments the local counter.
 
void touch ()
 Signals that the object has been used now.
 

Private Attributes

counter_ {0}
 Internal counter.
 

Detailed Description

template<class T>
class LruCounter< T >

Create an instance of this type for each object whose age needs to be measured with the GlobalLruCounter.

For further details, see { }. T is the storage type, typically uint8_t or uint16_t.

Definition at line 126 of file LruCounter.hxx.

Member Function Documentation

◆ tick()

template<class T >
void LruCounter< T >::tick ( const GlobalLruCounter< T > &  global)
inline

Increments the local counter.

Parameters
globalreference to the global tick counter. All calls must use the same global counter.

Definition at line 138 of file LruCounter.hxx.

◆ touch()

template<class T >
void LruCounter< T >::touch ( )
inline

Signals that the object has been used now.

Definition at line 159 of file LruCounter.hxx.

◆ value()

template<class T >
unsigned LruCounter< T >::value ( )
inline
Returns
A value monotonic in the age of the current counter.

Definition at line 130 of file LruCounter.hxx.

Member Data Documentation

◆ counter_

template<class T >
T LruCounter< T >::counter_ {0}
private

Internal counter.

Definition at line 166 of file LruCounter.hxx.


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