diff options
Diffstat (limited to 'src/uscxml/plugins/invoker/scxml')
-rw-r--r-- | src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp | 19 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h | 11 |
2 files changed, 16 insertions, 14 deletions
diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp index b4ee3eb..c90ef4d 100644 --- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp +++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp @@ -23,7 +23,7 @@ USCXMLInvoker::~USCXMLInvoker() { delete _invokedInterpreter; }; -Invoker* USCXMLInvoker::create(Interpreter* interpreter) { +InvokerImpl* USCXMLInvoker::create(Interpreter* interpreter) { USCXMLInvoker* invoker = new USCXMLInvoker(); invoker->_parentInterpreter = interpreter; return invoker; @@ -34,7 +34,7 @@ Data USCXMLInvoker::getDataModelVariables() { return data; } -void USCXMLInvoker::send(SendRequest& req) { +void USCXMLInvoker::send(const SendRequest& req) { assert(false); } @@ -42,19 +42,20 @@ void USCXMLInvoker::cancel(const std::string sendId) { assert(false); } -void USCXMLInvoker::sendToParent(SendRequest& req) { - req.invokeid = _invokeId; - _parentInterpreter->receive(req); +void USCXMLInvoker::sendToParent(const SendRequest& req) { + SendRequest parentReq = req; + parentReq.invokeid = _invokeId; + _parentInterpreter->receive(parentReq); } -void USCXMLInvoker::invoke(InvokeRequest& req) { +void USCXMLInvoker::invoke(const InvokeRequest& req) { _invokeId = req.invokeid; _invokedInterpreter = Interpreter::fromURI(req.src); - DataModel* dataModel = _invokedInterpreter->getDataModel(); - if (dataModel != NULL) { + DataModel dataModel(_invokedInterpreter->getDataModel()); + if (dataModel) { } - _invokedInterpreter->setInvoker(this); + _invokedInterpreter->setInvoker(boost::static_pointer_cast<InvokerImpl>(shared_from_this())); _invokedInterpreter->start(); } diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h index 907df41..b1579a2 100644 --- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h +++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h @@ -2,6 +2,7 @@ #define USCXMLINVOKER_H_OQFA21IO #include <uscxml/Interpreter.h> +#include <boost//enable_shared_from_this.hpp> #ifdef BUILD_AS_PLUGINS #include "uscxml/plugins/Plugins.h" @@ -11,11 +12,11 @@ namespace uscxml { class Interpreter; -class USCXMLInvoker : public Invoker { +class USCXMLInvoker : public InvokerImpl, public boost::enable_shared_from_this<USCXMLInvoker> { public: USCXMLInvoker(); virtual ~USCXMLInvoker(); - virtual Invoker* create(Interpreter* interpreter); + virtual InvokerImpl* create(Interpreter* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; names.insert("uscxml"); @@ -25,10 +26,10 @@ public: } virtual Data getDataModelVariables(); - virtual void send(SendRequest& req); + virtual void send(const SendRequest& req); virtual void cancel(const std::string sendId); - virtual void invoke(InvokeRequest& req); - virtual void sendToParent(SendRequest& req); + virtual void invoke(const InvokeRequest& req); + virtual void sendToParent(const SendRequest& req); protected: std::string _invokeId; |