diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-05-23 14:14:56 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-05-23 14:14:56 (GMT) |
commit | 4ecca617e628e94845dafafbdee46ce57f7bc843 (patch) | |
tree | 9113189a54068dd7916bcc377e0d1ff92fc1806b /src | |
parent | 3709f5aa6bc3f458078b9e2b9ded67b75bbbcce4 (diff) | |
download | uscxml-4ecca617e628e94845dafafbdee46ce57f7bc843.zip uscxml-4ecca617e628e94845dafafbdee46ce57f7bc843.tar.gz uscxml-4ecca617e628e94845dafafbdee46ce57f7bc843.tar.bz2 |
Builds as plugins again
Diffstat (limited to 'src')
-rw-r--r-- | src/uscxml/Factory.cpp | 33 | ||||
-rw-r--r-- | src/uscxml/Factory.h | 13 | ||||
-rw-r--r-- | src/uscxml/Interpreter.cpp | 5 | ||||
-rw-r--r-- | src/uscxml/Interpreter.h | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/CMakeLists.txt | 4 |
5 files changed, 43 insertions, 14 deletions
diff --git a/src/uscxml/Factory.cpp b/src/uscxml/Factory.cpp index 2c663b2..378f15e 100644 --- a/src/uscxml/Factory.cpp +++ b/src/uscxml/Factory.cpp @@ -126,19 +126,33 @@ namespace uscxml { Factory::Factory(Factory* parentFactory) : _parentFactory(parentFactory) { } -Factory::Factory() { - _parentFactory = NULL; +Factory::Factory(const std::string& pluginPath, Factory* parentFactory) : _parentFactory(parentFactory), _pluginPath(pluginPath) { + registerPlugins(); +} + +Factory::Factory(const std::string& pluginPath) : _parentFactory(NULL), _pluginPath(pluginPath) { + registerPlugins(); +} + +void Factory::setDefaultPluginPath(const std::string& path) { + _defaultPluginPath = path; +} +std::string Factory::getDefaultPluginPath() { + return _defaultPluginPath; +} + +void Factory::registerPlugins() { #ifdef BUILD_AS_PLUGINS - if (pluginPath.length() == 0) { + if (_pluginPath.length() == 0) { // try to read USCXML_PLUGIN_PATH environment variable - pluginPath = (getenv("USCXML_PLUGIN_PATH") != NULL ? getenv("USCXML_PLUGIN_PATH") : ""); + _pluginPath = (getenv("USCXML_PLUGIN_PATH") != NULL ? getenv("USCXML_PLUGIN_PATH") : ""); } - if (pluginPath.length() > 0) { + if (_pluginPath.length() > 0) { pluma.acceptProviderType<InvokerImplProvider>(); pluma.acceptProviderType<IOProcessorImplProvider>(); pluma.acceptProviderType<DataModelImplProvider>(); pluma.acceptProviderType<ExecutableContentImplProvider>(); - pluma.loadFromFolder(pluginPath); + pluma.loadFromFolder(_pluginPath); std::vector<InvokerImplProvider*> invokerProviders; pluma.getProviders(invokerProviders); @@ -164,6 +178,9 @@ Factory::Factory() { LOG(WARNING) << "No path to plugins known, export USCXML_PLUGIN_PATH or pass path as parameter"; } #else + if (_pluginPath.length() > 0) + LOG(WARNING) << "Plugin path is given, but uscxml is compiled without support"; + #if 1 # if (defined UMUNDO_FOUND && defined PROTOBUF_FOUND) { @@ -573,7 +590,7 @@ size_t DataModelImpl::replaceExpressions(std::string& content) { Factory* Factory::getInstance() { if (_instance == NULL) { - _instance = new Factory(); + _instance = new Factory(Factory::_defaultPluginPath); } return _instance; } @@ -625,5 +642,5 @@ void DataModelImpl::throwErrorPlatform(const std::string& cause) { Factory* Factory::_instance = NULL; -std::string Factory::pluginPath; +std::string Factory::_defaultPluginPath; }
\ No newline at end of file diff --git a/src/uscxml/Factory.h b/src/uscxml/Factory.h index 02ce6b8..3a3080a 100644 --- a/src/uscxml/Factory.h +++ b/src/uscxml/Factory.h @@ -23,6 +23,7 @@ #include "uscxml/Common.h" #include "uscxml/Message.h" #include "uscxml/Convenience.h" +#include <string.h> #ifdef BUILD_AS_PLUGINS #include "Pluma/Pluma.hpp" @@ -438,6 +439,7 @@ protected: class USCXML_API Factory { public: Factory(Factory* parentFactory); + Factory(const std::string& pluginPath, Factory* parentFactory); void registerIOProcessor(IOProcessorImpl* ioProcessor); void registerDataModel(DataModelImpl* dataModel); @@ -453,6 +455,9 @@ public: static Factory* getInstance(); + static void setDefaultPluginPath(const std::string& path); + static std::string getDefaultPluginPath(); + std::map<std::string, DataModelImpl*> _dataModels; std::map<std::string, std::string> _dataModelAliases; std::map<std::string, IOProcessorImpl*> _ioProcessors; @@ -461,17 +466,19 @@ public: std::map<std::string, std::string> _invokerAliases; std::map<std::pair<std::string, std::string>, ExecutableContentImpl*> _executableContent; - static std::string pluginPath; - protected: #ifdef BUILD_AS_PLUGINS pluma::Pluma pluma; #endif - Factory(); + void registerPlugins(); + + Factory(const std::string&); ~Factory(); Factory* _parentFactory; + std::string _pluginPath; static Factory* _instance; + static std::string _defaultPluginPath; }; diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp index e2ee1da..0afdf04 100644 --- a/src/uscxml/Interpreter.cpp +++ b/src/uscxml/Interpreter.cpp @@ -104,9 +104,12 @@ void InterpreterOptions::printUsageAndExit(const char* progName) { printf(" \\\n\t\t[URLN [--disable-http] [--optionN=valueN --optionM=valueM]]"); printf("\n"); printf("Options\n"); +#ifdef BUILD_AS_PLUGINS + printf("\t-p : path to the uSCXML plugins (or export USCXML_PLUGIN_PATH)\n"); +#endif printf("\t-v : be verbose\n"); printf("\t-d : enable debugging via HTTP\n"); - printf("\t-lN : Set loglevel to N\n"); + printf("\t-lN : set loglevel to N\n"); printf("\t-tN : port for HTTP server\n"); printf("\t-sN : port for HTTPS server\n"); printf("\t-wN : port for WebSocket server\n"); diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h index 93062e6..3a02cb7 100644 --- a/src/uscxml/Interpreter.h +++ b/src/uscxml/Interpreter.h @@ -138,7 +138,7 @@ public: }; -class NameSpaceInfo { +class USCXML_API NameSpaceInfo { public: NameSpaceInfo() : nsContext(NULL) { init(std::map<std::string, std::string>()); diff --git a/src/uscxml/plugins/invoker/CMakeLists.txt b/src/uscxml/plugins/invoker/CMakeLists.txt index ceb9c90..301f04a 100644 --- a/src/uscxml/plugins/invoker/CMakeLists.txt +++ b/src/uscxml/plugins/invoker/CMakeLists.txt @@ -474,8 +474,10 @@ if (MILES_FOUND) ${MILES_LIBRARIES} ${OPENAL_LIBRARY} ${JPEG_LIBRARIES} - ${ICONV_LIBRARIES} uscxml) + if (ICONV_FOUND) + target_link_libraries(invoker_miles ${ICONV_LIBRARIES}) + endif() set_target_properties(invoker_miles PROPERTIES FOLDER "Plugin Invoker") else() list (APPEND USCXML_FILES ${MILES_INVOKER}) |