Parameters system¶
Runtime configuration for the eOn C++ client lives in the Parameters
class. Field names, types, and defaults for the high-traffic option groups
are authored in a Cap’n Proto schema.
Runtime architecture¶
Option-group structs (
Parameters.h): nested C++ structs; covered defaults originate from the Cap’n Proto schema viaeonc::config::apply_ssot_defaults()in theParametersconstructor.INI parser (
ParametersINI.cpp): readsconfig.inivia inih and populates option groups.JSON serializer (
ParametersJSON.cpp):to_json()/from_json()for library use, RPC text blobs, and debugging.
validate_and_link() resolves cross-group dependencies (time unit conversions,
default inheritance) after loading from any source.
Cross-group dependencies¶
Some fields depend on values from other groups. These are resolved in
validate_and_link() after all groups have their raw values:
Dependent field |
Source |
|---|---|
|
|
|
|
|
|
|
|
All |
|
Narrow parameter passing¶
Core classes receive only the option groups they need via config structs:
Class |
Config struct |
Fields |
|---|---|---|
|
Direct members |
|
|
|
|
|
|
12 fields from 5 groups |
|
|
No Parameters dependency |
Deprecated backward-compatibility constructors are retained for callers that
still pass the full Parameters object.
JSON serialization¶
ParametersJSON.cpp provides round-trip JSON serialization using
nlohmann/json. JSON covers:
Library usage: configure eOn programmatically without INI files
RPC transport: send config as JSON text via capnp serve mode
Debugging: dump current config to human-readable JSON
Parameters params;
params.load_json(R"({"Main": {"job": "Nudged_Elastic_Band", "temperature": 500}})");
std::string json = params.to_json(); // pretty-printed JSON
Python server vs client¶
The Python server (python -m eon / eon-server) still uses
eon.config.ConfigClass driven by config.ini and eon/config.yaml for
validation of allowed keys. For covered groups, those keys and defaults are
parity-checked against the Cap’n Proto catalog. The client binary
(eonclient) uses Parameters with the same SSoT-backed defaults for those
groups.
History¶
The v3c branch (2024) attempted to switch from INI to TOML and restructure all parameters simultaneously. It was abandoned because it changed too many fields at once. Later work added NSDMI defaults, JSON I/O, and narrow passing. The Cap’n Proto L0 field graph unifies authoring for the core groups without forcing a pure-binary config format on users.