rad 6.2.0
|
#include <Action.h>
Public Member Functions | |
Action (const std::string &id) | |
virtual | ~Action () |
std::string | getId () const |
std::string | getParam () const |
void | setId (const std::string &id) |
void | setParam (const std::string &p) |
virtual void | execute (Context *c)=0 |
virtual bool | evaluate (Context *c)=0 |
This class represents an interface for an Action.
An action is a piece of code executed by the State Machine interpreter. Since the execution is synchronous, it is blocking the interpretation of the SCXML document.
The implementation of the action can be added by sub-classing and implementing the execute() virtual method.
This class can also be used to implement a guard by sub-classing and implementing the evaluate() virtual method.
Actions can be executed when entering, exiting, or transitioning to a state.
Guards are evaluated before taking a transition.
scxml4cpp::Action::Action | ( | const std::string & | id | ) |
Create a generic action object.
id | Identifier of the action. |
|
virtual |
|
pure virtual |
Evaluate a guard condition usually verified before taking a transition. The evaluation is blocking the State Machine interpreter and therefore should be short (ideally it should last 0 time).
c | Context for the execution of the action. |
Implemented in scxml4cpp::ActionTrace, rad::ActionCallback, MyAction, SignalAction, TestDummyAction, ReplyAction, ReplyAction, TimerAction, TrsHealthAction, MyAction, TestExecutableContentAction, TestExecutableContentAction2, TestExecutorAction, TestHelperAction, TestMergerAction, TestCondition, TestAction, TestCondition, TestAppendAction, TestDOMSCXMLReaderAction, TestReplaceAction, TestWarningsAction, and rad::GuardCallback.
|
pure virtual |
Execute the task associated to the action. The execution is blocking the State Machine interpreter and therefore should be short (ideally it should last 0 time).
c | Context for the execution of the action. |
Implemented in scxml4cpp::ActionTrace, rad::ActionCallback, MyAction, SignalAction, TestDummyAction, ReplyAction, ReplyAction, TimerAction, TrsHealthAction, MyAction, TestExecutableContentAction, TestExecutableContentAction2, TestExecutorAction, TestHelperAction, TestMergerAction, TestCondition, TestAction, TestCondition, TestAppendAction, TestDOMSCXMLReaderAction, TestReplaceAction, TestWarningsAction, and rad::GuardCallback.
std::string scxml4cpp::Action::getId | ( | ) | const |
std::string scxml4cpp::Action::getParam | ( | ) | const |
void scxml4cpp::Action::setId | ( | const std::string & | id | ) |
Set the action identifier.
id | The action identifier. |
void scxml4cpp::Action::setParam | ( | const std::string & | p | ) |
Set the action parameters.
p | The action parameters in string format. |