creativity
v1.3.0
Agent-based model of creativity and piracy
|
Namespace for command-line argument handling classes. More...
Classes | |
class | Above |
Validation wrapper for options that have a strict inequality boundary that the value must be above, such as \(v > 3\). More... | |
class | Below |
Validation wrapper for options that have a strict inequality boundary that the value must be below, such as \(v < 3\). More... | |
class | CLI |
CmdArgs subclass for command-line simulator command-line arguments. More... | |
class | CmdArgs |
This class handles command line argument parsing. More... | |
class | Data |
CmdArgs subclass for creativity-data arguments (for generating data from crstate files). More... | |
class | GUI |
CmdArgs/Simulator subclass for graphical simulator command-line arguments. More... | |
class | Info |
CmdArgs subclass for creativity-info script to display simulation information. More... | |
class | Max |
Validation wrapper for options that have a maximum value. More... | |
class | Min |
Validation wrapper for options that have a minimum value. More... | |
class | Range |
Validation wrapper for options that have both a minimum and maximum value. More... | |
class | Results |
CmdArgs subclass for creativity-results script to run models on generated data. More... | |
class | Series |
CmdArgs subclass for creativity-series arguments (for generating series values from crstate files). More... | |
class | SeriesGraphs |
CmdArgs subclass for creativity-series-plots arguments (for plotting quantiles from series and/or quantiles files). More... | |
class | SeriesQuantiles |
CmdArgs subclass for creativity-series-quantiles arguments (for extracting quantiles from series files). More... | |
class | Simulator |
Common base class for CLI and GUI argument handling for running a simulation. More... | |
class | Validation |
Validation wrapper base class. More... | |
class | ValidationTag |
Validation tag; any Validation class must (ultimately) inherit from this class. More... | |
Functions | |
template<typename T > | |
constexpr T | inf_or_max () |
constexpr that returns positive infinity, if T has such a value, or the maximum value T supports if it does not. | |
template<typename T > | |
constexpr T | neginf_or_lowest () |
constexpr that returns negative infinity, if T has such a value, or the lowest value T supports if it does not. | |
template<typename T > | |
std::string | type_string () |
Returns an argument name for T. More... | |
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value>::type> | |
std::string | output_string (T v) |
Returns a value converted to a string; in most cases this just passes the value to std::to_string for conversion. More... | |
template<> | |
std::string | output_string (double v) |
Specialization of output_string for double types that trims trailing 0's and a trailing decimal point from the string representation before returning it. | |
template<class V , typename = typename std::enable_if<std::is_base_of<ValidationTag, V>::value>::type> | |
void | validate (boost::any &v, const std::vector< std::string > &values, V *, int) |
Overload of validate for boost to convert from string to a validated data type. More... | |
Namespace for command-line argument handling classes.
std::string creativity::cmdargs::output_string | ( | T | v | ) |
Returns a value converted to a string; in most cases this just passes the value to std::to_string for conversion.
A specialization of this for doubles converts the double to a string via std::to_string(), then trims off trailing 0's and, possibly, a trailing .
.
std::string creativity::cmdargs::type_string | ( | ) |
Returns an argument name for T.
For numeric types, this is one of 𝑹 (for floating point values), 𝑵 (for unsigned integer types), or 𝒁 (for signed integer types). For other types, this is simply "arg".
void creativity::cmdargs::validate | ( | boost::any & | v, |
const std::vector< std::string > & | values, | ||
V * | , | ||
int | |||
) |
Overload of validate for boost to convert from string to a validated data type.
Mostly this just checks that the validation object can be constructed (which will fail if the validation fails), but this also makes sure signed types aren't provided with a leading minus sign.