Parameters

class Parameters

Class for user-defined parameters.

Unnamed Group

template<typename T, typename S>
inline Parameters &add_param(const std::string &name, const S &value, const std::string &doc_string)

These methods add an option parameter and a documentation string to the Parameters object. The first version of this function takes a default value which is used if the parameter is not found in the input file. The second method will leave the parameter uninitialized but can be checked with “is_param_valid” before use.

Unnamed Group

template<typename T>
inline Parameters &add_private_param(const std::string &name, const T &value)

These methods add a parameter to the Parameters object which can be retrieved like any other parameter. This parameter however is not printed in the Input file syntax dump or web page dump so does not take a documentation string. The first version of this function takes an optional default value.

Public Types

using iterator = std::map<std::string, Parameters::Value*>::iterator

Parameter map iterator.

using const_iterator = std::map<std::string, Parameters::Value*>::const_iterator

Constant parameter map iterator.

Public Functions

Parameters(const Parameters &other)

Copy operator.

Parameters(Parameters &&other) noexcept

Move operator.

Parameters &operator=(const Parameters &other)

Assignment operator.

Parameters &operator=(Parameters &&other) noexcept

Move assignment.

template<typename T>
inline bool has(const std::string &name) const

Check if parameter exist.

template<typename T>
inline T get(const std::string &name) const

Get parameter value.

template<typename T>
inline Parameters &set(const std::string &name, T value)

Set parameter.

template<typename T>
inline Parameters &add_required_param(const std::string &name, const std::string &doc_string)

This method adds a parameter and documentation string to the Parameters object that will be extracted from the input file.

If the parameter is missing in the input file, and error will be thrown

bool is_param_required(const std::string &name) const

Returns a boolean indicating whether the specified parameter is required or not.

bool is_param_valid(const std::string &name) const

This method returns parameters that have been initialized in one fashion or another, i.e.

The value was supplied as a default argument or read and properly converted from the input file

Parameters::iterator begin()

Iterator pointing to the beginning of the set of parameters.

Parameters::const_iterator begin() const

Iterator pointing to the beginning of the set of parameters.

Parameters::iterator end()

Iterator pointing to the end of the set of parameters.

Parameters::const_iterator end() const

Iterator pointing to the end of the set of parameters.

Parameters &operator+=(const Parameters &other)

Add other Parameters into this Parameters object.