Registry that allows for the typeless setting of a parameter value from a hit field.
More...
#include <ParameterRegistry.h>
Registry that allows for the typeless setting of a parameter value from a hit field.
Definition at line 40 of file ParameterRegistry.h.
◆ ParameterRegistry()
Moose::ParameterRegistry::ParameterRegistry |
( |
| ) |
|
|
inlineprivate |
Constructor; private so that it can only be created with the singleton.
Definition at line 63 of file ParameterRegistry.h.
Referenced by get().
◆ add()
template<class T , class F >
char Moose::ParameterRegistry::add |
( |
F && |
f | ) |
|
Add a parameter.
Definition at line 80 of file ParameterRegistry.h.
82 static_assert(std::is_invocable_r_v<void, F &, T &, const hit::Field &>,
83 "Setter function must be callable with (T &, const hit::Field &) and return void");
89 const hit::Field & field) ->
void 92 mooseAssert(cast_param_value,
"Cast failed");
93 f(cast_param_value->set(), field);
97 const auto it_inserted_pair =
_registry.emplace(key, std::move(setter));
99 if (!it_inserted_pair.second)
100 mooseError(
"ParameterRegistry: Parameter with type '", key,
"' is already registered");
std::string name(const ElemQuality q)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
std::string demangle(const char *name)
std::map< std::string, std::function< void(libMesh::Parameters::Value &value, const hit::Field &)> > _registry
Registration map of type -> function to fill each type.
◆ FRIEND_TEST() [1/5]
Moose::ParameterRegistry::FRIEND_TEST |
( |
::ParameterRegistryTest |
, |
|
|
add |
|
|
) |
| |
|
private |
◆ FRIEND_TEST() [2/5]
Moose::ParameterRegistry::FRIEND_TEST |
( |
::ParameterRegistryTest |
, |
|
|
addExists |
|
|
) |
| |
|
private |
◆ FRIEND_TEST() [3/5]
Moose::ParameterRegistry::FRIEND_TEST |
( |
::ParameterRegistryTest |
, |
|
|
set |
|
|
) |
| |
|
private |
◆ FRIEND_TEST() [4/5]
Moose::ParameterRegistry::FRIEND_TEST |
( |
::ParameterRegistryTest |
, |
|
|
setNotRegistered |
|
|
) |
| |
|
private |
◆ FRIEND_TEST() [5/5]
Moose::ParameterRegistry::FRIEND_TEST |
( |
::ParameterRegistryTest |
, |
|
|
setCatchMooseError |
|
|
) |
| |
|
private |
◆ get()
◆ set()
Sets a parameter value given a hit field.
Definition at line 26 of file ParameterRegistry.C.
Referenced by Moose::Builder::extractParams().
28 const auto key =
value.type();
31 mooseError(
"ParameterRegistry::set(): Parameter type '", key,
"' is not registered");
37 it->second(value, field);
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
std::map< std::string, std::function< void(libMesh::Parameters::Value &value, const hit::Field &)> > _registry
Registration map of type -> function to fill each type.
Scoped helper for setting Moose::_throw_on_error during this scope.
◆ _registry
The documentation for this class was generated from the following files: