summaryrefslogtreecommitdiffstats
path: root/src/uscxml/Factory.cpp
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-05-23 14:14:56 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-05-23 14:14:56 (GMT)
commit4ecca617e628e94845dafafbdee46ce57f7bc843 (patch)
tree9113189a54068dd7916bcc377e0d1ff92fc1806b /src/uscxml/Factory.cpp
parent3709f5aa6bc3f458078b9e2b9ded67b75bbbcce4 (diff)
downloaduscxml-4ecca617e628e94845dafafbdee46ce57f7bc843.zip
uscxml-4ecca617e628e94845dafafbdee46ce57f7bc843.tar.gz
uscxml-4ecca617e628e94845dafafbdee46ce57f7bc843.tar.bz2
Builds as plugins again
Diffstat (limited to 'src/uscxml/Factory.cpp')
-rw-r--r--src/uscxml/Factory.cpp33
1 files changed, 25 insertions, 8 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