18 "' cannot be indexed in '" +
28 std::string(s.full_key) +
"'");
35 template <
class T,
class T_actual,
class A>
54 -> std::optional<typename attribute_table_t<S>::const_iterator> {
55 auto it = m.find(key);
57 auto keys = std::views::keys(m);
63 return std::make_optional(it);
70 requires requires { attribute_table<T, ParamString>::table; }
82 (*param)->second.set(&t, s);
87 requires requires { enum_table<T, ParamString>::table; }
91 auto it = m.find(s.
value);
93 auto vals = std::views::keys(m);
97 "Invalid value '" + std::string(s.
value) +
"' for enum '" +
99 "',\n possible value are: " +
102 t = it->second.value;
Like std::any, but storing just the pointer, without any dynamic allocation.
std::string demangled_typename(const std::type_info &t)
Get the pretty name of the given type as a string.
auto find_param(const attribute_table_t< S > &m, std::string_view key, std::string &error_msg) -> std::optional< typename attribute_table_t< S >::const_iterator >
std::map< std::string_view, attribute_accessor< S > > attribute_table_t
Dictionary that maps struct attribute names to type-erased functions that set those attributes.
void set_param_default(T &t, const json &j)
void unsupported_type(T &, ParamString s)
Throw a meaningful error to indicate that parameters of type T are not supported or implemented.
std::string_view key
The subkey to resolve next.
void assert_key_empty(ParamString s)
Throw a meaningful error when s.key is not empty, to indicate that the given type T is not of struct ...
std::string_view full_key
Full key string, used for diagnostics.
auto split_key(std::string_view full, char tok='.')
Split the string full on the first occurrence of tok.
void set_param(T &, const json &j)
Update/overwrite the first argument based on the JSON object j.
std::string_view value
The value of the parameter to store.
Represents a parameter value encoded as a string in the format abc.def.key=value.
Function wrapper to set attributes of a struct, type-erasing the type of the attribute.
Specialize this type to define the attribute name to attribute setters dictionaries for a struct type...
Function wrapper access the enumerators of an enum, type-erasing the type of the enum.
Specialize this type to define the enumerator name to value dictionaries for an enum type T.
std::string join(std::ranges::input_range auto strings, join_opt opt={})
Join the list of strings into a single string, using the separator given by opt.
void sort_case_insensitive(auto &range)
Sort the given range of strings in-place in a case-insensitive manner.
EigenConfigd DefaultConfig
static attribute_accessor make(A T_actual::*attr, std::string_view="")
std::function< void(const any_ptr &, const ParamString &)> set
enum_accessor(T value, std::string_view="")
Custom parameter parsing exception.