summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/invoker/scxml
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-01-12 23:49:43 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-01-12 23:49:43 (GMT)
commita116aeb2cf5a84fa03f9814c3884561149029267 (patch)
treebdd7dfc15ec1e38edcc9a7532ffad03fe4f6f823 /src/uscxml/plugins/invoker/scxml
parent6d0622c0bb8f0e52589c82252f2cc1eb847ad9bf (diff)
downloaduscxml-a116aeb2cf5a84fa03f9814c3884561149029267.zip
uscxml-a116aeb2cf5a84fa03f9814c3884561149029267.tar.gz
uscxml-a116aeb2cf5a84fa03f9814c3884561149029267.tar.bz2
Refactored to PIMPL pattern
Diffstat (limited to 'src/uscxml/plugins/invoker/scxml')
-rw-r--r--src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp19
-rw-r--r--src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h11
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;