#include <icy/sched/trigger.h>Inherits:
ISerializableSubclassed by:DailyTrigger,IntervalTrigger,OnceOnlyTrigger
Base class for scheduled task triggers that determine when a task should run.
| Return | Name | Description |
|---|---|---|
std::string | type | The type of this trigger class. |
std::string | name | The display name of this trigger class. |
int | timesRun | The number of times the task has run since creation; |
DateTime | createdAt | The time the task was created. |
DateTime | scheduleAt | The time the task is scheduled to run. |
DateTime | lastRunAt | The time the task was last run. |
std::string typeThe type of this trigger class.
std::string nameThe display name of this trigger class.
int timesRunThe number of times the task has run since creation;
DateTime createdAtThe time the task was created.
DateTime scheduleAtThe time the task is scheduled to run.
DateTime lastRunAtThe time the task was last run.
| Return | Name | Description |
|---|---|---|
Trigger | #### Parameters | |
void | update | Updates the scheduleAt value to the next scheduled time. |
std::int64_t | remaining virtual | Returns the milliseconds remaining until the next scheduled timeout. |
bool | timeout virtual | Returns true if the task is ready to be run, false otherwise. |
bool | expired virtual | Returns true if the task is expired and should be destroyed. Returns false by default. |
void | serialize virtual | Serializes timing state (type, name, createdAt, scheduleAt, lastRunAt, timesRun) to root. |
void | deserialize virtual | Deserializes timing state from root. |
Trigger(const std::string & type, const std::string & name)type Registered type name used by TaskFactory.
name Human-readable display name.
void update()Updates the scheduleAt value to the next scheduled time.
virtual
virtual std::int64_t remaining()Returns the milliseconds remaining until the next scheduled timeout.
virtual
virtual bool timeout()Returns true if the task is ready to be run, false otherwise.
virtual
virtual bool expired()Returns true if the task is expired and should be destroyed. Returns false by default.
virtual
virtual void serialize(json::Value & root)Serializes timing state (type, name, createdAt, scheduleAt, lastRunAt, timesRun) to root.
root JSON object to populate.virtual
virtual void deserialize(json::Value & root)Deserializes timing state from root.
root JSON object previously produced by serialize().