#include <Executor.h>
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/
◆ 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,
|
◆ Executor()
Constructor.
- Parameters
-
stateMachine | SCXML document to be executed. |
context | Data context that be needed by the actions and do-activities to be executed. |
events | Shared 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()
◆ addEventListener()
Add a listener to the event notifications.
- Parameters
-
eventListener | Listener to be added. |
◆ addStatusListener()
Add a listener to the status notifications.
- Parameters
-
statusListener | Listener to be added. |
◆ formatModel()
std::string Executor::formatModel |
( |
| ) |
|
- Returns
- The in-memory loaded SCXML model to be executed.
◆ formatStatus()
std::string Executor::formatStatus |
( |
const bool |
usefullyqualified = false | ) |
|
- Returns
- The identifiers of current active states.
- Parameters
-
usefullyqualified | if 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()
- Returns
- The currently configured event handling policy.
◆ getStatus()
std::list< State * > Executor::getStatus |
( |
| ) |
|
- Returns
- The current active states.
◆ isFinal()
bool Executor::isFinal |
( |
| ) |
|
- Returns
- true if the interpreter has reached a final state.
◆ isRunning()
bool Executor::isRunning |
( |
| ) |
|
- Returns
- true if the interpreter has not been terminated.
◆ postEvent()
void 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
-
◆ printStatus()
void Executor::printStatus |
( |
const bool |
usefullyqualified = false | ) |
|
Prints via the logger the result of formatStatus().
- Parameters
-
usefullyqualified | See formatStatus. |
◆ processEvent() [1/2]
void 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 Executor::processEvent |
( |
Event * |
e | ) |
|
Add an event in the event queue and then the processEvent() method is invoked.
- Parameters
-
◆ removeAllEventListener()
void Executor::removeAllEventListener |
( |
| ) |
|
Remove all event notification listeners.
◆ removeAllStatusListener()
void Executor::removeAllStatusListener |
( |
| ) |
|
Remove all status notification listeners.
◆ removeEventListener()
void Executor::removeEventListener |
( |
EventListener * |
eventListener | ) |
|
Remove a listener from the event notifications.
- Parameters
-
eventListener | Listener to be removed. |
◆ removeStatusListener()
void Executor::removeStatusListener |
( |
StatusListener * |
statusListener | ) |
|
Remove a listener from the status notifications.
- Parameters
-
statusListener | Listener to be removed. |
◆ run()
This method can be used when starting the SCXML execution on a secondary thread.
◆ setContext()
void Executor::setContext |
( |
Context * |
context | ) |
|
Set the context to be passed to the Action and Do-Activities.
- Parameters
-
◆ setEventHandlingPolicy()
Configure the event handling policy.
- Parameters
-
policy | Specifies how to processed events. |
◆ start()
Start the SCXML execution.
◆ startSM()
void Executor::startSM |
( |
| ) |
|
Start the execution of the SCXML document. TODO to be made private?
◆ stop()
Stop the SCXML execution.
◆ stopSM()
void 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: