42 enum class JobState { New, Active, Ready, Idle, Suspended, Timeout, Disabled };
91 void setCycleTime(
unsigned long cycle);
96 void setCycleOffset(
unsigned long cycle);
101 void setTimeoutTime(
double time_s);
106 void setExecutionCounter(
int count);
111 void skipFirstCycles(
unsigned count);
142 virtual void activate();
156 virtual void prepare();
167 virtual void execute() = 0;
178 virtual void suspend();
186 virtual void timeout();
197 virtual void disable();
208 virtual void reset();
225 bool isJobScheduled(
unsigned long cycle)
const;
232 bool isCallbackScheduled(
unsigned long cycle)
const;
238 bool isJobTimeout(
void)
const;
241 std::string getJobName()
const;
242 unsigned long getCycleTime()
const;
243 unsigned long getCycleOffset()
const;
244 bool isSynchronized()
const;
245 unsigned long getCycle()
const;
248 std::string getJobTypeName()
const;
251 std::string getCallbackHookName()
const;
254 std::string getJobStateName()
const;
257 void setCycle(
unsigned long cycle);
265 void setJobName(
const std::string& name);
278 std::unique_ptr<Impl> impl_;
301 void setCycleStep(
unsigned short cycle_step);
310 void lock(
unsigned long cycle,
const std::function<
void(
void)>& fp);
317 void addJob(
const std::shared_ptr<AbstractJob>& job);
324 bool areJobsReady(
unsigned long cycle)
const;
330 bool areJobsTimeout(
void)
const;
338 void executeJobs(
CallbackHook hook,
unsigned long cycle);
345 void updateJobs(
unsigned long cycle_current);
350 void resetJobs(
void);
355 void disableJobs(
void);
362 std::shared_ptr<CMJob::AbstractJob> getJob(
const std::string& name)
const;
367 void deleteJobs(
void);
373 void deleteJob(
const std::string& name);
378 void printJobs(
void)
const;
386 std::vector<std::shared_ptr<AbstractJob>> Jobs_;
388 unsigned short cycle_step_ = 1;
401 static void setLog(
void (*pLog)(
const char* format, ...));
402 static void setLogWarn(
void (*pLogWarn)(
unsigned ECId,
const char* format,
404 static void setLogErr(
void (*pLogErr)(
unsigned ECId,
const char* format,
409 static void printLog(
const std::string& out);
410 static void printWarn(
unsigned ECId,
const std::string& out);
411 static void printError(
unsigned ECId,
const std::string& out);
414 static void (*cm_log)(
const char* format, ...);
415 static void (*cm_log_warn_f)(
unsigned ECId,
const char* format,
417 static void (*cm_log_err_f)(
unsigned ECId,
const char* format,
called periodically at the end of the job
The Log class.
Definition: CMJob.h:398
static JobScheduler & instance()
instance singleton
Definition: CMJob.h:291
JobState
Definition: CMJob.h:42
JobType
Definition: CMJob.h:30
The AbstractJob class provides an interface for jobs.
Definition: CMJob.h:74
CallbackHook
Definition: CMJob.h:52
The singleton JobScheduler class handles AbstractJobs.
Definition: CMJob.h:285