FastMM documentation
FastMM C++ API 0.14.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
fastmm::sim::ParamSchedule Class Reference

#include <fastmm/sim/param_schedule.hpp>

Public Types

using Refill = Timestamp(*)(void *ctx, Timestamp due)
 refill(ctx, due) adds the updates due at due (at() with that time) and returns when the next ones are due (Timestamp::max(): none).
 

Public Member Functions

void at (Timestamp ts, const ParamUpdateMsg &m)
 Delivers m at ts; updates with the same time keep the order they were added in.
 
void set_delay (Duration d) noexcept
 Added to the time of updates that arrive through sink() (the slow tier's delay).
 
Duration delay () const noexcept
 
ParamSink sink (const SimClock &clock) noexcept
 A ParamPublisher sink: each update is delivered delay() after clock's time at the publish.
 
ParamSink threaded_sink (const SimClock &clock) noexcept
 Like sink(), for a schedule that other threads publish to as well: an update from the thread that called threaded_sink() (the thread that runs the SimDriver) is delivered delay() after clock's time; one from another thread goes to the inbox (post()).
 
void set_refill (const SimClock &clock, void *ctx, Refill refill, Timestamp first) noexcept
 
void post (const ParamUpdateMsg &m)
 Any thread: holds m until the next collect().
 
void collect ()
 Driver thread: schedules the posted updates delay() after the clock's time (the clock passed to sink() or threaded_sink()).
 
bool empty () const noexcept
 
std::size_t size () const noexcept
 
Timestamp next_ts () const noexcept
 The earliest delivery time (Timestamp::max() when empty).
 
ParamUpdateMsg pop () noexcept
 Removes the earliest update; its recv_ts is the delivery time.
 

Member Typedef Documentation

◆ Refill

refill(ctx, due) adds the updates due at due (at() with that time) and returns when the next ones are due (Timestamp::max(): none).

The first call asks for first; each later one comes once clock has reached the time the call before it asked for.

Member Function Documentation

◆ at()

void fastmm::sim::ParamSchedule::at ( Timestamp  ts,
const ParamUpdateMsg &  m 
)
inline

Delivers m at ts; updates with the same time keep the order they were added in.

◆ set_delay()

void fastmm::sim::ParamSchedule::set_delay ( Duration  d)
inlinenoexcept

Added to the time of updates that arrive through sink() (the slow tier's delay).

◆ delay()

Duration fastmm::sim::ParamSchedule::delay ( ) const
inlinenoexcept

◆ sink()

ParamSink fastmm::sim::ParamSchedule::sink ( const SimClock &  clock)
inlinenoexcept

A ParamPublisher sink: each update is delivered delay() after clock's time at the publish.

◆ threaded_sink()

ParamSink fastmm::sim::ParamSchedule::threaded_sink ( const SimClock &  clock)
inlinenoexcept

Like sink(), for a schedule that other threads publish to as well: an update from the thread that called threaded_sink() (the thread that runs the SimDriver) is delivered delay() after clock's time; one from another thread goes to the inbox (post()).

◆ set_refill()

void fastmm::sim::ParamSchedule::set_refill ( const SimClock &  clock,
void *  ctx,
Refill  refill,
Timestamp  first 
)
inlinenoexcept

◆ post()

void fastmm::sim::ParamSchedule::post ( const ParamUpdateMsg &  m)
inline

Any thread: holds m until the next collect().

◆ collect()

void fastmm::sim::ParamSchedule::collect ( )
inline

Driver thread: schedules the posted updates delay() after the clock's time (the clock passed to sink() or threaded_sink()).

Cheap when nothing was posted.

◆ empty()

bool fastmm::sim::ParamSchedule::empty ( ) const
inlinenoexcept

◆ size()

std::size_t fastmm::sim::ParamSchedule::size ( ) const
inlinenoexcept

◆ next_ts()

Timestamp fastmm::sim::ParamSchedule::next_ts ( ) const
inlinenoexcept

The earliest delivery time (Timestamp::max() when empty).

◆ pop()

ParamUpdateMsg fastmm::sim::ParamSchedule::pop ( )
inlinenoexcept

Removes the earliest update; its recv_ts is the delivery time.