#include <readparameters.h>
|
| static void | add (const std::string &name, const std::string &desc, const std::string &defValue) |
| template<typename T> |
| static void | add (const std::string &name, const std::string &desc, const T &defValue) |
| static void | get (const std::string &name, std::string &value) |
| static void | get (const std::string &name, std::vector< std::string > &value) |
| template<typename T> |
| static void | get (const std::string &name, T &value) |
| template<typename T> |
| static void | get (const std::string &name, std::vector< T > &value) |
| static bool | isSet (const std::string &name) |
| static void | addComposing (const std::string &name, const std::string &desc) |
| static void | helpMessage () |
| static bool | versionMessage () |
| static std::string | versionInfo () |
| static std::string | configInfo () |
| static bool | parse (const bool needsRunConfig=true, const bool allowUnknown=true) |
Definition at line 40 of file readparameters.h.
◆ Readparameters()
| Readparameters::Readparameters |
( |
int | cmdargc, |
|
|
char * | cmdargv[] ) |
Constructor for class ReadParameters. The constructor defines some default parameters and parses the input files.
- Parameters
-
| cmdargc | Command line argc. |
| cmdargv | Command line argv. |
Definition at line 51 of file readparameters.cpp.
◆ ~Readparameters()
| Readparameters::~Readparameters |
( |
| ) |
|
◆ add() [1/2]
| void Readparameters::add |
( |
const std::string & | name, |
|
|
const std::string & | desc, |
|
|
const std::string & | defValue ) |
|
inlinestatic |
Add a new input parameter. Note that parse must be called in order for the input file(s) to be re-read. Only called by the root process.
- Parameters
-
| name | The name of the parameter, as given in the input file(s). |
| desc | Description for the parameter. |
| defValue | Default value for variable. |
Definition at line 52 of file readparameters.h.
◆ add() [2/2]
template<typename T>
| void Readparameters::add |
( |
const std::string & | name, |
|
|
const std::string & | desc, |
|
|
const T & | defValue ) |
|
inlinestatic |
◆ addComposing()
| void Readparameters::addComposing |
( |
const std::string & | name, |
|
|
const std::string & | desc ) |
|
static |
Add a new composing input parameter. Note that parse must be called in order for the input file(s) to be re-read. Only needs to be called by root process. It can be defined multiple times and are all returned as a vector.
- Parameters
-
| name | The name of the parameter, as given in the input file(s). |
| desc | Description for the parameter. |
Definition at line 89 of file readparameters.cpp.
◆ addDefaultParameters()
| void Readparameters::addDefaultParameters |
( |
| ) |
|
|
staticprivate |
◆ configInfo()
| std::string Readparameters::configInfo |
( |
| ) |
|
|
static |
Helper wrapper function to get the config info
- Returns
- std string with the config information
Definition at line 143 of file readparameters.cpp.
◆ get() [1/4]
| void Readparameters::get |
( |
const std::string & | name, |
|
|
std::string & | value ) |
|
inlinestatic |
Get the value of the given parameter added with add(). This may be called after having called Parse, and it may be called by any process, in any order. Aborts if given parameter was not found (a parameter passed to get() wasn't add()ed, defaults are ok).
- Parameters
-
| name | The name of the parameter. |
| value | A variable where the value of the parameter is written. |
Definition at line 90 of file readparameters.h.
◆ get() [2/4]
| void Readparameters::get |
( |
const std::string & | name, |
|
|
std::vector< std::string > & | value ) |
|
inlinestatic |
◆ get() [3/4]
template<typename T>
| void Readparameters::get |
( |
const std::string & | name, |
|
|
std::vector< T > & | value ) |
|
inlinestatic |
Get the value of the given parameter added with addComposing(). This may be called after having called Parse, and it may be called by any process, in any order. Aborts on failed cast.
- Parameters
-
| name | The name of the parameter. |
| value | A variable where the value of the parameter is written. |
Definition at line 141 of file readparameters.h.
◆ get() [4/4]
template<typename T>
| void Readparameters::get |
( |
const std::string & | name, |
|
|
T & | value ) |
|
inlinestatic |
◆ helpMessage()
| void Readparameters::helpMessage |
( |
| ) |
|
|
static |
Write the descriptions of known input options to standard output if an option called "help" has been read, and exit in that case.
Definition at line 102 of file readparameters.cpp.
◆ isSet()
| bool Readparameters::isSet |
( |
const std::string & | name | ) |
|
|
inlinestatic |
◆ parse()
| bool Readparameters::parse |
( |
const bool | needsRunConfig = true, |
|
|
const bool | allowUnknown = true ) |
|
static |
Request Parameters to reparse input file(s). This function needs to be called after new options have been added via Parameters:add functions. Otherwise the values of the new options are not read. This is a collective function, all processes have to see it.
- Parameters
-
| needsRunConfig | Whether or not this program can run without a runconfig file (esm: vlasiator can't, but particle pusher can). |
| allowUnknown | true if unregistered options are parsed without error. |
- Returns
- True if input file(s) were parsed successfully.
Definition at line 157 of file readparameters.cpp.
◆ versionInfo()
| std::string Readparameters::versionInfo |
( |
| ) |
|
|
static |
Helper wrapper function to get version info
- Returns
- std string with the version information
Definition at line 136 of file readparameters.cpp.
◆ versionMessage()
| bool Readparameters::versionMessage |
( |
| ) |
|
|
static |
Write version information to standard output if an option called "version" has been read.
- Returns
- If true, option called "version" was found and descriptions were written to standard output.
Definition at line 119 of file readparameters.cpp.
◆ argc
◆ argv
| char ** Readparameters::argv |
|
staticprivate |
Pointer to char* array containing command line parameters.
Definition at line 183 of file readparameters.h.
◆ descriptions
| PO::options_description * Readparameters::descriptions = NULL |
|
staticprivate |
◆ global_config_file_name
| string Readparameters::global_config_file_name = "" |
|
staticprivate |
◆ helpRequested
| bool Readparameters::helpRequested = false |
|
static |
◆ isOptionParsed
| map< string, bool > Readparameters::isOptionParsed |
|
staticprivate |
◆ isVectorOptionParsed
| map< string, bool > Readparameters::isVectorOptionParsed |
|
staticprivate |
◆ options
| map< string, string > Readparameters::options |
|
staticprivate |
◆ run_config_file_name
| string Readparameters::run_config_file_name = "" |
|
staticprivate |
◆ user_config_file_name
| string Readparameters::user_config_file_name = "" |
|
staticprivate |
◆ variables
| PO::variables_map * Readparameters::variables = NULL |
|
staticprivate |
◆ vectorOptions
| map< string, vector< string > > Readparameters::vectorOptions |
|
staticprivate |
The documentation for this class was generated from the following files: