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. More... | |
typedef std::function< void()> | JobCallback |
The signature for job callbacks. More... | |
Public Member Functions | |
BackgroundProcessing (const BackgroundProcessing &)=delete | |
BackgroundProcessing cannot be copy-constructed. More... | |
BackgroundProcessing & | operator= (const BackgroundProcessing &)=delete |
BackgroundProcessing cannot be copy-assigned. More... | |
BackgroundProcessing () | |
Constructor. The background thread is activated automatically. More... | |
~BackgroundProcessing () | |
Finishes currently executing job, clears the remaining queue. More... | |
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. More... | |
std::size_t | getJobCount () const |
Get the size of the queue of jobs (includes currently processed job). More... | |
void | clear () |
Clear the queue of jobs. More... | |
void | setJobUpdateEvent (const JobUpdateCallback &event) |
Set the callback to be triggered when events in JobEvent take place. More... | |
void | clearJobUpdateEvent () |
Clear the callback to be triggered when events in JobEvent take place. More... | |
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 48 of file background_processing.cpp.
moveit::tools::BackgroundProcessing::~BackgroundProcessing | ( | ) |
Finishes currently executing job, clears the remaining queue.
Definition at line 56 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 100 of file background_processing.cpp.
void moveit::tools::BackgroundProcessing::clear | ( | ) |
Clear the queue of jobs.
Definition at line 112 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 139 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 127 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 133 of file background_processing.cpp.