1#ifndef STORM_SETTINGS_ARGUMENT_H_
2#define STORM_SETTINGS_ARGUMENT_H_
10#include <unordered_map>
23template<
typename ValueType>
24class ArgumentValidator;
72 "Unable to unify the arguments " <<
this->getName() <<
" and " <<
other.getName() <<
", because they have different types.");
74 "Unable to unify the arguments '" <<
this->getName() <<
"' and '" <<
other.getName()
75 <<
"', because one of them is optional and the other one is not.");
77 "Unable to unify the arguments " <<
this->getName() <<
" and " <<
other.getName()
78 <<
", because one of them has a default value and the other one does not.");
115 std::vector<std::shared_ptr<ArgumentValidator<T>>> validators;
124 bool hasDefaultValue;
127 bool wasSetFromDefaultValueFlag;
143 bool validate(T
const& value)
const;
This class serves as the (untemplated) base class of argument classes.
This class subclasses the argument base to actually implement the pure virtual functions.
virtual bool getValueAsBoolean() const override
Retrieves the value of this argument as a boolean.
virtual double getValueAsDouble() const override
Retrieves the value of this argument as a double.
virtual std::string getValueAsString() const override
Retrieves the value of this argument as a string.
virtual bool getHasDefaultValue() const override
Retrieves whether the argument has a default value.
virtual uint_fast64_t getValueAsUnsignedInteger() const override
Retrieves the value of this argument as an unsigned integer.
bool setFromStringValue(std::string const &fromStringValue) override
Tries to set the value of the argument from the given string.
bool isCompatibleWith(Argument< S > const &other) const
Checks whether the given argument is compatible with the current one.
bool setFromTypeValue(T const &newValue, bool hasBeenSet=true)
void setFromDefaultValue() override
Sets the value of the argument from the default value.
virtual bool getIsOptional() const override
Retrieves whether the argument is optional.
virtual bool wasSetFromDefaultValue() const override
virtual void printToStream(std::ostream &out) const override
Prints a string representation of the argument to the provided stream.
virtual ArgumentType getType() const override
Retrieves the type of the argument.
virtual int_fast64_t getValueAsInteger() const override
Retrieves the value of this argument as an integer.
T const & getArgumentValue() const
Retrieves the value of the argument if any has been set.
#define STORM_LOG_THROW(cond, exception, message)
SettingsType const & getModule()
Get module.
ArgumentType
This enum captures all possible types for arguments.