Idea for python bindings for config parsing and object construction.
Python bindings for config parsers could be helpful. On the OGS side this requires separation of parsing and object creation; few snippets on how possibly to implement this.
tuple parseConfigForAClass(config)
{ ... return {a, b, c};}
struct AClass { AClass(a, b, c) : ... { ... } };
template <typename U, typename T>
U createFromDictionary(T const& tuple)
{
return std::apply(U, tuple);
}
int main()
{
x = parseConfig(..);
//auto obj = AClass(x.get<0>(), x.get<1>() ...);
//auto obj = std::apply(AClass, x);
auto obj = createFromDictionary<AClass>(x);
}
Current structure
graph LR
A[config] -->|"createAClass()"| B[obj];
Proposed split
graph LR
A[config] -->|"parseConfig()"| B[tuple of args];
B -->|"createFromDictionary<AClass>()"| C[obj];