#include <ParFile.h>
Public Member Functions | |
~ParFile () | |
ParFile () | |
ParFile (int argc, char **argv, const char *file=NULL) throw ( ParFileException, Exception ) | |
string | get_filename () |
void | init_ParFile (int argc, char **argv, const char *file=NULL) throw ( ParFileException, Exception ) |
Par * | get_par (const char *name) const throw ( ParFileException ) |
Get the pointer to the parameter. | |
void | print (ostream &os) const |
bool | pgetb (const char *name) const throw ( ParFileException ) |
double | pgetd (const char *name) const throw ( ParFileException ) |
int | pgeti (const char *name) const throw ( ParFileException ) |
long | pgetl (const char *name) const throw ( ParFileException ) |
void | pgetstr (const char *name, char result[], size_t size) const throw ( ParFileException ) |
string | pgetstring (const char *name) const throw ( ParFileException ) |
void | pget (const char *name, bool &result) const throw ( ParFileException ) |
Same functionality as ParFile::pgetb. | |
void | pget (const char *name, double &result) const throw ( ParFileException ) |
Same functionality as ParFile::pgetd. | |
void | pget (const char *name, int &result) const throw ( ParFileException ) |
Same functionality as ParFile::pgeti. | |
void | pget (const char *name, long &result) const throw ( ParFileException ) |
Same functionality as ParFile::pgetl. | |
void | pget (const char *name, char result[], size_t) const throw ( ParFileException ) |
Same functionality as ParFile::pgetstr. | |
void | pget (const char *name, string &rult) const throw ( ParFileException ) |
Same functionality as ParFile::pgetstring. | |
int | traverse (int(*fct)(Par *)) const |
Static Public Member Functions | |
static int | is_blank (const char *str) |
static int | is_comment (const char *str, char delimit='#') |
Friends | |
ostream & | operator<< (ostream &os, ParFile &parFile) |
ostream & | operator<< (ostream &os, ParFile *parFile) |
Definition at line 38 of file ParFile.h.
ParFile::~ParFile | ( | ) |
The destructor.
Definition at line 47 of file ParFile.cc.
ParFile::ParFile | ( | int | argc, | |
char ** | argv, | |||
const char * | file = NULL | |||
) | throw ( ParFileException, Exception ) |
The constructor to load the parameter file and parse the command line args. Calling this constructor is equivalent to call the default constructor then call the init_ParFile method.
argc | The number of parameters from the command line. | |
argv | The command line arguments. | |
file | The specific file to use. |
ParFileException |
Definition at line 59 of file ParFile.cc.
References init_ParFile().
string ParFile::get_filename | ( | ) | [inline] |
Get the parameter filename.
Definition at line 85 of file ParFile.h.
References ParFilename::get_filename().
void ParFile::init_ParFile | ( | int | argc, | |
char ** | argv, | |||
const char * | file = NULL | |||
) | throw ( ParFileException, Exception ) |
Load the appropiate parameter file and parse the command line args.
argc | The number of parameters from the command line. | |
argv | The command line arguments. | |
file | The specific file to use. |
ParFileException |
Definition at line 294 of file ParFile.cc.
Referenced by ParFile().
Par * ParFile::get_par | ( | const char * | name | ) | const throw ( ParFileException ) |
Get the pointer to the parameter.
Definition at line 255 of file ParFile.cc.
References Par::get_value().
Referenced by pgetb(), pgetd(), pgeti(), pgetl(), pgetstr(), and pgetstring().
void ParFile::print | ( | ostream & | os | ) | const |
Loop over the parameters to call the print method for each parameter. The individual parameter will print its content in the form: name,type,mode,val,min,max,prompt
os | The stream to print the content of the parameter file. |
Definition at line 368 of file ParFile.cc.
References Par::print().
bool ParFile::pgetb | ( | const char * | name | ) | const throw ( ParFileException ) |
To get a parameter of type boolean.
name | The name of the parameter to retrieve its value |
ParFileException |
Definition at line 138 of file ParFile.cc.
References get_par(), and Par::pgetb().
Referenced by pget().
double ParFile::pgetd | ( | const char * | name | ) | const throw ( ParFileException ) |
To get a parameter of type double.
name | The name of the parameter to retrieve its value |
ParFileException |
Definition at line 149 of file ParFile.cc.
References get_par(), and Par::pgetd().
Referenced by pget().
int ParFile::pgeti | ( | const char * | name | ) | const throw ( ParFileException ) |
To get a parameter of type long.
name | The name of the parameter to retrieve its value |
ParFileException |
Definition at line 160 of file ParFile.cc.
References get_par(), and Par::pgeti().
Referenced by pget().
long ParFile::pgetl | ( | const char * | name | ) | const throw ( ParFileException ) |
To get a parameter of type long.
name | The name of the parameter to retrieve its value |
ParFileException |
Definition at line 171 of file ParFile.cc.
References get_par(), and Par::pgetl().
Referenced by pget().
void ParFile::pgetstr | ( | const char * | name, | |
char | result[], | |||
size_t | size | |||
) | const throw ( ParFileException ) |
To get a parameter of type char[]. The length of the result in the following function must be at least size+1
name | The name of the parameter to retrieve its value |
ParFileException |
Definition at line 182 of file ParFile.cc.
References get_par(), and Par::pgetstring().
Referenced by pget().
string ParFile::pgetstring | ( | const char * | name | ) | const throw ( ParFileException ) |
To get a parameter of type string.
name | The name of the parameter to retrieve its value |
ParFileException |
Definition at line 197 of file ParFile.cc.
References get_par(), and Par::pgetstring().
Referenced by pget().
void ParFile::pget | ( | const char * | name, | |
bool & | result | |||
) | const throw ( ParFileException ) |
Same functionality as ParFile::pgetb.
Definition at line 72 of file ParFile.cc.
References pgetb().
void ParFile::pget | ( | const char * | name, | |
double & | result | |||
) | const throw ( ParFileException ) |
void ParFile::pget | ( | const char * | name, | |
int & | result | |||
) | const throw ( ParFileException ) |
void ParFile::pget | ( | const char * | name, | |
long & | result | |||
) | const throw ( ParFileException ) |
Same functionality as ParFile::pgetl.
Definition at line 105 of file ParFile.cc.
References pgetl().
void ParFile::pget | ( | const char * | name, | |
char | result[], | |||
size_t | size | |||
) | const throw ( ParFileException ) |
Same functionality as ParFile::pgetstr.
Definition at line 116 of file ParFile.cc.
References pgetstr().
void ParFile::pget | ( | const char * | name, | |
string & | rult | |||
) | const throw ( ParFileException ) |
Same functionality as ParFile::pgetstring.
Definition at line 127 of file ParFile.cc.
References pgetstring().
int ParFile::traverse | ( | int(*)(Par *) | fct | ) | const |
Traverse the parameters list and invoke the function fct, if fct returns a non-zero the traversal is aborted and the fct return value is returned.
Definition at line 561 of file ParFile.cc.
int ParFile::is_comment | ( | const char * | str, | |
char | delimit = '#' | |||
) | [static] |
if the first character is #, or the line is blank, then the line is a comment
Definition at line 585 of file ParFile.cc.
ostream& operator<< | ( | ostream & | os, | |
ParFile & | parFile | |||
) | [friend] |
ostream& operator<< | ( | ostream & | os, | |
ParFile * | parFile | |||
) | [friend] |