Scheduler Class Reference

#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 ()
 
- Functions inherited from Component
std::string GetTag ()
 
EntityGetHost () 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

- Public Types inherited from Component
using EventHandler = bool(*)(void *, Component *component, Entity::ID self, Entity::ID source, const std::vector< std::string > &args)
 
- Protected Member Functions inherited from Component
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

void OnStep ( )
virtual

Function that is called upon each Run iteration. Component Run()s are run before the entity's run function.

Reimplemented from Component.

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
nameThe name of the task.
intervalMSThe interval to run the task in milliseconds.
taskThe task to add.
initialDelaySpecifies 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.

std::string GetInfo ( )
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