diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-05-15 19:55:13 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-05-15 19:55:13 (GMT) |
commit | f9a620340ddce2a17fd775d1e210268cac13377b (patch) | |
tree | 58d8dad794e5a34237c2738fe77c151d0810624f /src/uscxml/Interpreter.h | |
parent | 49127140ed2ad91bfcf532b3d2265582cb80b0db (diff) | |
download | uscxml-f9a620340ddce2a17fd775d1e210268cac13377b.zip uscxml-f9a620340ddce2a17fd775d1e210268cac13377b.tar.gz uscxml-f9a620340ddce2a17fd775d1e210268cac13377b.tar.bz2 |
Introduced interpreter.step()
Diffstat (limited to 'src/uscxml/Interpreter.h')
-rw-r--r-- | src/uscxml/Interpreter.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h index 6a11c46..93062e6 100644 --- a/src/uscxml/Interpreter.h +++ b/src/uscxml/Interpreter.h @@ -188,6 +188,16 @@ private: void init(const std::map<std::string, std::string>& nsInfo); }; +// values larger than 0 indicate that you ought to step again +enum InterpreterState { + FINISHED = 0, // machine reached a final configuration + INIT_FAILED = -1, // could not initialize interpreter + INTERRUPTED = -2, // machine was interrupted + NOTHING_TODO = 4, // when non-blocking returns nothing to do + PROCESSED = 8, // an event was processed + INITIALIZED = 16 // initial stable configuration was assumed +}; + class USCXML_API InterpreterImpl : public boost::enable_shared_from_this<InterpreterImpl> { public: @@ -214,7 +224,8 @@ public: } /// This one ought to be pure, but SWIG will generate gibberish if it is - virtual void interpret() {}; + virtual void interpret() = 0; + virtual InterpreterState step(bool blocking = false) = 0; void addMonitor(InterpreterMonitor* monitor) { _monitors.insert(monitor); @@ -535,6 +546,10 @@ public: _impl->interpret(); }; + InterpreterState step(bool blocking = false) { + return _impl->step(blocking); + }; + void addMonitor(InterpreterMonitor* monitor) { return _impl->addMonitor(monitor); } @@ -684,6 +699,7 @@ public: return _impl->isLegalConfiguration(config); } +#if 0 static bool isState(const Arabica::DOM::Node<std::string>& state) { return InterpreterImpl::isState(state); } @@ -773,6 +789,7 @@ public: Arabica::XPath::NodeSet<std::string> getProperAncestors(const Arabica::DOM::Node<std::string>& s1, const Arabica::DOM::Node<std::string>& s2) { return _impl->getProperAncestors(s1, s2); } +#endif boost::shared_ptr<InterpreterImpl> getImpl() const { return _impl; |