kanzi::Scheduler Class Reference

Scheduler class. More...

#include <kanzi/core.ui/scheduler/scheduler.hpp>

Public Types

typedef function< void()> Task
 Type for scheduled tasks. More...
 

Public Member Functions

bool submitTask (string_view name, Task task)
 Submits a task for one-shot execution. More...
 
bool insertRecurringTask (string_view name, Task task)
 Submits a task for recurring execution. More...
 
bool removeTask (string_view name)
 Immediately removes a task from the scheduler. More...
 
bool removeTaskAfterExecution (string_view name)
 Removes a task from the scheduler after its execution (next or current) ends. More...
 
void executeTasks ()
 Executes all tasks in ascending alphabetical order and removes non-recurring tasks after their execution. More...
 
void debugPrintTasks () const
 Prints the tasks to the log. More...
 

Detailed Description

Scheduler class.

Represents an ordered set of tasks.

Member Typedef Documentation

typedef function<void()> kanzi::Scheduler::Task

Type for scheduled tasks.

Member Function Documentation

bool kanzi::Scheduler::submitTask ( string_view  name,
Task  task 
)

Submits a task for one-shot execution.

Parameters
nameThe name of the task. Establishes the task execution order.
taskThe task to submit.
Returns
True, if this function did not replace an existing task.
bool kanzi::Scheduler::insertRecurringTask ( string_view  name,
Task  task 
)

Submits a task for recurring execution.

Parameters
nameThe name of the task. Establishes the task execution order.
taskThe task to submit.
Returns
True, if this function did not replace an existing task.
bool kanzi::Scheduler::removeTask ( string_view  name)

Immediately removes a task from the scheduler.

A task may not remove itself.

Parameters
nameThe name of the task to remove.
Returns
True, if a task was removed.
bool kanzi::Scheduler::removeTaskAfterExecution ( string_view  name)

Removes a task from the scheduler after its execution (next or current) ends.

Parameters
nameThe name of the task to remove.
Returns
True, if a task was marked for removal.
void kanzi::Scheduler::executeTasks ( )

Executes all tasks in ascending alphabetical order and removes non-recurring tasks after their execution.

Removal of tasks may be interleaved with execution of other tasks.

void kanzi::Scheduler::debugPrintTasks ( ) const

Prints the tasks to the log.


The documentation for this class was generated from the following file: