moveit2
The MoveIt Motion Planning Framework for ROS 2.
|
This class provides simple API for executing background jobs. A queue of jobs is created and the specified jobs are executed in order, one at a time. More...
#include <background_processing.hpp>
Public Types | |
enum | JobEvent { ADD , REMOVE , COMPLETE } |
Events for jobs. More... | |
typedef std::function< void(JobEvent, const std::string &)> | JobUpdateCallback |
The signature for callback triggered when job events take place: the event that took place and the name of the job. | |
typedef std::function< void()> | JobCallback |
The signature for job callbacks. | |
Public Member Functions | |
BackgroundProcessing (const BackgroundProcessing &)=delete | |
BackgroundProcessing cannot be copy-constructed. | |
BackgroundProcessing & | operator= (const BackgroundProcessing &)=delete |
BackgroundProcessing cannot be copy-assigned. | |
BackgroundProcessing () | |
Constructor. The background thread is activated automatically. | |
~BackgroundProcessing () | |
Finishes currently executing job, clears the remaining queue. | |
void | addJob (const JobCallback &job, const std::string &name) |
Add a job to the queue of jobs to execute. A name is also specifies for the job. | |
std::size_t | getJobCount () const |
Get the size of the queue of jobs (includes currently processed job). | |
void | clear () |
Clear the queue of jobs. | |
void | setJobUpdateEvent (const JobUpdateCallback &event) |
Set the callback to be triggered when events in JobEvent take place. | |
void | clearJobUpdateEvent () |
Clear the callback to be triggered when events in JobEvent take place. | |
This class provides simple API for executing background jobs. A queue of jobs is created and the specified jobs are executed in order, one at a time.
Definition at line 56 of file background_processing.hpp.
typedef std::function<void()> moveit::tools::BackgroundProcessing::JobCallback |
The signature for job callbacks.
Definition at line 85 of file background_processing.hpp.
typedef std::function<void(JobEvent, const std::string&)> moveit::tools::BackgroundProcessing::JobUpdateCallback |
The signature for callback triggered when job events take place: the event that took place and the name of the job.
Definition at line 82 of file background_processing.hpp.
Events for jobs.
Enumerator | |
---|---|
ADD | Called when a job is added to the queue. |
REMOVE | Called when a job is removed from the queue without execution. |
COMPLETE | Called when a job is completed (and removed from the queue) |
Definition at line 70 of file background_processing.hpp.
|
delete |
BackgroundProcessing cannot be copy-constructed.
moveit::tools::BackgroundProcessing::BackgroundProcessing | ( | ) |
Constructor. The background thread is activated automatically.
Definition at line 46 of file background_processing.cpp.
moveit::tools::BackgroundProcessing::~BackgroundProcessing | ( | ) |
Finishes currently executing job, clears the remaining queue.
Definition at line 54 of file background_processing.cpp.
void moveit::tools::BackgroundProcessing::addJob | ( | const JobCallback & | job, |
const std::string & | name | ||
) |
Add a job to the queue of jobs to execute. A name is also specifies for the job.
Definition at line 99 of file background_processing.cpp.
void moveit::tools::BackgroundProcessing::clear | ( | ) |
Clear the queue of jobs.
Definition at line 111 of file background_processing.cpp.
void moveit::tools::BackgroundProcessing::clearJobUpdateEvent | ( | ) |
Clear the callback to be triggered when events in JobEvent take place.
Definition at line 140 of file background_processing.cpp.
std::size_t moveit::tools::BackgroundProcessing::getJobCount | ( | ) | const |
Get the size of the queue of jobs (includes currently processed job).
Definition at line 128 of file background_processing.cpp.
|
delete |
BackgroundProcessing cannot be copy-assigned.
void moveit::tools::BackgroundProcessing::setJobUpdateEvent | ( | const JobUpdateCallback & | event | ) |
Set the callback to be triggered when events in JobEvent take place.
Definition at line 134 of file background_processing.cpp.