Base module
Task
Abstract base class for implementing asynchronous tasks.
Task
#include <icy/task.h>Abstract base class for implementing asynchronous tasks.
Tasks are designed to be run by a TaskRunner.
Public Methods
| Return | Name | Description |
|---|---|---|
Task | #### Parameters | |
void | destroy virtual | Sets the task to destroyed state. |
bool | destroyed virtual const | Signals that the task should be disposed of. |
bool | repeating virtual const | Signals that the task should be called repeatedly by the TaskRunner. If this returns false the task will be cancelled. |
uint32_t | id virtual const | Unique task ID. |
Task | Deleted constructor. | |
Task | Deleted constructor. |
Task
Task(bool repeat)Parameters
repeatIf true, the[TaskRunner](icy-TaskRunner.html#taskrunner)will call[run()](#run-5)repeatedly; if false, the task is cancelled after one execution.
destroy
virtual
virtual void destroy()Sets the task to destroyed state.
destroyed
virtual const
virtual bool destroyed() constSignals that the task should be disposed of.
repeating
virtual const
virtual bool repeating() constSignals that the task should be called repeatedly by the TaskRunner. If this returns false the task will be cancelled.
id
virtual const
virtual uint32_t id() constUnique task ID.
Task
Task(const Task & task) = deleteDeleted constructor.
Task
Task(Task &&) = deleteDeleted constructor.
Protected Attributes
| Return | Name | Description |
|---|---|---|
uint32_t | _id | |
bool | _repeating | |
bool | _destroyed |
_id
uint32_t _id_repeating
bool _repeating_destroyed
bool _destroyedProtected Methods
| Return | Name | Description |
|---|---|---|
void | run | 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. |
run
void run()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.
