scheduler::Task Class Reference

Base task class. More...

#include <scheduler.h>

Inheritance diagram for scheduler::Task:

scheduler::TaskAlways scheduler::TaskStep scheduler::TaskTimeout List of all members.

Public Types

enum  { rOK = 0x0, rSlept = 0x1, rRemove = 0x2, rFree = (rRemove | 0x4) }
 Possible return value bits for run(). More...

Public Member Functions

 Task (int type)
 Constructor setting the task type.
 Task (Task const &t)
 Copy constructor.
virtual Taskoperator= (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.
virtual std::string description () const =0
 Returns the description of the task.
virtual std::string name () const =0
 Returns the name of the task.
virtual int type () const
 Returns the task type.
virtual int type (int type)
 Sets the task type.

Protected Attributes

int m_type
 The task type.

Detailed Description

The Task class implements a task used by the Scheduler class. Each Task object has its own task type, allowing you to remove all tasks of a specific type easily through the Scheduler object.

This class must not be used directly; instead, you must inherit it and override the abstract functions.


Member Enumeration Documentation

anonymous enum
 

Enumerator:
rOK  Use this as an alias for 0.
rSlept  The task has called sleep() -- no need to call it again.
rRemove  Remove the task from the list.
rFree  Remove the task from the list and call operator delete on it.


Member Function Documentation

virtual std::string scheduler::Task::description  )  const [pure virtual]
 

Returns the description of the task. It can be used by the program to show information about the running task.

Returns:
The description of the task.

virtual std::string scheduler::Task::name  )  const [pure virtual]
 

Returns the name of the task. This name is used by the Scheduler::remove_bytype to remove tasks by type and name.

Returns:
The name of the task.
See also:
Scheduler::remove_bytype(int, std::string const &)

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.

Returns:
true if the task should be run (in that case, run() is then called by the scheduler), false otherwise.
See also:
run()

Implemented in scheduler::TaskAlways, scheduler::TaskTimeout, and scheduler::TaskStep.

virtual int scheduler::Task::run  )  [pure virtual]
 

Runs the task. Override this function to do whatever you want there.

Returns:
An or'ed combination of any of the rSlept, rRemove or rFree bits as appropriate. There is no error return value.
See also:
rSlept, rRemove, rRemoveFree

virtual int scheduler::Task::type int  type  )  [inline, virtual]
 

Sets the task type.

Parameters:
[in] type The new task type.
Returns:
The new task type.


The documentation for this class was generated from the following file:
Generated on Sun May 20 21:32:22 2007 for Epona API by  doxygen 1.4.6