scheduler::TaskStep Class Reference

Step task class. More...

#include <scheduler.h>

Inheritance diagram for scheduler::TaskStep:

scheduler::Task

List of all members.

Public Member Functions

 TaskStep (time_t step, time_t shift, modules::Module *module, std::string const &name="", std::string const &desc="")
 Constructor.
 TaskStep (TaskStep const &t)
 Copy constructor.
TaskStepoperator= (TaskStep const &right)
 Assignment operator.
virtual bool poll ()
 Returns true and when the interval has elapsed.
time_t step () const
 Returns the interval between two runs, in seconds.
time_t step (time_t step)
 Sets the interval between two runs.
time_t shift () const
 Returns the shift, in seconds.
time_t shift (time_t shift)
 Sets the shift.
time_t next () const
 Returns when the task will run next time.

Protected Attributes

time_t m_step
 Interval between two runs.
time_t m_shift
 Shift.
time_t m_next
 When must the task run next?


Detailed Description

The TaskStep class is a task class whose poll() function yields true once every predetermined amount of seconds.

The main difference with other similar classes, such as TaskTimeout, is that the base time is midnight of the day the task has been created.

So, for example, if you create a task of this type at 1pm that must run every four hours, it will be run at 4pm and 8pm of the same day, and at 12am, 4am, 8am, 12pm, 4pm and 8pm of the next days until it is removed.

You can also set a shift that will modify the behaviour of the class. For example, a 7200 seconds shift for the task described above will make it run at 2am, 6am, 10am, 2pm, 6pm and 10pm.


Constructor & Destructor Documentation

scheduler::TaskStep::TaskStep ( time_t  step,
time_t  shift,
modules::Module module,
std::string const &  name = "",
std::string const &  desc = "" 
)

Sets the task type, step and shift (see the class description for more details).

Parameters:
[in] step The interval between two runs, in seconds.
[in] shift The shift, in seconds (must be less than step).
[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.


Member Function Documentation

time_t scheduler::TaskStep::step ( time_t  step  ) 

Sets the interval between two runs.

Parameters:
[in] step The new interval between two runs, in seconds.
Returns:
The new interval between two runs, in seconds.

time_t scheduler::TaskStep::shift ( time_t  shift  ) 

Sets the shift.

Parameters:
[in] shift The new shift.
Returns:
The new shift.


The documentation for this class was generated from the following file:
Generated on Fri Apr 18 22:03:29 2008 for Epona API by  doxygen 1.5.3