summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gansen <c64zottel@gmail.com>2016-03-13 14:05:30 (GMT)
committerAndreas Gansen <c64zottel@gmail.com>2016-03-13 14:05:30 (GMT)
commitd9abe5a5480dd3f2c0fd0110b02c1a370f5a3b02 (patch)
treeb0b151d6fccd6b8a7a7b28c4830523402e29f29d
parent686bee5a98d5b64102c81e0718dc08342f2f9076 (diff)
downloaduscxml-d9abe5a5480dd3f2c0fd0110b02c1a370f5a3b02.zip
uscxml-d9abe5a5480dd3f2c0fd0110b02c1a370f5a3b02.tar.gz
uscxml-d9abe5a5480dd3f2c0fd0110b02c1a370f5a3b02.tar.bz2
return reachable targets / valid events as vector<string>
-rw-r--r--src/uscxml/Interpreter.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h
index c65c8f7..420e685 100644
--- a/src/uscxml/Interpreter.h
+++ b/src/uscxml/Interpreter.h
@@ -46,6 +46,8 @@
#include "uscxml/plugins/Invoker.h"
#include "uscxml/plugins/ExecutableContent.h"
+#include "dom/DOMUtils.h"
+
#ifndef TIME_BLOCK
# ifdef BUILD_PROFILING
# include "uscxml/concurrency/Timer.h"
@@ -402,6 +404,38 @@ public:
virtual void handleDOMEvent(Arabica::DOM::Events::Event<std::string>& event);
+ std::vector<std::string> getReachableTargets() {
+
+ std::vector<std::string> e;
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ Arabica::XPath::NodeSet<std::string> possibleTransitions = DOMUtils::filterChildElements( "transition", _configuration, false);
+
+ for( size_t i = 0; i < possibleTransitions.size(); i++ ) {
+ Arabica::DOM::Node<std::string> transitions = possibleTransitions[ i ];
+ Arabica::DOM::NamedNodeMap<std::string> attributes = transitions.getAttributes();
+ Arabica::DOM::Node<std::string> events = attributes.getNamedItem("target");
+ e.push_back( std::string( events.getNodeValue() ) );
+ }
+ return e;
+
+ }
+
+ std::vector<std::string> getValidEvents() {
+
+ std::vector<std::string> e;
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ Arabica::XPath::NodeSet<std::string> possibleTransitions = DOMUtils::filterChildElements( "transition", _configuration, false);
+
+ for( size_t i = 0; i < possibleTransitions.size(); i++ ) {
+ Arabica::DOM::Node<std::string> transitions = possibleTransitions[ i ];
+ Arabica::DOM::NamedNodeMap<std::string> attributes = transitions.getAttributes();
+ Arabica::DOM::Node<std::string> events = attributes.getNamedItem("event");
+ e.push_back( std::string( events.getNodeValue() ) );
+ }
+ return e;
+
+ }
+
protected:
static void run(void*); // static method for thread to run
@@ -589,6 +623,14 @@ public:
return _impl->reset();
}
+ std::vector<std::string> getReachableTargets() {
+ return _impl->getReachableTargets();
+ }
+
+ std::vector<std::string> getValidEvents() {
+ return _impl->getValidEvents();
+ }
+
void start() {
return _impl->start();
}
@@ -807,6 +849,7 @@ public:
Timer timer;
#endif
+
protected:
void setInvokeRequest(const InvokeRequest& req) {