Storm
A Modern Probabilistic Model Checker
|
This class subclasses the argument base to actually implement the pure virtual functions. More...
#include <Argument.h>
Public Member Functions | |
Argument (std::string const &name, std::string const &description, std::vector< std::shared_ptr< ArgumentValidator< T > > > const &validators) | |
Creates a new argument with the given parameters. | |
Argument (std::string const &name, std::string const &description, std::vector< std::shared_ptr< ArgumentValidator< T > > > const &validators, bool isOptional, T defaultValue) | |
Creates a new argument with the given parameters. | |
virtual bool | getIsOptional () const override |
Retrieves whether the argument is optional. | |
bool | setFromStringValue (std::string const &fromStringValue) override |
Tries to set the value of the argument from the given string. | |
bool | setFromTypeValue (T const &newValue, bool hasBeenSet=true) |
virtual ArgumentType | getType () const override |
Retrieves the type of the argument. | |
template<typename S > | |
bool | isCompatibleWith (Argument< S > const &other) const |
Checks whether the given argument is compatible with the current one. | |
T const & | getArgumentValue () const |
Retrieves the value of the argument if any has been set. | |
virtual bool | getHasDefaultValue () const override |
Retrieves whether the argument has a default value. | |
void | setFromDefaultValue () override |
Sets the value of the argument from the default value. | |
virtual bool | wasSetFromDefaultValue () const override |
virtual std::string | getValueAsString () const override |
Retrieves the value of this argument as a string. | |
virtual int_fast64_t | getValueAsInteger () const override |
Retrieves the value of this argument as an integer. | |
virtual uint_fast64_t | getValueAsUnsignedInteger () const override |
Retrieves the value of this argument as an unsigned integer. | |
virtual double | getValueAsDouble () const override |
Retrieves the value of this argument as a double. | |
virtual bool | getValueAsBoolean () const override |
Retrieves the value of this argument as a boolean. | |
virtual void | printToStream (std::ostream &out) const override |
Prints a string representation of the argument to the provided stream. | |
![]() | |
ArgumentBase (std::string const &name, std::string const &description) | |
Constructs a new argument base with the given name, description and indication whether the argument is optional. | |
virtual | ~ArgumentBase ()=default |
std::string const & | getName () const |
Retrieves the name of the argument. | |
std::string const & | getDescription () const |
Retrieves the description of the argument. | |
virtual bool | getHasBeenSet () const |
Retrieves whether the argument has been set. | |
template<> | |
std::string | convertFromString (std::string const &valueAsString, bool &conversionSuccessful) |
Additional Inherited Members | |
![]() | |
template<typename TargetType > | |
static TargetType | convertFromString (std::string const &valueAsString, bool &conversionSuccessful) |
Converts the given value represented as a string to the type of the template parameter. | |
template<typename ValueType > | |
static std::string | convertToString (ValueType const &value) |
Converts the given value to a string representation. | |
template<> | |
bool | convertFromString (std::string const &s, bool &ok) |
![]() | |
bool | hasBeenSet |
std::string | name |
std::string | description |
This class subclasses the argument base to actually implement the pure virtual functions.
This construction is necessary so that it becomes easy to store a vector of arguments later despite variing template types, by keeping a vector of pointers to the base class.
Definition at line 32 of file Argument.h.
storm::settings::Argument< T >::Argument | ( | std::string const & | name, |
std::string const & | description, | ||
std::vector< std::shared_ptr< ArgumentValidator< T > > > const & | validators | ||
) |
Creates a new argument with the given parameters.
name | The name of the argument. |
description | The description of the argument. |
validators | A vector of validators that are to be executed upon assigning a value to this argument. |
isOptional | A flag indicating whether the argument is optional. |
Definition at line 15 of file Argument.cpp.
storm::settings::Argument< T >::Argument | ( | std::string const & | name, |
std::string const & | description, | ||
std::vector< std::shared_ptr< ArgumentValidator< T > > > const & | validators, | ||
bool | isOptional, | ||
T | defaultValue | ||
) |
Creates a new argument with the given parameters.
name | The name of the argument. |
description | The description of the argument. |
validators | A vector of validators that are to be executed upon assigning a value to this argument. |
isOptional | A flag indicating whether the argument is optional. |
Definition at line 28 of file Argument.cpp.
T const & storm::settings::Argument< T >::getArgumentValue | ( | ) | const |
Retrieves the value of the argument if any has been set.
Otherwise, an exception is thrown.
Definition at line 72 of file Argument.cpp.
|
overridevirtual |
Retrieves whether the argument has a default value.
Implements storm::settings::ArgumentBase.
Definition at line 83 of file Argument.cpp.
|
overridevirtual |
Retrieves whether the argument is optional.
Implements storm::settings::ArgumentBase.
Definition at line 42 of file Argument.cpp.
|
overridevirtual |
Retrieves the type of the argument.
Implements storm::settings::ArgumentBase.
Definition at line 67 of file Argument.cpp.
|
overridevirtual |
Retrieves the value of this argument as a boolean.
If the conversion cannot be performed, an exception is thrown.
Implements storm::settings::ArgumentBase.
Definition at line 155 of file Argument.cpp.
|
overridevirtual |
Retrieves the value of this argument as a double.
If the conversion cannot be performed, an exception is thrown.
Implements storm::settings::ArgumentBase.
Definition at line 144 of file Argument.cpp.
|
overridevirtual |
Retrieves the value of this argument as an integer.
If the conversion cannot be performed, an exception is thrown.
Implements storm::settings::ArgumentBase.
Definition at line 121 of file Argument.cpp.
|
overridevirtual |
Retrieves the value of this argument as a string.
Implements storm::settings::ArgumentBase.
Definition at line 103 of file Argument.cpp.
|
overridevirtual |
Retrieves the value of this argument as an unsigned integer.
If the conversion cannot be performed, an exception is thrown.
Implements storm::settings::ArgumentBase.
Definition at line 132 of file Argument.cpp.
|
inline |
Checks whether the given argument is compatible with the current one.
If not, an exception is thrown.
other | The other argument with which to check compatibility. |
Definition at line 70 of file Argument.h.
|
overridevirtual |
Prints a string representation of the argument to the provided stream.
Implements storm::settings::ArgumentBase.
Definition at line 197 of file Argument.cpp.
|
overridevirtual |
Sets the value of the argument from the default value.
Implements storm::settings::ArgumentBase.
Definition at line 88 of file Argument.cpp.
|
overridevirtual |
Tries to set the value of the argument from the given string.
stringValue | The new value of the argument given as a string. |
Implements storm::settings::ArgumentBase.
Definition at line 47 of file Argument.cpp.
bool storm::settings::Argument< T >::setFromTypeValue | ( | T const & | newValue, |
bool | hasBeenSet = true |
||
) |
Definition at line 57 of file Argument.cpp.
|
overridevirtual |
Implements storm::settings::ArgumentBase.
Definition at line 98 of file Argument.cpp.