Class Dune::XT::Common::Configuration¶
Inherits from Dune::ParameterTree.
-
class Dune::XT::Common::Configuration : public Dune::ParameterTree¶
A Dune::ParameterTree extended with typed/validated get and set, tree merging and default-access tracking.
Method Dune::XT::Common::Configuration::operator=¶
-
Configuration &Dune::XT::Common::Configuration::operator=(const Configuration &other)¶
No documentation provided.
Method Dune::XT::Common::Configuration::has_key¶
-
bool Dune::XT::Common::Configuration::has_key(const std::string &key) const¶
check if key is existing in tree_
Method Dune::XT::Common::Configuration::has_sub¶
-
bool Dune::XT::Common::Configuration::has_sub(const std::string &subTreeName) const¶
check if sub is existing in tree_
Method Dune::XT::Common::Configuration::report¶
-
void Dune::XT::Common::Configuration::report(std::ostream &out = std::cout, const std::string &prefix) const¶
print the ParameterTree
:param out: output stream :param prefix: to be prepended to each line
Method Dune::XT::Common::Configuration::sub¶
-
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)!
Method Dune::XT::Common::Configuration::set¶
-
void Dune::XT::Common::Configuration::set(const std::string &key, const char *value, const bool overwrite = false)¶
No documentation provided.
Method Dune::XT::Common::Configuration::add¶
-
Configuration &Dune::XT::Common::Configuration::add(const Configuration &other, const std::string &sub_id, 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
Method Dune::XT::Common::Configuration::add¶
-
Configuration &Dune::XT::Common::Configuration::add(const ParameterTree &other, const std::string &sub_id, 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
Method Dune::XT::Common::Configuration::operator+=¶
-
Configuration &Dune::XT::Common::Configuration::operator+=(const Configuration &other)¶
add another Configuration to this (merge tree_s and requests_map_s)
Method Dune::XT::Common::Configuration::operator+¶
-
Configuration Dune::XT::Common::Configuration::operator+(const Configuration &other) const¶
add this and another Configuration (merge tree_s and requests_map_s)
Method Dune::XT::Common::Configuration::set_warn_on_default_access¶
-
void Dune::XT::Common::Configuration::set_warn_on_default_access(const bool value)¶
\ }
Method Dune::XT::Common::Configuration::set_log_on_exit¶
-
void Dune::XT::Common::Configuration::set_log_on_exit(const bool value)¶
No documentation provided.
Method Dune::XT::Common::Configuration::set_logfile¶
-
void Dune::XT::Common::Configuration::set_logfile(const std::string &logfile)¶
No documentation provided.
Method Dune::XT::Common::Configuration::empty¶
-
bool Dune::XT::Common::Configuration::empty() const¶
check if tree_ is empty
Method Dune::XT::Common::Configuration::report_string¶
-
std::string Dune::XT::Common::Configuration::report_string(const std::string &prefix) const¶
store output of report(…, prefix) in std::string
Method Dune::XT::Common::Configuration::flatten¶
-
int Dune::XT::Common::Configuration::flatten() const¶
No documentation provided.
Method Dune::XT::Common::Configuration::read_command_line¶
-
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)
Method Dune::XT::Common::Configuration::read_options¶
-
void Dune::XT::Common::Configuration::read_options(int argc, char **argv)¶
search command line options for key-value pairs and add them to Configuration
Method Dune::XT::Common::Configuration::setup_¶
-
void Dune::XT::Common::Configuration::setup_()¶
No documentation provided.
Method Dune::XT::Common::Configuration::add_tree_¶
-
void Dune::XT::Common::Configuration::add_tree_(const Configuration &other, const std::string &sub_id, const bool overwrite)¶
No documentation provided.
Method Dune::XT::Common::Configuration::initialize¶
-
static ParameterTree Dune::XT::Common::Configuration::initialize(const std::string &filename)¶
read Dune::ParameterTree from file
Method Dune::XT::Common::Configuration::initialize¶
-
static ParameterTree Dune::XT::Common::Configuration::initialize(std::istream &in)¶
read Dune::ParameterTree from istream
Method Dune::XT::Common::Configuration::initialize¶
-
static ParameterTree Dune::XT::Common::Configuration::initialize(int argc, char **argv)¶
read Dune::ParameterTree from arguments
Method Dune::XT::Common::Configuration::initialize¶
-
static ParameterTree Dune::XT::Common::Configuration::initialize(int argc, char **argv, std::string filename)¶
read Dune::ParameterTree from arguments and file
Method Dune::XT::Common::Configuration::report_as_sub¶
-
void Dune::XT::Common::Configuration::report_as_sub(std::ostream &out, const std::string &prefix, const std::string &sub_path) const¶
No documentation provided.
Method Dune::XT::Common::Configuration::find_common_prefix¶
-
std::string Dune::XT::Common::Configuration::find_common_prefix(const BaseType &subtree, const std::string &previous_prefix) const¶
No documentation provided.
Method Dune::XT::Common::Configuration::report_flatly¶
-
void Dune::XT::Common::Configuration::report_flatly(const BaseType &subtree, const std::string &prefix, std::ostream &out) const¶
No documentation provided.
Constructor Dune::XT::Common::Configuration::Configuration¶
-
Dune::XT::Common::Configuration::Configuration()¶
No documentation provided.
Constructor Dune::XT::Common::Configuration::Configuration¶
-
Dune::XT::Common::Configuration::Configuration(const ParameterTree &tree, const ConfigurationDefaults &defaults = ConfigurationDefaults())¶
No documentation provided.
Constructor Dune::XT::Common::Configuration::Configuration¶
-
Dune::XT::Common::Configuration::Configuration(const ParameterTree &tree_in, const std::string &sub_id)¶
No documentation provided.
Constructor Dune::XT::Common::Configuration::Configuration¶
-
Dune::XT::Common::Configuration::Configuration(const Configuration &other)¶
No documentation provided.
Constructor Dune::XT::Common::Configuration::Configuration¶
-
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:
Constructor Dune::XT::Common::Configuration::Configuration¶
-
explicit Dune::XT::Common::Configuration::Configuration(std::istream &in, ConfigurationDefaults defaults = ConfigurationDefaults())¶
No documentation provided.
Constructor Dune::XT::Common::Configuration::Configuration¶
-
Dune::XT::Common::Configuration::Configuration(const std::string &in, ConfigurationDefaults defaults = ConfigurationDefaults())¶
No documentation provided.
Constructor Dune::XT::Common::Configuration::Configuration¶
-
Dune::XT::Common::Configuration::Configuration(int argc, char **argv, ConfigurationDefaults defaults = ConfigurationDefaults())¶
read ParameterTree from given arguments and call Configuration(const ParameterTree & tree)
Destructor Dune::XT::Common::Configuration::~Configuration¶
-
Dune::XT::Common::Configuration::~Configuration()¶
No documentation provided.
Field Dune::XT::Common::Configuration::warn_on_default_access_¶
-
bool Dune::XT::Common::Configuration::warn_on_default_access_¶
No documentation provided.
Field Dune::XT::Common::Configuration::log_on_exit_¶
-
bool Dune::XT::Common::Configuration::log_on_exit_¶
No documentation provided.
Field Dune::XT::Common::Configuration::logfile_¶
-
std::string Dune::XT::Common::Configuration::logfile_¶
No documentation provided.
Type alias Dune::XT::Common::Configuration::BaseType¶
-
type Dune::XT::Common::Configuration::BaseType¶
No documentation provided.
Function template Dune::XT::Common::Configuration::Configuration¶
-
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.
Function template Dune::XT::Common::Configuration::get¶
-
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 int size, const int cols = 0, const ValidatorInterface<T, Validator> &validator = ValidateAny<typename internal::Typer<T>::type>()) const¶ const get without default value, with validation
Function template Dune::XT::Common::Configuration::get¶
-
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
Function template Dune::XT::Common::Configuration::get¶
-
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 int size, const int cols = 0, const ValidatorInterface<typename internal::Typer<T>::type, Validator> &validator = ValidateAny<typename internal::Typer<T>::type>()) const¶ get variation with default value, validation
Function template Dune::XT::Common::Configuration::get¶
-
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
Function template Dune::XT::Common::Configuration::set¶
-
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
Function template Dune::XT::Common::Configuration::get_valid_value¶
-
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 int size, const int cols) const¶ get value from tree and validate with validator
Function template Dune::XT::Common::Configuration::get_¶
-
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 int size, const int 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