#include <scheduler.h>
Public Types | |
enum | { rOK = 0x0, rSlept = 0x1, rRemove = 0x2, rFree = (rRemove | 0x4) } |
Possible return value bits for run(). More... | |
Public Member Functions | |
Task (modules::Module *module, std::string const &name="", std::string const &desc="") | |
Constructor. | |
Task (Task const &t) | |
Copy constructor. | |
Task & | operator= (Task const &right) |
Assignment operator. | |
virtual | ~Task () |
Destructor. | |
virtual bool | poll ()=0 |
Determines whether the task should be run. | |
virtual int | run ()=0 |
Runs the task. | |
modules::Module * | module () const |
Returns the module this task belongs to. | |
virtual std::string | description () const |
Returns the description of the task. | |
virtual std::string | name () const |
Returns the name of the task. | |
Protected Attributes | |
modules::Module * | m_module |
The module this task belongs to. | |
std::string | m_name |
The task name. | |
std::string | m_desc |
The task description. |
This class must not be used directly; instead, you must inherit it and override the abstract functions.
anonymous enum |
scheduler::Task::Task | ( | modules::Module * | module, | |
std::string const & | name = "" , |
|||
std::string const & | desc = "" | |||
) | [inline, explicit] |
Constructor.
[in] | module | The module this task belongs to. |
[in] | name | The name of the task, used by some functions who act on tasks by name. Set that if you don't intend to override the name() function. |
[in] | desc | An arbitrary description of the task. Set that if you don't intend to * override the description() function. |
virtual bool scheduler::Task::poll | ( | ) | [pure virtual] |
Determines whether the task should be run. This function is called periodically by the Scheduler object to which the class has been added.
Implemented in scheduler::TaskAlways, scheduler::TaskTimeout, and scheduler::TaskStep.
virtual int scheduler::Task::run | ( | ) | [pure virtual] |
virtual std::string scheduler::Task::description | ( | ) | const [inline, virtual] |
Returns the description of the task. It can be used by the program to show information about the running task.
The default implementation returns the description specified in the constructor.
virtual std::string scheduler::Task::name | ( | ) | const [inline, virtual] |
Returns the name of the task. This name is used by the Scheduler::remove_bytype to remove tasks by type and name.
The default implementation returns the name specified in the constructor.