|
Uni20
Asynchronous tensor and runtime library.
|
Parser-independent configuration with CLI/API > file > attribute > environment > default precedence. More...
#include <configuration.hpp>
Public Types | |
| using | environment_reader = std::function< std::optional< std::string >(std::string const &)> |
Public Member Functions | |
| template<ConfigurationValue T> | |
| configuration_binding & | add (std::string id) |
| template<ConfigurationValue T> | |
| configuration_binding & | add (std::string id, T initial) |
| void | attributes (std::string repository, attribute_map values) |
| configuration_binding & | binding (std::string const &id) |
| configuration_binding const & | binding (std::string const &id) const |
| configuration (environment_reader reader=[](std::string const &name) -> std::optional< std::string > { if(auto p=std::getenv(name.c_str())) return std::string(p);return std::nullopt;}) | |
| void | copy_attributes (attribute_map &output, std::map< std::string, std::string > const &keys) const |
| Copy only explicitly selected resolved fields to output-object attributes. | |
| template<ConfigurationValue T> | |
| T | get (std::string const &id) const |
| Resolve and convert a value without choosing a runtime precision. | |
| void | option_file (std::string path, attribute_map values) |
| Supply one already parsed option file; reject undeclared or ambiguous keys before use. | |
| std::optional< resolved_value > | resolve (std::string const &id) const |
| void | set (std::string const &id, metadata_value value) |
| metadata_document | snapshot (std::string group="configuration") const |
Friends | |
| class | cli::configuration |
Parser-independent configuration with CLI/API > file > attribute > environment > default precedence.
A present empty/false/zero value wins. Invalid winners never fall back. Each resolve call makes a new owned result, permitting bootstrap resolution before input attributes are loaded. The environment reader is injectable and returns nullopt only for absence.
| using uni20::configuration::environment_reader = std::function<std::optional<std::string>(std::string const&)> |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Copy only explicitly selected resolved fields to output-object attributes.
|
inline |
Resolve and convert a value without choosing a runtime precision.
|
inline |
Supply one already parsed option file; reject undeclared or ambiguous keys before use.
|
inline |
|
inline |
|
inline |
|
friend |