summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--project2/ice/iceDaemon.cpp6
-rw-r--r--project2/ice/iceModule.cpp4
-rw-r--r--project2/ice/iceModule.h3
-rw-r--r--project2/ice/slice2Daemon.cpp2
-rw-r--r--project2/ice/unittests/testDaemon.cpp6
-rw-r--r--project2/ice/unittests/testDaemonCompile.cpp4
6 files changed, 13 insertions, 12 deletions
diff --git a/project2/ice/iceDaemon.cpp b/project2/ice/iceDaemon.cpp
index 15ae1b0..0f56a33 100644
--- a/project2/ice/iceDaemon.cpp
+++ b/project2/ice/iceDaemon.cpp
@@ -72,9 +72,9 @@ IceDaemon::setup() const
Ice::ObjectAdapterPtr adapter = ic->createObjectAdapterWithEndpoints(adapterName, adapterEndpoint);
Logger()->messagebf(LOG_DEBUG, " %s installing servants...", __PRETTY_FUNCTION__);
- InstanceSet<IceDaemonAdapterHandlerLoader>::OnAll([this, adapter](IceDaemonAdapterHandlerLoader * loader) {
- loader->create(this)->add(adapter, ic);
- });
+ for(auto p : AdHoc::PluginManager::getDefault()->getAll<IceDaemonAdapterHandlerFactory>()) {
+ p->implementation()->create(this)->add(adapter, ic);
+ }
Logger()->messagebf(LOG_DEBUG, " %s starting...", __PRETTY_FUNCTION__);
adapter->activate();
diff --git a/project2/ice/iceModule.cpp b/project2/ice/iceModule.cpp
index 7e39858..309e9a5 100644
--- a/project2/ice/iceModule.cpp
+++ b/project2/ice/iceModule.cpp
@@ -1,7 +1,7 @@
#include <pch.hpp>
#include "iceModule.h"
#include "iceDaemon.h"
-#include "instanceStore.impl.h"
+#include <factory.impl.h>
IceDaemonModule::IceDaemonModule(const std::string & n, const IceDaemon * id) :
name(n),
@@ -31,5 +31,5 @@ IceDaemonModule::remove(Ice::ObjectAdapterPtr adapter, Ice::CommunicatorPtr ic)
adapter->remove(ic->stringToIdentity(name));
}
-INSTANTIATESTORE(std::string, IceDaemonAdapterHandlerLoader);
+INSTANTIATEFACTORY(IceDaemonModule, const IceDaemon *);
diff --git a/project2/ice/iceModule.h b/project2/ice/iceModule.h
index fcdd3e4..49aa63b 100644
--- a/project2/ice/iceModule.h
+++ b/project2/ice/iceModule.h
@@ -9,6 +9,7 @@
#include <boost/function.hpp>
#include <slicer/modelParts.h>
#include "iceConvert.h"
+#include <factory.h>
typedef std::map<std::string, VariableType> ParamMap;
class IceDaemon;
@@ -29,7 +30,7 @@ class IceDaemonModule : virtual public ::Ice::Object {
const IceDaemon * const iceDaemon;
};
-typedef GenLoader<IceDaemonModule, std::string, const IceDaemon *> IceDaemonAdapterHandlerLoader;
+typedef AdHoc::Factory<IceDaemonModule, const IceDaemon *> IceDaemonAdapterHandlerFactory;
#endif
diff --git a/project2/ice/slice2Daemon.cpp b/project2/ice/slice2Daemon.cpp
index 177e406..41e71f1 100644
--- a/project2/ice/slice2Daemon.cpp
+++ b/project2/ice/slice2Daemon.cpp
@@ -65,7 +65,7 @@ Slice2Daemon::visitClassDefEnd(const Slice::ClassDefPtr & c)
{
if (code) {
fprintf(code, "\t}; // class %sImpl\n\n", c->name().c_str());
- fprintf(code, "\tDECLARE_GENERIC_LOADER(\"%s-%s\", IceDaemonAdapterHandlerLoader, %sImpl);\n\n",
+ fprintf(code, "\tNAMEDFACTORY(\"%s-%s\", %sImpl, IceDaemonAdapterHandlerFactory);\n\n",
module.c_str(), c->name().c_str(), c->name().c_str());
}
components += 1;
diff --git a/project2/ice/unittests/testDaemon.cpp b/project2/ice/unittests/testDaemon.cpp
index f12935d..a1985a4 100644
--- a/project2/ice/unittests/testDaemon.cpp
+++ b/project2/ice/unittests/testDaemon.cpp
@@ -96,8 +96,8 @@ void
commonTests()
{
BOOST_TEST_CHECKPOINT("Verify loaded");
- BOOST_REQUIRE(IceDaemonAdapterHandlerLoader::getFor("UnitTest-SimpleInterface"));
- BOOST_REQUIRE(IceDaemonAdapterHandlerLoader::getFor("UnitTestComplex-ComplexInterface"));
+ BOOST_REQUIRE(IceDaemonAdapterHandlerFactory::get("UnitTest-SimpleInterface"));
+ BOOST_REQUIRE(IceDaemonAdapterHandlerFactory::get("UnitTestComplex-ComplexInterface"));
int dummy = 0;
BOOST_TEST_CHECKPOINT("Run daemon");
@@ -195,7 +195,7 @@ void
unloadTests()
{
BOOST_TEST_CHECKPOINT("Verify unloaded");
- BOOST_REQUIRE_THROW(IceDaemonAdapterHandlerLoader::createNew("UnitTest-SimpleInterface", NULL), NotSupported);
+ BOOST_REQUIRE_THROW(IceDaemonAdapterHandlerFactory::createNew("UnitTest-SimpleInterface", NULL), AdHoc::NoSuchPluginException);
}
BOOST_FIXTURE_TEST_SUITE( Core, TestAppInstance );
diff --git a/project2/ice/unittests/testDaemonCompile.cpp b/project2/ice/unittests/testDaemonCompile.cpp
index 95fb6f2..c3f7064 100644
--- a/project2/ice/unittests/testDaemonCompile.cpp
+++ b/project2/ice/unittests/testDaemonCompile.cpp
@@ -18,7 +18,7 @@ void
commonTests()
{
BOOST_TEST_CHECKPOINT("Verify loaded");
- BOOST_REQUIRE(IceDaemonAdapterHandlerLoader::getFor("UnitTest-SimpleInterface"));
+ BOOST_REQUIRE(IceDaemonAdapterHandlerFactory::get("UnitTest-SimpleInterface"));
}
static
@@ -26,7 +26,7 @@ void
unloadTests()
{
BOOST_TEST_CHECKPOINT("Verify unloaded");
- BOOST_REQUIRE_THROW(IceDaemonAdapterHandlerLoader::createNew("UnitTest-SimpleInterface", NULL), NotSupported);
+ BOOST_REQUIRE_THROW(IceDaemonAdapterHandlerFactory::createNew("UnitTest-SimpleInterface", NULL), AdHoc::NoSuchPluginException);
}
BOOST_FIXTURE_TEST_SUITE( Core, TestAppInstance );