#include <Scheduler.h>
Description
A Scheduler allows for automatic running of logic at certain intervals.
Functions | |
void | OnStep () |
void | StartTask (const std::string &name, uint32_t intervalMS, Component::EventHandler task, uint32_t initialDelay=0, void *data=nullptr) |
void | EndTask (const std::string &name) |
uint32_t | GetTaskInterval (const std::string &name) |
std::vector< std::string > | GetTasks () |
void | Pause () |
void | Resume () |
std::string | GetInfo () |
![]() | |
std::string | GetTag () |
Entity * | GetHost () const |
template<typename T > | |
T * | GetHostAs () const |
Entity::ID | GetHostID () const |
bool | EmitEvent (const std::string &eventName, Entity::ID source=Entity::ID(), const std::vector< std::string > &args={}) |
bool | CanHandleEvent (const std::string &eventName) |
void | InstallHook (const std::string &eventName, EventHandler, void *data=nullptr) |
void | UninstallHook (const std::string &eventName, EventHandler) |
void | InstallHandler (const std::string &eventName, EventHandler, void *data=nullptr) |
void | UninstallHandler (const std::string &eventName, EventHandler) |
std::vector< std::string > | GetKnownEvents () const |
Additional Inherited Members | |
![]() | |
using | EventHandler = bool(*)(void *, Component *component, Entity::ID self, Entity::ID source, const std::vector< std::string > &args) |
![]() | |
virtual void | OnDraw () |
virtual void | OnAttach () |
void | InstallEvent (const std::string &eventName, EventHandler mainHandler=nullptr, void *data=nullptr) |
void | UninstallEvent (const std::string &) |
Member Function Documentation
|
virtual |
void StartTask | ( | const std::string & | name, |
uint32_t | intervalMS, | ||
Component::EventHandler | task, | ||
uint32_t | initialDelay = 0 , |
||
void * | data = nullptr |
||
) |
Begins a new task. A task will run once per every announced millisecond interval. The resolution is only as good as the number of times the host's Run() is called. In an Engine context, this is usually locked to the Engine's max FPS.
- Parameters
-
name The name of the task. intervalMS The interval to run the task in milliseconds. task The task to add. initialDelay Specifies an amount of time in milliseconds to wait before starting to manage this task.
void EndTask | ( | const std::string & | name | ) |
Halts the task with the given name.
If there is no task with the given name, no action is taken.
uint32_t GetTaskInterval | ( | const std::string & | name | ) |
Returns the number of milliseconds that the given task is set to.
std::vector<std::string> GetTasks | ( | ) |
Returns a vector of the names of currently running tasks.
void Pause | ( | ) |
Stops running tasks until Resume() is run.
All Task's intervals are halted as well
void Resume | ( | ) |
Resumes all tasks.
|
virtual |
Returns a string containing human-readable information on the state of the component.
Reimplemented from Component.
The documentation for this class was generated from the following file:
- /home/jc/git/Dynacoe/DynacoeSrc/includes/Dynacoe/Components/Scheduler.h