Configurable Class Reference

Abstact class for configurable objects. More...

#include <configurable.h>

Inherited by AbstractController, AbstractModel, AbstractRobot, and OdeConfig.

Inheritance diagram for Configurable:

Inheritance graph
[legend]
List of all members.

Public Types

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

Public Member Functions

 Configurable ()
 Configurable (const std::string &name, const std::string &revision)
 intialise with name and revision (use "$ID$")
virtual ~Configurable ()
int getId () const
 return the id of the configurable objects, which is created by random on initialisation
virtual paramkey getName () const
 return the name of the object
virtual paramkey getRevision () const
 returns the revision of the object
virtual void setName (const paramkey &name)
 stes the name of the object
virtual void getRevision (const paramkey &revision)
 sets the revision 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
 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

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.

Private Attributes

int id
paramkey name
paramkey revision

Detailed Description

Abstact class for configurable objects.

Sort of Hashmap interface. Parameters are double values

The Configurator is a (planned) 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


Member Typedef Documentation

typedef std::string paramkey
 

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

typedef double paramval
 


Constructor & Destructor Documentation

Configurable  )  [inline]
 

Configurable const std::string &  name,
const std::string &  revision
[inline]
 

intialise with name and revision (use "$ID$")

virtual ~Configurable  )  [inline, virtual]
 


Member Function Documentation

int getId  )  const [inline]
 

return the id of the configurable objects, which is created by random on initialisation

virtual paramkey getName  )  const [inline, virtual]
 

return the name of the object

Reimplemented in DInvert3ChannelController, Elman, InvertNChannelController, MultiLayerFFNN, OneLayerFFNN, ProActive, ProActive2, OdeConfig, DemoController, MultiController, and SimpleController.

virtual paramval getParam const paramkey key  )  const [inline, virtual]
 

returns the value of the requested parameter or 0 (+ error message to stderr) if unknown.

Reimplemented in DerController, FFNNController, InvertController, InvertMotorBigModel, InvertMotorController, MultiLayerFFNN, ProActive, ProActive2, SineController, OdeConfig, Arm2Segm, DefaultCaterPillar, DefaultWheelie, HurlingSnake, MuscledArm, Schlange, SliderWheelie, Uwo, DemoController, MultiController, SimpleController, and Hand.

Examples:
integration/main.cpp, and main.cpp.

virtual paramlist getParamList  )  const [inline, virtual]
 

The list of all parameters with there value as allocated lists.

Returns:
list of key-value pairs

Reimplemented in DerController, FFNNController, InvertController, InvertMotorBigModel, InvertMotorController, MultiLayerFFNN, OneLayerFFNN, ProActive, ProActive2, SineController, OdeConfig, Arm2Segm, DefaultCaterPillar, DefaultWheelie, HurlingSnake, MuscledArm, Schlange, SliderWheelie, Uwo, DemoController, MultiController, SimpleController, and Hand.

virtual void getRevision const paramkey revision  )  [inline, virtual]
 

sets the revision Hint: { return "$ID$"; }

virtual paramkey getRevision  )  const [inline, virtual]
 

returns the revision of the object

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.12

void parse FILE *  f  ) 
 

void print FILE *  f,
const char *  prefix
const
 

Examples:
directconnect/directconnect.cpp.

bool restoreCfg const char *  filenamestem  ) 
 

restores the key values paires from the file : filenamestem.cfg

virtual void setName const paramkey name  )  [inline, virtual]
 

stes the name of the object

virtual bool setParam const paramkey key,
paramval  val
[inline, virtual]
 

sets the value of the given parameter or does nothing if unknown.

Reimplemented in DerController, FFNNController, InvertController, InvertMotorBigModel, InvertMotorController, MultiLayerFFNN, ProActive, ProActive2, SineController, OdeConfig, Arm2Segm, CaterPillar, DefaultCaterPillar, DefaultWheelie, HurlingSnake, MuscledArm, Schlange, SchlangeServo, SchlangeServo2, SliderWheelie, Uwo, Wheelie, DemoController, MultiController, SimpleController, and Hand.

Examples:
directconnect/directconnect.cpp, integration/main.cpp, and main.cpp.

bool storeCfg const char *  filenamestem  ) 
 

stores the key values paires into the file : filenamestem.cfg


Member Data Documentation

int id [private]
 

paramkey name [private]
 

Reimplemented in DInvert3ChannelController, InvertNChannelController, SineController, OdeConfig, Arm2Segm, DemoController, and SimpleController.

paramkey revision [private]
 


The documentation for this class was generated from the following files:
Generated on Tue Jan 16 02:14:45 2007 for Robotsystem of the Robot Group Leipzig by doxygen 1.3.8