LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::ssa::SsaEventCache< T > Class Template Reference

EventCache: the per-state enabled-event memo of the serial SSA engine. More...

#include <line/solvers/ssa/ssa_event_cache.h>

Public Member Functions

 SsaEventCache ()
 SsaEventCache (bool enabled, const qn::NetworkStruct< T > *sn)
bool enabled () const
qn::EventOutcome< T > after_event (const qn::NetworkStruct< T > &sn, std::size_t ind, const std::vector< T > &inspace, lang::EventType event, std::size_t cls, bool no_promote=false, const T &aux_rate=num_traits< T >::from_int(0))
 State.afterEvent with the lookup in front of it.
std::size_t hits () const
 Hits and misses, so a caller can report the memo's effect.
std::size_t misses () const
std::size_t size () const
void clear ()

Static Public Member Functions

static SsaEventCache create (bool enabled, const qn::NetworkStruct< T > &sn)
 EventCache.create(enabled, sn).

Detailed Description

template<class T>
class line::ssa::SsaEventCache< T >

EventCache: the per-state enabled-event memo of the serial SSA engine.

Definition at line 94 of file ssa_event_cache.h.

Constructor & Destructor Documentation

◆ SsaEventCache() [1/2]

template<class T>
line::ssa::SsaEventCache< T >::SsaEventCache ( )
inline

Definition at line 107 of file ssa_event_cache.h.

Referenced by create().

◆ SsaEventCache() [2/2]

template<class T>
line::ssa::SsaEventCache< T >::SsaEventCache ( bool enabled,
const qn::NetworkStruct< T > * sn )
inline

Definition at line 108 of file ssa_event_cache.h.

References enabled().

Member Function Documentation

◆ after_event()

template<class T>
qn::EventOutcome< T > line::ssa::SsaEventCache< T >::after_event ( const qn::NetworkStruct< T > & sn,
std::size_t ind,
const std::vector< T > & inspace,
lang::EventType event,
std::size_t cls,
bool no_promote = false,
const T & aux_rate = num_traits<T>::from_int(0) )
inline

State.afterEvent with the lookup in front of it.

sn is passed rather than taken from the binding so the signature is the free function's and a caller can switch between them by changing one token; the binding is only there to catch the mistake of reusing a cache across structs.

Definition at line 120 of file ssa_event_cache.h.

References line::qn::after_event(), line::ssa::SsaEventKey::aux_rate, line::ssa::SsaEventKey::cls, line::ssa::SsaEventKey::event, line::ssa::SsaEventKey::ind, line::InputError::InputError(), line::ssa::SsaEventKey::inspace, and line::ssa::SsaEventKey::no_promote.

◆ clear()

template<class T>
void line::ssa::SsaEventCache< T >::clear ( )
inline

Definition at line 165 of file ssa_event_cache.h.

◆ create()

template<class T>
SsaEventCache line::ssa::SsaEventCache< T >::create ( bool enabled,
const qn::NetworkStruct< T > & sn )
inlinestatic

EventCache.create(enabled, sn).

The struct is held by pointer, so the cache must not outlive it. Every caller in this port constructs the cache inside the scope that already holds sn by const reference for the run.

Definition at line 103 of file ssa_event_cache.h.

References enabled(), and SsaEventCache().

◆ enabled()

template<class T>
bool line::ssa::SsaEventCache< T >::enabled ( ) const
inline

Definition at line 110 of file ssa_event_cache.h.

Referenced by create(), and SsaEventCache().

◆ hits()

template<class T>
std::size_t line::ssa::SsaEventCache< T >::hits ( ) const
inline

Hits and misses, so a caller can report the memo's effect.

They are counters and not a hit RATIO because the ratio alone hides the denominator, and a 100% hit rate over three lookups says nothing.

Definition at line 161 of file ssa_event_cache.h.

◆ misses()

template<class T>
std::size_t line::ssa::SsaEventCache< T >::misses ( ) const
inline

Definition at line 162 of file ssa_event_cache.h.

◆ size()

template<class T>
std::size_t line::ssa::SsaEventCache< T >::size ( ) const
inline

Definition at line 163 of file ssa_event_cache.h.


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