rad 6.2.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
rad::ExecutorActivity< Executor, Func > Class Template Reference

#include <executorActivity.hpp>

Inheritance diagram for rad::ExecutorActivity< Executor, Func >:
scxml4cpp::Activity

Public Member Functions

 ExecutorActivity (const std::string &id, Executor ex, Func &&func)
 
 ExecutorActivity (const ExecutorActivity &)=delete
 
ExecutorActivityoperator= (const ExecutorActivity &)=delete
 Disable copy constructor.
 
void start (scxml4cpp::Context *c) override
 Disable assignment operator.
 
void stop (scxml4cpp::Context *c) override
 
- Public Member Functions inherited from scxml4cpp::Activity
 Activity (const std::string &id)
 
virtual ~Activity ()
 
std::string getId () const
 
void setId (const std::string &id)
 

Detailed Description

template<class Executor, class Func>
class rad::ExecutorActivity< Executor, Func >

This class is the base class for boost ASIO (and compatible) executor do-activities.

Note
When requested to stop (scxml4cpp::stop()) there needs to be a way to synchronously await the completion (as required by the scxml4cpp::Activity interface). This is an inherent friction in the transition between a synchronous API and an asynchronous API. This also carries a risk of deadlock if the same single-threaded executor is used to await the activity and to complete the stop of the activity. One possibility is to require the Run() method to be synchronous as well, and will thus consume a whole thread from the executor.

Func requirements:

Callable with signature void(Executor, StopToken) Copyable.

Constructor & Destructor Documentation

◆ ExecutorActivity() [1/2]

template<class Executor , class Func >
rad::ExecutorActivity< Executor, Func >::ExecutorActivity ( const std::string & id,
Executor ex,
Func && func )
inlineexplicit

◆ ExecutorActivity() [2/2]

template<class Executor , class Func >
rad::ExecutorActivity< Executor, Func >::ExecutorActivity ( const ExecutorActivity< Executor, Func > & )
delete

Member Function Documentation

◆ operator=()

template<class Executor , class Func >
ExecutorActivity & rad::ExecutorActivity< Executor, Func >::operator= ( const ExecutorActivity< Executor, Func > & )
delete

Disable copy constructor.

◆ start()

template<class Executor , class Func >
void rad::ExecutorActivity< Executor, Func >::start ( scxml4cpp::Context * c)
overridevirtual

Disable assignment operator.

Start activity by invoking provided Func in provided Executor.

Implements scxml4cpp::start() and is invoked by state machine engine.

Precondition
Activity is not running.

Implements scxml4cpp::Activity.

◆ stop()

template<class Executor , class Func >
void rad::ExecutorActivity< Executor, Func >::stop ( scxml4cpp::Context * c)
overridevirtual

Stop activity. If activity is already completed it does nothing.

Implements scxml4cpp::stop() and is invoked by state machine engine.

Implements scxml4cpp::Activity.


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