Homepage Demos Overview Downloads Tutorials Reference
Credits

ROBOOP::Config Class Reference

#include <config.h>

List of all members.


Detailed Description

Handle configuration files.

The file syntax used is:

  • [section_name]
  • one or more entries for that section:
    field_name: value

White space is ignored, but a newline must follow each section or field entry

The minimal entries required to avoid warnings are (can be any order):

  • [chain_name]
    • Name: - a string identifier
    • DH: - whether or not the chain specification is standard Denavit-Hartenberg (non-zero), or modified Denavit-Hartenberg (0)
    • Fix: - ?
    • MinPara: - ?
    • dof: - number of links in the chain
    • Motor: - ?
    • Stl: - ?
  • For each link N: 1..dof
    [chain_name_LINKN]
    • joint_type: - revolute (0), prismatic (1)
    • theta: - DH theta parameter
    • d: - DH d parameter
    • a: - DH a parameter
    • alpha: - DH alpha parameter
    • theta_min: - minimum achievable joint position
    • theta_max: - maximum achievable joint position
    • m: - mass of link
    • cx: - x position of center of gravity for link
    • cy: - y position of center of gravity for link
    • cz: - z position of center of gravity for link
    • Ixx: - xx entry of inertia matrix
    • Ixy: - xy entry of inertia matrix
    • Ixz: - xz entry of inertia matrix
    • Iyy: - yy entry of inertia matrix
    • Iyz: - yz entry of inertia matrix
    • Izz: - zz entry of inertia matrix

Additional entries may be defined, but will be silently ignored.

Definition at line 126 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 Types

typedef map< string, map<
string, string > > 
confdata_t
 holds configuration data - a map from section name to sub-map of parameters to values

Private Attributes

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


Member Typedef Documentation

typedef map<string, map<string, string> > ROBOOP::Config::confdata_t [private]
 

holds configuration data - a map from section name to sub-map of parameters to values

Definition at line 170 of file config.h.


Constructor & Destructor Documentation

ROBOOP::Config::Config  )  [inline]
 

Definition at line 128 of file config.h.

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

Constructor.

Definition at line 73 of file config.cpp.

ROBOOP::Config::Config const Config x  ) 
 

Constructor.

Definition at line 81 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 489 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 553 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 529 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 509 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 577 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 479 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 87 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 258 of file config.cpp.

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

void ROBOOP::Config::print  ) 
 

Print the configuration data.

Definition at line 238 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 95 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 249 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 290 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 394 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 368 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 316 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 420 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 342 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 270 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 446 of file config.cpp.


Member Data Documentation

confdata_t ROBOOP::Config::conf [private]
 

Data store from/to configuration file.

Definition at line 172 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 173 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 Aug 16 16:32:19 2005 by Doxygen 1.4.4