Commit f30ccb59 authored by Stanislav Bohm's avatar Stanislav Bohm

ENH: templated add_task_factory

parent 08cb3cc7
......@@ -84,6 +84,11 @@ public:
unregistered_task_factories.push_back(std::move(factory));
}
template<typename T> void add_task_factory(const std::string &name)
{
add_task_factory(std::make_unique<SimpleTaskFactory<T>>(name));
}
InterConnection &get_connection(const std::string &address);
void close_all();
......
......@@ -114,28 +114,20 @@ int main(int argc, char **argv)
loom::llog->info("Worker started; listening on port {}", worker.get_listen_port());
// Base
worker.add_task_factory(
std::make_unique<SimpleTaskFactory<GetTask>>("base/get"));
worker.add_task_factory(
std::make_unique<SimpleTaskFactory<SliceTask>>("base/slice"));
worker.add_task_factory<GetTask>("base/get");
worker.add_task_factory<SliceTask>("base/slice");
// RawData
worker.add_task_factory(
std::make_unique<SimpleTaskFactory<ConstTask>>("data/const"));
worker.add_task_factory(
std::make_unique<SimpleTaskFactory<MergeTask>>("data/merge"));
worker.add_task_factory(
std::make_unique<SimpleTaskFactory<OpenTask>>("data/open"));
worker.add_task_factory(
std::make_unique<SimpleTaskFactory<SplitTask>>("data/split"));
worker.add_task_factory<ConstTask>("data/const");
worker.add_task_factory<MergeTask>("data/merge");
worker.add_task_factory<OpenTask>("data/open");
worker.add_task_factory<SplitTask>("data/split");
// Arrays
worker.add_task_factory(
std::make_unique<SimpleTaskFactory<ArrayMakeTask>>("array/make"));
worker.add_task_factory<ArrayMakeTask>("array/make");
// Run
worker.add_task_factory(
std::make_unique<SimpleTaskFactory<RunTask>>("run/run"));
worker.add_task_factory<RunTask>("run/run");
worker.set_cpus(config.cpus);
uv_run(&loop, UV_RUN_DEFAULT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment