diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-01-20 17:34:02 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-01-20 17:34:02 (GMT) |
commit | a0666b3ab907c0036f5e3f036b32e9ec5a6e551d (patch) | |
tree | d3db8b6beb8622fa41b87b0934d4702cf0b61819 /src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp | |
parent | f4f05b40c8c464daf1e11df6fcdb63d05766ed1f (diff) | |
download | uscxml-a0666b3ab907c0036f5e3f036b32e9ec5a6e551d.zip uscxml-a0666b3ab907c0036f5e3f036b32e9ec5a6e551d.tar.gz uscxml-a0666b3ab907c0036f5e3f036b32e9ec5a6e551d.tar.bz2 |
Regenerated V8 DOM and beautified code
Diffstat (limited to 'src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp')
-rw-r--r-- | src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp index 65eed78..a983d58 100644 --- a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp +++ b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp @@ -36,58 +36,58 @@ void HeartbeatInvoker::send(const SendRequest& req) { } void HeartbeatInvoker::cancel(const std::string sendId) { - HeartbeatDispatcher::getInstance()->cancelEvent(toStr(this)); + HeartbeatDispatcher::getInstance()->cancelEvent(toStr(this)); } void HeartbeatInvoker::sendToParent(const SendRequest& req) { } void HeartbeatInvoker::invoke(const InvokeRequest& req) { - _invokeId = req.invokeid; - _event.invokeid = _invokeId; - std::string intervalStr; - double interval = 0; - unsigned long intervalMs = 0; - InvokeRequest::params_t::const_iterator paramIter = req.params.begin(); - while(paramIter != req.params.end()) { - if (boost::iequals(paramIter->first, "interval")) { - intervalStr = paramIter->second; - NumAttr intervalAttr(paramIter->second); - interval = strTo<double>(intervalAttr.value); - if (false) { - } else if (boost::iequals(intervalAttr.unit, "s")) { - intervalMs = interval * 1000; - } else if (boost::iequals(intervalAttr.unit, "ms")) { - intervalMs = interval; - } else { - intervalMs = interval; - } - } - if (boost::iequals(paramIter->first, "eventname")) { - _event.name = paramIter->second; - } - paramIter++; - } - if (_event.name.length() == 0) - _event.name = std::string("heartbeat." + intervalStr); - - if (intervalMs > 0) { - HeartbeatDispatcher::getInstance()->addEvent(toStr(this), HeartbeatInvoker::dispatch, intervalMs, this, true); - } + _invokeId = req.invokeid; + _event.invokeid = _invokeId; + std::string intervalStr; + double interval = 0; + unsigned long intervalMs = 0; + InvokeRequest::params_t::const_iterator paramIter = req.params.begin(); + while(paramIter != req.params.end()) { + if (boost::iequals(paramIter->first, "interval")) { + intervalStr = paramIter->second; + NumAttr intervalAttr(paramIter->second); + interval = strTo<double>(intervalAttr.value); + if (false) { + } else if (boost::iequals(intervalAttr.unit, "s")) { + intervalMs = interval * 1000; + } else if (boost::iequals(intervalAttr.unit, "ms")) { + intervalMs = interval; + } else { + intervalMs = interval; + } + } + if (boost::iequals(paramIter->first, "eventname")) { + _event.name = paramIter->second; + } + paramIter++; + } + if (_event.name.length() == 0) + _event.name = std::string("heartbeat." + intervalStr); + + if (intervalMs > 0) { + HeartbeatDispatcher::getInstance()->addEvent(toStr(this), HeartbeatInvoker::dispatch, intervalMs, this, true); + } } void HeartbeatInvoker::dispatch(void* instance, std::string name) { - HeartbeatInvoker* invoker = (HeartbeatInvoker*)instance; - invoker->_interpreter->receive(invoker->_event); + HeartbeatInvoker* invoker = (HeartbeatInvoker*)instance; + invoker->_interpreter->receive(invoker->_event); } - + HeartbeatDispatcher* HeartbeatDispatcher::_instance = NULL; HeartbeatDispatcher* HeartbeatDispatcher::getInstance() { - if (_instance == NULL) { - _instance = new HeartbeatDispatcher(); - _instance->start(); - } - return _instance; + if (_instance == NULL) { + _instance = new HeartbeatDispatcher(); + _instance->start(); + } + return _instance; } HeartbeatDispatcher::HeartbeatDispatcher() {} |