JobScheduler  1.1.0
CMJob::JobScheduler Class Reference

The singleton JobScheduler class handles AbstractJobs. More...

#include <CMJob.h>

Collaboration diagram for CMJob::JobScheduler:
Collaboration graph

Public Member Functions

void setCycleStep (unsigned short cycle_step)
 SetCycleStep sets the cycle step, in which the scheduler should operate. More...
 
void lock (unsigned long cycle, const std::function< void(void)> &fp)
 Lock locks the simulation, when a job is suspended and releases it, when this job gets prepared() within fp. More...
 
void addJob (const std::shared_ptr< AbstractJob > &job)
 AddJob adds the job to the container to handle it. More...
 
bool areJobsReady (unsigned long cycle) const
 AreJobsReady iterates through all jobs and checks if they are ready. More...
 
bool areJobsTimeout (void) const
 AreJobsTimedout iterates through all jobs and checks if they are timedout. More...
 
void executeJobs (CallbackHook hook, unsigned long cycle)
 ExecuteJobs executes jobs at the defined hook point. More...
 
void updateJobs (unsigned long cycle_current)
 UpdateJobs iterates through all jobs and only sets individual jobs active, when the job cycle is met. Also updates every job. More...
 
void resetJobs (void)
 ResetJobs iterates through all jobs and sets them all to active.
 
void disableJobs (void)
 DisableJobs iterates through all jobs and sets them all to disabled.
 
std::shared_ptr< CMJob::AbstractJobgetJob (const std::string &name) const
 GetJob returns the job with name. More...
 
void deleteJobs (void)
 DeleteJobs removes all jobs from the scheduler.
 
void deleteJob (const std::string &name)
 DeleteJob remove a job from the scheduler. More...
 
void printJobs (void) const
 PrintJobs prints all jobs from the scheduler.
 

Static Public Member Functions

static JobSchedulerinstance ()
 instance singleton More...
 

Detailed Description

The singleton JobScheduler class handles AbstractJobs.

Member Function Documentation

◆ addJob()

void JobScheduler::addJob ( const std::shared_ptr< AbstractJob > &  job)

AddJob adds the job to the container to handle it.

Parameters
jobhas to be a derived class of AbstractJob

◆ areJobsReady()

bool JobScheduler::areJobsReady ( unsigned long  cycle) const

AreJobsReady iterates through all jobs and checks if they are ready.

Returns
state, if all jobs are ready at current timestamp
Parameters
[in]cycle
Here is the caller graph for this function:

◆ areJobsTimeout()

bool JobScheduler::areJobsTimeout ( void  ) const

AreJobsTimedout iterates through all jobs and checks if they are timedout.

Returns
state, if any job is in overtime
Here is the caller graph for this function:

◆ deleteJob()

void JobScheduler::deleteJob ( const std::string &  name)

DeleteJob remove a job from the scheduler.

Parameters
[in]nameof the job

◆ executeJobs()

void JobScheduler::executeJobs ( CallbackHook  hook,
unsigned long  cycle 
)

ExecuteJobs executes jobs at the defined hook point.

Parameters
[in]hook
[in]cycle

◆ getJob()

std::shared_ptr< CMJob::AbstractJob > JobScheduler::getJob ( const std::string &  name) const

GetJob returns the job with name.

Parameters
nameof the job
Returns
reference to the job

◆ instance()

static JobScheduler& CMJob::JobScheduler::instance ( )
inlinestatic

instance singleton

Returns
singleton instance of the class JobScheduler

◆ lock()

void JobScheduler::lock ( unsigned long  cycle,
const std::function< void(void)> &  fp 
)

Lock locks the simulation, when a job is suspended and releases it, when this job gets prepared() within fp.

Parameters
[in]cycle
[in]fpfunction pointer, which prepares the suspended job to be ready
Here is the call graph for this function:

◆ setCycleStep()

void JobScheduler::setCycleStep ( unsigned short  cycle_step)

SetCycleStep sets the cycle step, in which the scheduler should operate.

Parameters
cycle_step(default = 1ms)

◆ updateJobs()

void JobScheduler::updateJobs ( unsigned long  cycle_current)

UpdateJobs iterates through all jobs and only sets individual jobs active, when the job cycle is met. Also updates every job.

Parameters
[in]cycle_current