#include <icy/sched/scheduler.h>Inherits:
TaskRunner,ISerializable
The Scheduler manages and runs tasks that need to be executed at specific times.
| Return | Name | Description |
|---|---|---|
Scheduler | ||
void | schedule virtual | Adds task to the scheduler and starts running it on its configured trigger. The scheduler takes ownership of the task. |
void | cancel virtual | Removes task from the scheduler and cancels any pending execution. |
void | clear virtual | Removes all scheduled tasks. |
void | serialize virtual | Serializes all scheduled tasks and their triggers to root. |
void | deserialize virtual | Reconstructs the task list from root using the TaskFactory. Skips entries that fail to deserialize and logs the error. |
void | print virtual | Writes a pretty-printed JSON representation of all tasks to ost. |
bool | cancel | Cancels a task. |
Scheduler()virtual
virtual void schedule(sched::Task * task)Adds task to the scheduler and starts running it on its configured trigger. The scheduler takes ownership of the task.
task Task to schedule; must have a trigger set.virtual
virtual void cancel(sched::Task * task)Removes task from the scheduler and cancels any pending execution.
task Task to cancel.virtual
virtual void clear()Removes all scheduled tasks.
virtual
virtual void serialize(json::Value & root)Serializes all scheduled tasks and their triggers to root.
root JSON array to append serialized task entries to.virtual
virtual void deserialize(json::Value & root)Reconstructs the task list from root using the TaskFactory. Skips entries that fail to deserialize and logs the error.
root JSON array previously produced by serialize().virtual
virtual void print(std::ostream & ost)Writes a pretty-printed JSON representation of all tasks to ost.
ost Output stream to write to.bool cancel(Task * task)Cancels a task.
The task reference will be managed by the TaskRunner until the task is destroyed.
| Return | Name | Description |
|---|---|---|
Scheduler & | getDefault static | Returns the default Scheduler singleton, although Scheduler instances may also be initialized individually. |
sched::TaskFactory & | factory static | Returns the TaskFactory singleton. |
static
static Scheduler & getDefault()Returns the default Scheduler singleton, although Scheduler instances may also be initialized individually.
static
static sched::TaskFactory & factory()Returns the TaskFactory singleton.
| Return | Name | Description |
|---|---|---|
void | run virtual | The run method will be called by the asynchronous context. |
void | update virtual |
virtual
virtual void run()The run method will be called by the asynchronous context.
virtual
virtual void update()