diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-06 21:17:13 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-06 21:17:13 (GMT) |
commit | 1e6ba139ac12c688f025745812d381915775b1fb (patch) | |
tree | 1d49070eddd4502ec6aa25a769ab7c47d04a1c30 /src/uscxml/plugins/element | |
parent | 139439f0675ec05e936fd4297086462037cd618e (diff) | |
download | uscxml-1e6ba139ac12c688f025745812d381915775b1fb.zip uscxml-1e6ba139ac12c688f025745812d381915775b1fb.tar.gz uscxml-1e6ba139ac12c688f025745812d381915775b1fb.tar.bz2 |
See detailled log
Added new revised W3C tests
Hide Interpreter via PIMPL
Implemented SCXMLIOProcessor
Diffstat (limited to 'src/uscxml/plugins/element')
6 files changed, 22 insertions, 22 deletions
diff --git a/src/uscxml/plugins/element/fetch/FetchElement.cpp b/src/uscxml/plugins/element/fetch/FetchElement.cpp index eabe0a2..56c1815 100644 --- a/src/uscxml/plugins/element/fetch/FetchElement.cpp +++ b/src/uscxml/plugins/element/fetch/FetchElement.cpp @@ -18,7 +18,7 @@ bool connect(pluma::Host& host) { } #endif -boost::shared_ptr<ExecutableContentImpl> FetchElement::create(Interpreter* interpreter) { +boost::shared_ptr<ExecutableContentImpl> FetchElement::create(InterpreterImpl* interpreter) { boost::shared_ptr<FetchElement> invoker = boost::shared_ptr<FetchElement>(new FetchElement()); invoker->_interpreter = interpreter; return invoker; diff --git a/src/uscxml/plugins/element/fetch/FetchElement.h b/src/uscxml/plugins/element/fetch/FetchElement.h index b553293..e293afe 100644 --- a/src/uscxml/plugins/element/fetch/FetchElement.h +++ b/src/uscxml/plugins/element/fetch/FetchElement.h @@ -13,7 +13,7 @@ class FetchElement : public ExecutableContentImpl, public URLMonitor { public: FetchElement() {} virtual ~FetchElement(); - boost::shared_ptr<ExecutableContentImpl> create(Interpreter* interpreter); + boost::shared_ptr<ExecutableContentImpl> create(InterpreterImpl* interpreter); std::string getLocalName() { return "fetch"; diff --git a/src/uscxml/plugins/element/postpone/PostponeElement.cpp b/src/uscxml/plugins/element/postpone/PostponeElement.cpp index baa8e62..54f2499 100644 --- a/src/uscxml/plugins/element/postpone/PostponeElement.cpp +++ b/src/uscxml/plugins/element/postpone/PostponeElement.cpp @@ -16,7 +16,7 @@ bool connect(pluma::Host& host) { } #endif -boost::shared_ptr<ExecutableContentImpl> PostponeElement::create(Interpreter* interpreter) { +boost::shared_ptr<ExecutableContentImpl> PostponeElement::create(InterpreterImpl* interpreter) { boost::shared_ptr<PostponeElement> invoker = boost::shared_ptr<PostponeElement>(new PostponeElement()); invoker->_interpreter = interpreter; return invoker; @@ -97,21 +97,21 @@ void PostponeElement::enterElement(const Arabica::DOM::Node<std::string>& node) void PostponeElement::exitElement(const Arabica::DOM::Node<std::string>& node) { } -void PostponeElement::Resubmitter::postpone(const Event& event, std::string until, uint64_t timeout, bool chained, Interpreter* interpreter) { +void PostponeElement::Resubmitter::postpone(const Event& event, std::string until, uint64_t timeout, bool chained, InterpreterImpl* interpreter) { Resubmitter* resubmitter = getInstance(interpreter); resubmitter->_postponedEvents.push_back(Postponed(event, until, timeout, chained)); } -void PostponeElement::Resubmitter::onStableConfiguration(Interpreter* interpreter) { +void PostponeElement::Resubmitter::onStableConfiguration(Interpreter interpreter) { std::list<Postponed>::iterator eventIter = _postponedEvents.begin(); bool dispatched = false; while(eventIter != _postponedEvents.end()) { try { // LOG(INFO) << "Reevaluating: >> " << eventIter->first << " <<"; - if ((!dispatched || eventIter->chaining) && interpreter->getDataModel().evalAsBool(eventIter->until)) { + if ((!dispatched || eventIter->chaining) && interpreter.getDataModel().evalAsBool(eventIter->until)) { // LOG(INFO) << " -> is TRUE"; eventIter->event.name += ".postponed"; - interpreter->receive(eventIter->event, true); + interpreter.receive(eventIter->event, true); _postponedEvents.erase(eventIter); dispatched = true; } @@ -127,21 +127,21 @@ void PostponeElement::Resubmitter::onStableConfiguration(Interpreter* interprete } -void PostponeElement::Resubmitter::afterCompletion(Interpreter* interpreter) { +void PostponeElement::Resubmitter::afterCompletion(Interpreter interpreter) { tthread::lock_guard<tthread::recursive_mutex> lock(PostponeElement::Resubmitter::_accessLock); _instances.erase(interpreter); delete this; // committing suicide is ok if we are careful } -std::map<Interpreter*, PostponeElement::Resubmitter*> PostponeElement::Resubmitter::_instances; +std::map<Interpreter, PostponeElement::Resubmitter*> PostponeElement::Resubmitter::_instances; tthread::recursive_mutex PostponeElement::Resubmitter::_accessLock; -PostponeElement::Resubmitter* PostponeElement::Resubmitter::getInstance(Interpreter* interpreter) { +PostponeElement::Resubmitter* PostponeElement::Resubmitter::getInstance(InterpreterImpl* interpreter) { tthread::lock_guard<tthread::recursive_mutex> lock(PostponeElement::Resubmitter::_accessLock); - if (_instances.find(interpreter) == _instances.end()) { - _instances[interpreter] = new Resubmitter(interpreter); + if (_instances.find(interpreter->shared_from_this()) == _instances.end()) { + _instances[interpreter->shared_from_this()] = new Resubmitter(interpreter); } - return _instances[interpreter]; + return _instances[interpreter->shared_from_this()]; } }
\ No newline at end of file diff --git a/src/uscxml/plugins/element/postpone/PostponeElement.h b/src/uscxml/plugins/element/postpone/PostponeElement.h index 7886415..f0c42c0 100644 --- a/src/uscxml/plugins/element/postpone/PostponeElement.h +++ b/src/uscxml/plugins/element/postpone/PostponeElement.h @@ -23,7 +23,7 @@ public: PostponeElement() {} virtual ~PostponeElement() {} - boost::shared_ptr<ExecutableContentImpl> create(Interpreter* interpreter); + boost::shared_ptr<ExecutableContentImpl> create(InterpreterImpl* interpreter); std::string getLocalName() { return "postpone"; @@ -44,19 +44,19 @@ protected: // once per interpreter class Resubmitter : public InterpreterMonitor { public: - Resubmitter(Interpreter* interpreter) { + Resubmitter(InterpreterImpl* interpreter) { interpreter->addMonitor(this); } - static Resubmitter* getInstance(Interpreter* interpreter); - static void postpone(const Event& event, std::string until, uint64_t timeout, bool chained, Interpreter* interpreter); + static Resubmitter* getInstance(InterpreterImpl* interpreter); + static void postpone(const Event& event, std::string until, uint64_t timeout, bool chained, InterpreterImpl* interpreter); // InterpreterMonitor - void onStableConfiguration(Interpreter* interpreter); - void afterCompletion(Interpreter* interpreter); + void onStableConfiguration(Interpreter interpreter); + void afterCompletion(Interpreter interpreter); std::list<Postponed> _postponedEvents; - static std::map<Interpreter*, Resubmitter*> _instances; + static std::map<Interpreter, Resubmitter*> _instances; static tthread::recursive_mutex _accessLock; }; diff --git a/src/uscxml/plugins/element/response/ResponseElement.cpp b/src/uscxml/plugins/element/response/ResponseElement.cpp index cd7ef2d..675bc1e 100644 --- a/src/uscxml/plugins/element/response/ResponseElement.cpp +++ b/src/uscxml/plugins/element/response/ResponseElement.cpp @@ -16,7 +16,7 @@ bool connect(pluma::Host& host) { } #endif -boost::shared_ptr<ExecutableContentImpl> ResponseElement::create(Interpreter* interpreter) { +boost::shared_ptr<ExecutableContentImpl> ResponseElement::create(InterpreterImpl* interpreter) { boost::shared_ptr<ResponseElement> invoker = boost::shared_ptr<ResponseElement>(new ResponseElement()); invoker->_interpreter = interpreter; return invoker; diff --git a/src/uscxml/plugins/element/response/ResponseElement.h b/src/uscxml/plugins/element/response/ResponseElement.h index de3991c..333dd98 100644 --- a/src/uscxml/plugins/element/response/ResponseElement.h +++ b/src/uscxml/plugins/element/response/ResponseElement.h @@ -13,7 +13,7 @@ class ResponseElement : public ExecutableContentImpl { public: ResponseElement() {} virtual ~ResponseElement() {} - boost::shared_ptr<ExecutableContentImpl> create(Interpreter* interpreter); + boost::shared_ptr<ExecutableContentImpl> create(InterpreterImpl* interpreter); std::string getLocalName() { return "response"; |