diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2012-12-15 19:10:50 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2012-12-15 19:10:50 (GMT) |
commit | f1700edcd08d6215888e226618555ba43b5324ec (patch) | |
tree | 738f30de64f699c3f56d2e15963537c9493a24b4 /src/uscxml/plugins/invoker/scxml | |
parent | 2855a9ff7b423140237c9e988252fde0cbacd0a1 (diff) | |
download | uscxml-f1700edcd08d6215888e226618555ba43b5324ec.zip uscxml-f1700edcd08d6215888e226618555ba43b5324ec.tar.gz uscxml-f1700edcd08d6215888e226618555ba43b5324ec.tar.bz2 |
Refactoring and plugin support
Diffstat (limited to 'src/uscxml/plugins/invoker/scxml')
-rw-r--r-- | src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp | 62 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h | 45 |
2 files changed, 107 insertions, 0 deletions
diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp new file mode 100644 index 0000000..0e617b9 --- /dev/null +++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp @@ -0,0 +1,62 @@ +#include "uscxml/Common.h" +#include "USCXMLInvoker.h" +#include "uscxml/Interpreter.h" + +#ifdef BUILD_AS_PLUGINS +#include <Pluma/Connector.hpp> +#endif + +namespace uscxml { + +#ifdef BUILD_AS_PLUGINS +PLUMA_CONNECTOR +bool connect(pluma::Host& host){ + host.add( new USCXMLInvokerProvider() ); + return true; +} +#endif + +USCXMLInvoker::USCXMLInvoker() { +} + + +USCXMLInvoker::~USCXMLInvoker() { + delete _invokedInterpreter; +}; + +Invoker* USCXMLInvoker::create(Interpreter* interpreter) { + USCXMLInvoker* invoker = new USCXMLInvoker(); + invoker->_parentInterpreter = interpreter; + return invoker; +} + +Data USCXMLInvoker::getDataModelVariables() { + Data data; + return data; +} + +void USCXMLInvoker::send(SendRequest& req) { + assert(false); +} + +void USCXMLInvoker::cancel(const std::string sendId) { + assert(false); +} + +void USCXMLInvoker::sendToParent(SendRequest& req) { + req.invokeid = _invokeId; + _parentInterpreter->receive(req); +} + +void USCXMLInvoker::invoke(InvokeRequest& req) { + _invokeId = req.invokeid; + _invokedInterpreter = Interpreter::fromURI(req.src); + DataModel* dataModel = _invokedInterpreter->getDataModel(); + if (dataModel != NULL) { + + } + _invokedInterpreter->setInvoker(this); + _invokedInterpreter->start(); +} + +}
\ No newline at end of file diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h new file mode 100644 index 0000000..9068a24 --- /dev/null +++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h @@ -0,0 +1,45 @@ +#ifndef USCXMLINVOKER_H_OQFA21IO +#define USCXMLINVOKER_H_OQFA21IO + +#include "uscxml/Factory.h" + +#ifdef BUILD_AS_PLUGINS +#include "uscxml/plugins/Plugins.h" +#endif + +namespace uscxml { + +class Interpreter; + +class USCXMLInvoker : public Invoker { +public: + USCXMLInvoker(); + virtual ~USCXMLInvoker(); + virtual Invoker* create(Interpreter* interpreter); + virtual std::set<std::string> getNames() { + std::set<std::string> names; + names.insert("uscxml"); + names.insert("http://www.w3.org/TR/scxml"); + names.insert("http://www.w3.org/TR/scxml/"); + return names; + } + + virtual Data getDataModelVariables(); + virtual void send(SendRequest& req); + virtual void cancel(const std::string sendId); + virtual void invoke(InvokeRequest& req); + virtual void sendToParent(SendRequest& req); + +protected: + std::string _invokeId; + Interpreter* _invokedInterpreter; + Interpreter* _parentInterpreter; +}; + +#ifdef BUILD_AS_PLUGINS +PLUMA_INHERIT_PROVIDER(USCXMLInvoker, Invoker); +#endif + +} + +#endif /* end of include guard: USCXMLINVOKER_H_OQFA21IO */ |