libpalliate v0.0.1
Palliate core library
runnable Class Referenceabstract

#include <runnable.h>

Inheritance diagram for runnable:

Public Types

using callback_f = std::function< void()>
 
using callback_t = std::stop_callback< callback_f >
 

Public Member Functions

 runnable (std::string const &_name)
 
virtual ~runnable ()
 
virtual void operator() (std::stop_token token={})
 
void run ()
 
void run (callback_f _callback)
 
void stop ()
 
auto operator<=> (runnable const &other) const
 

Protected Member Functions

virtual bool setup ()
 
virtual bool loop ()=0
 

Protected Attributes

std::jthread thread
 
std::unique_ptr< callback_tcallback
 

Member Typedef Documentation

◆ callback_f

using runnable::callback_f = std::function<void()>

◆ callback_t

using runnable::callback_t = std::stop_callback<callback_f>

Constructor & Destructor Documentation

◆ runnable()

runnable::runnable ( std::string const &  _name)
explicit

◆ ~runnable()

runnable::~runnable ( )
virtual

Member Function Documentation

◆ loop()

virtual bool runnable::loop ( )
protectedpure virtual

◆ operator()()

void runnable::operator() ( std::stop_token  token = {})
virtual

◆ operator<=>()

auto runnable::operator<=> ( runnable const &  other) const

◆ run() [1/2]

void runnable::run ( )

◆ run() [2/2]

void runnable::run ( callback_f  _callback)

◆ setup()

virtual bool runnable::setup ( )
inlineprotectedvirtual

◆ stop()

void runnable::stop ( )

Member Data Documentation

◆ callback

std::unique_ptr<callback_t> runnable::callback
protected

◆ thread

std::jthread runnable::thread
protected

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