cxcparamx  1.1.0
 All Classes Functions Pages
cxcparamx::simple Class Reference

#include <cxcparamx/simple.h>

Public Member Functions

 simple (int argc, char **argv, const char *mode="rw")
 Constructor with file name taken from argv[0]. More...
 
 simple (const char *filename, int argc, char **argv, const char *mode="rw")
 Constructor with explicit parameter file name. More...
 
 simple (const std::string &filename, int argc, char **argv, const char *mode="rw")
 Constructor with explicit parameter file name. More...
 
void get (const char *name, float &value)
 Retrieve a parameter value into a float. More...
 
void get (const char *name, double &value)
 Retrieve a parameter value into a double. More...
 
void get (const char *name, short &value)
 Retrieve a parameter value into a short. More...
 
void get (const char *name, int &value)
 Retrieve a parameter value into an int. More...
 
void get (const char *name, long &value)
 Retrieve a parameter value into a long. More...
 
void get (const char *name, bool &value)
 Retrieve a parameter value into an bool. More...
 
void get (const char *name, std::string &value)
 Retrieve a parameter value into an string. More...
 
float getf (const char *name)
 Return a parameter value as a float. More...
 
double getd (const char *name)
 Return a parameter value as a double. More...
 
short gets (const char *name)
 Return a parameter value as a short. More...
 
int geti (const char *name)
 Return a parameter value as an int. More...
 
long getl (const char *name)
 Return a parameter value as a long. More...
 
bool getb (const char *name)
 Return a parameter value as an bool. More...
 
std::string getstr (const char *name)
 Return a parameter value as an string. More...
 

Detailed Description

A simple wrapper class providing polymorphic attribute retrieval.

Instantiating the class opens the parameter file; the file is closed during object destruction.

Constructor & Destructor Documentation

cxcparamx::simple::simple ( int  argc,
char **  argv,
const char *  mode = "rw" 
)

Constructor with file name taken from argv[0].

Parameters
[in]argcthe number of elements in argv
[in]argvtypically, the command line arguments vector passed to main*
[in]modemode with which to open the file
cxcparamx::simple::simple ( const char *  filename,
int  argc,
char **  argv,
const char *  mode = "rw" 
)

Constructor with explicit parameter file name.

Parameters
[in]filenamethe parameter file name
[in]argcthe number of elements in argv
argvtypically, the command line arguments vector passed to main
[in]modemode with which to open the file
cxcparamx::simple::simple ( const std::string &  filename,
int  argc,
char **  argv,
const char *  mode = "rw" 
)

Constructor with explicit parameter file name.

Parameters
[in]filenamethe parameter file name
[in]argcthe number of elements in argv
argvtypically, the command line arguments vector passed to main
[in]modemode with which to open the file

Member Function Documentation

void cxcparamx::simple::get ( const char *  name,
float &  value 
)

Retrieve a parameter value into a float.

Parameters
[in]nameparameter name
[out]valuereturned value
Exceptions
Exceptionif parameter is not found
void cxcparamx::simple::get ( const char *  name,
double &  value 
)

Retrieve a parameter value into a double.

Parameters
[in]nameparameter name
[out]valuereturned value
Exceptions
Exceptionif parameter is not found
void cxcparamx::simple::get ( const char *  name,
short &  value 
)

Retrieve a parameter value into a short.

Parameters
[in]nameparameter name
[out]valuereturned value
Exceptions
Exceptionif parameter is not found
void cxcparamx::simple::get ( const char *  name,
int &  value 
)

Retrieve a parameter value into an int.

Parameters
[in]nameparameter name
[out]valuereturned value
Exceptions
Exceptionif parameter is not found
void cxcparamx::simple::get ( const char *  name,
long &  value 
)

Retrieve a parameter value into a long.

Parameters
[in]nameparameter name
[out]valuereturned value
Exceptions
Exceptionif parameter is not found
void cxcparamx::simple::get ( const char *  name,
bool &  value 
)

Retrieve a parameter value into an bool.

Parameters
[in]nameparameter name
[out]valuereturned value
Exceptions
Exceptionif parameter is not found
void cxcparamx::simple::get ( const char *  name,
std::string &  value 
)

Retrieve a parameter value into an string.

Parameters
[in]nameparameter name
[out]valuereturned value
Exceptions
Exceptionif parameter is not found
bool cxcparamx::simple::getb ( const char *  name)

Return a parameter value as an bool.

Parameters
[in]nameparameter name
Exceptions
Exceptionif parameter is not found
double cxcparamx::simple::getd ( const char *  name)

Return a parameter value as a double.

Parameters
[in]nameparameter name
Exceptions
Exceptionif parameter is not found
float cxcparamx::simple::getf ( const char *  name)

Return a parameter value as a float.

Parameters
[in]nameparameter name
Exceptions
Exceptionif parameter is not found
int cxcparamx::simple::geti ( const char *  name)

Return a parameter value as an int.

Parameters
[in]nameparameter name
Exceptions
Exceptionif parameter is not found
long cxcparamx::simple::getl ( const char *  name)

Return a parameter value as a long.

Parameters
[in]nameparameter name
Exceptions
Exceptionif parameter is not found
short cxcparamx::simple::gets ( const char *  name)

Return a parameter value as a short.

Parameters
[in]nameparameter name
Exceptions
Exceptionif parameter is not found
string cxcparamx::simple::getstr ( const char *  name)

Return a parameter value as an string.

Parameters
[in]nameparameter name
Exceptions
Exceptionif parameter is not found

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