diff options
Diffstat (limited to 'project2/basics')
39 files changed, 90 insertions, 80 deletions
diff --git a/project2/basics/aggregates/avg.cpp b/project2/basics/aggregates/avg.cpp index 900bc5f..0547120 100644 --- a/project2/basics/aggregates/avg.cpp +++ b/project2/basics/aggregates/avg.cpp @@ -26,5 +26,5 @@ class Average : public ValueAggregate { mutable std::list<double> vals; }; -DECLARE_LOADER("average", Average); +NAMEDFACTORY("average", Average, ValueAggregateFactory); diff --git a/project2/basics/aggregates/count.cpp b/project2/basics/aggregates/count.cpp index be22783..3d47b34 100644 --- a/project2/basics/aggregates/count.cpp +++ b/project2/basics/aggregates/count.cpp @@ -25,6 +25,5 @@ class Count : public ValueAggregate { mutable int c; }; -DECLARE_LOADER("count", Count); - +NAMEDFACTORY("count", Count, ValueAggregateFactory); diff --git a/project2/basics/aggregates/countDistinct.cpp b/project2/basics/aggregates/countDistinct.cpp index 205b932..9acba4c 100644 --- a/project2/basics/aggregates/countDistinct.cpp +++ b/project2/basics/aggregates/countDistinct.cpp @@ -22,5 +22,5 @@ class CountDistinct : public ValueAggregate { mutable std::set<VariableType> result; }; -DECLARE_LOADER("countdistinct", CountDistinct); +NAMEDFACTORY("countdistinct", CountDistinct, ValueAggregateFactory); diff --git a/project2/basics/aggregates/distinct.cpp b/project2/basics/aggregates/distinct.cpp index 33d71b0..c7f5fe0 100644 --- a/project2/basics/aggregates/distinct.cpp +++ b/project2/basics/aggregates/distinct.cpp @@ -24,4 +24,5 @@ class Distinct : public SetAggregate { mutable std::set<VariableType> result; }; -DECLARE_LOADER("distinct", Distinct); +NAMEDFACTORY("distinct", Distinct, SetAggregateFactory); + diff --git a/project2/basics/aggregates/join.cpp b/project2/basics/aggregates/join.cpp index 405c093..695626f 100644 --- a/project2/basics/aggregates/join.cpp +++ b/project2/basics/aggregates/join.cpp @@ -31,5 +31,5 @@ class Join : public ValueAggregate { Variable sep; }; -DECLARE_LOADER("join", Join); +NAMEDFACTORY("join", Join, ValueAggregateFactory); diff --git a/project2/basics/aggregates/max.cpp b/project2/basics/aggregates/max.cpp index 6304647..a193ed4 100644 --- a/project2/basics/aggregates/max.cpp +++ b/project2/basics/aggregates/max.cpp @@ -22,6 +22,5 @@ class Max : public ValueAggregate { mutable VariableType result; }; -DECLARE_LOADER("max", Max); - +NAMEDFACTORY("max", Max, ValueAggregateFactory); diff --git a/project2/basics/aggregates/min.cpp b/project2/basics/aggregates/min.cpp index 75b0b87..f5e442c 100644 --- a/project2/basics/aggregates/min.cpp +++ b/project2/basics/aggregates/min.cpp @@ -28,5 +28,5 @@ class Min : public ValueAggregate { mutable bool first; }; -DECLARE_LOADER("min", Min); +NAMEDFACTORY("min", Min, ValueAggregateFactory); diff --git a/project2/basics/aggregates/sum.cpp b/project2/basics/aggregates/sum.cpp index 68a9cd4..bdbf229 100644 --- a/project2/basics/aggregates/sum.cpp +++ b/project2/basics/aggregates/sum.cpp @@ -23,5 +23,5 @@ class Sum : public ValueAggregate { mutable double sum; }; -DECLARE_LOADER("sum", Sum); +NAMEDFACTORY("sum", Sum, ValueAggregateFactory); diff --git a/project2/basics/caches/memoryCache.cpp b/project2/basics/caches/memoryCache.cpp index 2bec824..8aaa019 100644 --- a/project2/basics/caches/memoryCache.cpp +++ b/project2/basics/caches/memoryCache.cpp @@ -138,14 +138,14 @@ class MemoryCache : public RowSetCache { CachedRowSetPtr cur; - friend class CustomMemoryCacheLoader; + friend class CustomMemoryCacheFactory; static time_t CacheLife; static CacheStore Store; }; time_t MemoryCache::CacheLife; MemoryCache::CacheStore MemoryCache::Store; -class CustomMemoryCacheLoader : public ElementLoader::For<MemoryCache> { +class CustomMemoryCacheFactory : public RowSetCacheFactory::For<MemoryCache>, public LifeCycle { public: void onPeriodic() override { typedef MemoryCache::CacheStore::index<MemoryCache::IndexByTime>::type::iterator iter; @@ -156,10 +156,10 @@ class CustomMemoryCacheLoader : public ElementLoader::For<MemoryCache> { INITOPTIONS; }; -DECLARE_CUSTOM_LOADER("memorycache", CustomMemoryCacheLoader); +NAMEDPLUGIN("memorycache", CustomMemoryCacheFactory, RowSetCacheFactory); -DECLARE_OPTIONS(CustomMemoryCacheLoader, "Memory Cache options") +DECLARE_OPTIONS(CustomMemoryCacheFactory, "Memory Cache options") ("cache.memory.life", Options::value(&MemoryCache::CacheLife, 3600), "The age of cache entries after which they are removed (seconds)") -END_OPTIONS(CustomMemoryCacheLoader); +END_OPTIONS(CustomMemoryCacheFactory); diff --git a/project2/basics/functions/dates.cpp b/project2/basics/functions/dates.cpp index b19b921..91a7077 100644 --- a/project2/basics/functions/dates.cpp +++ b/project2/basics/functions/dates.cpp @@ -35,7 +35,7 @@ class ParseDate : public VariableImpl { Variable string; Variable format; }; -DECLARE_COMPONENT_LOADER("parsedate", ParseDate, VariableLoader); +NAMEDFACTORY("parsedate", ParseDate, VariableFactory); class FormatDate : public VariableImpl { public: @@ -57,7 +57,7 @@ class FormatDate : public VariableImpl { Variable date; Variable format; }; -DECLARE_COMPONENT_LOADER("formatdate", FormatDate, VariableLoader); +NAMEDFACTORY("formatdate", FormatDate, VariableFactory); class AdjustDate : public VariableImpl { public: @@ -74,7 +74,7 @@ class AdjustDate : public VariableImpl { Variable date; Variable offset; }; -DECLARE_COMPONENT_LOADER("adjustdate", AdjustDate, VariableLoader); +NAMEDFACTORY("adjustdate", AdjustDate, VariableFactory); class CurrentDate : public VariableImpl { public: @@ -86,5 +86,5 @@ class CurrentDate : public VariableImpl { return boost::posix_time::microsec_clock::universal_time(); } }; -DECLARE_COMPONENT_LOADER("currentdate", CurrentDate, VariableLoader); +NAMEDFACTORY("currentdate", CurrentDate, VariableFactory); diff --git a/project2/basics/functions/strings.cpp b/project2/basics/functions/strings.cpp index 735a781..640cfb3 100644 --- a/project2/basics/functions/strings.cpp +++ b/project2/basics/functions/strings.cpp @@ -23,6 +23,6 @@ class Trim : public VariableImpl { private: Variable string; }; -DECLARE_COMPONENT_LOADER("trim", Trim, VariableLoader); +NAMEDFACTORY("trim", Trim, VariableFactory); diff --git a/project2/basics/if.cpp b/project2/basics/if.cpp index bdd9835..d860b55 100644 --- a/project2/basics/if.cpp +++ b/project2/basics/if.cpp @@ -4,8 +4,10 @@ #include "scriptLoader.h" #include <boost/bind.hpp> #include <algorithm> +#include <task.h> -DECLARE_LOADER("if", If); +NAMEDFACTORY("if", If, ViewFactory); +NAMEDFACTORY("if", If, TaskFactory); StaticMessageException(NoTestsToPerform, "No tests to perform"); If::If(ScriptNodePtr e) : @@ -13,9 +15,9 @@ If::If(ScriptNodePtr e) : IHaveSubTasks(e), View(e) { - e->script->loader.addLoadTarget(e, Storer::into<ElementLoader>(&normal)); - e->script->loader.addLoadTarget(e, Storer::into<ElementLoader>(&subViews)); - e->script->loader.addLoadTarget(e, Storer::into<ElementLoader>(&test)); + e->script->loader.addLoadTarget(e, Storer::into<TaskFactory>(&normal)); + e->script->loader.addLoadTarget(e, Storer::into<ViewFactory>(&subViews)); + e->script->loader.addLoadTarget(e, Storer::into<TestFactory>(&test)); } bool diff --git a/project2/basics/loggers/consoleLog.cpp b/project2/basics/loggers/consoleLog.cpp index de45245..a88e6b2 100644 --- a/project2/basics/loggers/consoleLog.cpp +++ b/project2/basics/loggers/consoleLog.cpp @@ -1,5 +1,5 @@ -#include "logger.h" -#include "options.h" +#include <loggerFactory.impl.h> +#include <options.h> /// Logger that writes to the console class ConsoleLogDriver : public LogDriverBase { @@ -25,5 +25,5 @@ END_OPTIONS(ConsoleLogDriver); int ConsoleLogDriver::level; -DECLARE_LOGGER_LOADER("console", ConsoleLogDriver); +DECLARE_LOGGER("console", ConsoleLogDriver); diff --git a/project2/basics/loggers/syslogLog.cpp b/project2/basics/loggers/syslogLog.cpp index 8e58326..cb026c6 100644 --- a/project2/basics/loggers/syslogLog.cpp +++ b/project2/basics/loggers/syslogLog.cpp @@ -1,5 +1,5 @@ -#include "logger.h" -#include "options.h" +#include <loggerFactory.impl.h> +#include <options.h> /// Logger that writes to syslog class SyslogLogDriver : public LogDriverBase { @@ -35,5 +35,5 @@ END_OPTIONS(SyslogLogDriver); int SyslogLogDriver::level; std::string SyslogLogDriver::ident; -DECLARE_LOGGER_LOADER("syslog", SyslogLogDriver); +DECLARE_LOGGER("syslog", SyslogLogDriver); diff --git a/project2/basics/options/preload.cpp b/project2/basics/options/preload.cpp index 5cf42e8..4781abb 100644 --- a/project2/basics/options/preload.cpp +++ b/project2/basics/options/preload.cpp @@ -19,7 +19,7 @@ class Preload { static void LoadLibrary(const VariableType & librarypath) { - const auto beforeOpts = InstanceSet<Options>::GetAll(); + const auto beforeOpts = AdHoc::PluginManager::getDefault()->getAll<Options>(); void * handle = dlopen(librarypath, RTLD_GLOBAL | RTLD_NOW); if (handle) { @@ -32,10 +32,10 @@ class Preload { } libs[librarypath.as<std::string>()] = boost::shared_ptr<void>(handle, &dlclose); - const auto afterOpts = InstanceSet<Options>::GetAll(); + const auto afterOpts = AdHoc::PluginManager::getDefault()->getAll<Options>(); for (const auto & opt : afterOpts) { if (std::find(beforeOpts.begin(), beforeOpts.end(), opt) == beforeOpts.end()) { - opt->reset(); + opt->implementation()->reset(); } } } diff --git a/project2/basics/options/showHelp.cpp b/project2/basics/options/showHelp.cpp index 86dbc6f..395baed 100644 --- a/project2/basics/options/showHelp.cpp +++ b/project2/basics/options/showHelp.cpp @@ -8,7 +8,9 @@ void ShowHelpComponent::onConfigLoad() if (!showHelp) return; fprintf(stdout, "Help\n"); - InstanceSet<Options>::OnAll(boost::bind(&ShowHelpComponent::outputOptions, this, _1)); + for (auto opts : AdHoc::PluginManager::getDefault()->getAll<Options>()) { + outputOptions(opts->implementation()); + } exit(1); } @@ -27,5 +29,5 @@ ShowHelpComponent::Option() } bool ShowHelpComponent::showHelp; -DECLARE_COMPONENT("ShowHelpComponent", ShowHelpComponent); +NAMEDPLUGIN("ShowHelpComponent", ShowHelpComponent, LifeCycle); diff --git a/project2/basics/options/showHelp.h b/project2/basics/options/showHelp.h index 75fb4cb..c42a736 100644 --- a/project2/basics/options/showHelp.h +++ b/project2/basics/options/showHelp.h @@ -1,10 +1,10 @@ #ifndef SHOWHELP_H #define SHOWHELP_H -#include <componentLoader.h> #include <options.h> +#include <lifeCycle.h> -class ShowHelpComponent : public ComponentLoader { +class ShowHelpComponent : public LifeCycle { public: void onConfigLoad() override; static Options::TargetPtr Option(); diff --git a/project2/basics/tasks/iterate.cpp b/project2/basics/tasks/iterate.cpp index d2a767a..16224f6 100644 --- a/project2/basics/tasks/iterate.cpp +++ b/project2/basics/tasks/iterate.cpp @@ -4,14 +4,14 @@ #include <boost/bind.hpp> #include "scriptLoader.h" -DECLARE_LOADER("iterate", Iterate); +NAMEDFACTORY("iterate", Iterate, TaskFactory); Iterate::Iterate(ScriptNodePtr p) : SourceObject(p), IHaveSubTasks(p), RowProcessor(p) { - p->script->loader.addLoadTarget(p, Storer::into<ElementLoader>(&normal)); + p->script->loader.addLoadTarget(p, Storer::into<TaskFactory>(&normal)); } Iterate::~Iterate() diff --git a/project2/basics/tasks/session/sessionClearTask.cpp b/project2/basics/tasks/session/sessionClearTask.cpp index 8a21791..2b016be 100644 --- a/project2/basics/tasks/session/sessionClearTask.cpp +++ b/project2/basics/tasks/session/sessionClearTask.cpp @@ -4,7 +4,7 @@ #include "session.h" #include "execContext.h" -DECLARE_LOADER("sessionclear", SessionClearTask); +NAMEDFACTORY("sessionclear", SessionClearTask, TaskFactory); SessionClearTask::SessionClearTask(ScriptNodePtr p) : SourceObject(p), diff --git a/project2/basics/tasks/session/sessionSetTask.cpp b/project2/basics/tasks/session/sessionSetTask.cpp index 120dd06..f009e46 100644 --- a/project2/basics/tasks/session/sessionSetTask.cpp +++ b/project2/basics/tasks/session/sessionSetTask.cpp @@ -4,7 +4,7 @@ #include "session.h" #include "execContext.h" -DECLARE_LOADER("sessionset", SessionSetTask); +NAMEDFACTORY("sessionset", SessionSetTask, TaskFactory); SessionSetTask::SessionSetTask(ScriptNodePtr p) : SourceObject(p), diff --git a/project2/basics/tasks/structExceptHandling.cpp b/project2/basics/tasks/structExceptHandling.cpp index b79dae6..4e46466 100644 --- a/project2/basics/tasks/structExceptHandling.cpp +++ b/project2/basics/tasks/structExceptHandling.cpp @@ -3,16 +3,17 @@ #include "scriptLoader.h" #include "scriptStorage.h" #include "scripts.h" +#include <task.h> -DECLARE_LOADER("handler", StructuredExceptionHandler); +NAMEDFACTORY("handler", StructuredExceptionHandler, TaskFactory); StructuredExceptionHandler::StructuredExceptionHandler(ScriptNodePtr e) : SourceObject(e), IHaveSubTasks(e) { - e->script->loader.addLoadTargetSub(e, "try", true, Storer::into<ElementLoader>(&normal)); - e->script->loader.addLoadTargetSub(e, "catch", false, Storer::into<ElementLoader>(&catches)); - e->script->loader.addLoadTargetSub(e, "finally", false, Storer::into<ElementLoader>(&finallies)); + e->script->loader.addLoadTargetSub(e, "try", true, Storer::into<TaskFactory>(&normal)); + e->script->loader.addLoadTargetSub(e, "catch", false, Storer::into<TaskFactory>(&catches)); + e->script->loader.addLoadTargetSub(e, "finally", false, Storer::into<TaskFactory>(&finallies)); } void diff --git a/project2/basics/tests/compoundTest.cpp b/project2/basics/tests/compoundTest.cpp index 3799d06..88cff62 100644 --- a/project2/basics/tests/compoundTest.cpp +++ b/project2/basics/tests/compoundTest.cpp @@ -10,7 +10,7 @@ CompoundTest::CompoundTest(ScriptNodePtr s) : SourceObject(s), Test(s) { - s->script->loader.addLoadTarget(s, Storer::into<ElementLoader>(&tests)); + s->script->loader.addLoadTarget(s, Storer::into<TestFactory>(&tests)); } class All : public CompoundTest { @@ -26,7 +26,7 @@ class All : public CompoundTest { return (std::find_if(tests.begin(), tests.end(), !boost::bind(&Test::passes, _1, ec)) == tests.end()); } }; -DECLARE_LOADER("all", All); +NAMEDFACTORY("all", All, TestFactory); class Any : public CompoundTest { public: @@ -41,7 +41,7 @@ class Any : public CompoundTest { return (std::find_if(tests.begin(), tests.end(), boost::bind(&Test::passes, _1, ec)) != tests.end()); } }; -DECLARE_LOADER("any", Any); +NAMEDFACTORY("any", Any, TestFactory); class None : public CompoundTest { public: @@ -56,7 +56,7 @@ class None : public CompoundTest { return (std::find_if(tests.begin(), tests.end(), boost::bind(&Test::passes, _1, ec)) == tests.end()); } }; -DECLARE_LOADER("none", None); +NAMEDFACTORY("none", None, TestFactory); class Not : public Test { public: @@ -64,7 +64,7 @@ class Not : public Test { SourceObject(s), Test(s) { - s->script->loader.addLoadTarget(s, Storer::into<ElementLoader>(&test)); + s->script->loader.addLoadTarget(s, Storer::into<TestFactory>(&test)); } bool passes(ExecContext * ec) const { if (!test) { @@ -75,4 +75,4 @@ class Not : public Test { private: TestPtr test; }; -DECLARE_LOADER("not", Not); +NAMEDFACTORY("not", Not, TestFactory); diff --git a/project2/basics/tests/equals.cpp b/project2/basics/tests/equals.cpp index 425d317..3f32053 100644 --- a/project2/basics/tests/equals.cpp +++ b/project2/basics/tests/equals.cpp @@ -16,9 +16,9 @@ class Equals : public Test { bool passes(ExecContext * ec) const { return (a(ec) == b(ec)); } - + private: Variable a, b; }; -DECLARE_LOADER("equals", Equals); +NAMEDFACTORY("equals", Equals, TestFactory); diff --git a/project2/basics/tests/greaterthan.cpp b/project2/basics/tests/greaterthan.cpp index b43cef1..01e5812 100644 --- a/project2/basics/tests/greaterthan.cpp +++ b/project2/basics/tests/greaterthan.cpp @@ -16,9 +16,9 @@ class GreaterThan : public Test { bool passes(ExecContext * ec) const { return (a(ec) > b(ec)); } - + private: Variable a, b; }; -DECLARE_LOADER("greaterthan", GreaterThan); +NAMEDFACTORY("greaterthan", GreaterThan, TestFactory); diff --git a/project2/basics/tests/greaterthanorequal.cpp b/project2/basics/tests/greaterthanorequal.cpp index 67328b2..f5f0124 100644 --- a/project2/basics/tests/greaterthanorequal.cpp +++ b/project2/basics/tests/greaterthanorequal.cpp @@ -16,9 +16,9 @@ class GreaterThanOrEqual : public Test { bool passes(ExecContext * ec) const { return (a(ec) >= b(ec)); } - + private: Variable a, b; }; -DECLARE_LOADER("greaterthanorequal", GreaterThanOrEqual); +NAMEDFACTORY("greaterthanorequal", GreaterThanOrEqual, TestFactory); diff --git a/project2/basics/tests/isdistinct.cpp b/project2/basics/tests/isdistinct.cpp index 47ed647..2c95535 100644 --- a/project2/basics/tests/isdistinct.cpp +++ b/project2/basics/tests/isdistinct.cpp @@ -37,4 +37,5 @@ class IsDistinct : public Test, IHaveParameters { typedef std::set<Vars> Rows; mutable Rows previous; }; -DECLARE_LOADER("isdistinct", IsDistinct); +NAMEDFACTORY("isdistinct", IsDistinct, TestFactory); + diff --git a/project2/basics/tests/isuniq.cpp b/project2/basics/tests/isuniq.cpp index dc71ac5..295be40 100644 --- a/project2/basics/tests/isuniq.cpp +++ b/project2/basics/tests/isuniq.cpp @@ -45,4 +45,5 @@ class IsUniq : public Test, IHaveParameters { typedef std::vector<VariableType> Vars; mutable Vars previous; }; -DECLARE_LOADER("isuniq", IsUniq); +NAMEDFACTORY("isuniq", IsUniq, TestFactory); + diff --git a/project2/basics/tests/lessthan.cpp b/project2/basics/tests/lessthan.cpp index f040532..3f172ef 100644 --- a/project2/basics/tests/lessthan.cpp +++ b/project2/basics/tests/lessthan.cpp @@ -16,9 +16,9 @@ class LessThan : public Test { bool passes(ExecContext * ec) const { return (a(ec) < b(ec)); } - + private: Variable a, b; }; -DECLARE_LOADER("lessthan", LessThan); +NAMEDFACTORY("lessthan", LessThan, TestFactory); diff --git a/project2/basics/tests/lessthanorequal.cpp b/project2/basics/tests/lessthanorequal.cpp index 1cb0e9e..8a64e01 100644 --- a/project2/basics/tests/lessthanorequal.cpp +++ b/project2/basics/tests/lessthanorequal.cpp @@ -16,9 +16,9 @@ class LessThanOrEqual : public Test { bool passes(ExecContext * ec) const { return (a(ec) <= b(ec)); } - + private: Variable a, b; }; -DECLARE_LOADER("lessthanorequal", LessThanOrEqual); +NAMEDFACTORY("lessthanorequal", LessThanOrEqual, TestFactory); diff --git a/project2/basics/tests/notequals.cpp b/project2/basics/tests/notequals.cpp index aeb784e..bbf3186 100644 --- a/project2/basics/tests/notequals.cpp +++ b/project2/basics/tests/notequals.cpp @@ -16,9 +16,9 @@ class NotEquals : public Test { bool passes(ExecContext * ec) const { return (a(ec) != b(ec)); } - + private: Variable a, b; }; -DECLARE_LOADER("notequals", NotEquals); +NAMEDFACTORY("notequals", NotEquals, TestFactory); diff --git a/project2/basics/tests/validDateCheck.cpp b/project2/basics/tests/validDateCheck.cpp index b1ab5a3..231a478 100644 --- a/project2/basics/tests/validDateCheck.cpp +++ b/project2/basics/tests/validDateCheck.cpp @@ -62,5 +62,5 @@ class ValidDateTest : public Test { int warnLev; }; -DECLARE_LOADER("validdatetest", ValidDateTest); +NAMEDFACTORY("validdatetest", ValidDateTest, TestFactory); diff --git a/project2/basics/unittests/dummylib.cpp b/project2/basics/unittests/dummylib.cpp index 2e919a0..a493f3c 100644 --- a/project2/basics/unittests/dummylib.cpp +++ b/project2/basics/unittests/dummylib.cpp @@ -13,5 +13,5 @@ class DummyTask : public Task { } }; -DECLARE_LOADER("DummyTask", DummyTask); +NAMEDFACTORY("DummyTask", DummyTask, TaskFactory); diff --git a/project2/basics/unittests/testLibraries.cpp b/project2/basics/unittests/testLibraries.cpp index 9b05166..7797694 100644 --- a/project2/basics/unittests/testLibraries.cpp +++ b/project2/basics/unittests/testLibraries.cpp @@ -4,6 +4,7 @@ #include <testOptionsSource.h> #include <exceptions.h> #include <library.h> +#include <task.h> #include <testAppInstance.h> #define XSTR(s) STR(s) @@ -24,18 +25,18 @@ BOOST_AUTO_TEST_CASE( load_missing_library ) BOOST_AUTO_TEST_CASE( load_and_unload_library ) { - BOOST_REQUIRE_THROW(ElementLoader::getFor("DummyTask"), NotSupported); + BOOST_REQUIRE_THROW(TaskFactory::get("DummyTask"), AdHoc::NoSuchPluginException); BOOST_TEST_CHECKPOINT("Configure (load)"); TestOptionsSource::LoadTestOptions({ { "library", (root / "bin" / self.parent_path().parent_path().leaf() / self.parent_path().leaf() / "libdummylib.so").string() } }); BOOST_TEST_CHECKPOINT("Verify"); - BOOST_REQUIRE(ElementLoader::getFor("DummyTask")); + BOOST_REQUIRE(TaskFactory::get("DummyTask")); BOOST_TEST_CHECKPOINT("Configure (empty)"); TestOptionsSource::LoadTestOptions({ }); - BOOST_REQUIRE_THROW(ElementLoader::getFor("DummyTask"), NotSupported); + BOOST_REQUIRE_THROW(TaskFactory::get("DummyTask"), AdHoc::NoSuchPluginException); } BOOST_AUTO_TEST_SUITE_END(); diff --git a/project2/basics/views/autotree.cpp b/project2/basics/views/autotree.cpp index 48cb643..bfeabee 100644 --- a/project2/basics/views/autotree.cpp +++ b/project2/basics/views/autotree.cpp @@ -4,7 +4,7 @@ #include "scriptLoader.h" #include <boost/bind.hpp> -DECLARE_LOADER("autotree", AutoTree); +NAMEDFACTORY("autotree", AutoTree, ViewFactory); AutoTree::AutoTree(ScriptNodePtr p) : SourceObject(p), diff --git a/project2/basics/views/flatView.cpp b/project2/basics/views/flatView.cpp index ad13105..1ad2c68 100644 --- a/project2/basics/views/flatView.cpp +++ b/project2/basics/views/flatView.cpp @@ -3,8 +3,10 @@ #include "presenter.h" #include "scriptLoader.h" #include <boost/bind.hpp> +#include <factory.impl.h> -DECLARE_LOADER("flatview", FlatView); +NAMEDFACTORY("flatview", FlatView, FlatViewFactory); +INSTANTIATEFACTORY(FlatView, ScriptNodePtr); FlatView::FlatView(ScriptNodePtr p) : SourceObject(p), diff --git a/project2/basics/views/flatView.h b/project2/basics/views/flatView.h index 5dc24dc..3e7f9d2 100644 --- a/project2/basics/views/flatView.h +++ b/project2/basics/views/flatView.h @@ -23,6 +23,7 @@ class FlatView : public SourceObject, public RowProcessor { typedef std::map<Glib::ustring, Variable> Columns; Columns viewColumns; }; +typedef AdHoc::Factory<FlatView, ScriptNodePtr> FlatViewFactory; #endif diff --git a/project2/basics/views/rowView.cpp b/project2/basics/views/rowView.cpp index 8ec5417..a798688 100644 --- a/project2/basics/views/rowView.cpp +++ b/project2/basics/views/rowView.cpp @@ -5,7 +5,7 @@ #include <scopeExit.h> #include <boost/bind.hpp> -DECLARE_LOADER("view", RowView); +NAMEDFACTORY("view", RowView, ViewFactory); RowView::RowView(ScriptNodePtr p) : SourceObject(p), @@ -23,9 +23,9 @@ RowView::RowView(ScriptNodePtr p) : viewColumns->insert(Columns::value_type(node->get_name(), Variable(node))); } } - p->script->loader.addLoadTarget(p, Storer::into<ElementLoader>(&subViews)); - p->script->loader.addLoadTarget(p, Storer::into<ElementLoader>(&valueAggregates)); - p->script->loader.addLoadTarget(p, Storer::into<ElementLoader>(&setAggregates)); + p->script->loader.addLoadTarget(p, Storer::into<ViewFactory>(&subViews)); + p->script->loader.addLoadTarget(p, Storer::into<ValueAggregateFactory>(&valueAggregates)); + p->script->loader.addLoadTarget(p, Storer::into<SetAggregateFactory>(&setAggregates)); } RowView::~RowView() diff --git a/project2/basics/views/singleton.cpp b/project2/basics/views/singleton.cpp index 29b32aa..15f2908 100644 --- a/project2/basics/views/singleton.cpp +++ b/project2/basics/views/singleton.cpp @@ -14,7 +14,7 @@ class Singleton : public View { for (ScriptNodePtr node : p->childrenIn("columns")) { viewColumns.insert(Columns::value_type(node->get_name(), Variable(node))); } - p->script->loader.addLoadTarget(p, Storer::into<ElementLoader>(&subViews)); + p->script->loader.addLoadTarget(p, Storer::into<ViewFactory>(&subViews)); } void execute(const MultiRowSetPresenter * p, ExecContext * ec) const { @@ -40,5 +40,5 @@ class Singleton : public View { typedef ANONSTORAGEOF(View) SubViews; SubViews subViews; }; -DECLARE_LOADER("singleton", Singleton); +NAMEDFACTORY("singleton", Singleton, ViewFactory); diff --git a/project2/basics/views/viewGroup.cpp b/project2/basics/views/viewGroup.cpp index 0049e9d..8237e86 100644 --- a/project2/basics/views/viewGroup.cpp +++ b/project2/basics/views/viewGroup.cpp @@ -7,7 +7,7 @@ class ViewGroup : public View { SourceObject(s), View(s) { - s->script->loader.addLoadTarget(s, Storer::into<ElementLoader>(&subViews)); + s->script->loader.addLoadTarget(s, Storer::into<ViewFactory>(&subViews)); } void execute(const MultiRowSetPresenter * presenter, ExecContext * ec) const @@ -23,4 +23,4 @@ class ViewGroup : public View { SubViews subViews; }; -DECLARE_LOADER("viewgroup", ViewGroup); +NAMEDFACTORY("viewgroup", ViewGroup, ViewFactory); |