plumbing::at_service Class Reference
#include <service.h>
Detailed Description
The plumbing::at_service class is used to represent a service that runs jobs at a specific time.
- Note:
- There is no provision for multi-threading in this code. The assumption is that all activity is initiated by the plumbing::reactor::process loop.
Definition at line 38 of file service.h.
Member Typedef Documentation
Constructor & Destructor Documentation
virtual plumbing::at_service::~at_service |
( |
|
) |
[virtual] |
plumbing::at_service::at_service |
( |
|
) |
|
plumbing::at_service::at_service |
( |
const at_service & |
|
) |
[private] |
The copy constructor. Do not use.
Member Function Documentation
bool plumbing::at_service::empty |
( |
|
) |
const [inline] |
The empty method is used to determine whether or not the at service still has work to do.
- Returns:
- true if no jobs queued, false if there is still work to be done.
Definition at line 109 of file service.h.
time_value plumbing::at_service::get_maximum_sleep |
( |
|
) |
const |
The get_maximum_sleep is used to obtain a sleep time, for handing to select(), based on the jobs in the queue. If there are no jobs, 60 seconds will be returned.
The assignment operator. Do not use.
void plumbing::at_service::process |
( |
|
) |
|
The process method will examine all of the jobs in the queue, and run all which have reached or passed their stated execution time. Jobs are removed from the queue when they are run, but they are NOT deleted.
If a job wishes to run again, it is safe to call, and it should call, the at_service::register_job within its at_job::process method. It is also safe if jobs use "delete this" within their at_job::process method.
void plumbing::at_service::register_job |
( |
const time_value & |
when, |
|
|
at_job * |
jp | |
|
) |
| | |
The register_job method is used to add a jobs to the queue of jobs waiting to run.
- Parameters:
-
| when | The time the job is to be called. |
| jp | The job to be queued. |
void plumbing::at_service::register_job_delta |
( |
const time_value & |
seconds, |
|
|
at_job * |
jp | |
|
) |
| | |
The The register_job_delta method is used to add a jobs to the queue of jobs waiting to run.
- Parameters:
-
| seconds | How many seconds into the future the job is to be called. |
| jp | The job to be queued. |
void plumbing::at_service::unregister_job |
( |
at_job * |
jp |
) |
|
The unregister_job method is used to remove a job from the queue of jobs waiting to run.
- Parameters:
-
| jp | The job to be de-queued. |
Field Documentation
The queue instance variable is used to remember the jobs waiting to run.
Definition at line 124 of file service.h.
The documentation for this class was generated from the following file: