|
Cholla 3.0.1-dev
Cholla - Massively parallel hydro on GPUs
|
A class that provides map-like access to parameter files. More...
#include <ParameterMap.h>
Classes | |
| struct | ParamEntry |
Public Member Functions | |
| ParameterMap (std::FILE *fp, int argc, char **argv, bool close_fp=false) | |
| ParameterMap (const std::string &fname, int argc, char **argv) | |
| std::size_t | size () |
| bool | has_param (const std::string ¶m) |
| template<typename T > | |
| bool | param_has_type (const std::string ¶m) |
| template<typename T > | |
| T | value (const std::string ¶m) |
| bool | value_or (const std::string ¶m, bool default_val) |
| int | value_or (const std::string ¶m, int default_val) |
| std::int64_t | value_or (const std::string ¶m, std::int64_t default_val) |
| double | value_or (const std::string ¶m, double default_val) |
| std::string | value_or (const std::string ¶m, const std::string &default_val) |
| std::string | value_or (const std::string ¶m, const char *default_val) |
| int | warn_unused_parameters (const std::set< std::string > &ignore_params, bool abort_on_warning=false, bool suppress_warning_msg=false) const |
| bool | Contains_Table (std::string table_name) const |
| Checks whether the specified table name was specified in the parameter file. | |
| void | Enforce_Table_Content_Uniform_Access_Status (std::string table_name, bool expect_unused) const |
A class that provides map-like access to parameter files.
After construction, the collection of parameters and associated values can not be mutated. However, the class is not entirely immutable; internally it tracks whether parameters have been accessed.
In contrast to formats like TOML, JSON, & YAML, the parameter files don't have syntactic typing (i.e. where the syntax determines formatting). In this sense, the format is more like ini files. As a consequence, we internally store the parameters as strings. The access API explicitly converts them to the user-specified type.
bool, std::int64_t, double, std::string.int.float. The reason for this distinction is that within the overlapping interval of values represented by bothint and std::int64_t, values are represented with equal levels of accuracy. In contrast, for the overlapping interval of values represented by both float and double, the latter represents some values with greater accuracy. | void ParameterMap::Enforce_Table_Content_Uniform_Access_Status | ( | std::string | table_name, |
| bool | expect_unused | ||
| ) | const |
Aborts with an error message if one or more of the parameters in the specified table has been used or has not been used. The precise details depend on the expect_unused argument.