Symmetri
Loading...
Searching...
No Matches
callback.h File Reference
#include <memory>
#include "symmetri/types.h"

Go to the source code of this file.

Classes

class  symmetri::Callback
 Callback is a wrapper around any type that you to tie to a transition. Typically this is an invokable object, such as a function, that executes some side-effects, but it can by anything if you implement a fire function for it. The output can be used to communicate success or failure to the petri-net executor. You can create custom behavior by defining a tailored "Token fire(const A&)" for your class A. More...
 

Functions

template<typename T >
bool symmetri::isSynchronous (const T &)
 Checks if the callback is synchronous. Synchronous callbacks are immediately executed inside the Petri net executor. Asynchronous callbacks are deferred to the TaskSystem.
 
template<typename T >
void symmetri::cancel (const T &)
 The default cancel implementation is naive. It only returns a user-exit state and does nothing to the actual Callback itself, and it will still complete. Because the transition is by default not cancelled, it will produce a reducer which potentially can still be processed.
 
template<typename T >
void symmetri::pause (const T &)
 Implements a pause action for a Callback. By default it does nothing and not pause the Callback.
 
template<typename T >
void symmetri::resume (const T &)
 Templates a resume action for a Callback. By default it does nothing and not resume the Callback.
 
template<typename T >
Token symmetri::fire (const T &callback)
 Generates a Token based on what kind of information the Callback returns.
 
template<typename T >
Eventlog symmetri::getLog (const T &)
 Get the Log object. By default it returns an empty vector.
 

Function Documentation

◆ cancel()

template<typename T >
void symmetri::cancel ( const T & )

The default cancel implementation is naive. It only returns a user-exit state and does nothing to the actual Callback itself, and it will still complete. Because the transition is by default not cancelled, it will produce a reducer which potentially can still be processed.

Template Parameters
Tthe type of the callback.

◆ fire()

template<typename T >
Token symmetri::fire ( const T & callback)

Generates a Token based on what kind of information the Callback returns.

Template Parameters
Tthe type of the callback.
Parameters
callbackThe function to be executed.
Returns
Token Contains information on the result-state and possible eventlog of the callback.

◆ getLog()

template<typename T >
Eventlog symmetri::getLog ( const T & )

Get the Log object. By default it returns an empty vector.

Template Parameters
Tthe type of the callback.
Returns
Eventlog

◆ isSynchronous()

template<typename T >
bool symmetri::isSynchronous ( const T & )

Checks if the callback is synchronous. Synchronous callbacks are immediately executed inside the Petri net executor. Asynchronous callbacks are deferred to the TaskSystem.

Template Parameters
Tthe type of the callback.
Returns
true the callback will be executed synchronously.
false the callback will be executed asynchronously

◆ pause()

template<typename T >
void symmetri::pause ( const T & )

Implements a pause action for a Callback. By default it does nothing and not pause the Callback.

Template Parameters
Tthe type of the callback.

◆ resume()

template<typename T >
void symmetri::resume ( const T & )

Templates a resume action for a Callback. By default it does nothing and not resume the Callback.

Template Parameters
Tthe type of the callback.