Robotsystem from Robot Group Leipzig: Configurable Class Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Alphabetical List
- Class Hierarchy
- Class Members

# Configurable Class Reference

`#include <configurable.h>`

Inheritance diagram for Configurable:

[legend]
List of all members.

## Detailed Description

Abstact class for configurable objects.

Sort of Hashmap interface. Parameters are double values

The Configurator is an external tool that can be used for changing the values of configurable objects.

Protocoll for Configurator:

    To Configurator (BNF notation):
    Conf             := <Comp>*
    Comp           := <CompName> <Pair>*
    CompName := [<string>][<int>]<newline>
    Pair               := <alphanum>=<double><newline>

the remaining tags are self explanatory

Example

    [Component name which can contain spaces and digits and .,- ][ID1]
    key1 = value1
    key2 = value2
    .
    .
    [Other Component name which can contain spaces and digits and .,- ][ID2]
    key3 = value3

Answer: (from Communicator to Simulation environment)
1. On change of a parameter:

    [ID] key=newvalue

or

    key=newvalue

the latter one means that the parameter is changed in all components

2. Request of the description as defined above.

    #Something I don\'t care

Definition at line 64 of file configurable.h.

## Public Types
typedef std::string | paramkey
typedef double | paramval
typedef std::list< std::pair< paramkey, paramval > > | paramlist
## Public Member Functions
| Configurable ()
virtual | ~Configurable ()
int | getId () const
| return the id of the configurable objects, which is created by random on initialisation
virtual paramkey | getName () const ABSTRACT
| return the name of the object (with version number) Hint: { return "$ID$"; }
virtual paramval | getParam (const paramkey &key) const
| returns the value of the requested parameter or 0 (+ error message to stderr) if unknown.
virtual bool | setParam (const paramkey &key, paramval val)
| sets the value of the given parameter or does nothing if unknown.
virtual paramlist | getParamList () const ABSTRACT
| The list of all parameters with there value as allocated lists.
bool | storeCfg (const char *filenamestem)
| stores the key values paires into the file : filenamestem.cfg
bool | restoreCfg (const char *filenamestem)
| restores the key values paires from the file : filenamestem.cfg
void | print (FILE *f, const char *prefix) const
void | parse (FILE *f)
## Static Public Member Functions
static void | insertCVSInfo (paramkey &str, const char *file, const char *revision)
| This is a utility function for inserting the filename and the revision number at the beginning of the given string buffer str and terminates it.
## Classes
struct | matchId
| nice predicate function for finding a Layer with its vectorname More...

## Member Typedef Documentation

typedef std::string paramkey

| Definition at line 67 of file configurable.h.

typedef std::list< std::pair<paramkey, paramval> > paramlist

| Definition at line 69 of file configurable.h.

typedef double paramval

| Definition at line 68 of file configurable.h.

## Constructor & Destructor Documentation

Configurable | ( |  | ) | `[inline]`

| Definition at line 78 of file configurable.h.

virtual ~Configurable | ( |  | ) | `[inline, virtual]`

| Definition at line 79 of file configurable.h.

## Member Function Documentation

int getId | ( |  | ) | const`[inline]`

| return the id of the configurable objects, which is created by random on initialisation Definition at line 82 of file configurable.h.

virtual paramkey getName | ( |  | ) | const`[virtual]`

| return the name of the object (with version number) Hint: { return "$ID$"; } Reimplemented in DInvert3ChannelController, InvertMotorSpace, InvertNChannelController, MultiLayerFFNN, OneLayerFFNN, SineController, AbstractComponent, OdeConfig, Arm2Segm, HurlingSnake, MuscledArm, and Schlange.

virtual paramval getParam | ( | const paramkey & | key | ) | const`[inline, virtual]`

| returns the value of the requested parameter or 0 (+ error message to stderr) if unknown. Definition at line 92 of file configurable.h.

virtual paramlist getParamList | ( |  | ) | const`[virtual]`

| The list of all parameters with there value as allocated lists. Returns: list of key-value pairs Reimplemented in InvertController, InvertMotorController, MultiLayerFFNN, OneLayerFFNN, SineController, AbstractComponent, AbstractCompoundComponent, UniversalMotorComponent, OdeConfig, Arm2Segm, HurlingSnake, MuscledArm, and Schlange.

void insertCVSInfo | ( | paramkey & | str,
|  | const char * | file,
|  | const char * | revision
| ) | `[static]`

  | This is a utility function for inserting the filename and the revision number at the beginning of the given string buffer str and terminates it. Parameters:
  | str | buffer (call by reference) that should have space for file+revision+2 characters
  | file | filename given by CVS i.e. RCSfile configurable.h,v
  | revision | revision number given by CVS i.e. Revision 1.9.6.5
Definition at line 51 of file configurable.cpp.

void parse | ( | FILE * | f | ) |

| Definition at line 105 of file configurable.cpp.

void print | ( | FILE * | f,
|  | const char * | prefix
| ) | const

| Definition at line 90 of file configurable.cpp.

bool restoreCfg | ( | const char * | filenamestem | ) |

| restores the key values paires from the file : filenamestem.cfg Definition at line 79 of file configurable.cpp.

virtual bool setParam | ( | const paramkey & | key,
|  | paramval | val
| ) | `[inline, virtual]`

| sets the value of the given parameter or does nothing if unknown. Definition at line 100 of file configurable.h.

bool storeCfg | ( | const char * | filenamestem | ) |

| stores the key values paires into the file : filenamestem.cfg Definition at line 69 of file configurable.cpp.