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

#include <Worker.hpp>

Public Member Functions

 Worker ()=delete
 
 Worker (const std::string &name, const double timestep, const WorkerCallback &callback)
 
 Worker (const std::string &name, const double timestep, const WorkerCallback &callback, const WorkerCallbackFailureReaction &callbackFailureReaction)
 
 Worker (const WorkerOptions &options)
 
 Worker (const Worker &)=delete
 
 Worker (Worker &&)
 
virtual ~Worker ()
 
bool start (const int priority=0)
 
void stop (const bool wait=true)
 
void setTimestep (const double timeStep)
 
void setEnforceRate (const bool enforceRate)
 
const std::string & getName () const
 
const RategetRate () const
 
RategetRate ()
 
bool isRunning () const
 
const bool isDestructible () const
 

Private Member Functions

void run ()
 

Private Attributes

WorkerOptions options_
 
std::atomic< bool > running_
 
std::atomic< bool > done_
 
std::thread thread_
 
Rate rate_
 

Constructor & Destructor Documentation

any_worker::Worker::Worker ( )
delete
any_worker::Worker::Worker ( const std::string &  name,
const double  timestep,
const WorkerCallback callback 
)
Parameters
namename of the worker
timestepwith a timestep of 0, the callback will be executed as fast as possible, with std::numeric_limits<double>::infinity() only once.
callbackstd::function pointing to the callback
any_worker::Worker::Worker ( const std::string &  name,
const double  timestep,
const WorkerCallback callback,
const WorkerCallbackFailureReaction callbackFailureReaction 
)
any_worker::Worker::Worker ( const WorkerOptions options)
any_worker::Worker::Worker ( const Worker )
delete
any_worker::Worker::Worker ( Worker &&  )
virtual any_worker::Worker::~Worker ( )
virtual

Member Function Documentation

const std::string& any_worker::Worker::getName ( ) const
inline
const Rate& any_worker::Worker::getRate ( ) const
inline
Rate& any_worker::Worker::getRate ( )
inline
const bool any_worker::Worker::isDestructible ( ) const
inline
Returns
true if underlying thread has terminated and deleteWhenDone_ option is set.
bool any_worker::Worker::isRunning ( ) const
inline
void any_worker::Worker::run ( )
private
void any_worker::Worker::setEnforceRate ( const bool  enforceRate)
void any_worker::Worker::setTimestep ( const double  timeStep)
bool any_worker::Worker::start ( const int  priority = 0)
void any_worker::Worker::stop ( const bool  wait = true)

Member Data Documentation

std::atomic<bool> any_worker::Worker::done_
private
WorkerOptions any_worker::Worker::options_
private
Rate any_worker::Worker::rate_
private
std::atomic<bool> any_worker::Worker::running_
private
std::thread any_worker::Worker::thread_
private

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