![]() |
ryujin 2.5.0 revision c64172211cf21344cb9b9b0f3a1266aa6400d392
|
#include <include/ryujin/base/library.h>
Public Types | |
| using | Creator = std::function< std::unique_ptr< Base >(Args...)> |
Public Member Functions | |
| Library ()=delete | |
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 |
|
inlinestatic |
|
static |
|
inlinestatic |
Append an entry to the creators() table that constructs an object of class T with the specified arguments.
Definition at line 81 of file library.h.
References ryujin::Library< Base, Args >::add().
Referenced by ryujin::Library< Base, Args >::add().
|
static |
Construct one object per entry, in the order of registration. Throws if two objects share a name.
Definition at line 148 of file library.h.
Referenced by ryujin::InitialValues< HyperbolicDescription, dim, Number >::InitialValues(), and ryujin::EulerPoisson::ParabolicModule< HyperbolicDescription, dim, Number >::ParabolicModule().
|
static |
|
static |
|
static |
Return the object of the given objects, as returned by create(), whose name() is name. Throws if there is none.
Definition at line 189 of file library.h.
Referenced by ryujin::EulerPoisson::ParabolicModule< HyperbolicDescription, dim, Number >::ParabolicModule(), and ryujin::InitialValues< HyperbolicDescription, dim, Number >::parse_parameters_callback().