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 (int type, time_t step, time_t shift)
 Constructor.
 TaskStep (TaskStep const &t)
 Copy constructor.
virtual 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 int  type,
time_t  step,
time_t  shift
 

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

Parameters:
[in] type The task type.
[in] step The interval between two runs, in seconds.
[in] shift The shift, in seconds (must be less than step).


Member Function Documentation

time_t scheduler::TaskStep::shift time_t  shift  ) 
 

Sets the shift.

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

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.


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