The AbstractJob class provides an interface for jobs. More...
#include <CMJob.h>
Public Member Functions | |
AbstractJob (const std::string &name, JobType type, bool sync) | |
AbstractJob. More... | |
void | setCycleTime (unsigned long cycle) |
setCycleTime More... | |
void | setCycleOffset (unsigned long cycle) |
setCycleOffset More... | |
void | setTimeoutTime (double time_s) |
setTimeoutTime More... | |
void | setExecutionCounter (int count) |
setExecutionCounter More... | |
void | skipFirstCycles (unsigned count) |
skipFirstNCycles More... | |
void | setCallbackHook (CallbackHook hook) |
setCallbackHook More... | |
virtual void | init () |
Initialization of the job. More... | |
virtual void | activate () |
Activation of the job. More... | |
virtual void | prepare () |
Preperation of the job. More... | |
virtual void | execute ()=0 |
Execution of the job. More... | |
virtual void | suspend () |
Suspension of the job. More... | |
virtual void | timeout () |
Putting job into timeout. More... | |
virtual void | disable () |
Disable the job. More... | |
virtual void | reset () |
Reset the job. More... | |
void | info () const |
Prints job details. More... | |
bool | isJobScheduled (unsigned long cycle) const |
function, which returns if the job is scheduled at cycle More... | |
bool | isCallbackScheduled (unsigned long cycle) const |
function to check if current callback is scheduled at cycle More... | |
bool | isJobTimeout (void) const |
isJobTimeout More... | |
std::string | getJobName () const |
unsigned long | getCycleTime () const |
unsigned long | getCycleOffset () const |
bool | isSynchronized () const |
unsigned long | getCycle () const |
JobType | getJobType () const |
std::string | getJobTypeName () const |
CallbackHook | getCallbackHook () const |
std::string | getCallbackHookName () const |
JobState | getJobState () const |
std::string | getJobStateName () const |
void | setCycle (unsigned long cycle) |
void | setJobName (const std::string &name) |
set a job name instead of the argument in constructor More... | |
Protected Member Functions | |
void | setReady () |
void | setIdle () |
void | setActive () |
void | setSuspended () |
void | setTimeout () |
void | setDisabled () |
The AbstractJob class provides an interface for jobs.
AbstractJob::AbstractJob | ( | const std::string & | name, |
JobType | type, | ||
bool | sync | ||
) |
name | is the job name |
type | is the type Cyclic or Trigger |
sync | is the flag if the job should get syncronized |
|
virtual |
Activation of the job.
Function activate() can be provided in the inherited class. Then AbstractJob::activate() has to be called.
Use it to
|
virtual |
Disable the job.
Function disable() can be provided in the inherited class. Then AbstractJob::disable() has to be called.
Use it to
|
pure virtual |
Execution of the job.
Function execute() has to be provided in the inherited class. Then AbstractJob::execute() has to be called.
Use it to
Implemented in CMJob::RosSubscriber< T >, and CMJob::RosPublisher< T >.
void AbstractJob::info | ( | ) | const |
Prints job details.
Prints name
, cycletime
and cycleoffset
|
virtual |
Initialization of the job.
Function init() can be provided in the inherited class. Then AbstractJob::init() has to be called.
Use it to
Reimplemented in CMJob::RosSubscriber< T >.
bool AbstractJob::isCallbackScheduled | ( | unsigned long | cycle | ) | const |
function to check if current callback is scheduled at cycle
[in] | cycle |
bool AbstractJob::isJobScheduled | ( | unsigned long | cycle | ) | const |
function, which returns if the job is scheduled at cycle
[in] | cycle |
bool AbstractJob::isJobTimeout | ( | void | ) | const |
isJobTimeout
|
virtual |
Preperation of the job.
Function prepare() can be provided in the inherited class. Then AbstractJob::prepare() has to be called.
Useful when you use a cyclic job, because then the execution is scheduled and uses data provided by this function
Use it to
|
virtual |
Reset the job.
Function reset() can be provided in the inherited class. Then AbstractJob::reset() has to be called.
Use it to
void AbstractJob::setCallbackHook | ( | CallbackHook | hook | ) |
setCallbackHook
hook |
void AbstractJob::setCycleOffset | ( | unsigned long | cycle | ) |
setCycleOffset
cycle |
void AbstractJob::setCycleTime | ( | unsigned long | cycle | ) |
setCycleTime
cycle |
void AbstractJob::setExecutionCounter | ( | int | count | ) |
setExecutionCounter
count |
void AbstractJob::setJobName | ( | const std::string & | name | ) |
set a job name instead of the argument in constructor
with the same argument in the constructor, there can be multiple jobs with the same name.
void AbstractJob::setTimeoutTime | ( | double | time_s | ) |
setTimeoutTime
time_s |
void AbstractJob::skipFirstCycles | ( | unsigned | count | ) |
skipFirstNCycles
count |
|
virtual |
Suspension of the job.
Function suspend() can be provided in the inherited class. Then AbstractJob::suspend() has to be called.
Use it to
|
virtual |
Putting job into timeout.
Function timeout() can be provided in the inherited class. Then AbstractJob::timeout() has to be called.