#include <DC_BasicDatabase.h>
Inheritance diagram for DC_BasicDatabase:
The basic database implements the Default Table and the Operational Table as linear arrays. The identifier of a parameter is the index in the array at which the parameter is stored. Syntactically, the elements of the table arrays are of char type but the tables can hold elements of any type (the getter and setter operations defined in this class will perform the necessary casting operations to convert the raw bytes in the table arrays to the type required by the operation).
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
) setTableLength
) reset
)
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:<code> void DC_BasicDatabase::setParameter(TD_DatabaseId parId, int newValue) { *( (int*)(pOperationalTable+parId) ) = newValue; } On some processors, the assignment will fail if location (pOperationalTable+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 setter method is called with the correct parameter values. The same applies to other setter and getter methods. 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 57 of file DC_BasicDatabase.h.
Public Member Functions | |
DC_BasicDatabase (void) | |
Instantiate a basic database component. | |
virtual void | reset (void) |
Copy the default table array onto the operational table array. | |
void | setTableLength (TD_DatabaseId length) |
Set the length of the default and operational table in number of bytes. | |
TD_DatabaseId | getTableLength (void) |
Get the length of the default and operational table in number of bytes. | |
void | setDefaultTable (char *pDefTable) |
Load the default table. | |
void | setOperationalTable (char *pOperTable) |
Load the operational table. | |
virtual void | setParameter (TD_DatabaseId parId, unsigned int newValue) |
Set the current value of a parameter interpreted as an unsigned integer. | |
virtual void | setParameter (TD_DatabaseId parId, int newValue) |
Set the current value of a parameter interpreted as an integer. | |
virtual void | setParameter (TD_DatabaseId parId, unsigned short newValue) |
Set the current value of a parameter interpreted as an unsigned short. | |
virtual void | setParameter (TD_DatabaseId parId, short newValue) |
Set the current value of a parameter interpreted as an short. | |
virtual void | setParameter (TD_DatabaseId parId, bool newValue) |
Set the current value of a parameter interpreted as a boolean. | |
virtual void | setParameter (TD_DatabaseId parId, char newValue) |
Set the current value of a parameter interpreted as a char. | |
virtual void | setParameter (TD_DatabaseId parId, unsigned char newValue) |
Set the current value of a parameter interpreted as an unsigned char. | |
virtual void | setParameter (TD_DatabaseId parId, float newValue) |
Set the current value of a parameter interpreted as a float. | |
virtual void | setParameter (TD_DatabaseId parId, double newValue) |
Set the current value of a parameter interpreted as a double. | |
virtual unsigned int | getParameterUnsignedInt (TD_DatabaseId parId) |
Get the current value of a parameter interpreted as an unsigned integer. | |
virtual int | getParameterInt (TD_DatabaseId parId) |
Get the current value of a parameter interpreted as an integer. | |
virtual unsigned short | getParameterUnsignedShort (TD_DatabaseId parId) |
Get the current value of a parameter interpreted as an unsigned short. | |
virtual short | getParameterShort (TD_DatabaseId parId) |
Get the current value of a parameter interpreted as a short. | |
virtual bool | getParameterBool (TD_DatabaseId parId) |
Get the current value of a parameter interpreted as a boolean. | |
virtual unsigned char | getParameterUnsignedChar (TD_DatabaseId parId) |
Get the current value of a parameter interpreted as an unsigned char. | |
virtual char | getParameterChar (TD_DatabaseId parId) |
Get the current value of a parameter interpreted as a char. | |
virtual float | getParameterFloat (TD_DatabaseId parId) |
Get the current value of a parameter interpreted as a float. | |
virtual double | getParameterDouble (TD_DatabaseId parId) |
Get the current value of a parameter interpreted as a double. | |
virtual unsigned int * | getParameterPointerUnsignedInt (TD_DatabaseId parId) |
Return the pointer to the variable in the operational table storing the parameter identified by parId . | |
virtual int * | getParameterPointerInt (TD_DatabaseId parId) |
Return the pointer to the variable in the operational table storing the parameter identified by parId . | |
virtual unsigned short * | getParameterPointerUnsignedShort (TD_DatabaseId parId) |
Return the pointer to the variable in the operational table storing the parameter identified by parId . | |
virtual short * | getParameterPointerShort (TD_DatabaseId parId) |
Return the pointer to the variable in the operational table storing the parameter identified by parId . | |
virtual unsigned char * | getParameterPointerUnsignedChar (TD_DatabaseId parId) |
Return the pointer to the variable in the operational table storing the parameter identified by parId . | |
virtual char * | getParameterPointerChar (TD_DatabaseId parId) |
Return the pointer to the variable in the operational table storing the parameter identified by parId . | |
virtual bool * | getParameterPointerBool (TD_DatabaseId parId) |
Return the pointer to the variable in the operational table storing the parameter identified by parId . | |
virtual float * | getParameterPointerFloat (TD_DatabaseId parId) |
Return the pointer to the variable in the operational table storing the parameter identified by parId . | |
virtual double * | getParameterPointerDouble (TD_DatabaseId parId) |
Return the pointer to the variable in the operational table storing the parameter identified by parId . | |
virtual bool | isObjectConfigured (void) |
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 basic database component. The default and operational table arrays are initialized to illegal values to signify that the component is not yet configured. values. The class identifier is set. Definition at line 17 of file DC_BasicDatabase.cpp. |
|
Get the current value of a parameter interpreted as a boolean.
Implements ParameterDatabase. Definition at line 136 of file DC_BasicDatabase.cpp. |
|
Get the current value of a parameter interpreted as a char.
Implements ParameterDatabase. Definition at line 131 of file DC_BasicDatabase.cpp. |
|
Get the current value of a parameter interpreted as a double.
Implements ParameterDatabase. Definition at line 146 of file DC_BasicDatabase.cpp. |
|
Get the current value of a parameter interpreted as a float.
Implements ParameterDatabase. Definition at line 141 of file DC_BasicDatabase.cpp. |
|
Get the current value of a parameter interpreted as an integer.
Implements ParameterDatabase. Definition at line 111 of file DC_BasicDatabase.cpp. |
|
Return the pointer to the variable in the operational table storing the parameter identified by
The variable is interpreted as of type
Implements ParameterDatabase. Definition at line 183 of file DC_BasicDatabase.cpp. |
|
Return the pointer to the variable in the operational table storing the parameter identified by
The variable is interpreted as of type
Implements ParameterDatabase. Definition at line 178 of file DC_BasicDatabase.cpp. |
|
Return the pointer to the variable in the operational table storing the parameter identified by
The variable is interpreted as of type
Implements ParameterDatabase. Definition at line 193 of file DC_BasicDatabase.cpp. |
|
Return the pointer to the variable in the operational table storing the parameter identified by
The variable is interpreted as of type
Implements ParameterDatabase. Definition at line 188 of file DC_BasicDatabase.cpp. |
|
Return the pointer to the variable in the operational table storing the parameter identified by
The variable is interpreted as of type
Implements ParameterDatabase. Definition at line 158 of file DC_BasicDatabase.cpp. |
|
Return the pointer to the variable in the operational table storing the parameter identified by
The variable is interpreted as of type
Implements ParameterDatabase. Definition at line 168 of file DC_BasicDatabase.cpp. |
|
Return the pointer to the variable in the operational table storing the parameter identified by
The variable is interpreted as of type
Implements ParameterDatabase. Definition at line 173 of file DC_BasicDatabase.cpp. |
|
Return the pointer to the variable in the operational table storing the parameter identified by
The variable is interpreted as of type
Implements ParameterDatabase. Definition at line 153 of file DC_BasicDatabase.cpp. |
|
Return the pointer to the variable in the operational table storing the parameter identified by
The variable is interpreted as of type
Implements ParameterDatabase. Definition at line 163 of file DC_BasicDatabase.cpp. |
|
Get the current value of a parameter interpreted as a short.
Implements ParameterDatabase. Definition at line 121 of file DC_BasicDatabase.cpp. |
|
Get the current value of a parameter interpreted as an unsigned char.
Implements ParameterDatabase. Definition at line 126 of file DC_BasicDatabase.cpp. |
|
Get the current value of a parameter interpreted as an unsigned integer.
Implements ParameterDatabase. Definition at line 106 of file DC_BasicDatabase.cpp. |
|
Get the current value of a parameter interpreted as an unsigned short.
Implements ParameterDatabase. Definition at line 116 of file DC_BasicDatabase.cpp. |
|
Get the length of the default and operational table in number of bytes.
Definition at line 38 of file DC_BasicDatabase.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 52 of file DC_BasicDatabase.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 42 of file DC_BasicDatabase.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 47 of file DC_BasicDatabase.cpp. |
|
Set the current value of a parameter interpreted as a double.
Implements ParameterDatabase. Definition at line 99 of file DC_BasicDatabase.cpp. |
|
Set the current value of a parameter interpreted as a float.
Implements ParameterDatabase. Definition at line 94 of file DC_BasicDatabase.cpp. |
|
Set the current value of a parameter interpreted as an unsigned char.
Implements ParameterDatabase. Definition at line 89 of file DC_BasicDatabase.cpp. |
|
Set the current value of a parameter interpreted as a char.
Implements ParameterDatabase. Definition at line 84 of file DC_BasicDatabase.cpp. |
|
Set the current value of a parameter interpreted as a boolean.
Implements ParameterDatabase. Definition at line 79 of file DC_BasicDatabase.cpp. |
|
Set the current value of a parameter interpreted as an short.
Implements ParameterDatabase. Definition at line 74 of file DC_BasicDatabase.cpp. |
|
Set the current value of a parameter interpreted as an unsigned short.
Implements ParameterDatabase. Definition at line 69 of file DC_BasicDatabase.cpp. |
|
Set the current value of a parameter interpreted as an integer.
Implements ParameterDatabase. Definition at line 64 of file DC_BasicDatabase.cpp. |
|
Set the current value of a parameter interpreted as an unsigned integer.
Implements ParameterDatabase. Definition at line 59 of file DC_BasicDatabase.cpp. |
|
Set the length of the default and operational table in number of bytes. Only non-negative values of the length are legal. This is an initialization method.
Definition at line 33 of file DC_BasicDatabase.cpp. |