12 #include <unordered_map> 26 inline bool addWorker(
const std::string& name,
const double timestep,
bool (T::*fp)(
const WorkerEvent&), T* obj,
27 const int priority = 0,
const bool autostart =
true)
29 return addWorker(
WorkerOptions(name, timestep, std::bind(fp, obj, std::placeholders::_1), priority), autostart);
34 void (T::*rfp)(), T* obj,
const int priority = 0,
const bool autostart =
true)
37 WorkerOptions(name, timestep, std::bind(cfp, obj, std::placeholders::_1), std::bind(rfp, obj), priority),
42 const int priority = 0,
const bool autostart =
true)
49 const bool autostart =
true)
62 void startWorker(
const std::string& name,
const int priority = 0);
68 void stopWorker(
const std::string& name,
const bool wait =
true);
72 void cancelWorker(
const std::string& name,
const bool wait =
true);
87 std::unordered_map<std::string, Worker>
workers_;
bool hasWorker(const std::string &name)
bool addWorker(const std::string &name, const double timestep, bool(T::*cfp)(const WorkerEvent &), void(T::*rfp)(), T *obj, const int priority=0, const bool autostart=true)
void cleanDestructibleWorkers()
void stopWorker(const std::string &name, const bool wait=true)
bool addWorker(const std::string &name, const double timestep, const WorkerCallback &callback, const int priority=0, const bool autostart=true)
std::function< void(void)> WorkerCallbackFailureReaction
std::function< bool(const WorkerEvent &)> WorkerCallback
bool addWorker(const std::string &name, const double timestep, const WorkerCallback &callback, const WorkerCallbackFailureReaction &callbackFailureReaction, const int priority=0, const bool autostart=true)
void setWorkerTimestep(const std::string &name, const double timeStep)
void stopWorkers(const bool wait=true)
std::unordered_map< std::string, Worker > workers_
void cancelWorkers(const bool wait=true)
void startWorker(const std::string &name, const int priority=0)
bool addWorker(const std::string &name, const double timestep, bool(T::*fp)(const WorkerEvent &), T *obj, const int priority=0, const bool autostart=true)
void cancelWorker(const std::string &name, const bool wait=true)