diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-01-21 23:47:54 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-01-21 23:47:54 (GMT) |
commit | 3be96d1aa3024c1acc129e587f5d3165c9434e48 (patch) | |
tree | fae65a932b899ed9424a5a76b9b98562d979fe40 /src/uscxml/Interpreter.cpp | |
parent | 3bda299c6d2efce71d76b44dea8e732a073304f3 (diff) | |
download | uscxml-3be96d1aa3024c1acc129e587f5d3165c9434e48.zip uscxml-3be96d1aa3024c1acc129e587f5d3165c9434e48.tar.gz uscxml-3be96d1aa3024c1acc129e587f5d3165c9434e48.tar.bz2 |
See detailed commitlog
- Started DirectoryMonitor invoker
- Refactored Invoker / IOProcessor interface
- Started with JavaScriptCore bindings
- Embedding applications can now use setParentQueue to receive events
sent to #_parent
Diffstat (limited to 'src/uscxml/Interpreter.cpp')
-rw-r--r-- | src/uscxml/Interpreter.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp index 5000498..6e34e07 100644 --- a/src/uscxml/Interpreter.cpp +++ b/src/uscxml/Interpreter.cpp @@ -32,6 +32,7 @@ Interpreter::Interpreter() : Arabica::SAX2DOM::Parser<std::string>() { _lastRunOnMainThread = 0; _thread = NULL; _sendQueue = NULL; + _parentQueue = NULL; _running = false; _done = false; @@ -164,7 +165,8 @@ void Interpreter::init() { Interpreter::~Interpreter() { if (_thread) { _running = false; - _externalQueue.push(Event()); + Event event; + _externalQueue.push(event); _thread->join(); delete(_thread); } @@ -445,6 +447,7 @@ void Interpreter::mainEventLoop() { } Event externalEvent = _externalQueue.pop(); + externalEvent.type = Event::EXTERNAL; // make sure it is set to external if (!_running) exitInterpreter(); @@ -679,8 +682,8 @@ void Interpreter::delayedSend(void* userdata, std::string eventName) { if (boost::iequals(sendReq.target, "#_parent")) { // send to parent scxml session - if (INSTANCE->_invoker) { - INSTANCE->_invoker.sendToParent(sendReq); + if (INSTANCE->_parentQueue != NULL) { + INSTANCE->_parentQueue->push(sendReq); } else { LOG(ERROR) << "Can not send to parent, we were not invoked" << std::endl; } @@ -794,6 +797,9 @@ void Interpreter::invoke(const Arabica::DOM::Node<std::string>& element) { Invoker invoker(Factory::createInvoker(invokeReq.type, this)); if (invoker) { tthread::lock_guard<tthread::mutex> lock(_mutex); + invoker.setInvokeId(invokeReq.invokeid); + invoker.setType(invokeReq.type); + invoker.setInterpreter(this); _invokers[invokeReq.invokeid] = invoker; LOG(INFO) << "Added invoker " << invokeReq.type << " at " << invokeReq.invokeid; invoker.invoke(invokeReq); @@ -1827,6 +1833,9 @@ void Interpreter::setupIOProcessors() { std::map<std::string, IOProcessorImpl*>::iterator ioProcIter = Factory::getInstance()->_ioProcessors.begin(); while(ioProcIter != Factory::getInstance()->_ioProcessors.end()) { _ioProcessors[ioProcIter->first] = Factory::createIOProcessor(ioProcIter->first, this); + _ioProcessors[ioProcIter->first].setType(ioProcIter->first); + _ioProcessors[ioProcIter->first].setInterpreter(this); + if (_dataModel) { try { _dataModel.registerIOProcessor(ioProcIter->first, _ioProcessors[ioProcIter->first]); |