Public Member Functions | Private Member Functions | Private Attributes | List of all members
bota_worker::Worker Class Reference

#include <Worker.hpp>

Public Member Functions

const std::string & getName () const
 
const RategetRate () const
 
RategetRate ()
 
bool isDestructible () const
 
bool isRunning () const
 
void setEnforceRate (const bool enforceRate)
 
void setTimestep (const double timeStep)
 
bool start (const int priority=0)
 
void stop (const bool wait=true)
 
 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 &&) noexcept
 
virtual ~Worker ()
 

Private Member Functions

void run ()
 

Private Attributes

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

Detailed Description

Definition at line 55 of file Worker.hpp.

Constructor & Destructor Documentation

bota_worker::Worker::Worker ( )
delete
bota_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

Definition at line 52 of file Worker.cpp.

bota_worker::Worker::Worker ( const std::string &  name,
const double  timestep,
const WorkerCallback callback,
const WorkerCallbackFailureReaction callbackFailureReaction 
)

Definition at line 57 of file Worker.cpp.

bota_worker::Worker::Worker ( const WorkerOptions options)
explicit

Definition at line 63 of file Worker.cpp.

bota_worker::Worker::Worker ( const Worker )
delete
bota_worker::Worker::Worker ( Worker &&  other)
noexcept

Definition at line 68 of file Worker.cpp.

bota_worker::Worker::~Worker ( )
virtual

Definition at line 77 of file Worker.cpp.

Member Function Documentation

const std::string& bota_worker::Worker::getName ( ) const
inline

Definition at line 82 of file Worker.hpp.

const Rate& bota_worker::Worker::getRate ( ) const
inline

Definition at line 86 of file Worker.hpp.

Rate& bota_worker::Worker::getRate ( )
inline

Definition at line 90 of file Worker.hpp.

bool bota_worker::Worker::isDestructible ( ) const
inline
Returns
true if underlying thread has terminated and deleteWhenDone_ option is set.

Definition at line 103 of file Worker.hpp.

bool bota_worker::Worker::isRunning ( ) const
inline

Definition at line 95 of file Worker.hpp.

void bota_worker::Worker::run ( )
private

Definition at line 155 of file Worker.cpp.

void bota_worker::Worker::setEnforceRate ( const bool  enforceRate)

Definition at line 149 of file Worker.cpp.

void bota_worker::Worker::setTimestep ( const double  timeStep)

Definition at line 134 of file Worker.cpp.

bool bota_worker::Worker::start ( const int  priority = 0)

Definition at line 82 of file Worker.cpp.

void bota_worker::Worker::stop ( const bool  wait = true)

Definition at line 125 of file Worker.cpp.

Member Data Documentation

std::atomic<bool> bota_worker::Worker::done_
private

Definition at line 115 of file Worker.hpp.

WorkerOptions bota_worker::Worker::options_
private

Definition at line 112 of file Worker.hpp.

Rate bota_worker::Worker::rate_
private

Definition at line 118 of file Worker.hpp.

std::atomic<bool> bota_worker::Worker::running_
private

Definition at line 114 of file Worker.hpp.

std::thread bota_worker::Worker::thread_
private

Definition at line 117 of file Worker.hpp.


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


bota_worker
Author(s):
autogenerated on Wed Mar 3 2021 03:09:10