43 #define MACRO_PRESERVE_TAG '\x01'
51 virtual string call (
string) = 0;
61 void setName(
const char* name) {_sname = name;}
64 map< string, vector< string > >& getParsedParameters(
const char* stream_name);
66 map< string, string >& getParameters(
const char* stream_name);
71 virtual bool read(
const char* stream) = 0;
75 static void getBlockArgument (istream& IN,
char& c,
string& arg);
76 static void getArguments (
string& arg_str, vector< string >& arg_vect);
79 string replaceMacro (
const string& arg);
80 string parseMacroFunctionBlock (
const string& in_arg);
81 string callMacro (
const string& name,
const string& argstr);
84 string expandMacros (
const string& arg) {
return replaceMacro(arg);}
85 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);
86 string getMacroSepParamChar (
const string& sep_in,
const string macro_name);
87 string getMacroParamValue (
const string& str_in,
const string& par_name,
const string& macro_name);
89 string quote (
const string& argstr);
91 string concat (
const string& argstr);
92 string rep (
const string& argstr);
93 string seq (
const string& argstr);
94 string tempseq (
const string& argstr);
95 string matrix (
const string& argstr);
96 string diag_matrix (
const string& argstr);
97 string sym_matrix (
const string& argstr);
98 string runif (
const string& argstr);
99 string rnorm (
const string& argstr);
100 string rpoiss (
const string& argstr);
101 string rbernoul (
const string& argstr);
102 string rgamma (
const string& argstr);
103 string rlognorm (
const string& argstr);
104 string rexp (
const string& argstr);
105 string sample (
const string& argstr);
106 string sort (
const string& argstr);
107 string round (
const string& argstr);
108 string ceiling (
const string& argstr);
109 string floor (
const string& argstr);
114 void add_inputParam (
string& param,
const string& arg) {_inputParams[param] = arg;}
120 static size_t matchClosingParen (
const string& s);
125 static bool containsPreserveMacro (
const string& s);
129 bool _hasPreservedMacro =
false;
152 virtual bool read (
const char* stream);
153 static bool removeComment (istream& IN,
int& l_count);
154 static bool removeSpaceAndComment (istream& IN,
int& l_count,
bool keepLast =
false);
155 virtual bool readArguments (istream& IN,
int& l_count,
string& args);
156 static string readUntilCharacter (istream& IN,
int& l_count,
const char start_c,
const char end_c);
157 static void eatLine (istream& IN,
int& l_count);
158 void replaceCR (
string& stream,
const char rpl =
'\n');
Definition: paramsparser.h:44
virtual ~MacroCaller()
Definition: paramsparser.h:49
virtual string call(string)=0
Provides interface to read input parameters from various sources and parses them.
Definition: paramsparser.h:54
map< string, string > get_inputParams()
Definition: paramsparser.h:63
void add_inputParam(string ¶m, const string &arg)
Definition: paramsparser.h:114
const char * _sname
Attached file of stream name.
Definition: paramsparser.h:132
string expandMacros(const string &arg)
Public entry point to expand macros in a string, used to expand macros that were preserved by P() onc...
Definition: paramsparser.h:84
map< string, string > & getParameters()
Definition: paramsparser.h:67
virtual bool read(const char *stream)=0
Read/parse params & args from a file or a string or an R object.
void setName(const char *name)
Definition: paramsparser.h:61
void reset_inputParams()
Definition: paramsparser.h:113
map< string, vector< string > > & getParsedParameters()
Definition: paramsparser.h:65
virtual ~ParamsParser()
Definition: paramsparser.h:59
map< string, string > _inputParams
The whole, unparsed set of input parameters.
Definition: paramsparser.h:135
map< string, vector< string > > _parsedParams
The parsed set of simulation parameters after sequential parameters have been separated.
Definition: paramsparser.h:138
Read parameters from a text buffer.
Definition: paramsparser.h:146
virtual ~StreamParser()
Definition: paramsparser.h:150
StreamParser(const char *stream)
Definition: paramsparser.h:149