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/Factory.h | |
parent | 2855a9ff7b423140237c9e988252fde0cbacd0a1 (diff) | |
download | uscxml-f1700edcd08d6215888e226618555ba43b5324ec.zip uscxml-f1700edcd08d6215888e226618555ba43b5324ec.tar.gz uscxml-f1700edcd08d6215888e226618555ba43b5324ec.tar.bz2 |
Refactoring and plugin support
Diffstat (limited to 'src/uscxml/Factory.h')
-rw-r--r-- | src/uscxml/Factory.h | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/uscxml/Factory.h b/src/uscxml/Factory.h index e2418f0..24d74e3 100644 --- a/src/uscxml/Factory.h +++ b/src/uscxml/Factory.h @@ -3,10 +3,16 @@ #include "uscxml/Message.h" +#ifdef BUILD_AS_PLUGINS +#include "Pluma/Pluma.hpp" +#endif + #include <string> +#include <set> namespace uscxml { + // see http://stackoverflow.com/questions/228005/alternative-to-itoa-for-converting-integer-to-string-c template <typename T> std::string toStr(T tmp) { std::ostringstream out; out << tmp; @@ -33,9 +39,13 @@ namespace uscxml { IOProcessor() {}; virtual ~IOProcessor() {}; virtual IOProcessor* create(Interpreter* interpreter) = 0; + virtual std::set<std::string> getNames() = 0; + virtual void setInterpreter(Interpreter* interpreter) { _interpreter = interpreter; } virtual Data getDataModelVariables() = 0; virtual void send(SendRequest& req) = 0; + protected: + Interpreter* _interpreter; }; class Invoker : public IOProcessor { @@ -46,8 +56,9 @@ namespace uscxml { class DataModel { public: - virtual DataModel* create(Interpreter* interpreter) = 0; virtual ~DataModel() {} + virtual DataModel* create(Interpreter* interpreter) = 0; + virtual std::set<std::string> getNames() = 0; virtual bool validate(const std::string& location, const std::string& schema) = 0; virtual void setEvent(const Event& event) = 0; @@ -67,10 +78,10 @@ namespace uscxml { class Factory { public: - static void registerIOProcessor(const std::string type, IOProcessor* ioProcessor); - static void registerDataModel(const std::string type, DataModel* dataModel); - static void registerExecutableContent(const std::string tag, ExecutableContent* executableContent); - static void registerInvoker(const std::string type, Invoker* invoker); + void registerIOProcessor(IOProcessor* ioProcessor); + void registerDataModel(DataModel* dataModel); + void registerInvoker(Invoker* invoker); + void registerExecutableContent(const std::string tag, ExecutableContent* executableContent); static DataModel* getDataModel(const std::string type, Interpreter* interpreter); static IOProcessor* getIOProcessor(const std::string type, Interpreter* interpreter); @@ -81,10 +92,14 @@ namespace uscxml { std::map<std::string, DataModel*> _dataModels; std::map<std::string, IOProcessor*> _ioProcessors; - std::map<std::string, Invoker*> _invoker; + std::map<std::string, Invoker*> _invokers; std::map<std::string, ExecutableContent*> _executableContent; protected: +#ifdef BUILD_AS_PLUGINS + pluma::Pluma pluma; +#endif + Factory(); static Factory* _instance; |