rad 6.2.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
scxml4cpp::Executor Class Reference

#include <Executor.h>

Public Types

enum  EventHandlingPolicy { SILENT = 0 , REJECT , DEFFERRED }
 

Public Member Functions

 Executor (StateMachine &stateMachine, Context *context, EventQueue &events)
 
 ~Executor ()
 
std::string formatStatus (const bool usefullyqualified=false)
 
std::string formatModel ()
 
std::list< State * > getStatus ()
 
void printStatus (const bool usefullyqualified=false)
 
void setContext (Context *context)
 
void setEventHandlingPolicy (const EventHandlingPolicy policy)
 
EventHandlingPolicy getEventHandlingPolicy ()
 
void addEventListener (EventListener *eventListener)
 
void removeEventListener (EventListener *eventListener)
 
void removeAllEventListener ()
 
void addStatusListener (StatusListener *statusListener)
 
void removeStatusListener (StatusListener *statusListener)
 
void removeAllStatusListener ()
 
void startSM ()
 
void stopSM ()
 
void start ()
 
void stop ()
 
void run ()
 
void postEvent (Event *e)
 
void processEvent ()
 
void processEvent (Event *e)
 
bool isRunning ()
 
bool isFinal ()
 

Detailed Description

This class implements an SCXML interpreter.

The execution algorithm is based on a subset of the W3C SCXML specifications: https://www.w3.org/TR/scxml/

Member Enumeration Documentation

◆ EventHandlingPolicy

enum scxml4cpp::Executor::EventHandlingPolicy

Event handling policies.

Enumerator
SILENT 
REJECT 

Event is silently rejected if transition is not enabled.

DEFFERRED 

Event is rejected with notification, if transition is not enabled.

Not supported,

Constructor & Destructor Documentation

◆ Executor()

scxml4cpp::Executor::Executor ( StateMachine & stateMachine,
Context * context,
EventQueue & events )

Constructor.

Parameters
stateMachineSCXML document to be executed.
contextData context that be needed by the actions and do-activities to be executed.
eventsShared queue used to inject events to be processed by the interpreter.

State machine executor.

This class is based on the algorithm presented in Appendix B of the "State Chart (SCXML): State Machine Notation for Control Abstraction", W3C working draft, 2009-10-29.

◆ ~Executor()

scxml4cpp::Executor::~Executor ( )

Destructor.

Member Function Documentation

◆ addEventListener()

void scxml4cpp::Executor::addEventListener ( EventListener * eventListener)

Add a listener to the event notifications.

Parameters
eventListenerListener to be added.

◆ addStatusListener()

void scxml4cpp::Executor::addStatusListener ( StatusListener * statusListener)

Add a listener to the status notifications.

Parameters
statusListenerListener to be added.

◆ formatModel()

std::string scxml4cpp::Executor::formatModel ( )
Returns
The in-memory loaded SCXML model to be executed.

◆ formatStatus()

std::string scxml4cpp::Executor::formatStatus ( const bool usefullyqualified = false)
Returns
The identifiers of current active states.
Parameters
usefullyqualifiedif true the atomic state identifier contains already all the information related to the parent states. If false the atomic state identifier is build concatenating the parents state identifiers.

◆ getEventHandlingPolicy()

Executor::EventHandlingPolicy scxml4cpp::Executor::getEventHandlingPolicy ( )
Returns
The currently configured event handling policy.

◆ getStatus()

std::list< State * > scxml4cpp::Executor::getStatus ( )
Returns
The current active states.

◆ isFinal()

bool scxml4cpp::Executor::isFinal ( )
Returns
true if the interpreter has reached a final state.

◆ isRunning()

bool scxml4cpp::Executor::isRunning ( )
Returns
true if the interpreter has not been terminated.

◆ postEvent()

void scxml4cpp::Executor::postEvent ( Event * e)

Adds an event to be processed to the event queue. The method returns immediately. The added process is processed only if the interpreter is started as secondary thread (see run() method).

Parameters
eEvent to be processed.

◆ printStatus()

void scxml4cpp::Executor::printStatus ( const bool usefullyqualified = false)

Prints via the logger the result of formatStatus().

Parameters
usefullyqualifiedSee formatStatus.

◆ processEvent() [1/2]

void scxml4cpp::Executor::processEvent ( )

Process to completion the next event in the event queue. The method returns when the next event in the queue has been fully processed.

◆ processEvent() [2/2]

void scxml4cpp::Executor::processEvent ( Event * e)

Add an event in the event queue and then the processEvent() method is invoked.

Parameters
eEvent to be added.

◆ removeAllEventListener()

void scxml4cpp::Executor::removeAllEventListener ( )

Remove all event notification listeners.

◆ removeAllStatusListener()

void scxml4cpp::Executor::removeAllStatusListener ( )

Remove all status notification listeners.

◆ removeEventListener()

void scxml4cpp::Executor::removeEventListener ( EventListener * eventListener)

Remove a listener from the event notifications.

Parameters
eventListenerListener to be removed.

◆ removeStatusListener()

void scxml4cpp::Executor::removeStatusListener ( StatusListener * statusListener)

Remove a listener from the status notifications.

Parameters
statusListenerListener to be removed.

◆ run()

void scxml4cpp::Executor::run ( )

This method can be used when starting the SCXML execution on a secondary thread.

◆ setContext()

void scxml4cpp::Executor::setContext ( Context * context)

Set the context to be passed to the Action and Do-Activities.

Parameters
contextContext to be used with Action and Do-Activities.

◆ setEventHandlingPolicy()

void scxml4cpp::Executor::setEventHandlingPolicy ( const EventHandlingPolicy policy)

Configure the event handling policy.

Parameters
policySpecifies how to processed events.

◆ start()

void scxml4cpp::Executor::start ( )

Start the SCXML execution.

◆ startSM()

void scxml4cpp::Executor::startSM ( )

Start the execution of the SCXML document. TODO to be made private?

◆ stop()

void scxml4cpp::Executor::stop ( )

Stop the SCXML execution.

◆ stopSM()

void scxml4cpp::Executor::stopSM ( )

Stop the execution of the SCXML document. TODO to be made private?


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