diff options
-rw-r--r-- | src/uscxml/Interpreter.h | 43 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/im/IMInvoker.cpp | 3 |
2 files changed, 45 insertions, 1 deletions
diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h index c65c8f7..303e126 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> getEventDescriptors() { + + 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> getEventDescriptors() { + return _impl->getEventDescriptors(); + } + void start() { return _impl->start(); } @@ -807,6 +849,7 @@ public: Timer timer; #endif + protected: void setInvokeRequest(const InvokeRequest& req) { diff --git a/src/uscxml/plugins/invoker/im/IMInvoker.cpp b/src/uscxml/plugins/invoker/im/IMInvoker.cpp index 91a22e1..f111743 100644 --- a/src/uscxml/plugins/invoker/im/IMInvoker.cpp +++ b/src/uscxml/plugins/invoker/im/IMInvoker.cpp @@ -21,6 +21,7 @@ #include <glog/logging.h> #include "uscxml/UUID.h" #include "uscxml/dom/DOMUtils.h" +#include "uscxml/dom/NameSpacingParser.h" #include <boost/algorithm/string.hpp> #include "uscxml/concurrency/DelayedEventQueue.h" @@ -1405,4 +1406,4 @@ gboolean IMInvoker::purpleDebugIsEnabled(PurpleDebugLevel level, const char *cat } -}
\ No newline at end of file +} |