creativity  v1.3.0
Agent-based model of creativity and piracy
Public Attributes | Protected Member Functions | Protected Attributes | List of all members
creativity::cmdargs::Simulator Class Reference

Common base class for CLI and GUI argument handling for running a simulation. More...

#include <creativity/cmdargs/Simulator.hpp>

Public Attributes

unsigned int periods = 300
 The number of periods to run the simulation. More...
 
std::string policy
 Stores the –policy= argument given.
 
std::string output
 The output file for simulation results; default is "creativity-SEED.crstate" for the CLI, unset for the GUI.
 
std::string tmpdir
 The temporary directory for results. If empty, use output file dirname.
 
unsigned int threads = 0
 The number of threads to use. More...
 
eris::random::rng_t::result_type seed = eris::random::seed()
 The seed. More...
 

Protected Member Functions

 Simulator ()=delete
 Default constructor deleted.
 
 Simulator (CreativitySettings &cs)
 Constructs a Simulator object that stores values in the given CreativitySettings object.
 
void addOptions () override
 Adds common options into the options descriptions. More...
 
virtual void postParse (boost::program_options::variables_map &vars) override
 Overridden to handle options such as output, seed, and boundary.
 
- Protected Member Functions inherited from creativity::cmdargs::CmdArgs
 CmdArgs ()=default
 Default constructor is protected; use a suitable subclass.
 

Protected Attributes

boost::program_options::options_description sim_controls_ {"Simulator controls"}
 The options (which will be added to the end of options_) containing simulator settings, some of which differ between the CLI and the GUI.
 
CreativitySettingss_
 The settings reference in which to store given values.
 
double density_ = Creativity::densityFromBoundary(s_.readers, s_.dimensions, s_.boundary)
 Density pseudo-parameter: the stored value is actually boundary.
 
- Protected Attributes inherited from creativity::cmdargs::CmdArgs
std::string prog_name_
 The program name, populated by parse(). More...
 
boost::program_options::options_description options_
 The options descriptions variable for all options.
 
boost::program_options::options_description invisible_
 Like options_, but for hidden options that aren't to be displayed in –help output.
 
boost::program_options::positional_options_description positional_
 Positional options object.
 

Additional Inherited Members

- Public Member Functions inherited from creativity::cmdargs::CmdArgs
void parse (int argc, char const *const *argv)
 Parses options and verifies them. More...
 
template<typename T , typename A >
std::enable_if< not std::is_unsigned< T >::value, boost::program_options::typed_value< std::vector< T, A > > * >::type value (std::vector< T, A > &store)
 Takes a std::vector of values for options that store multiple values. More...
 
template<typename T , typename A >
std::enable_if< std::is_unsigned< T >::value, boost::program_options::typed_value< std::vector< Validation< T > > > * >::type value (std::vector< T, A > &store)
 Takes a std::vector of values for options that store multiple values. More...
 
virtual std::string version () const
 Returns a version string.
 
virtual std::string versionSuffix () const
 Returns a per-executable suffix to add to the generic version string. More...
 
virtual std::string usage () const
 Returns a usage string such as "Usage: program [ARGS]". More...
 
virtual std::string help () const
 Returns a argument help message.
 
- Static Public Member Functions inherited from creativity::cmdargs::CmdArgs
template<typename T >
static std::enable_if< not std::is_unsigned< T >::value and not std::is_same< T, bool >::value, boost::program_options::typed_value< T > *>::type value (T &store)
 Creates an option value object without any special validation wrapper class. More...
 
template<typename T >
static std::enable_if< std::is_unsigned< T >::value and not std::is_same< T, bool >::value, boost::program_options::typed_value< Validation< T > > * >::type value (T &storage)
 Creates an option value object around an unsigned primitive type, with automatic value storage and default value. More...
 
static boost::program_options::typed_value< bool > * value (bool &store)
 Creates an option value for a boolean value, that is, for an switch without an argument, with default value as given in store.
 
template<typename V >
static boost::program_options::typed_value< V > * value (typename V::value_type &store)
 Creates an option value object with explicit validation wrapper class V. More...
 
template<typename V , typename A >
static boost::program_options::typed_value< std::vector< V > > * value (std::vector< typename V::value_type, A > &store)
 Creates an option value object around a vector of options with validation wrapper class V applied to each element of the vector. More...
 
template<long minimum, long denom = 1, typename T >
static boost::program_options::typed_value< Min< T, minimum, denom > > * min (T &store)
 Shortcut for value<Min<T, n, d>>(val) with T last (so that it can be inferred from val)
 
template<long maximum, long denom = 1, typename T >
static boost::program_options::typed_value< Max< T, maximum, denom > > * max (T &store)
 Shortcut for value<Max<T, n, d>>(val) with T last (so that it can be inferred from val)
 
template<long min, long max, long denom = 1, typename T >
static boost::program_options::typed_value< Range< T, min, max, denom > > * range (T &store)
 Shortcut for value<Range<T, a, b, d>>(val) with T last (so that it can be inferred from val)
 
template<long lower, long denom = 1, typename T >
static boost::program_options::typed_value< Above< T, lower, denom > > * above (T &store)
 Shortcut for value<Above<T, a, d>>(val) with T last (so that it can be inferred from val)
 
template<long upper, long denom = 1, typename T >
static boost::program_options::typed_value< Below< T, upper, denom > > * below (T &store)
 Shortcut for value<Below<T, b, d>>(val) with T last (so that it can be inferred from val)
 

Detailed Description

Common base class for CLI and GUI argument handling for running a simulation.

Current used single-argument parameters:

Single-letter options used in this class: A b B c C d D e E g G i j J k K L m M n N p P Q r R s S T u U v V w W x y z Z Used in [CLI], {GUI}, or both: o [O] [q] Used in CmdArgs base class: h Available: a f F H I l t X Y

Member Function Documentation

§ addOptions()

void creativity::cmdargs::Simulator::addOptions ( )
overrideprotectedvirtual

Adds common options into the options descriptions.

Called by CLI::addOptions() and GUI::addOptions().

Reimplemented from creativity::cmdargs::CmdArgs.

Member Data Documentation

§ periods

unsigned int creativity::cmdargs::Simulator::periods = 300

The number of periods to run the simulation.

Before calling addCliOptions() or addGuiOptions(), this is the default value; after calling parse this will be updated to whatever the user specified.

§ seed

eris::random::rng_t::result_type creativity::cmdargs::Simulator::seed = eris::random::seed()

The seed.

The default is whatever eris::random::seed() returns, which is random (unless overridden with ERIS_RNG_SEED). This value can be ignored: it is handled by parse().

§ threads

unsigned int creativity::cmdargs::Simulator::threads = 0

The number of threads to use.

The default is number of hardware threads for the GUI, 0 for the CLI.

Inheritance diagram for creativity::cmdargs::Simulator:
[legend]
Collaboration diagram for creativity::cmdargs::Simulator:
[legend]

The documentation for this class was generated from the following file: