struct
TimeTriggerManagerA time-based manager of triggers that each have an associated time period that get triggered from the progress function.
Timed triggers are "drifting", meaning that they approximate the associated time period but are not absolutely fixed in time.
Base classes
-
template<typename T>struct vt::runtime::component::PollableComponent<TimeTriggerManager>
Component
class for a generic, pollable VT runtime module, CRTP'ed over the component's actual type. A pollable component will be registered with the VT scheduler to ensure it makes progress.
Public types
Constructors, destructors, conversion operators
- TimeTriggerManager() defaulted
Public functions
- auto name() -> std::string override
- Get the name of the component.
- auto progress(TimeType current_time) -> int override
- Progress function for incremental polling.
- auto needsCurrentTime() -> bool override
- Whether the component needs the current time.
- auto addTrigger(TimeType current_time, std::chrono::milliseconds period, ActionType action, bool fire_immediately = false) -> int
- Register a time-based trigger with a specific period.
- void removeTrigger(int id)
- Unregister a time-based trigger.
- void triggerReady(TimeType cur_time)
- Trigger any read time-based triggers.
-
template<typename SerializerT>void serialize(SerializerT& s)
Function documentation
bool vt:: timetrigger:: TimeTriggerManager:: needsCurrentTime() override
Whether the component needs the current time.
Returns | whether it needs time |
---|
int vt:: timetrigger:: TimeTriggerManager:: addTrigger(TimeType current_time,
std::chrono::milliseconds period,
ActionType action,
bool fire_immediately = false)
Register a time-based trigger with a specific period.
Parameters | |
---|---|
current_time in | current time |
period in | time period to trigger action |
action in | action to trigger |
fire_immediately in | whether to wait the period before triggering the first time |
Returns | the trigger id (can be used for removal) |
void vt:: timetrigger:: TimeTriggerManager:: removeTrigger(int id)
Unregister a time-based trigger.
Parameters | |
---|---|
id in | the id to remove |
void vt:: timetrigger:: TimeTriggerManager:: triggerReady(TimeType cur_time)
Trigger any read time-based triggers.
Parameters | |
---|---|
cur_time in | the current time |