alpaqa 1.0.0a16
Nonconvex constrained optimization
Loading...
Searching...
No Matches
param-complete.hpp
Go to the documentation of this file.
1#pragma once
2
4
5#include <optional>
6#include <string_view>
7#include <vector>
8using namespace std::string_view_literals;
9
10namespace alpaqa::params {
11
13 /// Full key string, used for diagnostics.
14 std::string_view full_key;
15 /// The subkey to resolve next.
16 std::string_view key;
17 /// The value of the parameter to store.
18 std::optional<std::string_view> value;
19};
20
21struct Result {
22 bool leaf;
23 std::string_view prefix;
24 struct Member {
25 std::string_view name;
26 std::optional<std::string_view> doc = std::nullopt;
27 std::optional<char> suffix = std::nullopt;
28 };
29 std::vector<Member> members;
30};
31
32template <class T>
33Result get_members(const MemberGetter &s); /* deliberately undefined */
34
35template <class T>
36bool is_leaf(); /* deliberately undefined */
37
38template <class T>
40 template <class T_actual, class A>
42 : get([](const auto &s) { return get_members<A>(s); }), doc(doc),
43 leaf(is_leaf<A>()) {}
46 std::string_view doc;
47 bool leaf;
48};
49
50template <class T>
52 enum_accessor(T, std::string_view doc = "") : doc(doc) {}
53 std::string_view doc;
54};
55
56} // namespace alpaqa::params
57
58void print_completion(std::string_view method, std::string_view params);
std::optional< std::string_view > doc
Result get_members(const MemberGetter &s)
Catch-all.
std::string_view key
The subkey to resolve next.
std::string_view prefix
std::string_view full_key
Full key string, used for diagnostics.
std::vector< Member > members
std::optional< std::string_view > value
The value of the parameter to store.
Function wrapper to set attributes of a struct, type-erasing the type of the attribute.
Definition structs.hpp:9
Function wrapper access the enumerators of an enum, type-erasing the type of the enum.
Definition structs.hpp:63
constexpr const auto inf
Definition config.hpp:98
void print_completion(std::string_view method, std::string_view params)
attribute_accessor(A T_actual::*, std::string_view doc="")