summaryrefslogtreecommitdiffstats
path: root/src/uscxml/Interpreter.cpp
diff options
context:
space:
mode:
authorStefan Radomski <github@mintwerk.de>2017-01-13 16:47:44 (GMT)
committerStefan Radomski <github@mintwerk.de>2017-01-13 16:47:44 (GMT)
commit4f6cbe9e7aec2b4a6c8f286f9097abfb011a6235 (patch)
tree8c023473bb342780ddf51a893d18369f1319bb5c /src/uscxml/Interpreter.cpp
parent0aa0fe08dc308c94379c47d0bf9745e341cb4c81 (diff)
downloaduscxml-4f6cbe9e7aec2b4a6c8f286f9097abfb011a6235.zip
uscxml-4f6cbe9e7aec2b4a6c8f286f9097abfb011a6235.tar.gz
uscxml-4f6cbe9e7aec2b4a6c8f286f9097abfb011a6235.tar.bz2
First support for serialization and some bug fixes for DOM per data.src
Diffstat (limited to 'src/uscxml/Interpreter.cpp')
-rw-r--r--src/uscxml/Interpreter.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index 1aa07df..d5f764d 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -187,10 +187,25 @@ void Interpreter::reset() {
return _impl->reset();
}
+void Interpreter::deserialize(const std::string& encodedState) {
+ return _impl->deserialize(encodedState);
+}
+
+std::string Interpreter::serialize() {
+ return _impl->serialize();
+}
+
InterpreterState Interpreter::step(size_t blockMs) {
return _impl->step(blockMs);
};
+void loadState(const std::string& encodedState);
+
+/**
+ * Save the interpreter's state.
+ */
+std::string saveState();
+
void Interpreter::cancel() {
return _impl->cancel();
}
@@ -215,6 +230,10 @@ void Interpreter::setActionLanguage(ActionLanguage actionLanguage) {
return _impl->setActionLanguage(actionLanguage);
}
+ActionLanguage Interpreter::getActionLanguage() {
+ return _impl->getActionLanguage();
+}
+
void Interpreter::setFactory(Factory* factory) {
return _impl->setFactory(factory);
}
@@ -235,9 +254,7 @@ std::list<InterpreterIssue> Interpreter::validate() {
return InterpreterIssue::forInterpreter(_impl.get());
}
-std::recursive_mutex StateTransitionMonitor::_mutex;
-
-#if 0
+#if 1
static void printNodeSet(const std::list<XERCESC_NS::DOMElement*> nodes) {
std::string seperator;
for (auto nIter = nodes.begin(); nIter != nodes.end(); nIter++) {
@@ -247,6 +264,8 @@ static void printNodeSet(const std::list<XERCESC_NS::DOMElement*> nodes) {
}
#endif
+std::recursive_mutex StateTransitionMonitor::_mutex;
+
void StateTransitionMonitor::beforeTakingTransition(Interpreter& interpreter, const XERCESC_NS::DOMElement* transition) {
std::lock_guard<std::recursive_mutex> lock(_mutex);
std::cerr << "Transition: " << uscxml::DOMUtils::xPathForNode(transition) << std::endl;
@@ -255,7 +274,7 @@ void StateTransitionMonitor::beforeTakingTransition(Interpreter& interpreter, co
void StateTransitionMonitor::onStableConfiguration(Interpreter& interpreter) {
std::lock_guard<std::recursive_mutex> lock(_mutex);
std::cerr << "Stable Config: { ";
-// printNodeSet(_interpreter.getConfiguration());
+ printNodeSet(interpreter.getConfiguration());
std::cerr << " }" << std::endl;
}
@@ -292,8 +311,8 @@ void StateTransitionMonitor::beforeEnteringState(Interpreter& interpreter, const
void StateTransitionMonitor::beforeMicroStep(Interpreter& interpreter) {
std::lock_guard<std::recursive_mutex> lock(_mutex);
- std::cerr << "Config: {";
-// printNodeSet(_interpreter.getConfiguration());
+ std::cerr << "Microstep in config: {";
+ printNodeSet(interpreter.getConfiguration());
std::cerr << "}" << std::endl;
}