|
Nemo
2.4.0b
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
|
Provides interface to read input parameters from various sources and parses them. More...
#include <paramsparser.h>
Inheritance diagram for ParamsParser:
Collaboration diagram for ParamsParser:Public Member Functions | |
| ParamsParser (const char *name) | |
| virtual | ~ParamsParser () |
| void | setName (const char *name) |
| map< string, string > | get_inputParams () |
| map< string, vector< string > > & | getParsedParameters (const char *stream_name) |
| map< string, vector< string > > & | getParsedParameters () |
| map< string, string > & | getParameters (const char *stream_name) |
| map< string, string > & | getParameters () |
| virtual bool | read (const char *stream)=0 |
| Read/parse params & args from a file or a string or an R object. More... | |
| void | parse () |
| Builds the _parsedParams from the _inputParams. More... | |
| string | replaceMacro (const string &arg) |
| Macros. More... | |
| string | parseMacroFunctionBlock (const string &in_arg) |
| string | callMacro (const string &name, const string &argstr) |
| vector< string > | getMacroArgs (const string &args, const int min_arg, const size_t max_arg, const string macro_name, const string syntax, bool lastArgIsSeparatorChar=true) |
| string | getMacroSepParamChar (const string &sep_in, const string macro_name) |
| string | getMacroParamValue (const string &str_in, const string &par_name, const string ¯o_name) |
| string | quote (const string &argstr) |
| Macro "q" returns a quoted string. More... | |
| string | concat (const string &argstr) |
| Macro "c" returns a character-delimited string of atomic arguments. More... | |
| string | rep (const string &argstr) |
| string | seq (const string &argstr) |
| string | tempseq (const string &argstr) |
| string | matrix (const string &argstr) |
| string | diag_matrix (const string &argstr) |
| string | sym_matrix (const string &argstr) |
| string | runif (const string &argstr) |
| string | rnorm (const string &argstr) |
| string | rpoiss (const string &argstr) |
| string | rbernoul (const string &argstr) |
| string | rgamma (const string &argstr) |
| string | rlognorm (const string &argstr) |
| string | rexp (const string &argstr) |
Static Public Member Functions | |
| static void | getBlockArgument (istream &IN, char &c, string &arg) |
| static void | getArguments (string &arg_str, vector< string > &arg_vect) |
Protected Member Functions | |
| void | reset_inputParams () |
| void | add_inputParam (string ¶m, const string &arg) |
Private Attributes | |
| const char * | _sname |
| Attached file of stream name. More... | |
| map< string, string > | _inputParams |
| The whole, unparsed set of input parameters. More... | |
| map< string, vector< string > > | _parsedParams |
| The parsed set of simulation parameters after sequential parameters have been separated. More... | |
| map< string, string(ParamsParser::*)(const string &)> | _macroMap |
| The macro table, mapping call name to caller. More... | |
Provides interface to read input parameters from various sources and parses them.
| ParamsParser::ParamsParser | ( | const char * | name | ) |
References concat(), diag_matrix(), matrix(), quote(), rbernoul(), rep(), rexp(), rgamma(), rlognorm(), rnorm(), rpoiss(), runif(), seq(), sym_matrix(), and tempseq().
|
inlineprotected |
Referenced by StreamParser::read().
| string ParamsParser::callMacro | ( | const string & | name, |
| const string & | argstr | ||
| ) |
| string ParamsParser::concat | ( | const string & | argstr | ) |
Macro "c" returns a character-delimited string of atomic arguments.
Can be passed as arguments to other macros.
References tstring::removeEnclosingChar().
Referenced by ParamsParser().
| string ParamsParser::diag_matrix | ( | const string & | argstr | ) |
References fatal(), tstring::removeEnclosingChar(), tstring::split(), and tstring::str2uint().
Referenced by ParamsParser().
|
inline |
|
static |
References StreamParser::removeSpaceAndComment().
|
static |
References StreamParser::readUntilCharacter().
| vector< string > ParamsParser::getMacroArgs | ( | const string & | args, |
| const int | min_arg, | ||
| const size_t | max_arg, | ||
| const string | macro_name, | ||
| const string | syntax, | ||
| bool | lastArgIsSeparatorChar = true |
||
| ) |
References fatal(), and tstring::splitExcludeEnclosedDelimiters().
| string ParamsParser::getMacroParamValue | ( | const string & | str_in, |
| const string & | par_name, | ||
| const string & | macro_name | ||
| ) |
References fatal(), and tstring::splitExcludeEnclosedDelimiters().
| string ParamsParser::getMacroSepParamChar | ( | const string & | sep_in, |
| const string | macro_name | ||
| ) |
References fatal(), tstring::isanumber(), tstring::removeEnclosingChar(), and tstring::splitExcludeEnclosedDelimiters().
|
inline |
| map< string, string > & ParamsParser::getParameters | ( | const char * | stream_name | ) |
References fatal().
Referenced by BinaryDataLoader::extractPop().
|
inline |
| map< string, vector< string > > & ParamsParser::getParsedParameters | ( | const char * | stream_name | ) |
Referenced by SimRunner::run().
| string ParamsParser::matrix | ( | const string & | argstr | ) |
References fatal(), tstring::removeEnclosingChar(), tstring::split(), and tstring::str2uint().
Referenced by ParamsParser().
| void ParamsParser::parse | ( | ) |
Builds the _parsedParams from the _inputParams.
This defines rules of sequential, matricial params, etc.
References message().
| string ParamsParser::parseMacroFunctionBlock | ( | const string & | in_arg | ) |
References fatal().
| string ParamsParser::quote | ( | const string & | argstr | ) |
Macro "q" returns a quoted string.
Useful to quote result of call to enclosed macro.
Referenced by ParamsParser().
| string ParamsParser::rbernoul | ( | const string & | argstr | ) |
References RAND::Bernoulli(), fatal(), tstring::int2str(), tstring::isanumber(), tstring::splitExcludeEnclosedDelimiters(), tstring::str2dble(), and tstring::str2uint().
Referenced by ParamsParser().
|
pure virtual |
Read/parse params & args from a file or a string or an R object.
Params and their args are put in the _inputParams.
Implemented in StreamParser, BinaryFileParser, and FileParser.
| string ParamsParser::rep | ( | const string & | argstr | ) |
References fatal(), tstring::isanumber(), tstring::removeEnclosingChar(), tstring::removeLastCharOf(), tstring::split(), and tstring::str2int().
Referenced by ParamsParser().
| string ParamsParser::replaceMacro | ( | const string & | arg | ) |
Macros.
|
inlineprotected |
Referenced by StreamParser::read().
| string ParamsParser::rexp | ( | const string & | argstr | ) |
References tstring::dble2str(), RAND::Exponential(), fatal(), tstring::isanumber(), tstring::splitExcludeEnclosedDelimiters(), tstring::str2dble(), and tstring::str2uint().
Referenced by ParamsParser().
| string ParamsParser::rgamma | ( | const string & | argstr | ) |
References tstring::dble2str(), fatal(), RAND::Gamma(), tstring::isanumber(), tstring::splitExcludeEnclosedDelimiters(), tstring::str2dble(), and tstring::str2uint().
Referenced by ParamsParser().
| string ParamsParser::rlognorm | ( | const string & | argstr | ) |
References tstring::dble2str(), fatal(), tstring::isanumber(), RAND::LogNormal(), tstring::splitExcludeEnclosedDelimiters(), tstring::str2dble(), and tstring::str2uint().
Referenced by ParamsParser().
| string ParamsParser::rnorm | ( | const string & | argstr | ) |
References tstring::dble2str(), fatal(), RAND::Gaussian(), tstring::isanumber(), tstring::splitExcludeEnclosedDelimiters(), tstring::str2dble(), and tstring::str2uint().
Referenced by ParamsParser().
| string ParamsParser::rpoiss | ( | const string & | argstr | ) |
References tstring::dble2str(), fatal(), tstring::isanumber(), RAND::Poisson(), tstring::splitExcludeEnclosedDelimiters(), tstring::str2dble(), and tstring::str2uint().
Referenced by ParamsParser().
| string ParamsParser::runif | ( | const string & | argstr | ) |
References tstring::dble2str(), fatal(), tstring::isanumber(), tstring::splitExcludeEnclosedDelimiters(), tstring::str2dble(), tstring::str2uint(), and RAND::Uniform().
Referenced by ParamsParser().
| string ParamsParser::seq | ( | const string & | argstr | ) |
References tstring::dble2str(), fatal(), tstring::isanumber(), and tstring::str2dble().
Referenced by ParamsParser().
|
inline |
Referenced by BinaryDataLoader::extractPop().
| string ParamsParser::sym_matrix | ( | const string & | argstr | ) |
References fatal(), TMatrix::get(), tstring::isanumber(), tstring::removeEnclosingChar(), TMatrix::set(), tstring::split(), tstring::str2dble(), tstring::str2int(), and TMatrix::to_string().
Referenced by ParamsParser().
| string ParamsParser::tempseq | ( | const string & | argstr | ) |
References fatal(), tstring::removeEnclosingChar(), and tstring::split().
Referenced by ParamsParser().
|
private |
The whole, unparsed set of input parameters.
|
private |
The macro table, mapping call name to caller.
|
private |
The parsed set of simulation parameters after sequential parameters have been separated.
|
private |
Attached file of stream name.
1.9.1 -- Nemo is hosted on