Homepage Demos Overview Downloads Tutorials Reference
Credits

ROBOOP::Config Class Reference

#include <config.h>

List of all members.


Detailed Description

Handle configuration files.

Definition at line 104 of file config.h.

Public Member Functions

 Config ()
 Config (const string &filename_, bool doRead=false)
 Constructor.
 Config (const Config &x)
 Constructor.
Configoperator= (const Config &x)
 Overload = operator.
short read_conf ()
 Read a configuration file.
void print ()
 Print the configuration data.
bool section_exists (const string &section) const
 Test to see if a section exists.
bool parameter_exists (const string &section, const string &parameter) const
 Test to see if a parameter exists within a section.
short select_string (const string section, const string parameter, string &value) const
 Get a parameter data, of a certain section, into the string value.
short select_bool (const string section, const string parameter, bool &value) const
 Get a parameter data, of a certain section, into the bool value.
short select_short (const string section, const string parameter, short &value) const
 Get a parameter data, of a certain section, into the short value.
short select_int (const string section, const string parameter, int &value) const
 Get a parameter data, of a certain section, into the int value.
short select_float (const string section, const string parameter, float &value) const
 Get a parameter data, of a certain section, into the float value.
short select_double (const string section, const string parameter, double &value) const
 Get a parameter data, of a certain section, into the double value.
short select_real (const string section, const string parameter, Real &value) const
 Get a parameter data, of a certain section, into the Real value.
short write_conf (const string name, const string file_title, const int space_between_column)
 Write the configuration information, contained in conf, on disk.
void add_string (const string section, const string parameter, const string value)
 Added the value(string) of the parameter in the section in the configuration data.
void add_bool (const string section, const string parameter, const bool value)
 Added the value (bool) of the parameter in the section in the configuration data.
void add_int (const string section, const string parameter, const int value)
 Added the value (int) of the parameter in the section in the configuration data.
void add_float (const string section, const string parameter, const float value)
 Added the value (float) of the parameter in the section in the configuration data.
void add_double (const string section, const string parameter, const double value)
 Added the value (double) of the parameter in the section in the configuration data.
void add_real (const string section, const string parameter, const Real value)
 Added the value (Real) of the parameter in the section in the configuration data.

Private Attributes

Conf_data conf
 Data store from/to configuration file.
string filename
 Configuration file name.


Constructor & Destructor Documentation

ROBOOP::Config::Config  )  [inline]
 

Definition at line 106 of file config.h.

ROBOOP::Config::Config const string &  filename_,
bool  doRead = false
 

Constructor.

Definition at line 61 of file config.cpp.

ROBOOP::Config::Config const Config x  ) 
 

Constructor.

Definition at line 69 of file config.cpp.


Member Function Documentation

void ROBOOP::Config::add_bool const string  section,
const string  parameter,
const bool  value
 

Added the value (bool) of the parameter in the section in the configuration data.

The functions use add_string by first converting the value (bool) in value (string)

Definition at line 509 of file config.cpp.

void ROBOOP::Config::add_double const string  section,
const string  parameter,
const double  value
 

Added the value (double) of the parameter in the section in the configuration data.

The functions use add_string by first converting the value (double) in value (string)

Definition at line 573 of file config.cpp.

void ROBOOP::Config::add_float const string  section,
const string  parameter,
const float  value
 

Added the value (float) of the parameter in the section in the configuration data.

The functions use add_string by first converting the value (float) in value (string)

Definition at line 549 of file config.cpp.

void ROBOOP::Config::add_int const string  section,
const string  parameter,
const int  value
 

Added the value (int) of the parameter in the section in the configuration data.

The functions use add_string by first converting the value (int) in value (string)

Definition at line 529 of file config.cpp.

void ROBOOP::Config::add_real const string  section,
const string  parameter,
const Real  value
 

Added the value (Real) of the parameter in the section in the configuration data.

The functions use add_string by first converting the value (Real) in value (string)

Definition at line 597 of file config.cpp.

void ROBOOP::Config::add_string const string  section,
const string  parameter,
const string  value
 

Added the value(string) of the parameter in the section in the configuration data.

The functions will added the parameter and the section if it does not already exist.

Definition at line 474 of file config.cpp.

Referenced by add_bool(), add_double(), add_float(), add_int(), and add_real().

Config & ROBOOP::Config::operator= const Config x  ) 
 

Overload = operator.

Definition at line 75 of file config.cpp.

