![]() |
ryujin 2.5.0 revision 3a6c8d57210175dea14d8116e1fe878f349f8c1c
|
#include <include/ryujin/base/library.h>
Public Types | |
| using | Creator = std::function< std::unique_ptr< Base >(Args...)> |
Public Member Functions | |
| Library ()=delete | |
| template<typename T > requires std::derived_from<T, Base> && std::constructible_from<T, Args...> | |
| auto | creator () -> Creator |
Static Public Member Functions | |
| template<typename T > requires std::derived_from<T, Base> && std::constructible_from<T, Args...> | |
| static Creator | creator () |
| static void | add (Creator creator) |
| template<typename T > requires std::derived_from<T, Base> && std::constructible_from<T, Args...> | |
| static void | add () |
| static std::vector< std::unique_ptr< Base > > | create (Args... args) |
| static std::vector< std::string > | names (Args... args) |
| static dealii::Patterns::Selection | selection (const std::vector< std::unique_ptr< Base > > &objects) |
| static Base & | select (const std::vector< std::unique_ptr< Base > > &objects, const std::string &name) |
A registry of creator functions for the abstract base class Base. A creator constructs an object of a class derived from Base from the arguments Args.
Library has only static members and is never constructed. One registry exists per instance: Library<Geometry<2>, const std::string &> and Library<Geometry<3>, const std::string &> are separate registries.
Entries are not keyed by name when they are added. The name of an entry is the name() of the object that it constructs: create() constructs all entries and throws if two of them share a name.
The registry starts with the built-in entries returned by defaults(), which is called when the registry is first used. add() appends further entries, at any time; an entry added after a call to create() is seen by every subsequent call. Objects are created in the order of registration.
A client can add its own entries with add(), for example in main() or in the constructor of an object at namespace scope.
| using ryujin::Library< Base, Args >::Creator = std::function<std::unique_ptr<Base>(Args...)> |
|
delete |
|
static |
Return a creator that constructs an object of class T.
|
static |
|
inlinestatic |
Append an entry to the creators() table that constructs an object of class T with the specified arguments.
Definition at line 137 of file library.h.
References ryujin::add().
|
static |
Construct one object per entry, in the order of registration. Throws if two objects share a name.
Definition at line 163 of file library.h.
Referenced by ryujin::EquationDispatch::create_parameter_files(), ryujin::InitialValues< HyperbolicDescription, dim, Number >::InitialValues(), and ryujin::EulerPoisson::ParabolicModule< HyperbolicDescription, dim, Number >::ParabolicModule().
|
static |
|
static |
Return a dealii::Patterns::Selection of the names of the given objects, as returned by create(). It is the pattern of the run time parameter that selects one of the objects by name.
Definition at line 193 of file library.h.
Referenced by ryujin::EquationDispatch::EquationDispatch().
|
static |
Return the object of the given objects, as returned by create(), whose name() is name. Throws if there is none.
Definition at line 204 of file library.h.
Referenced by ryujin::EquationDispatch::dispatch(), ryujin::EulerPoisson::ParabolicModule< HyperbolicDescription, dim, Number >::ParabolicModule(), and ryujin::InitialValues< HyperbolicDescription, dim, Number >::parse_parameters_callback().
|
inline |