Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Inspectable Class Reference

Interface for inspectable objects. More...

#include <inspectable.h>

Inheritance diagram for Inspectable:

Classes

struct  IConnection
 
struct  ILayer
 
struct  matchName
 nice predicate function for finding a Layer with its vectorname More...
 

Public Types

typedef std::string iparamkey
 
typedef double iparamval
 
typedef std::pair< iparamkey,
iparamval const * > 
iparampair
 
typedef std::pair< iparamkey,
std::pair< const
matrix::Matrix *, bool > > 
imatrixpair
 
typedef std::list< iparamkeyiparamkeylist
 
typedef std::list< std::string > infoLinesList
 
typedef std::list< iparamvaliparamvallist
 
typedef std::list< iparamval
const * > 
iparamvalptrlist
 
typedef std::list< iparampairiparampairlist
 
typedef std::list< imatrixpairimatrixpairlist
 
typedef struct Inspectable::ILayer ILayer
 
typedef struct
Inspectable::IConnection 
IConnection
 
typedef std::list< ILayerilayerlist
 
typedef std::list< IConnectioniconnectionlist
 
typedef std::list< const
Inspectable * > 
inspectableList
 

Public Member Functions

 Inspectable (const iparamkey &name="")
 TYPEDEFS END. More...
 
virtual ~Inspectable ()
 
virtual iparamkeylist getInternalParamNames () const
 The list of the names of all internal parameters given by getInternalParams(). More...
 
virtual iparamvallist getInternalParams () const
 
virtual iparamvalptrlist getInternalParamsPtr () const
 be careful: matrices will be ignored More...
 
virtual ilayerlist getStructuralLayers () const
 Specifies which parameter vector forms a structural layer (in terms of a neural network) The ordering is important. More...
 
virtual iconnectionlist getStructuralConnections () const
 Specifies which parameter matrix forms a connection between layers (in terms of a neural network) The orderning is not important. More...
 
virtual void addInspectableValue (const iparamkey &key, iparamval const *val, const std::string &descr=std::string())
 This is the new style for adding inspectable values. More...
 
virtual void addInspectableMatrix (const iparamkey &key, const matrix::Matrix *m, bool only4x4AndDiag=true, const std::string &descr=std::string())
 This is the new style for adding inspectable values. More...
 