bool ROBOOP::Config::parameter_exists const string &  section,
const string &  parameter
const
 

Test to see if a parameter exists within a section.

Returns:
true if parameter is found within section

Definition at line 246 of file config.cpp.

Referenced by ROBOOP::Robot_basic::Robot_basic().

void ROBOOP::Config::print  ) 
 

Print the configuration data.

Definition at line 216 of file config.cpp.

short ROBOOP::Config::read_conf  ) 
 

Read a configuration file.

This function reads the configuration file specified in the constructor parameter. The information is stored in the variable conf.

A configuration file contains section(s) (between [ ]), and the section(s) contains parameter(s) with there respective value(s). The section and the parameter are always access via a string. Below is an exemple: one section named PUMA560_mDH, and two parameters.

[PUMA560_mDH] DH: 0 dof: 6

Definition at line 83 of file config.cpp.

Referenced by Config(), and ROBOOP::Control_Select::set_control().

bool ROBOOP::Config::section_exists const string &  section  )  const
 

Test to see if a section exists.

Returns:
true if section is found

Definition at line 234 of file config.cpp.

short ROBOOP::Config::select_bool const string  section,
const string  parameter,
bool &  value
const
 

Get a parameter data, of a certain section, into the bool value.

Returns:
0 or SECTION_OR_PARAMETER_DOES_NOT_EXIST if the data can not be found.

Definition at line 278 of file config.cpp.

Referenced by ROBOOP::Robot_basic::Robot_basic().

short ROBOOP::Config::select_double const string  section,
const string  parameter,
double &  value
const
 

Get a parameter data, of a certain section, into the double value.

Returns:
0 or SECTION_OR_PARAMETER_DOES_NOT_EXIST if the data can not be found.

Definition at line 382 of file config.cpp.

Referenced by ROBOOP::Robot_basic::Robot_basic().

short ROBOOP::Config::select_float const string  section,
const string  parameter,
float &  value
const
 

Get a parameter data, of a certain section, into the float value.

Returns:
0 or SECTION_OR_PARAMETER_DOES_NOT_EXIST if the data can not be found.

Definition at line 356 of file config.cpp.

short ROBOOP::Config::select_int const string  section,
const string  parameter,
int &  value
const
 

Get a parameter data, of a certain section, into the int value.

Returns:
0 or SECTION_OR_PARAMETER_DOES_NOT_EXIST if the data can not be found.

Definition at line 304 of file config.cpp.

Referenced by ROBOOP::Robot_basic::Robot_basic(), and ROBOOP::Control_Select::set_control().

short ROBOOP::Config::select_real const string  section,
const string  parameter,
Real value
const
 

Get a parameter data, of a certain section, into the Real value.

Returns:
0 or SECTION_OR_PARAMETER_DOES_NOT_EXIST if the data can not be found.

Definition at line 408 of file config.cpp.

Referenced by ROBOOP::Control_Select::set_control().

short ROBOOP::Config::select_short const string  section,
const string  parameter,
short &  value
const
 

Get a parameter data, of a certain section, into the short value.

Returns:
0 or SECTION_OR_PARAMETER_DOES_NOT_EXIST if the data can not be found.

Definition at line 330 of file config.cpp.

short ROBOOP::Config::select_string const string  section,
const string  parameter,
string &  value
const
 

Get a parameter data, of a certain section, into the string value.

Returns:
0 or SECTION_OR_PARAMETER_DOES_NOT_EXIST if the data can not be found.

Definition at line 258 of file config.cpp.

Referenced by ROBOOP::Control_Select::set_control().

short ROBOOP::Config::write_conf const string  name,
const string  file_title,
const int  space_between_column
 

Write the configuration information, contained in conf, on disk.

Parameters:
name: Configuration file name.
file_title: Title in the configuration file header.
space_between_column: Number of blanks between : (of a parameter) and it's value.

Definition at line 434 of file config.cpp.


Member Data Documentation

Conf_data ROBOOP::Config::conf [private]
 

Data store from/to configuration file.

Definition at line 147 of file config.h.

Referenced by add_string(), operator=(), print(), read_conf(), and write_conf().

string ROBOOP::Config::filename [private]
 

Configuration file name.

Definition at line 148 of file config.h.

Referenced by operator=(), and read_conf().


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

ROBOOP v1.21a
Generated Tue Nov 23 16:35:55 2004 by Doxygen 1.3.9.1