Class Dune::XT::Common::Configuration¶
-
class Dune::XT::Common::Configuration¶
A Dune::ParameterTree extended with typed/validated get and set, tree merging and default-access tracking.
-
Configuration &Dune::XT::Common::Configuration::operator=(const Configuration &other)¶
No documentation provided.
-
bool Dune::XT::Common::Configuration::has_key(const std::string &key) const¶
check if key is existing in tree_
-
bool Dune::XT::Common::Configuration::has_sub(const std::string &subTreeName) const¶
check if sub is existing in tree_
-
void Dune::XT::Common::Configuration::report(std::ostream &out = std::cout, const std::string &prefix =
<recovery-expr>("")) const¶ print the ParameterTree
:param out: output stream :param prefix: to be prepended to each line
-
Configuration Dune::XT::Common::Configuration::sub(const std::string &sub_id, bool fail_if_missing = true, const Configuration &default_value = Configuration()) const¶
Warning
Please note the difference to Dune::ParameterTree::sub (return: value vs. reference)!
-
void Dune::XT::Common::Configuration::set(const std::string &key, const char *value, const bool overwrite = false)¶
No documentation provided.
-
Configuration &Dune::XT::Common::Configuration::add(const Configuration &other, const std::string &sub_id =
<recovery-expr>(""), const bool overwrite = false)¶ add another Configuration to this (merge tree_s and requests_map_s)
:param other: Configuration to add :param sub_id: if not empty, other.tree_ is merged in as a sub “sub_id” of tree_ :param overwrite: if true, existing values are overwritten by other’s values to the same key
-
Configuration &Dune::XT::Common::Configuration::add(const int &other, const std::string &sub_id =
<recovery-expr>(""), const bool overwrite = false)¶ add a Dune::ParameterTree paramtree to this (merge tree_ and paramtree)
:param paramtree: ParameterTree to add :param sub_id: if not empty, paramtree is merged in as a sub “sub_id” of tree_ :param overwrite: if true, existing values are overwritten by paramtree’s values to the same key
-
Configuration &Dune::XT::Common::Configuration::operator+=(const Configuration &other)¶
add another Configuration to this (merge tree_s and requests_map_s)
-
Configuration Dune::XT::Common::Configuration::operator+(const Configuration &other) const¶
add this and another Configuration (merge tree_s and requests_map_s)
-
void Dune::XT::Common::Configuration::set_warn_on_default_access(const bool value)¶
\ }
-
void Dune::XT::Common::Configuration::set_log_on_exit(const bool value)¶
No documentation provided.
-
void Dune::XT::Common::Configuration::set_logfile(const std::string &logfile)¶
No documentation provided.
-
bool Dune::XT::Common::Configuration::empty() const¶
check if tree_ is empty
-
std::string Dune::XT::Common::Configuration::report_string(const std::string &prefix =
<recovery-expr>("")) const¶ store output of report(…, prefix) in std::string
-
int Dune::XT::Common::Configuration::flatten() const¶
No documentation provided.
-
void Dune::XT::Common::Configuration::read_command_line(int argc, char **argv)¶
get parameters from parameter file or key-value pairs given on the command line and store in Configuration (and load into fem parameter, if available)
-
void Dune::XT::Common::Configuration::read_options(int argc, char **argv)¶
search command line options for key-value pairs and add them to Configuration
-
void Dune::XT::Common::Configuration::setup_()¶
No documentation provided.
-
void Dune::XT::Common::Configuration::add_tree_(const Configuration &other, const std::string &sub_id, const bool overwrite)¶
No documentation provided.
-
static int Dune::XT::Common::Configuration::initialize(const std::string &filename)¶
read Dune::ParameterTree from file
-
static int Dune::XT::Common::Configuration::initialize(std::istream &in)¶
read Dune::ParameterTree from istream
-
static int Dune::XT::Common::Configuration::initialize(int argc, char **argv)¶
read Dune::ParameterTree from arguments
-
static int Dune::XT::Common::Configuration::initialize(int argc, char **argv, std::string filename)¶
read Dune::ParameterTree from arguments and file
-
void Dune::XT::Common::Configuration::report_as_sub(std::ostream &out, const std::string &prefix, const std::string &sub_path) const¶
No documentation provided.
-
std::string Dune::XT::Common::Configuration::find_common_prefix(const int &subtree, const std::string &previous_prefix) const¶
No documentation provided.
-
void Dune::XT::Common::Configuration::report_flatly(const int &subtree, const std::string &prefix, std::ostream &out) const¶
No documentation provided.
-
Dune::XT::Common::Configuration::Configuration()¶
No documentation provided.
-
Dune::XT::Common::Configuration::Configuration(const int &tree, const ConfigurationDefaults &defaults = ConfigurationDefaults())¶
No documentation provided.
-
Dune::XT::Common::Configuration::Configuration(const int &tree_in, const std::string &sub_id)¶
No documentation provided.
-
Dune::XT::Common::Configuration::Configuration(const Configuration &other)¶
No documentation provided.
-
Dune::XT::Common::Configuration::Configuration(const std::initializer_list<std::pair<std::string, std::string>> &key_value_pairs)¶
Allows to construct from a list of key/value pairs.
Configuration default_config() { return ; }
some_function_which_expects_a_config();
This ctor is not marked explicit on purpose to allow for code such as
or:
-
explicit Dune::XT::Common::Configuration::Configuration(std::istream &in, ConfigurationDefaults defaults = ConfigurationDefaults())¶
No documentation provided.
-
Dune::XT::Common::Configuration::Configuration(const std::string &in, ConfigurationDefaults defaults = ConfigurationDefaults())¶
No documentation provided.
-
Dune::XT::Common::Configuration::Configuration(int argc, char **argv, ConfigurationDefaults defaults = ConfigurationDefaults())¶
read ParameterTree from given arguments and call Configuration(const ParameterTree & tree)
-
Dune::XT::Common::Configuration::~Configuration() noexcept¶
No documentation provided.
-
bool Dune::XT::Common::Configuration::warn_on_default_access_¶
No documentation provided.
-
bool Dune::XT::Common::Configuration::log_on_exit_¶
No documentation provided.
-
std::string Dune::XT::Common::Configuration::logfile_¶
No documentation provided.
-
template<class T>
Dune::XT::Common::Configuration::Configuration(const int &keys, const std::initializer_list<T> values_in, const ConfigurationDefaults &defaults = ConfigurationDefaults())¶ No documentation provided.
-
template<class T, class Validator = ValidateAny<typename internal::Typer<T>::type>>
typename internal::Typer<T>::type Dune::XT::Common::Configuration::get(std::string key, const size_t size, const size_t cols = 0, const ValidatorInterface<T, Validator> &validator = ValidateAny<typename internal::Typer<T>::type>()) const¶ const get without default value, with validation
-
template<class T, class Validator = ValidateAny<typename internal::Typer<T>::type>>
typename internal::Typer<T>::type Dune::XT::Common::Configuration::get(std::string key, const ValidatorInterface<typename internal::Typer<T>::type, Validator> &validator = ValidateAny<typename internal::Typer<T>::type>()) const¶ const get without default value, with validation
-
template<typename T, class Validator = ValidateAny<typename internal::Typer<T>::type>>
typename internal::Typer<T>::type Dune::XT::Common::Configuration::get(std::string key, T def, const size_t size, const size_t cols = 0, const ValidatorInterface<typename internal::Typer<T>::type, Validator> &validator = ValidateAny<typename internal::Typer<T>::type>()) const¶ get variation with default value, validation
-
template<typename T, class Validator = ValidateAny<typename internal::Typer<T>::type>>
typename internal::Typer<T>::type Dune::XT::Common::Configuration::get(std::string key, T def, const ValidatorInterface<typename internal::Typer<T>::type, Validator> &validator = ValidateAny<typename internal::Typer<T>::type>()) const¶ get variation with default value, validation
-
template<class T>
void Dune::XT::Common::Configuration::set(const std::string &key, const T &value, const bool overwrite = false)¶ set value to key in Configuration
-
template<typename T, class Validator>
T Dune::XT::Common::Configuration::get_valid_value(const std::string &key, T def, const ValidatorInterface<typename internal::Typer<T>::type, Validator> &validator, const size_t size, const size_t cols) const¶ get value from tree and validate with validator
-
template<typename T, class Validator>
typename internal::Typer<T>::type Dune::XT::Common::Configuration::get_(const std::string &key, typename internal::Typer<T>::type def, const ValidatorInterface<T, Validator> &validator, const size_t size, const size_t cols) const¶ all public get signatures call this one
:param key: requested key :param def: default value :param validator: validator that is used to validate the value before it is returned :param request: Request that is stored in requests_map_ :param size: Determines the size of the returning container (size if T is a vector type, rows if T is a matrix type, 0 means automatic). :param cols: Determines the number of columns of the returning matrix if T is a matrix type (0 means automatic, ignored, if T is a vector or scalar type). :param def_provided: bool to indicate if the calling get method provides a default value :returns: value associated to key in Configuration (interpreted as type T), def if key does not exist in Configuration