Nemo
2.3.56
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
|
Read parameters from a text buffer. More...
#include <paramsparser.h>
Public Member Functions | |
StreamParser (const char *stream) | |
virtual | ~StreamParser () |
virtual bool | read (const char *stream) |
virtual bool | readArguments (istream &IN, int &l_count, string &args) |
void | replaceCR (string &stream, const char rpl='\n') |
![]() | |
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 bool | removeComment (istream &IN, int &l_count) |
Recusively removes comments until the end of a line/of the file, or of a block comment is reached. More... | |
static bool | removeSpaceAndComment (istream &IN, int &l_count, bool keepLast=false) |
Removes whitespace char on a line until a non-ws or EOL is reached. More... | |
static string | readUntilCharacter (istream &IN, int &l_count, const char start_c, const char end_c) |
static void | eatLine (istream &IN, int &l_count) |
![]() | |
static void | getBlockArgument (istream &IN, char &c, string &arg) |
static void | getArguments (string &arg_str, vector< string > &arg_vect) |
Additional Inherited Members | |
![]() | |
void | reset_inputParams () |
void | add_inputParam (string ¶m, const string &arg) |
Read parameters from a text buffer.
|
inline |
|
inlinevirtual |
|
static |
References EOL.
Referenced by readArguments(), and readUntilCharacter().
|
virtual |
Implements ParamsParser.
Reimplemented in FileParser, and BinaryFileParser.
References ParamsParser::add_inputParam(), EOL, message(), readArguments(), removeComment(), removeSpaceAndComment(), replaceCR(), and ParamsParser::reset_inputParams().
Referenced by FileParser::read(), and BinaryFileParser::read().
|
virtual |
References eatLine(), EOL, fatal(), readUntilCharacter(), removeComment(), and removeSpaceAndComment().
Referenced by Param::getArgumentFromFile(), and read().
|
static |
References eatLine(), EOL, fatal(), readUntilCharacter(), removeComment(), and removeSpaceAndComment().
Referenced by ParamsParser::getBlockArgument(), readArguments(), and readUntilCharacter().
|
static |
Recusively removes comments until the end of a line/of the file, or of a block comment is reached.
#: commented line (removed until the end of the line is reached) #/ ... /#: a block comment (may span several lines) Consecutive lines of comments are also removed, even if not part of a block comment. Note: this function always returns false, unless something remains on a line after a block comment (i.e. if removeSpaceAndComment() returns true)
References EOL, and removeSpaceAndComment().
Referenced by read(), readArguments(), readUntilCharacter(), and removeSpaceAndComment().
|
static |
Removes whitespace char on a line until a non-ws or EOL is reached.
Returns false if EOL or EOF is reached or true otherwise.
References EOL, and removeComment().
Referenced by ParamsParser::getArguments(), read(), readArguments(), readUntilCharacter(), and removeComment().
void StreamParser::replaceCR | ( | string & | stream, |
const char | rpl = '\n' |
||
) |
Referenced by read().