#include <DC_BasicDataPool.h>
Inheritance diagram for DC_BasicDataPool:
The data pool is implemented as a linear array whose index is the identifier of the data pool item. Of all the attributes for data pool items defined in the base class, the only ones to have a non-dummy implementation are the value and the identifier. For all other attributes, the default implementation inherited from the base class is kept. Note in particular that there are no checks on the legality of the identifier values used when accessing data pool items. This results in a very efficient implementation both in terms of memory and run-time overheads but it also results in a low level of robustness.
This class defines one single configuration method to set the size of the data pool.
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 variables is implemened as follows:<code> void DC_BasicDataPool::setValue(TD_DataPoolId id,TD_Integer newValue) { *(TD_Integer *)(value+id)=newValue; } On some processors, the assignment will fail if location (value+id)
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 data pool locations and the method variables.
Definition at line 47 of file DC_BasicDataPool.h.
Public Member Functions | |
DC_BasicDataPool (void) | |
Instantiate a data pool component. | |
void | setDataPoolSize (TD_DataPoolId size) |
Set the size of the internal array where the data pool items are stored. | |
TD_DataPoolId | getDataPoolSize (void) |
Get the size of the data pool. | |
virtual void | setValue (TD_DataPoolId id, TD_Float newValue) |
Setter method for the value of a real-typed data pool item. | |
virtual void | setValue (TD_DataPoolId id, TD_Integer newValue) |
Setter method for the value of an integer-typed data pool item. | |
virtual TD_Float | getFloatValue (TD_DataPoolId id) |
Getter method for the value of a real-typed data pool item. | |
virtual TD_Integer | getIntegerValue (TD_DataPoolId id) |
Getter method for the value of an integer-typed data pool item. | |
virtual TD_Float * | getPointerFloatValue (TD_DataPoolId id) |
Getter method for the pointer to a real-typed data pool item. | |
virtual TD_Integer * | getPointerIntegerValue (TD_DataPoolId id) |
Getter method for the pointer to an integer-typed data pool item. | |
virtual bool | isObjectConfigured (void) |
Perform a class-specific configuration check on a data pool component: verify that the size of the data pool has been set. |
|
Instantiate a data pool component. The class identifier is set. The internal data structures are left uninitialized to signify that the component is not yet configured. Definition at line 18 of file DC_BasicDataPool.cpp. |
|
Get the size of the data pool.
Definition at line 34 of file DC_BasicDataPool.cpp. |
|
Getter method for the value of a real-typed data pool item. This method implements the copy link mechanism for real-valued data.
Implements DataPool. Definition at line 50 of file DC_BasicDataPool.cpp. |
|
Getter method for the value of an integer-typed data pool item. This method implements the copy link mechanism for integer-valued data.
Implements DataPool. Definition at line 56 of file DC_BasicDataPool.cpp. |
|
Getter method for the pointer to a real-typed data pool item. This method implements the pointer link mechanism for real-typed data.
Implements DataPool. Definition at line 62 of file DC_BasicDataPool.cpp. |
|
Getter method for the pointer to an integer-typed data pool item. This method implements the pointer link mechanism for integer-typed data.
Implements DataPool. Definition at line 68 of file DC_BasicDataPool.cpp. |
|
Perform a class-specific configuration check on a data pool component: verify that the size of the data pool has been set.
Reimplemented from CC_RootObject. Definition at line 74 of file DC_BasicDataPool.cpp. |
|
Set the size of the internal array where the data pool items are stored. After this method is called, the internal data structures for the data pool component are allocated and initialized to zero. The data pool is internally implemented as a linear array. In order to avoid alignment problems (see class comment), the array is forced to start at an 8-byte word boundary. Only data pool size greater than zero are legal. This is an initialization method. It should only be called once. If it is called more than once, internal memory will be allocated multiple times. The memory allocated in previous calls is never reclaimed.
Definition at line 24 of file DC_BasicDataPool.cpp. |
|
Setter method for the value of an integer-typed data pool item.
Implements DataPool. Definition at line 44 of file DC_BasicDataPool.cpp. |
|
Setter method for the value of a real-typed data pool item.
Implements DataPool. Definition at line 38 of file DC_BasicDataPool.cpp. |