hmbdc
simplify-high-performance-messaging-programming
|
class to hold an hmbdc configuration More...
#include <Config.hpp>
Public Member Functions | |
Config () | |
empty config | |
Config (istream &&is, char const *section=nullptr) | |
construct using stream, optionally specifying the section name More... | |
Config (istream &is, char const *section=nullptr) | |
construct using stream, optionally specifying the section name More... | |
Config (char const *json, char const *section=nullptr) | |
construct using a string, optionally specifying the section name More... | |
Config (ptree const &t, char const *section=nullptr) | |
construct using another ptree as fallbacks, optionally specifying the section name More... | |
Config (ptree const &t, ptree const §ion) | |
construct using a fallback ptree, and specify the section ptree More... | |
void | setDefaultUserConfig (Config const &c) |
internal use More... | |
template<typename T > | |
T | getExt (const path_type ¶m) const |
get a value from the config More... | |
template<typename T > | |
T | getHex (ptree::path_type const ¶m) |
get a number value in hex format More... | |
template<typename T > | |
Config const & | operator() (T &to, const path_type ¶m) const |
fill in a variable with a configured value retrieved using getExt More... | |
list< pair< string, string > > | content (unordered_set< string > const &skipThese=unordered_set< string >()) const |
get contents of all the effective configure in the form of list of string pairs More... | |
class to hold an hmbdc configuration
it is based on a two level json format. top level for the fallback values and lower level for section specific values shown below:
{ "parameter_1": "top level, value used as a fallback", "parameter_2": "fallback is used when not configured in a section", "section_A": { "parameter_2": "lower level, a specific value effective in section_A", "parameter_1": "a specific value effective in section_A" }, "another_section": { "parameter_2": "a specific value effective in another_section" } }
|
inlineexplicit |
construct using stream, optionally specifying the section name
if the section is nullptr, just use the fallback values. if the section name cannot be found, throw an exception
is | stream as input providing a json stream |
section | pointing to the effective section in the json above |
|
inlineexplicit |
construct using stream, optionally specifying the section name
if the section is nullptr, just use the fallback values. if the section name cannot be found, throw an exception
is | stream as input providing a json stream |
section | pointing to the effective section in the json above |
|
inlineexplicit |
construct using a string, optionally specifying the section name
if the section is nullptr, just use the fallback values. if the section name cannot be found, throw an exception
json | string as input providing a json text |
section | pointing to the effective section in the json above |
|
inline |
construct using another ptree as fallbacks, optionally specifying the section name
if the section is nullptr, just use the fallback values. if the section name cannot be found, throw an exception
t | ptree as input providing fallbacks (and sections) |
section | pointing to the effective section in the ptree above |
|
inlineexplicit |
construct using a fallback ptree, and specify the section ptree
if the section is nullptr, just use the fallback values. if the section name cannot be found, throw an exception
t | ptree as input providing fallbacks |
section | ptree providing section specific values |
|
inline |
get contents of all the effective configure in the form of list of string pairs
only effective ones are shown
skipThese | skip those config params |
|
inline |
get a value from the config
check the section for it, if not found, try use fallback provided if still missing, search using the default user config values set by setDefaultUserConfig. Throw exception ptree_bad_path if all fail
param | config parameter name |
T | type of the value |
|
inline |
get a number value in hex format
check the section for it, if not found, try use fallback provided if still missing, search using the default user config values set by setDefaultUserConfig. Throw exception ptree_bad_path if all fail
param | config parameter name |
T | numeric type of the value: int , uint64_t ... |
|
inline |
fill in a variable with a configured value retrieved using getExt
example cfg(abc, "abc")(def, "def");
to | destination |
param | config parameter |
|
inline |
internal use
this is to set the default user config values (not the fallback values)
c | a config holding configuration values |