#include <ParameterDatabase.h>
Inheritance diagram for ParameterDatabase:
A parameter database object encapsulates a set of parameter values. Each parameter can have two values: the default value and the current value. The default value is the value of the parameters immediately after the database object is created or reset. The current values are initialized with the default values at the time the database object is created or reset and they can subsequently be modified.
Parameters are identified by a parameter identifier. Syntactically, this is a positive integer. Each application instantiated from the framework would have its own set of parameter identifiers.
In order to properly use the parameter database abstraction, it is necessary to understand the conceptual implementation model that is behind the interface defined in this class. Parameter database information is stored in two tables: the Default Table and the Operational Table. Each table stores a sequence of pairs. The pairs have the form: (parameter value, parameter identifier). Each entry in the table, in other words, contains the value of a parameter and its identifier. The two tables store values for the same set of parameters. They differ only because the values stored in the default table are intended to remain fixed whereas the values stored in the operational table can be dynamically updated. The operational table is initialized with a copy of the default table (this is done using the reset
operation).
In many implementations, the default table will be stored in ROM and the operational table will be stored in RAM.
No methods are defined to set the default parameter values. This is because, in most cases, these are defined outside the parameter database class (they may, for instance, be burnt in PROM).
A parameter database is a low-level data structure whose implementation will usually require use of pointers. Most implementations of this class will therefore violate project specific coding rule PR3.1.
Client components can access the parameters in two ways. They can either get their values using the getter methods defined in this interface. Or they can link to the parameters using the getParameterPointer
method. This method returns a pointer to a specific parameter (as identified by its identifier) which the client component can then store internally and use to directly access the parameter value.
Parameters have a type. The type of the parameter defines how the raw parameter value is interpreted and how it is returned to the external user of the database. The possible types for the parameters are: unsigned int, int, unsigned short, unsigned char, char, float, double. For each paramete type, there is a dedicated parameter getter method. Note that this interface does not mandate any protection against attempts to access parameters with the wrong type. Thus, for instance, if the parameter identified by identifier ID is intended to represent an integer, attempts to retrieve it as if it were of float type (using method getFloatParameter(ID)
) will not necessarily result in an error and may produce a meaningless result. Avoiding this type of errors is the responsibility of the user. Subclasses, however, are free to introduce some run-time check to catch this kind of error.
For similar reasons, the interface defined by this class does not mandate any checks on the legality of the value of the parameter identifier in the method calls. Such checks can again be added by subclasses.
The methods declared by this class allow an application component to establish a link between their internal variables and the database parameters. The process whereby this link is established is called database linking. Two types of database linking are allowed by this class: copy link and pointer link.
In a copy link, the application component holds a reference to the parameter database and to the identifier of the target parameter and periodically updates the value of its internal variable by copying the value of the target database parameter.
In a pointer link, the application component internally defines a pointer which is then initialized to point to the target database parameter. The application component effectively uses the target database parameter as its internal variable.
This is an abstract class because the internal organization of the parameter database is application-dependent. All the class methods are declared abstract. In particular, the data structure used to represent the parameter tables and the way parameters and their identifiers are associated is application dependent.
Definition at line 126 of file ParameterDatabase.h.
Public Member Functions | |
ParameterDatabase (void) | |
Instantiate a parameter database object. | |
virtual void | reset (void)=0 |
Load the current values of the parameters with their default values. | |
virtual void | setParameter (TD_DatabaseId parId, unsigned int newValue)=0 |
Set the current value of a parameter interpreted as an unsigned integer. | |
virtual void | setParameter (TD_DatabaseId parId, int newValue)=0 |
Set the current value of a parameter interpreted as an integer. | |
virtual void | setParameter (TD_DatabaseId parId, unsigned short newValue)=0 |
Set the current value of a parameter interpreted as an unsigned short. | |
virtual void | setParameter (TD_DatabaseId parId, short newValue)=0 |
Set the current value of a parameter interpreted as an short. | |
virtual void | setParameter (TD_DatabaseId parId, bool newValue)=0 |
Set the current value of a parameter interpreted as a boolean. | |
virtual void | setParameter (TD_DatabaseId parId, char newValue)=0 |
Set the current value of a parameter interpreted as a char. | |
virtual void | setParameter (TD_DatabaseId parId, unsigned char newValue)=0 |
Set the current value of a parameter interpreted as an unsigned char. | |
virtual void | setParameter (TD_DatabaseId parId, float newValue)=0 |
Set the current value of a parameter interpreted as a float. | |
virtual void | setParameter (TD_DatabaseId parId, double newValue)=0 |
Set the current value of a parameter interpreted as a double. | |
virtual unsigned int | getParameterUnsignedInt (TD_DatabaseId parId)=0 |
Get the current value of a parameter interpreted as an unsigned integer. | |
virtual int | getParameterInt (TD_DatabaseId parId)=0 |
Get the current value of a parameter interpreted as an integer. | |
virtual unsigned short | getParameterUnsignedShort (TD_DatabaseId parId)=0 |
Get the current value of a parameter interpreted as an unsigned short. | |
virtual short | getParameterShort (TD_DatabaseId parId)=0 |
Get the current value of a parameter interpreted as a short. | |
virtual bool | getParameterBool (TD_DatabaseId parId)=0 |
Get the current value of a parameter interpreted as a boolean. | |
virtual unsigned char | getParameterUnsignedChar (TD_DatabaseId parId)=0 |
Get the current value of a parameter interpreted as an unsigned char. | |
virtual char | getParameterChar (TD_DatabaseId parId)=0 |
Get the current value of a parameter interpreted as a char. | |
virtual float | getParameterFloat (TD_DatabaseId parId)=0 |
Get the current value of a parameter interpreted as a float. | |
virtual double | getParameterDouble (TD_DatabaseId parId)=0 |
Get the current value of a parameter interpreted as a double. | |
virtual unsigned int * | getParameterPointerUnsignedInt (TD_DatabaseId parId)=0 |
Return the pointer to the variable in the operational table storing the parameter identified by parId . | |
virtual int * | getParameterPointerInt (TD_DatabaseId parId)=0 |
Return the pointer to the variable in the operational table storing the parameter identified by parId . | |
virtual unsigned short * | getParameterPointerUnsignedShort (TD_DatabaseId parId)=0 |
Return the pointer to the variable in the operational table storing the parameter identified by parId . | |
virtual short * | getParameterPointerShort (TD_DatabaseId parId)=0 |
Return the pointer to the variable in the operational table storing the parameter identified by parId . | |
virtual unsigned char * | getParameterPointerUnsignedChar (TD_DatabaseId parId)=0 |
Return the pointer to the variable in the operational table storing the parameter identified by parId . | |
virtual char * | getParameterPointerChar (TD_DatabaseId parId)=0 |
Return the pointer to the variable in the operational table storing the parameter identified by parId . | |
virtual bool * | getParameterPointerBool (TD_DatabaseId parId)=0 |
Return the pointer to the variable in the operational table storing the parameter identified by parId . | |
virtual float * | getParameterPointerFloat (TD_DatabaseId parId)=0 |
Return the pointer to the variable in the operational table storing the parameter identified by parId . | |
virtual double * | getParameterPointerDouble (TD_DatabaseId parId)=0 |
Return the pointer to the variable in the operational table storing the parameter identified by parId . |
|
Instantiate a parameter database object. This method returns without taking any actions. Definition at line 13 of file ParameterDatabase.cpp. |
|
Get the current value of a parameter interpreted as a boolean.
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Get the current value of a parameter interpreted as a char.
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Get the current value of a parameter interpreted as a double.
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Get the current value of a parameter interpreted as a float.
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Get the current value of a parameter interpreted as an integer.
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Return the pointer to the variable in the operational table storing the parameter identified by
The variable is interpreted as of type
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Return the pointer to the variable in the operational table storing the parameter identified by
The variable is interpreted as of type
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Return the pointer to the variable in the operational table storing the parameter identified by
The variable is interpreted as of type
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Return the pointer to the variable in the operational table storing the parameter identified by
The variable is interpreted as of type
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Return the pointer to the variable in the operational table storing the parameter identified by
The variable is interpreted as of type
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Return the pointer to the variable in the operational table storing the parameter identified by
The variable is interpreted as of type
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Return the pointer to the variable in the operational table storing the parameter identified by
The variable is interpreted as of type
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Return the pointer to the variable in the operational table storing the parameter identified by
The variable is interpreted as of type
This and other methods returing pointers to parameters are typically used to set up a pointer link between a target database parameter and the internal variable of an application component. This can be done as follows. Consider an application component instantiated from class class Comp { unsigned int* par; . . . void linkParToDatabase(TD_DatabaseId parId, ParameterDatabase* pDB) { par = pDB->getParameterPointerUnsignedInt(parId); } . . .The application component must then be configured as follows:<PRE> Comp* comp; // the application component ParameterDatabase* pDB; // the parameter database TD_DatabaseId PAR_ID; // the parameter identifier . . . comp->linkParToDatabase(PAR_ID,pDB); The last statement sets up a permanent link between the internal application component variable and the database parameter. Note that use of this mechanism entails a violation of coding rule PR3.1. This is inevitable if the database linking is to be performed in an efficient manner.
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Return the pointer to the variable in the operational table storing the parameter identified by
The variable is interpreted as of type
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Get the current value of a parameter interpreted as a short.
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Get the current value of a parameter interpreted as an unsigned char.
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Get the current value of a parameter interpreted as an unsigned integer.
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Get the current value of a parameter interpreted as an unsigned short.
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Set the current value of a parameter interpreted as a double.
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Set the current value of a parameter interpreted as a float.
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Set the current value of a parameter interpreted as an unsigned char.
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Set the current value of a parameter interpreted as a char.
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Set the current value of a parameter interpreted as a boolean.
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Set the current value of a parameter interpreted as an short.
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Set the current value of a parameter interpreted as an unsigned short.
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Set the current value of a parameter interpreted as an integer.
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |
|
Set the current value of a parameter interpreted as an unsigned integer.
Implemented in DC_BasicDatabase, DC_SampleR1Database, DC_SampleR2Database, and DC_SampleR3Database. |