virtual void addInspectableDescription (const iparamkey &key, const std::string &descr)
 adds a description for the given parameter using info-lines The line will start (appart from the #I) with a D for description followed by the key end then followed by the string. More...
 
virtual void addInfoLine (std::string infoLine)
 Adds an info line to this inspectable instance. More...
 
virtual void addInfoLines (std::list< std::string > infoLineList)
 Adds a bunch of infolines with addInfoLine to this inspectable instance. More...
 
virtual void removeInfoLines ()
 Removes all infolines from this inspectable instance. More...
 
virtual const infoLinesListgetInfoLines () const
 Returns all infolines added to this inspectable instance. More...
 
virtual void addInspectable (Inspectable *insp)
 Adds an inspectable as a child object. More...
 
virtual void removeInspectable (Inspectable *insp)
 Removes an inspectable as a child object. More...
 
virtual void setNameOfInspectable (const iparamkey &name)
 set the name of the inspectable More...
 
virtual const iparamkey getNameOfInspectable () const
 return the name of the inspectable, getName() would conflict with Configurable::getName() too often More...
 
virtual const inspectableListgetInspectables () const
 Returns the list containing all inspectable children. More...
 

Protected Attributes

iparamkey name
 
iparampairlist mapOfValues
 
imatrixpairlist mapOfMatrices
 
infoLinesList infoLineStringList
 

Detailed Description

Interface for inspectable objects.

That means that one can read out some internal parameters indentified by string keys

TODO: support for lead through of params (e.g. getInternalParams()) for all children inspectables. For this use a instance-wide switch (useChildren) as a member variable to enable this feature when desired.

Member Typedef Documentation

typedef std::list<IConnection> iconnectionlist
typedef struct Inspectable::ILayer ILayer
typedef std::list<ILayer> ilayerlist
typedef std::pair<iparamkey,std::pair< const matrix::Matrix*, bool > > imatrixpair
typedef std::list<imatrixpair> imatrixpairlist
typedef std::list<std::string> infoLinesList
typedef std::list<const Inspectable*> inspectableList
typedef std::string iparamkey
typedef std::list<iparamkey> iparamkeylist
typedef std::pair<iparamkey,iparamval const*> iparampair
typedef std::list<iparampair> iparampairlist
typedef double iparamval
typedef std::list<iparamval> iparamvallist
typedef std::list<iparamval const *> iparamvalptrlist

Constructor & Destructor Documentation

Inspectable ( const iparamkey name = "")

TYPEDEFS END.

~Inspectable ( )
virtual

Member Function Documentation

void addInfoLine ( std::string  infoLine)
virtual

Adds an info line to this inspectable instance.

All infolines are plotted by the PlotOptionEngine and therefore appear e.g. in the logfile. They are leaded by a #I. If you have your own identifiers, just begin with your one (e.g. N for number of NOTE: You must not add e.g. carriage return, all this is handled by the PlotOptionsEngine itself. If you like to add multiple lines, call this function a lot more or use instead addInfoLines.

Parameters
infoLinethe line (as string) to be added
void addInfoLines ( std::list< std::string >  infoLineList)
virtual

Adds a bunch of infolines with addInfoLine to this inspectable instance.

Every infoline is separated by an carriage return automatically, done by the PlotOptionsEngine.

Parameters
infoLineListthe infoLines to be added as a string list.
void addInspectable ( Inspectable insp)
virtual

Adds an inspectable as a child object.

Parameters
inspthe instance to add
void addInspectableDescription ( const iparamkey key,
const std::string &  descr 
)
virtual

adds a description for the given parameter using info-lines The line will start (appart from the #I) with a D for description followed by the key end then followed by the string.

Parameters
keyparameter name (no spaces allowed)
descrdescriptive string (no newlines allowed)
void addInspectableMatrix ( const iparamkey key,
const matrix::Matrix m,
bool  only4x4AndDiag = true,
const std::string &  descr = std::string() 
)
virtual

This is the new style for adding inspectable values.

Just call this function for each parameter and you are done. Inspects elements of the given matrix or vector (automatic detection) For Matrixes Either all or only the values given by store4x4AndDiagonalFieldNames(Matrix& m,string& matrixName); are used.

Parameters
keythe name of the matrix, shown e.g. in guilogger (no spaces allowed)
mthe address of the matrix to inspect
only4x4AndDiagof true only 4x4 matrix plus the diagonal is used
descrdescription string to be exported (for the entire matrix with key_) (using infolines)
Note
that you can change the structure of the matrix while being inspected, but no after the getInternalParameterNames is called!
void addInspectableValue ( const iparamkey key,
iparamval const *  val,
const std::string &  descr = std::string() 
)
virtual

This is the new style for adding inspectable values.

Just call this function for each parameter and you are done. registers a single value

Parameters
keythe name of the inspectable, shown e.g. in guilogger (no spaces allowed)
valthe address of the value to inspect
descrdescription string to be exported (using infolines)
const std::list< std::string > & getInfoLines ( ) const
virtual

Returns all infolines added to this inspectable instance.

This function is called by the PlotOptionEngine.

Returns
all added infolines.
const Inspectable::inspectableList & getInspectables ( ) const
virtual

Returns the list containing all inspectable children.

Inspectable::iparamkeylist getInternalParamNames ( ) const
virtual

The list of the names of all internal parameters given by getInternalParams().

The naming convention is "v[i]" for vectors and "A[i][j]" for matrices, where i, j start at 0.

Returns
: list of keys

Reimplemented in Nejihebi, MultiLayerFFNN, DerLinUnivers, Elman, use_java_controller, UniversalController, MultiReinforce, ModelWithMemoryAdapter, DerPseudoSensor, ReplayController, DerLinInvert, DerBigController, InvertMotorBigModel, ClassicReinforce, DerController, DerInf, FFNNController, and FeedbackWiring.

Inspectable::iparamvalptrlist getInternalParamsPtr ( ) const
virtual

be careful: matrices will be ignored

Returns
list of values (pointer)
const Inspectable::iparamkey getNameOfInspectable ( ) const
virtual

return the name of the inspectable, getName() would conflict with Configurable::getName() too often

Inspectable::iconnectionlist getStructuralConnections ( ) const
virtual

Specifies which parameter matrix forms a connection between layers (in terms of a neural network) The orderning is not important.

Returns
: list of layer names with dimension

Reimplemented in MultiLayerFFNN, DerLinUnivers, Elman, UniversalController, MultiReinforce, SeMoX, ModelWithMemoryAdapter, DerPseudoSensor, DerLinInvert, DerBigController, InvertMotorBigModel, ClassicReinforce, InvertMotorNStep, DerController, DerInf, InvertNChannelController, and InvertMotorSpace.

Inspectable::ilayerlist getStructuralLayers ( ) const
virtual

Specifies which parameter vector forms a structural layer (in terms of a neural network) The ordering is important.

The first entry is the input layer and so on.

Returns
: list of layer names with dimension

Reimplemented in MultiLayerFFNN, DerLinUnivers, Elman, UniversalController, MultiReinforce, SeMoX, ModelWithMemoryAdapter, DerPseudoSensor, DerLinInvert, DerBigController, InvertMotorBigModel, ClassicReinforce, InvertMotorNStep, DerController, DerInf, InvertNChannelController, and InvertMotorSpace.

void removeInfoLines ( )
virtual

Removes all infolines from this inspectable instance.

This is useful if you have new infoLines and would like to restart the PlotOptionEngine.

void removeInspectable ( Inspectable insp)
virtual

Removes an inspectable as a child object.

Parameters
inspthe instance to remove
void setNameOfInspectable ( const iparamkey name)
virtual

set the name of the inspectable

Member Data Documentation

infoLinesList infoLineStringList
protected
imatrixpairlist mapOfMatrices
protected
iparampairlist mapOfValues
protected
iparamkey name
protected

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