1#ifndef DUNE_ISTL_COMMON_REGISTRY_HH
2#define DUNE_ISTL_COMMON_REGISTRY_HH
12#include <dune/common/typelist.hh>
13#include <dune/common/hybridutilities.hh>
14#include <dune/common/parameterizedobject.hh>
16#define DUNE_REGISTRY_PUT(Tag, id, ...) \
19 struct Registry<Tag, DUNE_GET_COUNTER(Tag)> \
21 static auto getCreator() \
25 static std::string name() { return id; } \
33 template<
class Tag, std::
size_t index>
38 template<
template<
class>
class Base,
class V,
class Tag,
typename... Args>
39 auto registryGet(Tag , std::string name, Args... args)
41 constexpr auto count = DUNE_GET_COUNTER(Tag);
42 std::shared_ptr<Base<V> > result;
45 using Reg = Registry<Tag, index>;
46 if(!result && Reg::name() == name) {
58 template<
class V,
class Type,
class Tag,
class... Args>
61 constexpr auto count = DUNE_GET_COUNTER(Tag);
67 using Reg = Registry<Tag, index>;
68 auto genericcreator = Reg::getCreator();
69 factory.define(Reg::name(), [genericcreator](Args... args){
70 return genericcreator(V{}, args...);
A factory class for parameterized objects.
Definition: parameterizedobject.hh:34
constexpr void forEach(Range &&range, F &&f)
Range based for loop.
Definition: hybridutilities.hh:266
Dune namespace.
Definition: alignedallocator.hh:11