#include <DC_SampleR3Database.h>
Inheritance diagram for DC_SampleR3Database:
This database contains nine parameters covering the eight possible syntactical types for database parameters.
The code for this class was automatically generated by an XSL program using as input the XML-based application model. This class offers a pointer-oriented and robust implementation of the ParameterDatabase
interface. The price paid for the safety offered by this implementation is a certain inefficiency both in terms of memory overhead and run-time when accessing a parameter.
An indexed database maintains internal data structures that, for each parameter in the database, store the following information:<ul> The pointer to the operational version of the parameter The syntactical type of the parameter These internal data structures are set up and initialized by the indexed database component during its configuration procedure. The parameter type information allows the component to perform run-time cheks on the access to the parameter values. Checks are performed on the legality of the parameter identifier and on the use of the correct accessor method for a parameter (e.g. the value of a parameter of type float should only be accessed with method getParameterFloat
).
The memory overhead caused by this class is minimized when the parameter identifiers begin with a zero and when there are no "gaps" in the parameter identifier.
The default and operational tables are not defined by this class. This class loads the tables using methods setDefaultTable
and setOperationalTable
.
The configuration procedure for an instance of this class is as follows:
setDefaultTable
) setOperationalTable
) reset
) DC_SampleR3Database_inc.h
) is also automatically generated that defines symbolic names to access the parameters in the database. The getter and setter methods are implemented to be fast and efficient but this makes them vulnerable to alignement problems on some processors. For instance, the setter methods for integer-valued parameters is implemened as follows:
void DC_BasicDatabase::setParameter(TD_DatabaseId parId, int newValue) { *( (int*)(pPar[parId]) ) = newValue; }On some processors, the assignment will fail if location
pPar[parId]
does not correspond to a longword (4 bytes) boundary. There is no check to ensure that this is the case and it is the responsibility of the user to ensure that the database map is such as to avoid this type of problems. The database map is defined in the XML document that is processed by the generator meta-component that generates the database implementation. A more robust (but possibly slower) implementation might use the memcpy
library function to transfer the values of the data between the database locations and the method variables.
Definition at line 78 of file DC_SampleR3Database.h.
Public Member Functions | |
DC_SampleR3Database () | |
Instantiate a database component The default and operational table arrays are initialized to illegal values to signify that the component is not yet configured. | |
virtual void | reset () |
Copy the default table array onto the operational table array and set up the internal data structures that describe the position of the parameters in the database and their type. | |
void | setDefaultTable (char *pDefTable) |
Load the default table. | |
void | setOperationalTable (char *pOperTable) |
Load the operational table. | |
virtual void | setParameter (TD_DatabaseId parId, int newValue) |
Set the current value of a parameter interpreted as a parameter of type int. | |
virtual void | setParameter (TD_DatabaseId parId, unsigned int newValue) |
Set the current value of a parameter interpreted as a parameter of type unsigned int. | |
virtual void | setParameter (TD_DatabaseId parId, short newValue) |
Set the current value of a parameter interpreted as a parameter of type short. | |
virtual void | setParameter (TD_DatabaseId parId, unsigned short newValue) |
Set the current value of a parameter interpreted as a parameter of type unsigned short. | |
virtual void | setParameter (TD_DatabaseId parId, char newValue) |
Set the current value of a parameter interpreted as a parameter of type char. | |
virtual void | setParameter (TD_DatabaseId parId, unsigned char newValue) |
Set the current value of a parameter interpreted as a parameter of type unsigned char. | |
virtual void | setParameter (TD_DatabaseId parId, bool newValue) |
Set the current value of a parameter interpreted as a parameter of type bool. | |
virtual void | setParameter (TD_DatabaseId parId, float newValue) |
Set the current value of a parameter interpreted as a parameter of type float. | |
virtual void | setParameter (TD_DatabaseId parId, double newValue) |
Set the current value of a parameter interpreted as a parameter of type double. | |
virtual int | getParameterInt (TD_DatabaseId parId) |
Get the current value of a parameter interpreted as a parameter of type int. | |
virtual unsigned int | getParameterUnsignedInt (TD_DatabaseId parId) |
Get the current value of a parameter interpreted as a parameter of type unsigned int. | |
virtual short | getParameterShort (TD_DatabaseId parId) |
Get the current value of a parameter interpreted as a parameter of type short. | |
virtual unsigned short | getParameterUnsignedShort (TD_DatabaseId parId) |
Get the current value of a parameter interpreted as a parameter of type unsigned short. | |
virtual char | getParameterChar (TD_DatabaseId parId) |
Get the current value of a parameter interpreted as a parameter of type char. | |
virtual unsigned char | getParameterUnsignedChar (TD_DatabaseId parId) |
Get the current value of a parameter interpreted as a parameter of type unsigned char. | |
virtual bool | getParameterBool (TD_DatabaseId parId) |
Get the current value of a parameter interpreted as a parameter of type bool. | |
virtual float | getParameterFloat (TD_DatabaseId parId) |
Get the current value of a parameter interpreted as a parameter of type float. | |
virtual double | getParameterDouble (TD_DatabaseId parId) |
Get the current value of a parameter interpreted as a parameter of type double. | |
virtual int * | getParameterPointerInt (TD_DatabaseId parId) |
Get the pointer to the operational table copy of the parameter interpreted as a parameter of type int. | |
virtual unsigned int * | getParameterPointerUnsignedInt (TD_DatabaseId parId) |
Get the pointer to the operational table copy of the parameter interpreted as a parameter of type unsigned int. | |
virtual short * | getParameterPointerShort (TD_DatabaseId parId) |
Get the pointer to the operational table copy of the parameter interpreted as a parameter of type short. | |
virtual unsigned short * | getParameterPointerUnsignedShort (TD_DatabaseId parId) |
Get the pointer to the operational table copy of the parameter interpreted as a parameter of type unsigned short. | |
virtual char * | getParameterPointerChar (TD_DatabaseId parId) |
Get the pointer to the operational table copy of the parameter interpreted as a parameter of type char. | |
virtual unsigned char * | getParameterPointerUnsignedChar (TD_DatabaseId parId) |
Get the pointer to the operational table copy of the parameter interpreted as a parameter of type unsigned char. | |
virtual bool * | getParameterPointerBool (TD_DatabaseId parId) |
Get the pointer to the operational table copy of the parameter interpreted as a parameter of type bool. | |
virtual float * | getParameterPointerFloat (TD_DatabaseId parId) |
Get the pointer to the operational table copy of the parameter interpreted as a parameter of type float. | |
virtual double * | getParameterPointerDouble (TD_DatabaseId parId) |
Get the pointer to the operational table copy of the parameter interpreted as a parameter of type double. | |
virtual bool | isObjectConfigured () |
Perform a class-specific configuration check on a basic database object: verify that the default and operational tables have been loaded, that method reset has been called, and that the table length is greater than zero. |
|
Instantiate a database component The default and operational table arrays are initialized to illegal values to signify that the component is not yet configured. values. The table and length and the class identifier are set. Definition at line 28 of file DC_SampleR3Database.cpp. |
|
Get the current value of a parameter interpreted as a parameter of type bool. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type bool). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The method returns a default value of zero.
Implements ParameterDatabase. Definition at line 333 of file DC_SampleR3Database.cpp. |
|
Get the current value of a parameter interpreted as a parameter of type char. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type char). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The method returns a default value of zero.
Implements ParameterDatabase. Definition at line 303 of file DC_SampleR3Database.cpp. |
|
Get the current value of a parameter interpreted as a parameter of type double. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type double). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The method returns a default value of zero.
Implements ParameterDatabase. Definition at line 363 of file DC_SampleR3Database.cpp. |
|
Get the current value of a parameter interpreted as a parameter of type float. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type float). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The method returns a default value of zero.
Implements ParameterDatabase. Definition at line 348 of file DC_SampleR3Database.cpp. |
|
Get the current value of a parameter interpreted as a parameter of type int. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type int). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The method returns a default value of zero.
Implements ParameterDatabase. Definition at line 243 of file DC_SampleR3Database.cpp. |
|
Get the pointer to the operational table copy of the parameter interpreted as a parameter of type bool. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type bool). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The method returns a default value zero.
Implements ParameterDatabase. Definition at line 468 of file DC_SampleR3Database.cpp. |
|
Get the pointer to the operational table copy of the parameter interpreted as a parameter of type char. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type char). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The method returns a default value zero.
Implements ParameterDatabase. Definition at line 438 of file DC_SampleR3Database.cpp. |
|
Get the pointer to the operational table copy of the parameter interpreted as a parameter of type double. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type double). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The method returns a default value zero.
Implements ParameterDatabase. Definition at line 498 of file DC_SampleR3Database.cpp. |
|
Get the pointer to the operational table copy of the parameter interpreted as a parameter of type float. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type float). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The method returns a default value zero.
Implements ParameterDatabase. Definition at line 483 of file DC_SampleR3Database.cpp. |
|
Get the pointer to the operational table copy of the parameter interpreted as a parameter of type int. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type int). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The method returns a default value zero.
Implements ParameterDatabase. Definition at line 378 of file DC_SampleR3Database.cpp. |
|
Get the pointer to the operational table copy of the parameter interpreted as a parameter of type short. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type short). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The method returns a default value zero.
Implements ParameterDatabase. Definition at line 408 of file DC_SampleR3Database.cpp. |
|
Get the pointer to the operational table copy of the parameter interpreted as a parameter of type unsigned char. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type unsigned char). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The method returns a default value zero.
Implements ParameterDatabase. Definition at line 453 of file DC_SampleR3Database.cpp. |
|
Get the pointer to the operational table copy of the parameter interpreted as a parameter of type unsigned int. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type unsigned int). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The method returns a default value zero.
Implements ParameterDatabase. Definition at line 393 of file DC_SampleR3Database.cpp. |
|
Get the pointer to the operational table copy of the parameter interpreted as a parameter of type unsigned short. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type unsigned short). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The method returns a default value zero.
Implements ParameterDatabase. Definition at line 423 of file DC_SampleR3Database.cpp. |
|
Get the current value of a parameter interpreted as a parameter of type short. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type short). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The method returns a default value of zero.
Implements ParameterDatabase. Definition at line 273 of file DC_SampleR3Database.cpp. |
|
Get the current value of a parameter interpreted as a parameter of type unsigned char. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type unsigned char). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The method returns a default value of zero.
Implements ParameterDatabase. Definition at line 318 of file DC_SampleR3Database.cpp. |
|
Get the current value of a parameter interpreted as a parameter of type unsigned int. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type unsigned int). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The method returns a default value of zero.
Implements ParameterDatabase. Definition at line 258 of file DC_SampleR3Database.cpp. |
|
Get the current value of a parameter interpreted as a parameter of type unsigned short. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type unsigned short). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The method returns a default value of zero.
Implements ParameterDatabase. Definition at line 288 of file DC_SampleR3Database.cpp. |
|
Perform a class-specific configuration check on a basic database object: verify that the default and operational tables have been loaded, that method
Reimplemented from CC_RootObject. Definition at line 85 of file DC_SampleR3Database.cpp. |
|
Copy the default table array onto the operational table array and set up the internal data structures that describe the position of the parameters in the database and their type. An indexed database component maintains two internal data structures that describe how the database is organized:
Implements ParameterDatabase. Definition at line 46 of file DC_SampleR3Database.cpp. |
|
Load the default table. This method assumes that the default table has been defined and initialized by the caller. The method does not perform any action on the table. It simply loads its address and will use it for accessing the table entries. This is an initialization method.
Definition at line 75 of file DC_SampleR3Database.cpp. |
|
Load the operational table. This method assumes that the operational table has been defined and initialized by the caller. The method does not perform any action on the table. It simply loads its address and will use it for accessing the table entries. This is an initialization method.
Definition at line 80 of file DC_SampleR3Database.cpp. |
|
Set the current value of a parameter interpreted as a parameter of type double. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type double). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The database parameter is not updated if the check fails.
Implements ParameterDatabase. Definition at line 228 of file DC_SampleR3Database.cpp. |
|
Set the current value of a parameter interpreted as a parameter of type float. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type float). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The database parameter is not updated if the check fails.
Implements ParameterDatabase. Definition at line 212 of file DC_SampleR3Database.cpp. |
|
Set the current value of a parameter interpreted as a parameter of type bool. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type bool). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The database parameter is not updated if the check fails.
Implements ParameterDatabase. Definition at line 196 of file DC_SampleR3Database.cpp. |
|
Set the current value of a parameter interpreted as a parameter of type unsigned char. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type unsigned char). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The database parameter is not updated if the check fails.
Implements ParameterDatabase. Definition at line 180 of file DC_SampleR3Database.cpp. |
|
Set the current value of a parameter interpreted as a parameter of type char. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type char). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The database parameter is not updated if the check fails.
Implements ParameterDatabase. Definition at line 164 of file DC_SampleR3Database.cpp. |
|
Set the current value of a parameter interpreted as a parameter of type unsigned short. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type unsigned short). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The database parameter is not updated if the check fails.
Implements ParameterDatabase. Definition at line 148 of file DC_SampleR3Database.cpp. |
|
Set the current value of a parameter interpreted as a parameter of type short. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type short). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The database parameter is not updated if the check fails.
Implements ParameterDatabase. Definition at line 132 of file DC_SampleR3Database.cpp. |
|
Set the current value of a parameter interpreted as a parameter of type unsigned int. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type unsigned int). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The database parameter is not updated if the check fails.
Implements ParameterDatabase. Definition at line 116 of file DC_SampleR3Database.cpp. |
|
Set the current value of a parameter interpreted as a parameter of type int. Run-time checks are performed on the legality of the parameter identifier and on the correctness of the parameter type (i.e. it is verified that the parameter being accessed is internally recorded as a parameter of type int). Failure of the checks results in the generation of an assert error and in the generation of an event report for an event of type EVT_ILLEGAL_DB_ACCESS. The database parameter is not updated if the check fails.
Implements ParameterDatabase. Definition at line 100 of file DC_SampleR3Database.cpp. |