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
 
RategetRate ()
 
const RategetRate () const
 
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 Worker &)=delete
 
 Worker (const WorkerOptions &options)
 
 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

◆ Worker() [1/6]

bota_worker::Worker::Worker ( )
delete

◆ Worker() [2/6]

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.

◆ Worker() [3/6]

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.

◆ Worker() [4/6]

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

Definition at line 63 of file Worker.cpp.

◆ Worker() [5/6]

bota_worker::Worker::Worker ( const Worker )
delete

◆ Worker() [6/6]

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

Definition at line 68 of file Worker.cpp.

◆ ~Worker()

bota_worker::Worker::~Worker ( )
virtual

Definition at line 77 of file Worker.cpp.

Member Function Documentation

◆ getName()

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

Definition at line 82 of file Worker.hpp.

◆ getRate() [1/2]

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

Definition at line 90 of file Worker.hpp.

◆ getRate() [2/2]

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

Definition at line 86 of file Worker.hpp.

◆ isDestructible()

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.

◆ isRunning()

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

Definition at line 95 of file Worker.hpp.

◆ run()

void bota_worker::Worker::run ( )
private

Definition at line 155 of file Worker.cpp.

◆ setEnforceRate()

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

Definition at line 149 of file Worker.cpp.

◆ setTimestep()

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

Definition at line 134 of file Worker.cpp.

◆ start()

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

Definition at line 82 of file Worker.cpp.

◆ stop()

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

Definition at line 125 of file Worker.cpp.

Member Data Documentation

◆ done_

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

Definition at line 115 of file Worker.hpp.

◆ options_

WorkerOptions bota_worker::Worker::options_
private

Definition at line 112 of file Worker.hpp.

◆ rate_

Rate bota_worker::Worker::rate_
private

Definition at line 118 of file Worker.hpp.

◆ running_

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

Definition at line 114 of file Worker.hpp.

◆ thread_

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 Sat Apr 15 2023 02:53:50