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 identifierDH: - 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 chainMotor: - ?Stl: - ?
- For each link N: 1..dof
[ chain_name_LINK N]
joint_type: - revolute (0), prismatic (1)theta: - DH theta parameterd: - DH d parametera: - DH a parameteralpha: - DH alpha parametertheta_min: - minimum achievable joint positiontheta_max: - maximum achievable joint positionm: - mass of linkcx: - x position of center of gravity for linkcy: - y position of center of gravity for linkcz: - z position of center of gravity for linkIxx: - xx entry of inertia matrixIxy: - xy entry of inertia matrixIxz: - xz entry of inertia matrixIyy: - yy entry of inertia matrixIyz: - yz entry of inertia matrixIzz: - zz entry of inertia matrix
Additional entries may be defined, but will be silently ignored.
Definition at line 122 of file config.h.
|
Public Member Functions |
| Config () |
| Config (const std::string &filename_, bool doRead=false) |
| Constructor.
|
| Config (const Config &x) |
| Constructor.
|
Config & | operator= (const Config &x) |
| Overload = operator.
|
short | read_conf () |
| Read a configuration file.
|
void | print () |
| Print the configuration data.
|
bool | section_exists (const std::string §ion) const |
| Test to see if a section exists.
|
bool | parameter_exists (const std::string §ion, const std::string ¶meter) const |
| Test to see if a parameter exists within a section.
|
short | select_string (const std::string section, const std::string parameter, std::string &value) const |
| Get a parameter data, of a certain section, into the string value.
|
short | select_bool (const std::string section, const std::string parameter, bool &value) const |
| Get a parameter data, of a certain section, into the bool value.
|
short | select_short (const std::string section, const std::string parameter, short &value) const |
| Get a parameter data, of a certain section, into the short value.
|
short | select_int (const std::string section, const std::string parameter, int &value) const |
| Get a parameter data, of a certain section, into the int value.
|
short | select_float (const std::string section, const std::string parameter, float &value) const |
| Get a parameter data, of a certain section, into the float value.
|
short | select_double (const std::string section, const std::string parameter, double &value) const |
| Get a parameter data, of a certain section, into the double value.
|
short | select_real (const std::string section, const std::string parameter, Real &value) const |
| Get a parameter data, of a certain section, into the Real value.
|
short | write_conf (const std::string name, const std::string file_title, const int space_between_column) |
| Write the configuration information, contained in conf, on disk.
|
void | add_string (const std::string section, const std::string parameter, const std::string value) |
| Added the value(string) of the parameter in the section in the configuration data.
|
void | add_bool (const std::string section, const std::string parameter, const bool value) |
| Added the value (bool) of the parameter in the section in the configuration data.
|
void | add_int (const std::string section, const std::string parameter, const int value) |
| Added the value (int) of the parameter in the section in the configuration data.
|
void | add_float (const std::string section, const std::string parameter, const float value) |
| Added the value (float) of the parameter in the section in the configuration data.
|
void | add_double (const std::string section, const std::string parameter, const double value) |
| Added the value (double) of the parameter in the section in the configuration data.
|
void | add_real (const std::string section, const std::string parameter, const Real value) |
| Added the value (Real) of the parameter in the section in the configuration data.
|
Private Types |
typedef std::map< std::string,
std::map< std::string,
std::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.
|
std::string | filename |
| Configuration file name.
|
Member Typedef Documentation
holds configuration data - a map from section name to sub-map of parameters to values
Definition at line 166 of file config.h.
Constructor & Destructor Documentation
ROBOOP::Config::Config |
( |
|
) |
[inline] |
ROBOOP::Config::Config |
( |
const std::string & |
filename_, |
|
|
bool |
doRead = false | |
|
) |
| | |
ROBOOP::Config::Config |
( |
const Config & |
x |
) |
|
Member Function Documentation
Overload = operator.
Definition at line 89 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 97 of file config.cpp.
Referenced by Config(), and ROBOOP::Control_Select::set_control().
void ROBOOP::Config::print |
( |
|
) |
|
Print the configuration data.
Definition at line 240 of file config.cpp.
bool ROBOOP::Config::section_exists |
( |
const std::string & |
section |
) |
const |
Test to see if a section exists.
- Returns:
- true if section is found
Definition at line 251 of file config.cpp.
bool ROBOOP::Config::parameter_exists |
( |
const std::string & |
section, |
|
|
const std::string & |
parameter | |
|
) |
| | const |
short ROBOOP::Config::select_string |
( |
const std::string |
section, |
|
|
const std::string |
parameter, |
|
|
std::string & |
value | |
|
) |
| | const |
short ROBOOP::Config::select_bool |
( |
const std::string |
section, |
|
|
const std::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 292 of file config.cpp.
Referenced by ROBOOP::Robot_basic::Robot_basic().
short ROBOOP::Config::select_short |
( |
const std::string |
section, |
|
|
const std::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 344 of file config.cpp.
short ROBOOP::Config::select_int |
( |
const std::string |
section, |
|
|
const std::string |
parameter, |
|
|
int & |
value | |
|
) |
| | const |
short ROBOOP::Config::select_float |
( |
const std::string |
section, |
|
|
const std::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 370 of file config.cpp.
short ROBOOP::Config::select_double |
( |
const std::string |
section, |
|
|
const std::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 396 of file config.cpp.
Referenced by ROBOOP::Robot_basic::Robot_basic().
short ROBOOP::Config::select_real |
( |
const std::string |
section, |
|
|
const std::string |
parameter, |
|
|
Real & |
value | |
|
) |
| | const |
short ROBOOP::Config::write_conf |
( |
const std::string |
name, |
|
|
const std::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 448 of file config.cpp.
void ROBOOP::Config::add_string |
( |
const std::string |
section, |
|
|
const std::string |
parameter, |
|
|
const std::string |
value | |
|
) |
| | |
void ROBOOP::Config::add_bool |
( |
const std::string |
section, |
|
|
const std::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 491 of file config.cpp.
void ROBOOP::Config::add_int |
( |
const std::string |
section, |
|
|
const std::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 511 of file config.cpp.
void ROBOOP::Config::add_float |
( |
const std::string |
section, |
|
|
const std::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 531 of file config.cpp.
void ROBOOP::Config::add_double |
( |
const std::string |
section, |
|
|
const std::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 555 of file config.cpp.
void ROBOOP::Config::add_real |
( |
const std::string |
section, |
|
|
const std::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 579 of file config.cpp.
Member Data Documentation
The documentation for this class was generated from the following files:
|