diff options
Diffstat (limited to 'src/uscxml/plugins')
-rw-r--r-- | src/uscxml/plugins/Factory.cpp | 44 | ||||
-rw-r--r-- | src/uscxml/plugins/Factory.h | 40 | ||||
-rw-r--r-- | src/uscxml/plugins/InvokerImpl.h | 2 |
3 files changed, 71 insertions, 15 deletions
diff --git a/src/uscxml/plugins/Factory.cpp b/src/uscxml/plugins/Factory.cpp index 4c67d1f..410ac36 100644 --- a/src/uscxml/plugins/Factory.cpp +++ b/src/uscxml/plugins/Factory.cpp @@ -33,6 +33,11 @@ #include "uscxml/plugins/InvokerImpl.h" #include "uscxml/plugins/DataModelImpl.h" +#ifndef FEATS_ON_CMD +#include "uscxml/interpreter/LargeMicroStep.h" +#include "uscxml/interpreter/FastMicroStep.h" +#endif + #if 0 #include <xercesc/dom/DOM.hpp> #include <xercesc/util/PlatformUtils.hpp> @@ -127,6 +132,11 @@ Factory::~Factory() { void Factory::registerPlugins() { +#ifndef FEATS_ON_CMD + registerMicrostepper(new LargeMicroStep()); + registerMicrostepper(new FastMicroStep()); +#endif + /*** PLUGINS ***/ #ifdef BUILD_AS_PLUGINS @@ -435,7 +445,6 @@ std::shared_ptr<DataModelImpl> Factory::createDataModel(const std::string& type, return std::shared_ptr<DataModelImpl>(); } - bool Factory::hasIOProcessor(const std::string& type) { if (_ioProcessorAliases.find(type) != _ioProcessorAliases.end()) { return true; @@ -495,6 +504,39 @@ std::shared_ptr<ExecutableContentImpl> Factory::createExecutableContent(const st } +#ifndef FEATS_ON_CMD + +bool Factory::hasMicroStepper(const std::string& name) { + if (_microSteppers.find(name) != _microSteppers.end()) { + return true; + } else if(_parentFactory) { + return _parentFactory->hasMicroStepper(name); + } + return false; +} + + +void Factory::registerMicrostepper(MicroStepImpl* microStepper) { + _microSteppers[microStepper->getName()] = microStepper; +} + +std::shared_ptr<MicroStepImpl> Factory::createMicroStepper(const std::string& name, MicroStepCallbacks* callbacks) { + if (_microSteppers.find(name) != _microSteppers.end()) { + std::shared_ptr<MicroStepImpl> microStepper = _microSteppers[name]->create(callbacks); + return microStepper; + } + + if (_parentFactory) { + return _parentFactory->createMicroStepper(name, callbacks); + } else { + ERROR_EXECUTION_THROW("No Microstepper '" + name + "' known"); + } + + return std::shared_ptr<MicroStepImpl>(); + +} +#endif + void DataModelImpl::addExtension(DataModelExtension* ext) { ERROR_EXECUTION_THROW("DataModel does not support extensions"); } diff --git a/src/uscxml/plugins/Factory.h b/src/uscxml/plugins/Factory.h index 0026df1..986ff5f 100644 --- a/src/uscxml/plugins/Factory.h +++ b/src/uscxml/plugins/Factory.h @@ -44,6 +44,8 @@ class DataModelCallbacks; class InvokerImpl; class InvokerCallbacks; class ExecutableContentImpl; +class MicroStepImpl; +class MicroStepCallbacks; class USCXML_API Factory { public: @@ -51,21 +53,31 @@ public: Factory(const std::string& pluginPath, Factory* parentFactory); void registerIOProcessor(IOProcessorImpl* ioProcessor); - void registerDataModel(DataModelImpl* dataModel); - void registerInvoker(InvokerImpl* invoker); - void registerExecutableContent(ExecutableContentImpl* executableContent); + bool hasIOProcessor(const std::string& type); + std::shared_ptr<IOProcessorImpl> createIOProcessor(const std::string& type, IOProcessorCallbacks* callbacks); - std::shared_ptr<DataModelImpl> createDataModel(const std::string& type, DataModelCallbacks* callbacks); - std::shared_ptr<IOProcessorImpl> createIOProcessor(const std::string& type, IOProcessorCallbacks* callbacks); - std::shared_ptr<InvokerImpl> createInvoker(const std::string& type, InvokerCallbacks* interpreter); - std::shared_ptr<ExecutableContentImpl> createExecutableContent(const std::string& localName, const std::string& nameSpace, InterpreterImpl* interpreter); + void registerDataModel(DataModelImpl* dataModel); + bool hasDataModel(const std::string& type); + std::shared_ptr<DataModelImpl> createDataModel(const std::string& type, DataModelCallbacks* callbacks); - bool hasDataModel(const std::string& type); - bool hasIOProcessor(const std::string& type); - bool hasInvoker(const std::string& type); - bool hasExecutableContent(const std::string& localName, const std::string& nameSpace); + void registerInvoker(InvokerImpl* invoker); + bool hasInvoker(const std::string& type); + std::shared_ptr<InvokerImpl> createInvoker(const std::string& type, InvokerCallbacks* interpreter); - std::map<std::string, IOProcessorImpl*> getIOProcessors(); + void registerExecutableContent(ExecutableContentImpl* executableContent); + bool hasExecutableContent(const std::string& localName, const std::string& nameSpace); + std::shared_ptr<ExecutableContentImpl> createExecutableContent(const std::string& localName, const std::string& nameSpace, InterpreterImpl* interpreter); + + + + +#ifndef FEATS_ON_CMD + void registerMicrostepper(MicroStepImpl* microStepper); + bool hasMicroStepper(const std::string& name); + std::shared_ptr<MicroStepImpl> createMicroStepper(const std::string& name, MicroStepCallbacks* callbacks); +#endif + + std::map<std::string, IOProcessorImpl*> getIOProcessors(); void listComponents(); @@ -83,6 +95,9 @@ protected: std::map<std::string, std::string> _invokerAliases; std::map<std::pair<std::string, std::string>, ExecutableContentImpl*> _executableContent; +#ifndef FEATS_ON_CMD + std::map<std::string, MicroStepImpl*> _microSteppers; +#endif #ifdef BUILD_AS_PLUGINS pluma::Pluma pluma; @@ -99,7 +114,6 @@ protected: }; - } #endif /* end of include guard: FACTORY_H_5WKLGPRB */ diff --git a/src/uscxml/plugins/InvokerImpl.h b/src/uscxml/plugins/InvokerImpl.h index 7af2028..71a8e7d 100644 --- a/src/uscxml/plugins/InvokerImpl.h +++ b/src/uscxml/plugins/InvokerImpl.h @@ -21,7 +21,7 @@ #define INVOKERIMPL_H_8A15A102 -#include "uscxml/config.h" +//#include "uscxml/config.h" #include "uscxml/Common.h" #include "uscxml/plugins/EventHandler.h" #include "uscxml/messages/Event.h" |