sched

May 15, 2026 ยท View on GitHub

{#schedmodule}

sched

Task scheduler for deferred and periodic jobs.

Namespaces

NameDescription
schedDeferred and periodic job scheduling primitives.

{#sched}

sched

Deferred and periodic job scheduling primitives.

Classes

NameDescription
SchedulerThe Scheduler manages and runs tasks that need to be executed at specific times.
TaskScheduled task with an attached trigger and scheduler association.
TaskFactoryThe TaskFactory can dynamically instantiate registered sched::Task and sched::Trigger classes from named strings.
DailyTriggerTrigger that fires once per day at a configured time, with optional day-of-week exclusions.
IntervalTriggerTrigger that fires repeatedly at a fixed time interval.
OnceOnlyTriggerTrigger that fires exactly once at the scheduled time and then expires.
TriggerBase class for scheduled task triggers that determine when a task should run.

Enumerations

NameDescription
DaysOfTheWeekDays of the week.
MonthOfTheYeayMonths of the year.

{#daysoftheweek}

DaysOfTheWeek

enum DaysOfTheWeek

Days of the week.

ValueDescription
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday

{#monthoftheyeay}

MonthOfTheYeay

enum MonthOfTheYeay

Months of the year.

ValueDescription
January
February
March
April
May
June
July
August
September
October
November
December

Typedefs

ReturnNameDescription
std::vector< sched::Task * >TaskListOrdered list of task pointers used by the scheduler.

{#tasklist}

TaskList

using TaskList = std::vector< sched::Task * >

Ordered list of task pointers used by the scheduler.

Functions

ReturnNameDescription
std::unique_ptr< sched::Task >instantiateTaskInstantiate a registered Task subtype using its default constructor.
std::unique_ptr< sched::Trigger >instantiateTriggerInstantiate a registered Trigger subtype using its default constructor.

{#instantiatetask}

instantiateTask

template<typename T> std::unique_ptr< sched::Task > instantiateTask()

Instantiate a registered Task subtype using its default constructor.


{#instantiatetrigger}

instantiateTrigger

template<typename T> std::unique_ptr< sched::Trigger > instantiateTrigger()

Instantiate a registered Trigger subtype using its default constructor.

{#scheduler}

Scheduler

#include <icy/sched/scheduler.h>
class Scheduler

Defined in src/sched/include/icy/sched/scheduler.h:31

Inherits: TaskRunner, ISerializable

The Scheduler manages and runs tasks that need to be executed at specific times.

List of all members

NameKindOwner
SchedulerfunctionDeclared here
schedulefunctionDeclared here
cancelfunctionDeclared here
clearfunctionDeclared here
serializefunctionDeclared here
deserializefunctionDeclared here
printfunctionDeclared here
cancelfunctionDeclared here
cancelfunctionDeclared here
getDefaultfunctionDeclared here
factoryfunctionDeclared here
runfunctionDeclared here
updatefunctionDeclared here
TaskListtypedefInherited from TaskRunner
IdlevariableInherited from TaskRunner
ShutdownvariableInherited from TaskRunner
_mutexvariableInherited from TaskRunner
_runnervariableInherited from TaskRunner
_tasksvariableInherited from TaskRunner
TaskRunnerfunctionInherited from TaskRunner
~TaskRunnerfunctionInherited from TaskRunner
TaskRunnerfunctionInherited from TaskRunner
operator=functionInherited from TaskRunner
TaskRunnerfunctionInherited from TaskRunner
operator=functionInherited from TaskRunner
startfunctionInherited from TaskRunner
cancelfunctionInherited from TaskRunner
destroyfunctionInherited from TaskRunner
existsfunctionInherited from TaskRunner
getfunctionInherited from TaskRunner
setRunnerfunctionInherited from TaskRunner
classNamefunctionInherited from TaskRunner
cancelfunctionInherited from TaskRunner
getDefaultfunctionInherited from TaskRunner
runfunctionInherited from TaskRunner
addfunctionInherited from TaskRunner
removefunctionInherited from TaskRunner
nextfunctionInherited from TaskRunner
clearfunctionInherited from TaskRunner
onAddfunctionInherited from TaskRunner
onStartfunctionInherited from TaskRunner
onCancelfunctionInherited from TaskRunner
onRemovefunctionInherited from TaskRunner
onRunfunctionInherited from TaskRunner
RunnablefunctionInherited from Runnable
runfunctionInherited from Runnable
cancelfunctionInherited from Runnable
cancelledfunctionInherited from Runnable
exitvariableInherited from Runnable
serializefunctionInherited from ISerializable
deserializefunctionInherited from ISerializable

Inherited from TaskRunner

KindNameDescription
typedefTaskList
variableIdleFires after completing an iteration of all tasks.
variableShutdownSignals when the [TaskRunner](base.md#taskrunner) is shutting down.
variable_mutex
variable_runner
variable_tasks
functionTaskRunner
function~TaskRunner virtual
functionTaskRunnerDeleted constructor.
functionoperator=Deleted assignment operator.
functionTaskRunnerDeleted constructor.
functionoperator=Deleted assignment operator.
functionstart virtualStarts a task, adding it if it doesn't exist.
functioncancel virtualCancels a task.
functiondestroy virtualQueues a task for destruction.
functionexists virtual constReturns whether a task exists.
functionget virtual constReturns the task pointer matching the given ID, or nullptr if no task exists.
functionsetRunner virtualSet the asynchronous context for packet processing. This may be a Thread or another derivative of Async. Must be set before the stream is activated.
functionclassName virtual const inline
functioncancel virtual inlineCancel the current task. The run() method should return ASAP.
functiongetDefault staticReturns the default [TaskRunner](base.md#taskrunner) singleton, although TaskRunner instances may be initialized individually. The default runner should be kept for short running tasks such as timers in order to maintain performance.
functionrun virtual overrideCalled by the async context to run the next task.
functionadd virtualAdds a task to the runner.
functionremove virtualRemoves a task from the runner.
functionnext virtual constReturns the next task to be run.
functionclear virtualDestroys and clears all manages tasks.
functiononAdd virtualCalled after a task is added.
functiononStart virtualCalled after a task is started.
functiononCancel virtualCalled after a task is cancelled.
functiononRemove virtualCalled after a task is removed.
functiononRun virtualCalled after a task has run.

Inherited from Runnable

KindNameDescription
functionRunnable inline
functionrun virtualThe run method will be called by the asynchronous context.
functioncancel virtual inlineCancel the current task. The run() method should return ASAP.
functioncancelled virtual const inlineReturns true when the task has been cancelled.
variableexit

Inherited from ISerializable

KindNameDescription
functionserialize virtualSerializes this object's state into root.
functiondeserialize virtualPopulates this object's state from root.

Public Methods

ReturnNameDescription
Scheduler
voidschedule virtualAdds task to the scheduler and starts running it on its configured trigger. The scheduler takes ownership of the task.
voidcancel virtualRemoves task from the scheduler and cancels any pending execution.
voidclear virtual overrideRemoves all scheduled tasks.
voidserialize virtual overrideSerializes all scheduled tasks and their triggers to root.
voiddeserialize virtual overrideReconstructs the task list from root using the TaskFactory. Skips entries that fail to deserialize and logs the error.
voidprint virtualWrites a pretty-printed JSON representation of all tasks to ost.
boolcancel virtualCancels a task.
voidcancel virtual inlineCancel the current task. The run() method should return ASAP.

{#scheduler-1}

Scheduler

Scheduler()

Defined in src/sched/include/icy/sched/scheduler.h:35


{#schedule}

schedule

virtual

virtual void schedule(sched::Task * task)

Defined in src/sched/include/icy/sched/scheduler.h:41

Adds task to the scheduler and starts running it on its configured trigger. The scheduler takes ownership of the task.

Parameters

  • task Task to schedule; must have a trigger set.

{#cancel-4}

cancel

virtual

virtual void cancel(sched::Task * task)

Defined in src/sched/include/icy/sched/scheduler.h:47

Removes task from the scheduler and cancels any pending execution.

Parameters

  • task Task to cancel.

{#clear-2}

clear

virtual override

virtual void clear() override

Defined in src/sched/include/icy/sched/scheduler.h:50

Removes all scheduled tasks.

Reimplements

{#serialize-3}

serialize

virtual override

virtual void serialize(json::Value & root) override

Defined in src/sched/include/icy/sched/scheduler.h:54

Serializes all scheduled tasks and their triggers to root.

Parameters

  • root JSON array to append serialized task entries to.
Reimplements

{#deserialize-3}

deserialize

virtual override

virtual void deserialize(json::Value & root) override

Defined in src/sched/include/icy/sched/scheduler.h:59

Reconstructs the task list from root using the TaskFactory. Skips entries that fail to deserialize and logs the error.

Parameters

Reimplements

{#print-14}

print

virtual

virtual void print(std::ostream & ost)

Defined in src/sched/include/icy/sched/scheduler.h:63

Writes a pretty-printed JSON representation of all tasks to ost.

Parameters

  • ost Output stream to write to.

{#cancel-5}

cancel

virtual

virtual bool cancel(Task * task)

Defined in src/sched/include/icy/sched/scheduler.h:43

Cancels a task.

The task reference will be managed by the TaskRunner until the task is destroyed.

Reimplements

{#cancel-6}

cancel

virtual inline

virtual inline void cancel(bool flag = true)

Defined in src/sched/include/icy/sched/scheduler.h:43

Cancel the current task. The run() method should return ASAP.

Reimplements

Public Static Methods

ReturnNameDescription
Scheduler &getDefault staticReturns the default Scheduler singleton, although Scheduler instances may also be initialized individually.
sched::TaskFactory &factory staticReturns the TaskFactory singleton.

{#getdefault-2}

getDefault

static

static Scheduler & getDefault()

Defined in src/sched/include/icy/sched/scheduler.h:68

Returns the default Scheduler singleton, although Scheduler instances may also be initialized individually.


{#factory-1}

factory

static

static sched::TaskFactory & factory()

Defined in src/sched/include/icy/sched/scheduler.h:71

Returns the TaskFactory singleton.

Protected Methods

ReturnNameDescription
voidrun virtual overrideThe run method will be called by the asynchronous context.
voidupdate virtual

{#run-6}

run

virtual override

virtual void run() override

Defined in src/sched/include/icy/sched/scheduler.h:74

The run method will be called by the asynchronous context.

Reimplements

{#update-5}

update

virtual

virtual void update()

Defined in src/sched/include/icy/sched/scheduler.h:75

{#task-1}

Task

#include <icy/sched/task.h>
class Task

Defined in src/sched/include/icy/sched/task.h:32

Inherits: Task, ISerializable

Scheduled task with an attached trigger and scheduler association.

List of all members

NameKindOwner
SchedulerfriendDeclared here
TaskfunctionDeclared here
TaskfunctionDeclared here
serializefunctionDeclared here
deserializefunctionDeclared here
createTriggerfunctionDeclared here
setTriggerfunctionDeclared here
triggerfunctionDeclared here
schedulerfunctionDeclared here
remainingfunctionDeclared here
typefunctionDeclared here
namefunctionDeclared here
setNamefunctionDeclared here
_typevariableDeclared here
_namevariableDeclared here
_schedulervariableDeclared here
_triggervariableDeclared here
_mutexvariableDeclared here
beforeRunfunctionDeclared here
runfunctionDeclared here
afterRunfunctionDeclared here
TaskRunnerfriendInherited from Task
_idvariableInherited from Task
_repeatingvariableInherited from Task
_destroyedvariableInherited from Task
TaskfunctionInherited from Task
destroyfunctionInherited from Task
destroyedfunctionInherited from Task
repeatingfunctionInherited from Task
idfunctionInherited from Task
~TaskfunctionInherited from Task
TaskfunctionInherited from Task
operator=functionInherited from Task
TaskfunctionInherited from Task
operator=functionInherited from Task
runfunctionInherited from Task
RunnablefunctionInherited from Runnable
runfunctionInherited from Runnable
cancelfunctionInherited from Runnable
cancelledfunctionInherited from Runnable
exitvariableInherited from Runnable
serializefunctionInherited from ISerializable
deserializefunctionInherited from ISerializable

Inherited from Task

KindNameDescription
friendTaskRunnerTasks belong to a TaskRunner instance.
variable_id
variable_repeating
variable_destroyed
functionTask
functiondestroy virtualSets the task to destroyed state.
functiondestroyed virtual constSignals that the task should be disposed of.
functionrepeating virtual constSignals that the task should be called repeatedly by the TaskRunner. If this returns false the task will be cancelled.
functionid virtual constUnique task ID.
function~Task virtual
functionTaskDeleted constructor.
functionoperator=Deleted assignment operator.
functionTaskDeleted constructor.
functionoperator=Deleted assignment operator.
functionrun virtual overrideCalled by the TaskRunner to run the task. Override this method to implement task action. Returning true means the task should be called again, and false will cause the task to be destroyed. The task will similarly be destroyed if destroy() was called during the current task iteration.

Inherited from Runnable

KindNameDescription
functionRunnable inline
functionrun virtualThe run method will be called by the asynchronous context.
functioncancel virtual inlineCancel the current task. The run() method should return ASAP.
functioncancelled virtual const inlineReturns true when the task has been cancelled.
variableexit

Inherited from ISerializable

KindNameDescription
functionserialize virtualSerializes this object's state into root.
functiondeserialize virtualPopulates this object's state from root.

Friends

NameDescription
Scheduler

{#scheduler-2}

Scheduler

friend class Scheduler

Defined in src/sched/include/icy/sched/task.h:111

Public Methods

ReturnNameDescription
TaskConstructs a detached task without an associated scheduler. A trigger must be set before scheduling.
TaskConstructs a task associated with the given scheduler.
voidserialize virtual overrideSerializes the task to JSON.
voiddeserialize virtual overrideDeserializes the task from JSON.
T *createTrigger inlineCreates a trigger of type T, attaches it to this task, and returns a raw pointer to it. Ownership of the trigger is transferred to this task.
voidsetTriggerReplaces the current trigger with trigger.
sched::Trigger &triggerReturns a reference to the associated sched::Trigger or throws an exception.
Scheduler &schedulerReturns a reference to the associated Scheduler or throws an exception.
std::int64_tremaining constReturns the milliseconds remaining until the next scheduled timeout. An sched::Trigger must be associated or an exception will be thrown.
std::stringtype constReturns the registered type string for this task.
std::stringname constReturns the human-readable display name of this task.
voidsetNameSets the human-readable display name.

{#task-2}

Task

Task(const std::string & type = "", const std::string & name = "")

Defined in src/sched/include/icy/sched/task.h:40

Constructs a detached task without an associated scheduler. A trigger must be set before scheduling.

Parameters

  • type Registered type name used by TaskFactory.

  • name Human-readable display name.


{#task-3}

Task

Task(Scheduler & scheduler, const std::string & type, const std::string & name = "")

Defined in src/sched/include/icy/sched/task.h:46

Constructs a task associated with the given scheduler.

Parameters

  • scheduler Scheduler that will own and run this task.

  • type Registered type name used by TaskFactory.

  • name Human-readable display name.


{#serialize-4}

serialize

virtual override

virtual void serialize(json::Value & root) override

Defined in src/sched/include/icy/sched/task.h:51

Serializes the task to JSON.

Reimplements

{#deserialize-4}

deserialize

virtual override

virtual void deserialize(json::Value & root) override

Defined in src/sched/include/icy/sched/task.h:54

Deserializes the task from JSON.

Reimplements

{#createtrigger}

createTrigger

inline

template<typename T> inline T * createTrigger()

Defined in src/sched/include/icy/sched/task.h:61

Creates a trigger of type T, attaches it to this task, and returns a raw pointer to it. Ownership of the trigger is transferred to this task.

Parameters

Returns

Raw pointer to the newly created trigger (still owned by this task).


{#settrigger}

setTrigger

void setTrigger(std::unique_ptr< sched::Trigger > trigger)

Defined in src/sched/include/icy/sched/task.h:71

Replaces the current trigger with trigger.

Parameters

  • trigger Owning pointer to the new trigger; must not be null before calling.

{#trigger}

trigger

sched::Trigger & trigger()

Defined in src/sched/include/icy/sched/task.h:75

Returns a reference to the associated sched::Trigger or throws an exception.


{#scheduler-3}

scheduler

Scheduler & scheduler()

Defined in src/sched/include/icy/sched/task.h:79

Returns a reference to the associated Scheduler or throws an exception.


{#remaining}

remaining

const

std::int64_t remaining() const

Defined in src/sched/include/icy/sched/task.h:85

Returns the milliseconds remaining until the next scheduled timeout. An sched::Trigger must be associated or an exception will be thrown.


{#type-16}

type

const

std::string type() const

Defined in src/sched/include/icy/sched/task.h:88

Returns the registered type string for this task.


{#name-9}

name

const

std::string name() const

Defined in src/sched/include/icy/sched/task.h:91

Returns the human-readable display name of this task.


{#setname-1}

setName

void setName(const std::string & name)

Defined in src/sched/include/icy/sched/task.h:95

Sets the human-readable display name.

Parameters

  • name New display name.

Protected Attributes

ReturnNameDescription
std::string_type
std::string_name
sched::Scheduler *_scheduler
std::unique_ptr< sched::Trigger >_trigger
std::mutex_mutex

{#_type-2}

_type

std::string _type

Defined in src/sched/include/icy/sched/task.h:113


{#_name-1}

_name

std::string _name

Defined in src/sched/include/icy/sched/task.h:114


{#_scheduler}

_scheduler

sched::Scheduler * _scheduler

Defined in src/sched/include/icy/sched/task.h:115


{#_trigger}

_trigger

std::unique_ptr< sched::Trigger > _trigger

Defined in src/sched/include/icy/sched/task.h:116


{#_mutex-14}

_mutex

std::mutex _mutex

Defined in src/sched/include/icy/sched/task.h:117

Protected Methods

ReturnNameDescription
boolbeforeRun virtual
voidrun virtual overrideCalled by the TaskRunner to run the task. Override this method to implement task action. Returning true means the task should be called again, and false will cause the task to be destroyed. The task will similarly be destroyed if destroy() was called during the current task iteration.
boolafterRun virtual

{#beforerun}

beforeRun

virtual

virtual bool beforeRun()

Defined in src/sched/include/icy/sched/task.h:100


{#run-7}

run

virtual override

virtual void run() override

Defined in src/sched/include/icy/sched/task.h:101

Called by the TaskRunner to run the task. Override this method to implement task action. Returning true means the task should be called again, and false will cause the task to be destroyed. The task will similarly be destroyed if destroy() was called during the current task iteration.

Reimplements

{#afterrun}

afterRun

virtual

virtual bool afterRun()

Defined in src/sched/include/icy/sched/task.h:102

{#taskfactory}

TaskFactory

#include <icy/sched/taskfactory.h>
class TaskFactory

Defined in src/sched/include/icy/sched/taskfactory.h:49

The TaskFactory can dynamically instantiate registered sched::Task and sched::Trigger classes from named strings.

List of all members

NameKindOwner
createTaskfunctionDeclared here
registerTaskfunctionDeclared here
unregisterTaskfunctionDeclared here
tasksfunctionDeclared here
createTriggerfunctionDeclared here
registerTriggerfunctionDeclared here
unregisterTriggerfunctionDeclared here
triggersfunctionDeclared here
getDefaultfunctionDeclared here
_mutexvariableDeclared here
_tasksvariableDeclared here
_triggersvariableDeclared here
TaskMaptypedefDeclared here
TriggerMaptypedefDeclared here

Public Methods

ReturnNameDescription
std::unique_ptr< sched::Task >createTask inlineInstantiates and returns a registered task by type name.
voidregisterTask inlineRegisters a task type T under the given name. Subsequent calls to createTask() with this type will return a T instance.
voidunregisterTask inlineRemoves the task registration for type. No-op if not registered.
TaskMaptasks const inlineReturns a snapshot copy of the registered task map.
std::unique_ptr< sched::Trigger >createTrigger inlineInstantiates and returns a registered trigger by type name.
voidregisterTrigger inlineRegisters a trigger type T under the given name.
voidunregisterTrigger inlineRemoves the trigger registration for type. No-op if not registered.
TriggerMaptriggers const inlineReturns a snapshot copy of the registered trigger map.

{#createtask}

createTask

inline

inline std::unique_ptr< sched::Task > createTask(const std::string & type)

Defined in src/sched/include/icy/sched/taskfactory.h:67

Instantiates and returns a registered task by type name.

Parameters

  • type Registered type name.

Returns

Owning pointer to the new task instance.

Exceptions

  • std::runtime_error if type is not registered.

{#registertask}

registerTask

inline

template<typename T> inline void registerTask(const std::string & type)

Defined in src/sched/include/icy/sched/taskfactory.h:81

Registers a task type T under the given name. Subsequent calls to createTask() with this type will return a T instance.

Parameters

  • T Concrete subclass of sched::Task with a default constructor.

Parameters

  • type Type name string to register.

{#unregistertask}

unregisterTask

inline

inline void unregisterTask(const std::string & type)

Defined in src/sched/include/icy/sched/taskfactory.h:89

Removes the task registration for type. No-op if not registered.

Parameters

  • type Type name to deregister.

{#tasks-2}

tasks

const inline

inline TaskMap tasks() const

Defined in src/sched/include/icy/sched/taskfactory.h:99

Returns a snapshot copy of the registered task map.


{#createtrigger-1}

createTrigger

inline

inline std::unique_ptr< sched::Trigger > createTrigger(const std::string & type)

Defined in src/sched/include/icy/sched/taskfactory.h:114

Instantiates and returns a registered trigger by type name.

Parameters

  • type Registered type name.

Returns

Owning pointer to the new trigger instance.

Exceptions

  • std::runtime_error if type is not registered.

{#registertrigger}

registerTrigger

inline

template<typename T> inline void registerTrigger(const std::string & type)

Defined in src/sched/include/icy/sched/taskfactory.h:127

Registers a trigger type T under the given name.

Parameters

Parameters

  • type Type name string to register.

{#unregistertrigger}

unregisterTrigger

inline

inline void unregisterTrigger(const std::string & type)

Defined in src/sched/include/icy/sched/taskfactory.h:135

Removes the trigger registration for type. No-op if not registered.

Parameters

  • type Type name to deregister.

{#triggers}

triggers

const inline

inline TriggerMap triggers() const

Defined in src/sched/include/icy/sched/taskfactory.h:145

Returns a snapshot copy of the registered trigger map.

Public Static Methods

ReturnNameDescription
TaskFactory &getDefault static inlineReturns the default TaskFactory singleton.

{#getdefault-3}

getDefault

static inline

static inline TaskFactory & getDefault()

Defined in src/sched/include/icy/sched/taskfactory.h:53

Returns the default TaskFactory singleton.

Protected Attributes

ReturnNameDescription
std::mutex_mutex
TaskMap_tasks
TriggerMap_triggers

{#_mutex-15}

_mutex

std::mutex _mutex

Defined in src/sched/include/icy/sched/taskfactory.h:152


{#_tasks-2}

_tasks

TaskMap _tasks

Defined in src/sched/include/icy/sched/taskfactory.h:154


{#_triggers}

_triggers

TriggerMap _triggers

Defined in src/sched/include/icy/sched/taskfactory.h:155

Public Types

NameDescription
TaskMapScheduled Tasks.
TriggerMapSchedule Triggers.

{#taskmap}

TaskMap

using TaskMap = std::map< std::string, std::unique_ptr< sched::Task >(*)()>

Defined in src/sched/include/icy/sched/taskfactory.h:61

Scheduled Tasks.


{#triggermap}

TriggerMap

using TriggerMap = std::map< std::string, std::unique_ptr< sched::Trigger >(*)()>

Defined in src/sched/include/icy/sched/taskfactory.h:108

Schedule Triggers.

{#dailytrigger}

DailyTrigger

#include <icy/sched/trigger.h>
struct DailyTrigger

Defined in src/sched/include/icy/sched/trigger.h:167

Inherits: Trigger

Trigger that fires once per day at a configured time, with optional day-of-week exclusions.

List of all members

NameKindOwner
timeOfDayvariableDeclared here
daysExcludedvariableDeclared here
DailyTriggerfunctionDeclared here
updatefunctionDeclared here
typevariableInherited from Trigger
namevariableInherited from Trigger
timesRunvariableInherited from Trigger
createdAtvariableInherited from Trigger
scheduleAtvariableInherited from Trigger
lastRunAtvariableInherited from Trigger
TriggerfunctionInherited from Trigger
updatefunctionInherited from Trigger
remainingfunctionInherited from Trigger
timeoutfunctionInherited from Trigger
expiredfunctionInherited from Trigger
serializefunctionInherited from Trigger
deserializefunctionInherited from Trigger
serializefunctionInherited from ISerializable
deserializefunctionInherited from ISerializable

Inherited from Trigger

KindNameDescription
variabletypeThe type of this trigger class.
variablenameThe display name of this trigger class.
variabletimesRunThe number of times the task has run since creation;
variablecreatedAtThe time the task was created.
variablescheduleAtThe time the task is scheduled to run.
variablelastRunAtThe time the task was last run.
functionTrigger
functionupdate virtualUpdates the scheduleAt value to the next scheduled time.
functionremaining virtualReturns the milliseconds remaining until the next scheduled timeout.
functiontimeout virtualReturns true if the task is ready to be run, false otherwise.
functionexpired virtualReturns true if the task is expired and should be destroyed. Returns false by default.
functionserialize virtual overrideSerializes timing state (type, name, createdAt, scheduleAt, lastRunAt, timesRun) to root.
functiondeserialize virtual overrideDeserializes timing state from root.

Inherited from ISerializable

KindNameDescription
functionserialize virtualSerializes this object's state into root.
functiondeserialize virtualPopulates this object's state from root.

Public Attributes

ReturnNameDescription
DateTimetimeOfDayThis value represents the time of day the task will trigger. The date part of the timestamp is redundant.
std::vector< DaysOfTheWeek >daysExcludedDays of the week can be excluded by adding the appropriate bit flag here.

{#timeofday}

timeOfDay

DateTime timeOfDay

Defined in src/sched/include/icy/sched/trigger.h:179

This value represents the time of day the task will trigger. The date part of the timestamp is redundant.


{#daysexcluded}

daysExcluded

std::vector< DaysOfTheWeek > daysExcluded

Defined in src/sched/include/icy/sched/trigger.h:183

Days of the week can be excluded by adding the appropriate bit flag here.

Public Methods

ReturnNameDescription
DailyTriggerConstructs the trigger with type "DailyTrigger".
voidupdate virtual overrideComputes the next scheduleAt value by advancing to the next non-excluded weekday at the configured timeOfDay.

{#dailytrigger-1}

DailyTrigger

DailyTrigger()

Defined in src/sched/include/icy/sched/trigger.h:170

Constructs the trigger with type "DailyTrigger".


{#update-2}

update

virtual override

virtual void update() override

Defined in src/sched/include/icy/sched/trigger.h:174

Computes the next scheduleAt value by advancing to the next non-excluded weekday at the configured timeOfDay.

Reimplements

{#intervaltrigger}

IntervalTrigger

#include <icy/sched/trigger.h>
struct IntervalTrigger

Defined in src/sched/include/icy/sched/trigger.h:133

Inherits: Trigger

Trigger that fires repeatedly at a fixed time interval.

List of all members

NameKindOwner
intervalvariableDeclared here
maxTimesvariableDeclared here
IntervalTriggerfunctionDeclared here
updatefunctionDeclared here
expiredfunctionDeclared here
serializefunctionDeclared here
deserializefunctionDeclared here
typevariableInherited from Trigger
namevariableInherited from Trigger
timesRunvariableInherited from Trigger
createdAtvariableInherited from Trigger
scheduleAtvariableInherited from Trigger
lastRunAtvariableInherited from Trigger
TriggerfunctionInherited from Trigger
updatefunctionInherited from Trigger
remainingfunctionInherited from Trigger
timeoutfunctionInherited from Trigger
expiredfunctionInherited from Trigger
serializefunctionInherited from Trigger
deserializefunctionInherited from Trigger
serializefunctionInherited from ISerializable
deserializefunctionInherited from ISerializable

Inherited from Trigger

KindNameDescription
variabletypeThe type of this trigger class.
variablenameThe display name of this trigger class.
variabletimesRunThe number of times the task has run since creation;
variablecreatedAtThe time the task was created.
variablescheduleAtThe time the task is scheduled to run.
variablelastRunAtThe time the task was last run.
functionTrigger
functionupdate virtualUpdates the scheduleAt value to the next scheduled time.
functionremaining virtualReturns the milliseconds remaining until the next scheduled timeout.
functiontimeout virtualReturns true if the task is ready to be run, false otherwise.
functionexpired virtualReturns true if the task is expired and should be destroyed. Returns false by default.
functionserialize virtual overrideSerializes timing state (type, name, createdAt, scheduleAt, lastRunAt, timesRun) to root.
functiondeserialize virtual overrideDeserializes timing state from root.

Inherited from ISerializable

KindNameDescription
functionserialize virtualSerializes this object's state into root.
functiondeserialize virtualPopulates this object's state from root.

Public Attributes

ReturnNameDescription
TimespanintervalThis value represents the interval to wait before running the task.
intmaxTimesThe maximum number of times the task will be run before it is destroyed. 0 for no effect.

{#interval}

interval

Timespan interval

Defined in src/sched/include/icy/sched/trigger.h:155

This value represents the interval to wait before running the task.


{#maxtimes}

maxTimes

int maxTimes

Defined in src/sched/include/icy/sched/trigger.h:160

The maximum number of times the task will be run before it is destroyed. 0 for no effect.

Public Methods

ReturnNameDescription
IntervalTriggerConstructs the trigger with type "IntervalTrigger" and maxTimes = 0 (unlimited).
voidupdate virtual overrideAdvances scheduleAt by one [interval](#interval) period.
boolexpired virtual overrideReturns true when maxTimes > 0 and timesRun >= maxTimes.
voidserialize virtual overrideSerializes interval fields (days, hours, minutes, seconds) in addition to base fields.
voiddeserialize virtual overrideDeserializes interval fields from root. Throws if the resulting interval is zero.

{#intervaltrigger-1}

IntervalTrigger

IntervalTrigger()

Defined in src/sched/include/icy/sched/trigger.h:136

Constructs the trigger with type "IntervalTrigger" and maxTimes = 0 (unlimited).


{#update-3}

update

virtual override

virtual void update() override

Defined in src/sched/include/icy/sched/trigger.h:139

Advances scheduleAt by one [interval](#interval) period.

Reimplements

{#expired-2}

expired

virtual override

virtual bool expired() override

Defined in src/sched/include/icy/sched/trigger.h:142

Returns true when maxTimes > 0 and timesRun >= maxTimes.

Reimplements

{#serialize-2}

serialize

virtual override

virtual void serialize(json::Value & root) override

Defined in src/sched/include/icy/sched/trigger.h:146

Serializes interval fields (days, hours, minutes, seconds) in addition to base fields.

Parameters

  • root JSON object to populate.
Reimplements

{#deserialize-2}

deserialize

virtual override

virtual void deserialize(json::Value & root) override

Defined in src/sched/include/icy/sched/trigger.h:151

Deserializes interval fields from root. Throws if the resulting interval is zero.

Parameters

Reimplements

{#onceonlytrigger}

OnceOnlyTrigger

#include <icy/sched/trigger.h>
struct OnceOnlyTrigger

Defined in src/sched/include/icy/sched/trigger.h:113

Inherits: Trigger

Trigger that fires exactly once at the scheduled time and then expires.

List of all members

NameKindOwner
OnceOnlyTriggerfunctionDeclared here
updatefunctionDeclared here
expiredfunctionDeclared here
typevariableInherited from Trigger
namevariableInherited from Trigger
timesRunvariableInherited from Trigger
createdAtvariableInherited from Trigger
scheduleAtvariableInherited from Trigger
lastRunAtvariableInherited from Trigger
TriggerfunctionInherited from Trigger
updatefunctionInherited from Trigger
remainingfunctionInherited from Trigger
timeoutfunctionInherited from Trigger
expiredfunctionInherited from Trigger
serializefunctionInherited from Trigger
deserializefunctionInherited from Trigger
serializefunctionInherited from ISerializable
deserializefunctionInherited from ISerializable

Inherited from Trigger

KindNameDescription
variabletypeThe type of this trigger class.
variablenameThe display name of this trigger class.
variabletimesRunThe number of times the task has run since creation;
variablecreatedAtThe time the task was created.
variablescheduleAtThe time the task is scheduled to run.
variablelastRunAtThe time the task was last run.
functionTrigger
functionupdate virtualUpdates the scheduleAt value to the next scheduled time.
functionremaining virtualReturns the milliseconds remaining until the next scheduled timeout.
functiontimeout virtualReturns true if the task is ready to be run, false otherwise.
functionexpired virtualReturns true if the task is expired and should be destroyed. Returns false by default.
functionserialize virtual overrideSerializes timing state (type, name, createdAt, scheduleAt, lastRunAt, timesRun) to root.
functiondeserialize virtual overrideDeserializes timing state from root.

Inherited from ISerializable

KindNameDescription
functionserialize virtualSerializes this object's state into root.
functiondeserialize virtualPopulates this object's state from root.

Public Methods

ReturnNameDescription
OnceOnlyTriggerConstructs the trigger with type "OnceOnlyTrigger".
voidupdate virtual inline overrideNo-op; scheduleAt is set once at construction and never advanced.
boolexpired virtual overrideReturns true after the task has run at least once.

{#onceonlytrigger-1}

OnceOnlyTrigger

OnceOnlyTrigger()

Defined in src/sched/include/icy/sched/trigger.h:116

Constructs the trigger with type "OnceOnlyTrigger".


{#update-4}

update

virtual inline override

virtual inline void update() override

Defined in src/sched/include/icy/sched/trigger.h:119

No-op; scheduleAt is set once at construction and never advanced.

Reimplements

{#expired-3}

expired

virtual override

virtual bool expired() override

Defined in src/sched/include/icy/sched/trigger.h:126

Returns true after the task has run at least once.

Reimplements

{#trigger-1}

Trigger

#include <icy/sched/trigger.h>
struct Trigger

Defined in src/sched/include/icy/sched/trigger.h:58

Inherits: ISerializable Subclassed by: DailyTrigger, IntervalTrigger, OnceOnlyTrigger

Base class for scheduled task triggers that determine when a task should run.

List of all members

NameKindOwner
typevariableDeclared here
namevariableDeclared here
timesRunvariableDeclared here
createdAtvariableDeclared here
scheduleAtvariableDeclared here
lastRunAtvariableDeclared here
TriggerfunctionDeclared here
updatefunctionDeclared here
remainingfunctionDeclared here
timeoutfunctionDeclared here
expiredfunctionDeclared here
serializefunctionDeclared here
deserializefunctionDeclared here
serializefunctionInherited from ISerializable
deserializefunctionInherited from ISerializable

Inherited from ISerializable

KindNameDescription
functionserialize virtualSerializes this object's state into root.
functiondeserialize virtualPopulates this object's state from root.

Public Attributes

ReturnNameDescription
std::stringtypeThe type of this trigger class.
std::stringnameThe display name of this trigger class.
inttimesRunThe number of times the task has run since creation;
DateTimecreatedAtThe time the task was created.
DateTimescheduleAtThe time the task is scheduled to run.
DateTimelastRunAtThe time the task was last run.

{#type-17}

type

std::string type

Defined in src/sched/include/icy/sched/trigger.h:90

The type of this trigger class.


{#name-10}

name

std::string name

Defined in src/sched/include/icy/sched/trigger.h:93

The display name of this trigger class.


{#timesrun}

timesRun

int timesRun

Defined in src/sched/include/icy/sched/trigger.h:97

The number of times the task has run since creation;


{#createdat}

createdAt

DateTime createdAt

Defined in src/sched/include/icy/sched/trigger.h:100

The time the task was created.


{#scheduleat}

scheduleAt

DateTime scheduleAt

Defined in src/sched/include/icy/sched/trigger.h:103

The time the task is scheduled to run.


{#lastrunat}

lastRunAt

DateTime lastRunAt

Defined in src/sched/include/icy/sched/trigger.h:106

The time the task was last run.

Public Methods

ReturnNameDescription
Trigger
voidupdate virtualUpdates the scheduleAt value to the next scheduled time.
std::int64_tremaining virtualReturns the milliseconds remaining until the next scheduled timeout.
booltimeout virtualReturns true if the task is ready to be run, false otherwise.
boolexpired virtualReturns true if the task is expired and should be destroyed. Returns false by default.
voidserialize virtual overrideSerializes timing state (type, name, createdAt, scheduleAt, lastRunAt, timesRun) to root.
voiddeserialize virtual overrideDeserializes timing state from root.

{#trigger-2}

Trigger

Trigger(const std::string & type = "", const std::string & name = "")

Defined in src/sched/include/icy/sched/trigger.h:62

Parameters

  • type Registered type name used by TaskFactory.

  • name Human-readable display name.


{#update-6}

update

virtual

virtual void update()

Defined in src/sched/include/icy/sched/trigger.h:66

Updates the scheduleAt value to the next scheduled time.

Reimplemented by

{#remaining-1}

remaining

virtual

virtual std::int64_t remaining()

Defined in src/sched/include/icy/sched/trigger.h:70

Returns the milliseconds remaining until the next scheduled timeout.


{#timeout-4}

timeout

virtual

virtual bool timeout()

Defined in src/sched/include/icy/sched/trigger.h:74

Returns true if the task is ready to be run, false otherwise.


{#expired-4}

expired

virtual

virtual bool expired()

Defined in src/sched/include/icy/sched/trigger.h:79

Returns true if the task is expired and should be destroyed. Returns false by default.

Reimplemented by

{#serialize-5}

serialize

virtual override

virtual void serialize(json::Value & root) override

Defined in src/sched/include/icy/sched/trigger.h:83

Serializes timing state (type, name, createdAt, scheduleAt, lastRunAt, timesRun) to root.

Parameters

  • root JSON object to populate.
Reimplements
Reimplemented by

{#deserialize-5}

deserialize

virtual override

virtual void deserialize(json::Value & root) override

Defined in src/sched/include/icy/sched/trigger.h:87

Deserializes timing state from root.

Parameters

Reimplements
Reimplemented by