LocalGuidance
A library that generates velocity references to follow a path.
any_worker::WorkerManager Class Reference

#include <WorkerManager.hpp>

Public Member Functions

 WorkerManager ()
 
virtual ~WorkerManager ()
 
template<class T >
bool addWorker (const std::string &name, const double timestep, bool(T::*fp)(const WorkerEvent &), T *obj, const int priority=0, const bool autostart=true)
 
template<class T >
bool addWorker (const std::string &name, const double timestep, bool(T::*cfp)(const WorkerEvent &), void(T::*rfp)(void), T *obj, const int priority=0, const bool autostart=true)
 
bool addWorker (const std::string &name, const double timestep, const WorkerCallback &callback, const int priority=0, const bool autostart=true)
 
bool addWorker (const std::string &name, const double timestep, const WorkerCallback &callback, const WorkerCallbackFailureReaction &callbackFailureReaction, const int priority=0, const bool autostart=true)
 
bool addWorker (const WorkerOptions &options, const bool autostart=true)
 
void startWorker (const std::string &name, const int priority=0)
 
void startWorkers ()
 
bool hasWorker (const std::string &name)
 
void stopWorker (const std::string &name, const bool wait=true)
 
void stopWorkers (const bool wait=true)
 
void cancelWorker (const std::string &name, const bool wait=true)
 
void cancelWorkers (const bool wait=true)
 
void setWorkerTimestep (const std::string &name, const double timeStep)
 
void clearWorkers ()
 
void cleanDestructibleWorkers ()
 

Private Attributes

std::unordered_map< std::string, Workerworkers_
 
std::mutex mutexWorkers_
 

Constructor & Destructor Documentation

any_worker::WorkerManager::WorkerManager ( )
virtual any_worker::WorkerManager::~WorkerManager ( )
virtual

Member Function Documentation

template<class T >
bool any_worker::WorkerManager::addWorker ( const std::string &  name,
const double  timestep,
bool(T::*)(const WorkerEvent &)  fp,
T *  obj,
const int  priority = 0,
const bool  autostart = true 
)
inline
template<class T >
bool any_worker::WorkerManager::addWorker ( const std::string &  name,
const double  timestep,
bool(T::*)(const WorkerEvent &)  cfp,
void(T::*)(void)  rfp,
T *  obj,
const int  priority = 0,
const bool  autostart = true 
)
inline
bool any_worker::WorkerManager::addWorker ( const std::string &  name,
const double  timestep,
const WorkerCallback callback,
const int  priority = 0,
const bool  autostart = true 
)
inline
bool any_worker::WorkerManager::addWorker ( const std::string &  name,
const double  timestep,
const WorkerCallback callback,
const WorkerCallbackFailureReaction callbackFailureReaction,
const int  priority = 0,
const bool  autostart = true 
)
inline
bool any_worker::WorkerManager::addWorker ( const WorkerOptions options,
const bool  autostart = true 
)
void any_worker::WorkerManager::cancelWorker ( const std::string &  name,
const bool  wait = true 
)
void any_worker::WorkerManager::cancelWorkers ( const bool  wait = true)
void any_worker::WorkerManager::cleanDestructibleWorkers ( )

Removes workers which are destructible (see Worker::isDestructible()) from the map (calling their destructors)

void any_worker::WorkerManager::clearWorkers ( )

Requests all workers to stop, then joins their threads and deletes their instances.

bool any_worker::WorkerManager::hasWorker ( const std::string &  name)
void any_worker::WorkerManager::setWorkerTimestep ( const std::string &  name,
const double  timeStep 
)
void any_worker::WorkerManager::startWorker ( const std::string &  name,
const int  priority = 0 
)
void any_worker::WorkerManager::startWorkers ( )
void any_worker::WorkerManager::stopWorker ( const std::string &  name,
const bool  wait = true 
)
void any_worker::WorkerManager::stopWorkers ( const bool  wait = true)

Member Data Documentation

std::mutex any_worker::WorkerManager::mutexWorkers_
private
std::unordered_map<std::string, Worker> any_worker::WorkerManager::workers_
private

The documentation for this class was generated from the following file: