Central class to interpret and process SCXML documents. More...
#include <Interpreter.h>
Public Member Functions | |
PIMPL_OPERATORS (Interpreter) | |
See PIMPL_OPERATORS macro in Common.h. | |
InterpreterState | step (bool blocking=false) |
Perform a single microstep and return. More... | |
void | cancel () |
Unblock and mark for finalize. | |
void | reset () |
Finalize and reset interpeter. | |
std::list< XERCESC_NS::DOMElement * > | getConfiguration () |
Get all state elements that constitute the active configuration. More... | |
bool | isInState (const std::string &stateId) |
Determine whether the state with the given id is in the active configuration. More... | |
InterpreterState | getState () |
The current state of the interpreter, not to be confused with its configuration. More... | |
std::list< InterpreterIssue > | validate () |
Return a list of possible syntactic and semantic issues with the interpreter's state-chart. More... | |
void | receive (const Event &event) |
Enqueue an event to the interpreter's external queue. More... | |
void | setActionLanguage (ActionLanguage actionLanguage) |
Adapt the constituting components for a SCXML interpreter. | |
void | setMonitor (InterpreterMonitor *monitor) |
Attach a monitor to make more details of the interpreter observable. | |
std::shared_ptr< InterpreterImpl > | getImpl () const |
Return the actual implementation of the Interperter. | |
Static Public Member Functions | |
static Interpreter | fromDocument (XERCESC_NS::DOMDocument *dom, const std::string &baseURL, bool copy=true) |
Instantiate an Interpeter with a given XML document. More... | |
static Interpreter | fromElement (XERCESC_NS::DOMElement *element, const std::string &baseURL) |
Instantiate an Interpeter with a given XML element. More... | |
static Interpreter | fromXML (const std::string &xml, const std::string &baseURL) |
Instantiate an Interpeter from a string containined proper XML markup. More... | |
static Interpreter | fromURL (const std::string &url) |
Instantiate an Interpeter with a document located at an URL. More... | |
static Interpreter | fromClone (const Interpreter &other) |
Instantiate an Interpeter as a copy of another. More... | |
Protected Attributes | |
std::shared_ptr< InterpreterImpl > | _impl |
Detailed Description
Central class to interpret and process SCXML documents.
Instances of this class are available from the static constructors. In order to use an interpreter instance to actually do things, you will want to provide an ActionLanguage and an InterpreterMonitor.
We did avoid threading primitives within the core interpreter (there is threading for nested interpeters in the USCXMLInvoker, though). As such, you will have to call the <step> function continuously.
Member Function Documentation
|
static |
Instantiate an Interpeter as a copy of another.
- Parameters
-
other The other interpreter.
|
static |
Instantiate an Interpeter with a given XML document.
- Parameters
-
dom A pointer to the XML document. baseURL An absolute URL to resolve relative URLs in the document. copy Whether to make a copy of the document, we deallocate it either way.
|
static |
Instantiate an Interpeter with a given XML element.
This constructor will create a new document and copy/import the given element.
- Parameters
-
element The element to be copies/imported as the new document element. baseURL An absolute URL to resolve relative URLs in the document.
|
static |
|
static |
Instantiate an Interpeter from a string containined proper XML markup.
- Parameters
-
xml Textual representation of an SCXML document. baseURL An absolute URL to resolve relative URLs in the document.
std::list< XERCESC_NS::DOMElement * > uscxml::Interpreter::getConfiguration | ( | ) |
Get all state elements that constitute the active configuration.
- Returns
- A list of XML elements of the active states.
InterpreterState uscxml::Interpreter::getState | ( | ) |
The current state of the interpreter, not to be confused with its configuration.
- Returns
- The current state of the interpreter object.
bool uscxml::Interpreter::isInState | ( | const std::string & | stateId | ) |
Determine whether the state with the given id
is in the active configuration.
- Parameters
-
id An identifier for a state from the SCXML document.
- Returns
- Whether the interpreter is in state
id
.
void uscxml::Interpreter::receive | ( | const Event & | event | ) |
Enqueue an event to the interpreter's external queue.
An event to be enqueued
InterpreterState uscxml::Interpreter::step | ( | bool | blocking = false | ) |
Perform a single microstep and return.
- Parameters
-
blocking Whether or not to block the thread when waiting for events
- Returns
- The new state of the interpreter object.
- Todo:
- Have Interpreter::step() take a duration to block
std::list< InterpreterIssue > uscxml::Interpreter::validate | ( | ) |
Return a list of possible syntactic and semantic issues with the interpreter's state-chart.
- Returns
- A list of InterpreterIssues
The documentation for this class was generated from the following files: