3#ifndef DUNE_ISTL_COMMON_REGISTRY_HH
4#define DUNE_ISTL_COMMON_REGISTRY_HH
14#include <dune/common/typelist.hh>
15#include <dune/common/hybridutilities.hh>
16#include <dune/common/parameterizedobject.hh>
18#define DUNE_REGISTRY_PUT(Tag, id, ...) \
21 struct Registry<Tag, DUNE_GET_COUNTER(Tag)> \
23 static auto getCreator() \
27 static std::string name() { return id; } \
35 template<
class Tag, std::
size_t index>
40 template<
template<
class>
class Base,
class V,
class Tag,
typename... Args>
41 auto registryGet(Tag , std::string name, Args... args)
43 constexpr auto count = DUNE_GET_COUNTER(Tag);
44 std::shared_ptr<Base<V> > result;
47 using Reg = Registry<Tag, index>;
48 if(!result && Reg::name() == name) {
60 template<
class V,
class Type,
class Tag,
class... Args>
63 constexpr auto count = DUNE_GET_COUNTER(Tag);
69 using Reg = Registry<Tag, index>;
70 auto genericcreator = Reg::getCreator();
71 factory.define(Reg::name(), [genericcreator](Args... args){
72 return genericcreator(V{}, args...);
A factory class for parameterized objects.
Definition: parameterizedobject.hh:36
constexpr void forEach(Range &&range, F &&f)
Range based for loop.
Definition: hybridutilities.hh:268
Dune namespace.
Definition: alignedallocator.hh:13