ParFile Class Reference

#include <ParFile.h>

Collaboration diagram for ParFile:

Collaboration graph
[legend]

List of all members.

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 )
Parget_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)


Detailed Description

To get the parameters in the parameter file.
Examples:

ptest.cc.

Definition at line 38 of file ParFile.h.


Constructor & Destructor Documentation

ParFile::~ParFile (  ) 

The destructor.

Definition at line 47 of file ParFile.cc.

ParFile::ParFile (  )  [inline]

The default constructor.

Definition at line 66 of file ParFile.h.

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.

Parameters:
argc The number of parameters from the command line.
argv The command line arguments.
file The specific file to use.
Returns:
void
Exceptions:
ParFileException 

Definition at line 59 of file ParFile.cc.

References init_ParFile().


Member Function Documentation

string ParFile::get_filename (  )  [inline]

Get the parameter filename.

Returns:
The name of the parameter file.

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.

Parameters:
argc The number of parameters from the command line.
argv The command line arguments.
file The specific file to use.
Returns:
void
Exceptions:
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

Parameters:
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.

Parameters:
name The name of the parameter to retrieve its value
Returns:
The value of the parameter name.
Exceptions:
ParFileException 
Examples:
ptest.cc.

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.

Parameters:
name The name of the parameter to retrieve its value
Returns:
The value of the parameter name.
Exceptions:
ParFileException 
Examples:
ptest.cc.

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.

Parameters:
name The name of the parameter to retrieve its value
Returns:
The value of the parameter name.
Exceptions:
ParFileException 
Examples:
ptest.cc.

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.

Parameters:
name The name of the parameter to retrieve its value
Returns:
The value of the parameter name.
Exceptions:
ParFileException 
Examples:
ptest.cc.

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

Parameters:
name The name of the parameter to retrieve its value
Returns:
The value of the parameter name.
Exceptions:
ParFileException 
Examples:
ptest.cc.

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.

Parameters:
name The name of the parameter to retrieve its value
Returns:
The value of the parameter name.
Exceptions:
ParFileException 
Examples:
ptest.cc.

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.

Examples:
ptest.cc.

Definition at line 72 of file ParFile.cc.

References pgetb().

void ParFile::pget ( const char *  name,
double &  result 
) const throw ( ParFileException )

Same functionality as ParFile::pgetd.

Definition at line 83 of file ParFile.cc.

References pgetd().

void ParFile::pget ( const char *  name,
int &  result 
) const throw ( ParFileException )

Same functionality as ParFile::pgeti.

Definition at line 94 of file ParFile.cc.

References pgeti().

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.


Friends And Related Function Documentation

ostream& operator<< ( ostream &  os,
ParFile parFile 
) [friend]

This operator outputs the contents of the object.

Definition at line 43 of file ParFile.h.

ostream& operator<< ( ostream &  os,
ParFile parFile 
) [friend]

This operator outputs the contents of the object.

Definition at line 51 of file ParFile.h.


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

Generated on Thu Oct 2 17:54:25 2008 for paramxx by  doxygen 1.5.6