Nemo  2.3.56
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
FileParser Class Reference

Text input parameter file parser. More...

#include <fileparser.h>

+ Inheritance diagram for FileParser:
+ Collaboration diagram for FileParser:

Public Member Functions

 FileParser (const char *stream)
 
virtual ~FileParser ()
 
virtual bool read (const char *stream)
 
- Public Member Functions inherited from StreamParser
 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')
 
- Public Member Functions inherited from ParamsParser
 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 &macro_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)
 

Additional Inherited Members

- Static Public Member Functions inherited from StreamParser
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 Public Member Functions inherited from ParamsParser
static void getBlockArgument (istream &IN, char &c, string &arg)
 
static void getArguments (string &arg_str, vector< string > &arg_vect)
 
- Protected Member Functions inherited from ParamsParser
void reset_inputParams ()
 
void add_inputParam (string &param, const string &arg)
 

Detailed Description

Text input parameter file parser.

This class provides the StreamParser with the whole content of the input file.

Constructor & Destructor Documentation

◆ FileParser()

FileParser::FileParser ( const char *  stream)
inline
40: StreamParser(stream) {}
Read parameters from a text buffer.
Definition: paramsparser.h:120

◆ ~FileParser()

virtual FileParser::~FileParser ( )
inlinevirtual
41{}

Member Function Documentation

◆ read()

bool FileParser::read ( const char *  stream)
virtual

Reimplemented from StreamParser.

42{
43// message("FileParser::read\n");
44 ifstream FILE(stream);
45 ostringstream OUT;
46
47 if( !(FILE) )
48 fatal("\"%s\": %s\n***ERROR*** Nemo couldn't find an input file (default is `Nemo2.ini')\n",
49 stream,
50 strerror(errno));
51
52#ifndef NEMOSUB
53 if ( _myenv->isMaster() ) message("reading parameters from \"%s\"\n",stream);
54#endif
55
56 OUT << FILE.rdbuf();
57
58 FILE.close();
59
60 return StreamParser::read(OUT.str().c_str());
61}
MPIenv * _myenv
Definition: MPImanager.cc:36
bool isMaster() const
Definition: MPImanager.h:127
virtual bool read(const char *stream)
Definition: paramsparser.cc:1408
void fatal(const char *str,...)
Definition: output.cc:96
void message(const char *message,...)
Definition: output.cc:40

References _myenv, fatal(), MPIenv::isMaster(), message(), and StreamParser::read().


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

Generated for Nemo v2.3.56 by  doxygen 1.9.0 -- Nemo is hosted on  Download Nemo

Locations of visitors to this page
Catalogued on GSR