diff options
Diffstat (limited to 'project2/ice')
-rw-r--r-- | project2/ice/iceDaemon.cpp | 12 | ||||
-rw-r--r-- | project2/ice/iceDataSource.cpp | 4 | ||||
-rw-r--r-- | project2/ice/iceModule.cpp | 4 | ||||
-rw-r--r-- | project2/ice/iceModule.h | 3 | ||||
-rw-r--r-- | project2/ice/iceRows.h | 3 | ||||
-rw-r--r-- | project2/ice/iceTask.h | 5 | ||||
-rw-r--r-- | project2/ice/pch.hpp | 8 | ||||
-rw-r--r-- | project2/ice/slice2Common.cpp | 6 | ||||
-rw-r--r-- | project2/ice/slice2Common.h | 2 | ||||
-rw-r--r-- | project2/ice/slice2Daemon.cpp | 2 | ||||
-rw-r--r-- | project2/ice/slice2Rows.cpp | 2 | ||||
-rw-r--r-- | project2/ice/slice2Task.cpp | 2 | ||||
-rw-r--r-- | project2/ice/unittests/testClient.cpp | 28 | ||||
-rw-r--r-- | project2/ice/unittests/testClientCompile.cpp | 20 | ||||
-rw-r--r-- | project2/ice/unittests/testDaemon.cpp | 12 | ||||
-rw-r--r-- | project2/ice/unittests/testDaemonCompile.cpp | 4 |
16 files changed, 59 insertions, 58 deletions
diff --git a/project2/ice/iceDaemon.cpp b/project2/ice/iceDaemon.cpp index ccd64a0..e6769b5 100644 --- a/project2/ice/iceDaemon.cpp +++ b/project2/ice/iceDaemon.cpp @@ -24,14 +24,14 @@ std::string IceDaemon::viewRoot; std::string IceDaemon::taskRoot; IceBase::Libs IceDaemon::libs; -class IceDaemonLoader : public DaemonLoader::For<IceDaemon> { +class IceDaemonFactory : public DaemonFactory::For<IceDaemon>, public LifeCycle { public: void onConfigLoad() override { IceBase::FinaliseLoad(IceDaemon::libs); } }; -DECLARE_CUSTOM_COMPONENT_LOADER("ice", IceDaemon, IceDaemonLoader, DaemonLoader); +NAMEDPLUGIN("ice", IceDaemonFactory, DaemonFactory); DECLARE_OPTIONS(IceDaemon, "ICE Daemon Options") ("ice.daemon.viewRoot", Options::value(&viewRoot, "views"), "The folder in which to find view scripts") @@ -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(); @@ -96,7 +96,7 @@ class IceDaemonViewHost : public virtual CommonObjects, public virtual CheckHost CommonObjects(s), CheckHost(s) { - s->script->loader.addLoadTarget(s, Storer::into<ElementLoader>(&view)); + s->script->loader.addLoadTarget(s, Storer::into<FlatViewFactory>(&view)); } void executeView(RowSetPresenterPtr presenter, ExecContext * ec) const { diff --git a/project2/ice/iceDataSource.cpp b/project2/ice/iceDataSource.cpp index aa033fc..cce2dd8 100644 --- a/project2/ice/iceDataSource.cpp +++ b/project2/ice/iceDataSource.cpp @@ -44,12 +44,12 @@ IceDataSource::ClearSlice() libs.clear(); } -class IceDataSourceLoader : public ElementLoader::For<IceDataSource> { +class IceDataSourceFactory : public DataSourceFactory::For<IceDataSource>, public LifeCycle { public: void onConfigLoad() override { IceBase::FinaliseLoad(IceDataSource::libs); } }; -DECLARE_CUSTOM_LOADER("icedatasource", IceDataSourceLoader); +NAMEDPLUGIN("icedatasource", IceDataSourceFactory, DataSourceFactory); 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/iceRows.h b/project2/ice/iceRows.h index dc729ff..7fcda85 100644 --- a/project2/ice/iceRows.h +++ b/project2/ice/iceRows.h @@ -30,7 +30,8 @@ class IceRows : public RowSet, public IceClient<Interface> { IceClient<Interface>(p) { } - void loadComplete(const CommonObjects * co) { + void loadComplete(const CommonObjects * co) override + { IceClient<Interface>::loadComplete(co); } }; diff --git a/project2/ice/iceTask.h b/project2/ice/iceTask.h index 2d71818..281429f 100644 --- a/project2/ice/iceTask.h +++ b/project2/ice/iceTask.h @@ -15,7 +15,10 @@ class IceTask : public Task, public IceClient<Interface> { { } - void loadComplete(const CommonObjects * co) { IceClient<Interface>::loadComplete(co); } + void loadComplete(const CommonObjects * co) override + { + IceClient<Interface>::loadComplete(co); + } }; #endif diff --git a/project2/ice/pch.hpp b/project2/ice/pch.hpp index 3ed09f0..1268e36 100644 --- a/project2/ice/pch.hpp +++ b/project2/ice/pch.hpp @@ -4,16 +4,12 @@ #include <Ice/Ice.h> #include <boost/filesystem.hpp> -#include <boost/function.hpp> +#include <boost/function/function_fwd.hpp> #include <boost/optional.hpp> -#include <commonObjects.h> -#include <exceptions.h> -#include <logger.h> #include <map> -#include <options.h> #include <Slice/Parser.h> #include <string> -#include <variables.h> +#include <boost/variant/variant_fwd.hpp> #include <slicer/modelParts.h> #include <slicer/serializer.h> diff --git a/project2/ice/slice2Common.cpp b/project2/ice/slice2Common.cpp index 9dfcf9f..9bd79aa 100644 --- a/project2/ice/slice2Common.cpp +++ b/project2/ice/slice2Common.cpp @@ -59,10 +59,10 @@ Slice2Common::ParameterVariables(Slice::OperationPtr o) } void -Slice2Common::Declaration(Slice::OperationPtr o) +Slice2Common::Declaration(Slice::OperationPtr o, const std::string & base) { - fprintf(code, "\t\t\tDECLARE_LOADER(\"%s-%s-%s\", %s);\n\n", - module.c_str(), interface.c_str(), o->name().c_str(), o->name().c_str()); + fprintf(code, "\t\t\tNAMEDFACTORY(\"%s-%s-%s\", %s, %s);\n\n", + module.c_str(), interface.c_str(), o->name().c_str(), o->name().c_str(), base.c_str()); } void diff --git a/project2/ice/slice2Common.h b/project2/ice/slice2Common.h index 170f0e7..8ea21d0 100644 --- a/project2/ice/slice2Common.h +++ b/project2/ice/slice2Common.h @@ -9,7 +9,7 @@ class Slice2Common : public Slice::ParserVisitor { void FunctionBegin(Slice::OperationPtr o); void ParameterVariables(Slice::OperationPtr o); - void Declaration(Slice::OperationPtr o); + void Declaration(Slice::OperationPtr o, const std::string &); void CallOperation(Slice::OperationPtr o); unsigned int Components() const; 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/slice2Rows.cpp b/project2/ice/slice2Rows.cpp index 8c67222..b91d158 100644 --- a/project2/ice/slice2Rows.cpp +++ b/project2/ice/slice2Rows.cpp @@ -63,7 +63,7 @@ Slice2Rows::visitOperation(const Slice::OperationPtr & o) fprintf(code, "\t\t\t\t\t}\n\n"); ParameterVariables(o); fprintf(code, "\t\t\t};\n"); - Declaration(o); + Declaration(o, "RowSetFactory"); } } diff --git a/project2/ice/slice2Task.cpp b/project2/ice/slice2Task.cpp index 84a4f29..f6dc58f 100644 --- a/project2/ice/slice2Task.cpp +++ b/project2/ice/slice2Task.cpp @@ -61,7 +61,7 @@ Slice2Task::visitOperation(const Slice::OperationPtr & o) fprintf(code, "\t\t\t\t\t}\n\n"); ParameterVariables(o); fprintf(code, "\t\t\t};\n"); - Declaration(o); + Declaration(o, "TaskFactory"); } } diff --git a/project2/ice/unittests/testClient.cpp b/project2/ice/unittests/testClient.cpp index e979f82..e151055 100644 --- a/project2/ice/unittests/testClient.cpp +++ b/project2/ice/unittests/testClient.cpp @@ -105,13 +105,13 @@ void commonTests(ExecContext * ec) { BOOST_TEST_CHECKPOINT("Verify loaded"); - BOOST_REQUIRE(ElementLoader::getFor("UnitTest-SimpleInterface-SomeTask")); - BOOST_REQUIRE(ElementLoader::getFor("UnitTest-SimpleInterface-SomeTaskParams")); - BOOST_REQUIRE(ElementLoader::getFor("UnitTest-SimpleInterface-SingleRow")); - BOOST_REQUIRE(ElementLoader::getFor("UnitTest-SimpleInterface-SomeRows")); - BOOST_REQUIRE(ElementLoader::getFor("UnitTest-SimpleInterface-SomeRowsParams")); - BOOST_REQUIRE(ElementLoader::getFor("UnitTestComplex-ComplexInterface-ComplexParam")); - BOOST_REQUIRE(ElementLoader::getFor("UnitTestComplex-ComplexInterface-ComplexRow")); + BOOST_REQUIRE(TaskFactory::get("UnitTest-SimpleInterface-SomeTask")); + BOOST_REQUIRE(TaskFactory::get("UnitTest-SimpleInterface-SomeTaskParams")); + BOOST_REQUIRE(RowSetFactory::get("UnitTest-SimpleInterface-SingleRow")); + BOOST_REQUIRE(RowSetFactory::get("UnitTest-SimpleInterface-SomeRows")); + BOOST_REQUIRE(RowSetFactory::get("UnitTest-SimpleInterface-SomeRowsParams")); + BOOST_REQUIRE(TaskFactory::get("UnitTestComplex-ComplexInterface-ComplexParam")); + BOOST_REQUIRE(RowSetFactory::get("UnitTestComplex-ComplexInterface-ComplexRow")); BOOST_TEST_CHECKPOINT("Load test script"); ScriptReaderPtr r = new XmlScriptParser(iceroot / "testClient.xml"); @@ -142,13 +142,13 @@ void unloadTests() { BOOST_TEST_CHECKPOINT("Verify unloaded"); - BOOST_REQUIRE_THROW(ElementLoader::getFor("UnitTest-SimpleInterface-SomeTask"), NotSupported); - BOOST_REQUIRE_THROW(ElementLoader::getFor("UnitTest-SimpleInterface-SomeTaskParams"), NotSupported); - BOOST_REQUIRE_THROW(ElementLoader::getFor("UnitTest-SimpleInterface-SingleRow"), NotSupported); - BOOST_REQUIRE_THROW(ElementLoader::getFor("UnitTest-SimpleInterface-SomeRows"), NotSupported); - BOOST_REQUIRE_THROW(ElementLoader::getFor("UnitTest-SimpleInterface-SomeRowsParams"), NotSupported); - BOOST_REQUIRE_THROW(ElementLoader::getFor("UnitTestComplex-ComplexInterface-ComplexParam"), NotSupported); - BOOST_REQUIRE_THROW(ElementLoader::getFor("UnitTestComplex-ComplexInterface-ComplexRow"), NotSupported); + BOOST_REQUIRE_THROW(TaskFactory::get("UnitTest-SimpleInterface-SomeTask"), AdHoc::NoSuchPluginException); + BOOST_REQUIRE_THROW(TaskFactory::get("UnitTest-SimpleInterface-SomeTaskParams"), AdHoc::NoSuchPluginException); + BOOST_REQUIRE_THROW(RowSetFactory::get("UnitTest-SimpleInterface-SingleRow"), AdHoc::NoSuchPluginException); + BOOST_REQUIRE_THROW(RowSetFactory::get("UnitTest-SimpleInterface-SomeRows"), AdHoc::NoSuchPluginException); + BOOST_REQUIRE_THROW(RowSetFactory::get("UnitTest-SimpleInterface-SomeRowsParams"), AdHoc::NoSuchPluginException); + BOOST_REQUIRE_THROW(TaskFactory::get("UnitTestComplex-ComplexInterface-ComplexParam"), AdHoc::NoSuchPluginException); + BOOST_REQUIRE_THROW(RowSetFactory::get("UnitTestComplex-ComplexInterface-ComplexRow"), AdHoc::NoSuchPluginException); } void test_client_run(ExecContext *, const boost::filesystem::path & tmpdir); diff --git a/project2/ice/unittests/testClientCompile.cpp b/project2/ice/unittests/testClientCompile.cpp index 0332da7..a299fff 100644 --- a/project2/ice/unittests/testClientCompile.cpp +++ b/project2/ice/unittests/testClientCompile.cpp @@ -21,11 +21,11 @@ void commonTests() { BOOST_TEST_CHECKPOINT("Verify loaded"); - BOOST_REQUIRE(ElementLoader::getFor("UnitTest-SimpleInterface-SomeTask")); - BOOST_REQUIRE(ElementLoader::getFor("UnitTest-SimpleInterface-SomeTaskParams")); - BOOST_REQUIRE(ElementLoader::getFor("UnitTest-SimpleInterface-SingleRow")); - BOOST_REQUIRE(ElementLoader::getFor("UnitTest-SimpleInterface-SomeRows")); - BOOST_REQUIRE(ElementLoader::getFor("UnitTest-SimpleInterface-SomeRowsParams")); + BOOST_REQUIRE(TaskFactory::get("UnitTest-SimpleInterface-SomeTask")); + BOOST_REQUIRE(TaskFactory::get("UnitTest-SimpleInterface-SomeTaskParams")); + BOOST_REQUIRE(RowSetFactory::get("UnitTest-SimpleInterface-SingleRow")); + BOOST_REQUIRE(RowSetFactory::get("UnitTest-SimpleInterface-SomeRows")); + BOOST_REQUIRE(RowSetFactory::get("UnitTest-SimpleInterface-SomeRowsParams")); } static @@ -33,11 +33,11 @@ void unloadTests() { BOOST_TEST_CHECKPOINT("Verify unloaded"); - BOOST_REQUIRE_THROW(ElementLoader::getFor("UnitTest-SimpleInterface-SomeTask"), NotSupported); - BOOST_REQUIRE_THROW(ElementLoader::getFor("UnitTest-SimpleInterface-SomeTaskParams"), NotSupported); - BOOST_REQUIRE_THROW(ElementLoader::getFor("UnitTest-SimpleInterface-SingleRow"), NotSupported); - BOOST_REQUIRE_THROW(ElementLoader::getFor("UnitTest-SimpleInterface-SomeRows"), NotSupported); - BOOST_REQUIRE_THROW(ElementLoader::getFor("UnitTest-SimpleInterface-SomeRowsParams"), NotSupported); + BOOST_REQUIRE_THROW(TaskFactory::get("UnitTest-SimpleInterface-SomeTask"), AdHoc::NoSuchPluginException); + BOOST_REQUIRE_THROW(TaskFactory::get("UnitTest-SimpleInterface-SomeTaskParams"), AdHoc::NoSuchPluginException); + BOOST_REQUIRE_THROW(RowSetFactory::get("UnitTest-SimpleInterface-SingleRow"), AdHoc::NoSuchPluginException); + BOOST_REQUIRE_THROW(RowSetFactory::get("UnitTest-SimpleInterface-SomeRows"), AdHoc::NoSuchPluginException); + BOOST_REQUIRE_THROW(RowSetFactory::get("UnitTest-SimpleInterface-SomeRowsParams"), AdHoc::NoSuchPluginException); } BOOST_FIXTURE_TEST_SUITE( Core, TestAppInstance ); diff --git a/project2/ice/unittests/testDaemon.cpp b/project2/ice/unittests/testDaemon.cpp index f12935d..3a31ebd 100644 --- a/project2/ice/unittests/testDaemon.cpp +++ b/project2/ice/unittests/testDaemon.cpp @@ -27,7 +27,7 @@ class DummyTask : public Task { static unsigned int execCount; }; -DECLARE_LOADER("DummyTask", DummyTask); +NAMEDFACTORY("DummyTask", DummyTask, TaskFactory); unsigned int DummyTask::execCount = 0; class DummyParamTask : public Task { @@ -53,7 +53,7 @@ class DummyParamTask : public Task { static VariableType execA; static VariableType execB; }; -DECLARE_LOADER("DummyParamTask", DummyParamTask); +NAMEDFACTORY("DummyParamTask", DummyParamTask, TaskFactory); unsigned int DummyParamTask::execCount = 0; VariableType DummyParamTask::execA; VariableType DummyParamTask::execB; @@ -85,7 +85,7 @@ class DummyComplexParamTask : public Task { static VariableType execB; static VariableType execD; }; -DECLARE_LOADER("DummyComplexParamTask", DummyComplexParamTask); +NAMEDFACTORY("DummyComplexParamTask", DummyComplexParamTask, TaskFactory); unsigned int DummyComplexParamTask::execCount = 0; VariableType DummyComplexParamTask::execA; VariableType DummyComplexParamTask::execB; @@ -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 ); |