Central class to interpret and process SCXML documents. More...
#include <Interpreter.h>
Public Member Functions | |
void | addMonitor (InterpreterMonitor *monitor) |
Attach a monitor to make more details of the interpreter observable. | |
void | cancel () |
Unblock and mark for finalize. | |
void | deserialize (const std::string &encodedState) |
Deserialize the state for the interpreter from a string. | |
ActionLanguage * | getActionLanguage () |
Return ActionLanguage with the instances actually used (i.e. More... | |
std::list< XERCESC_NS::DOMElement * > | getConfiguration () |
Get all state elements that constitute the active configuration. More... | |
std::shared_ptr< InterpreterImpl > | getImpl () const |
Return the actual implementation of the Interperter. | |
Logger | getLogger () |
Return the logger associated with this interpreter. | |
InterpreterState | getState () |
The current state of the interpreter, not to be confused with its configuration. More... | |
bool | isInState (const std::string &stateId) |
Determine whether the state with the given id is in the active configuration. More... | |
PIMPL_OPERATORS (Interpreter) | |
See PIMPL_OPERATORS macro in Common.h. | |
void | receive (const Event &event) |
Enqueue an event to the interpreter's external queue. More... | |
void | removeMonitor (InterpreterMonitor *monitor) |
Remove a monitor that was attached previously. | |
void | reset () |
Finalize and reset interpeter. | |
std::string | serialize () |
Serialize the interpreter's state in a string. | |
void | setActionLanguage (ActionLanguage actionLanguage) |
Adapt the constituting components for a SCXML interpreter. | |
void | setFactory (Factory *factory) |
Provide a custom Factory to instantiate dynamic instances for this and invoked state-chart instances. | |
InterpreterState | step (size_t blockMs=std::numeric_limits< size_t >::max()) |
Advance the state-machine by a single microstep and return. More... | |
std::list< InterpreterIssue > | validate () |
Return a list of possible syntactic and semantic issues with the interpreter's state-chart. More... | |
Static Public Member Functions | |
static Interpreter | fromClone (const Interpreter &other) |
Instantiate an Interpeter as a copy of another. More... | |
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 | fromURL (const std::string &url) |
Instantiate an Interpeter with a document located at an URL. More... | |
static Interpreter | fromXML (const std::string &xml, const std::string &baseURL) |
Instantiate an Interpeter from a string containined proper XML markup. More... | |
Protected Attributes | |
std::shared_ptr< InterpreterImpl > | _impl |
Detailed Description
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 |
- Parameters
-
other The other interpreter.
|
static |
- 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 |
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 |
- Parameters
-
url An absolute URL to locate the SCXML document.
|
static |
- Parameters
-
xml Textual representation of an SCXML document. baseURL An absolute URL to resolve relative URLs in the document.
ActionLanguage * uscxml::Interpreter::getActionLanguage | ( | ) |
those from the factory).
std::list< XERCESC_NS::DOMElement * > uscxml::Interpreter::getConfiguration | ( | ) |
- Returns
- A list of XML elements of the active states.
InterpreterState uscxml::Interpreter::getState | ( | ) |
- Returns
- The current state of the interpreter object.
bool uscxml::Interpreter::isInState | ( | const std::string & | stateId | ) |
- 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 | ) |
An event to be enqueued
InterpreterState uscxml::Interpreter::step | ( | size_t | blockMs = std::numeric_limits<size_t>::max() | ) |
This is the central function to drive the state machine. Calling step() will perform one microstep and return the current state of the interpreter. Here, the state is not to be confused with the interpreter's configuration.
- Parameters
-
blockMs The maximum duration in milli-seconds to wait for an event to become available.
- Returns
- The new state of the interpreter object.
std::list< InterpreterIssue > uscxml::Interpreter::validate | ( | ) |
- Returns
- A list of InterpreterIssues
The documentation for this class was generated from the following files: