SignalLogger
A library for signal logging.
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

◆ Worker() [1/6]

any_worker::Worker::Worker ( )
delete

◆ Worker() [2/6]

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

◆ Worker() [3/6]

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

◆ Worker() [4/6]

any_worker::Worker::Worker ( const WorkerOptions options)

◆ Worker() [5/6]

any_worker::Worker::Worker ( const Worker )
delete

◆ Worker() [6/6]

any_worker::Worker::Worker ( Worker &&  )

◆ ~Worker()

virtual any_worker::Worker::~Worker ( )
virtual

Member Function Documentation

◆ getName()

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

◆ getRate() [1/2]

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

◆ getRate() [2/2]

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

◆ isDestructible()

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

◆ isRunning()

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

◆ run()

void any_worker::Worker::run ( )
private

◆ setEnforceRate()

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

◆ setTimestep()

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

◆ start()

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

◆ stop()

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

Member Data Documentation

◆ done_

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

◆ options_

WorkerOptions any_worker::Worker::options_
private

◆ rate_

Rate any_worker::Worker::rate_
private

◆ running_

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

◆ thread_

std::thread any_worker::Worker::thread_
private

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