|
template<typename ValueT > |
static std::enable_if< std::is_same< ValueT, bool >::value, ValueT >::type | get (const std::string &key) |
|
template<typename ValueT > |
static std::enable_if< std::is_floating_point< ValueT >::value, ValueT >::type | get (const std::string &key) |
|
template<typename ValueT > |
static std::enable_if< !std::is_same< ValueT, bool >::value &&std::is_integral< ValueT >::value, ValueT >::type | get (const std::string &key) |
|
template<typename ValueT > |
static std::enable_if< !std::is_floating_point< ValueT >::value &&!std::is_integral< ValueT >::value, ValueT >::type | get (const std::string &key) |
|
template<typename ValueT > |
static std::enable_if< std::is_arithmetic< ValueT >::value, void >::type | set (const std::string &key, ValueT value) |
|
static void | set (const std::string &key, std::string value) |
|
static void | set (const std::string &key, const char *cstr) |
|
static std::unordered_map< std::string, std::string >::iterator | begin () |
|
static std::unordered_map< std::string, std::string >::iterator | end () |
|
static bool | is_set (const std::string &key) |
|
static void | init () |
|
Usage:
dash::utils::Config::set("NCHUNKS", 1024);
size_t cfg_value = dash::utils::Config::get<size_t>("NCHUNKS");
Environment variables starting with 'DASH_' are automatically added.
Configuration keys ending in '_SIZE' allow to set sizes (bytes) in human-readable format, e.g. "2M" -> 2048. The parsed size in number of bytes is then stored in a separate configuration key <key name>="">_BYTES.
For example:
dash::utils::Config::set("CHUNK_SIZE", "4MB");
auto chunk_bytes = dash::utils::Config::get<size_t>("CHUNK_SIZE_BYTES");
Definition at line 41 of file Config.h.