paramxx
1.0.7
|
#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. More... | |
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. More... | |
void | pget (const char *name, double &result) const throw ( ParFileException ) |
Same functionality as ParFile::pgetd. More... | |
void | pget (const char *name, int &result) const throw ( ParFileException ) |
Same functionality as ParFile::pgeti. More... | |
void | pget (const char *name, long &result) const throw ( ParFileException ) |
Same functionality as ParFile::pgetl. More... | |
void | pget (const char *name, char result[], size_t) const throw ( ParFileException ) |
Same functionality as ParFile::pgetstr. More... | |
void | pget (const char *name, string &rult) const throw ( ParFileException ) |
Same functionality as ParFile::pgetstring. More... | |
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) |
To get the parameters in the parameter file.
ParFile::~ParFile | ( | ) |
The destructor.
|
inline |
The default constructor.
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 |
|
inline |
Get the parameter filename.
Par * ParFile::get_par | ( | const char * | name | ) | const |
throw | ( | ParFileException | |||
) |
Get the pointer to the parameter.
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 |
References NameAttributeValue::get_name().
|
static |
if the first character is #, or the line is blank, then the line is a comment
void ParFile::pget | ( | const char * | name, |
bool & | result | ||
) | const | ||
throw | ( | ParFileException | |
) |
Same functionality as ParFile::pgetb.
void ParFile::pget | ( | const char * | name, |
double & | result | ||
) | const | ||
throw | ( | ParFileException | |
) |
Same functionality as ParFile::pgetd.
void ParFile::pget | ( | const char * | name, |
int & | result | ||
) | const | ||
throw | ( | ParFileException | |
) |
Same functionality as ParFile::pgeti.
void ParFile::pget | ( | const char * | name, |
long & | result | ||
) | const | ||
throw | ( | ParFileException | |
) |
Same functionality as ParFile::pgetl.
void ParFile::pget | ( | const char * | name, |
char | result[], | ||
size_t | size | ||
) | const | ||
throw | ( | ParFileException | |
) |
Same functionality as ParFile::pgetstr.
void ParFile::pget | ( | const char * | name, |
string & | rult | ||
) | const | ||
throw | ( | ParFileException | |
) |
Same functionality as ParFile::pgetstring.
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 |
References Par::pgetb().
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 |
References Par::pgetd().
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 |
References Par::pgeti().
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 |
References Par::pgetl().
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 |
References Par::pgetstring().
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 |
References Par::get_mode(), NameAttributeValue::get_name(), NameAttributeValue::get_value(), and Par::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. |
References NameAttributeValue::get_name(), Par::get_prompt(), NameAttributeValue::get_value(), and Par::PARTYPE.
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.
|
friend |
This operator outputs the contents of the object.
|
friend |
This operator outputs the contents of the object.