Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

DC_BasicDataPool Class Reference

#include <DC_BasicDataPool.h>

Inheritance diagram for DC_BasicDataPool:

DataPool CC_RootObject DC_DummyDataPool List of all members.

Detailed Description

Default component implementing a data pool with basic functionality.

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.

Author:
Alessandro Pasetti (P&P Software)
Version:
1.0

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_FloatgetPointerFloatValue (TD_DataPoolId id)
 Getter method for the pointer to a real-typed data pool item.

virtual TD_IntegergetPointerIntegerValue (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.


Constructor & Destructor Documentation

DC_BasicDataPool::DC_BasicDataPool void   ) 
 

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.


Member Function Documentation

TD_DataPoolId DC_BasicDataPool::getDataPoolSize void   ) 
 

Get the size of the data pool.

See also:
setDataPoolSize
Returns:
size of the data pool in number of bytes

Definition at line 34 of file DC_BasicDataPool.cpp.

TD_Float DC_BasicDataPool::getFloatValue TD_DataPoolId  id  )  [virtual]
 

Getter method for the value of a real-typed data pool item.

This method implements the copy link mechanism for real-valued data.

Parameters:
id the data identifier of the data pool item to be read
Returns:
the value of the data with identifier id

Implements DataPool.

Definition at line 50 of file DC_BasicDataPool.cpp.

TD_Integer DC_BasicDataPool::getIntegerValue TD_DataPoolId  id  )  [virtual]
 

Getter method for the value of an integer-typed data pool item.

This method implements the copy link mechanism for integer-valued data.

Parameters:
id the data identifier of the data pool item to be read
Returns:
the value of the data with identifier id

Implements DataPool.

Definition at line 56 of file DC_BasicDataPool.cpp.

TD_Float * DC_BasicDataPool::getPointerFloatValue TD_DataPoolId  id  )  [virtual]
 

Getter method for the pointer to a real-typed data pool item.

This method implements the pointer link mechanism for real-typed data.

Parameters:
id the data identifier of the data pool item to be read
Returns:
the pointer to the data with identifier id

Implements DataPool.

Definition at line 62 of file DC_BasicDataPool.cpp.

TD_Integer * DC_BasicDataPool::getPointerIntegerValue TD_DataPoolId  id  )  [virtual]
 

Getter method for the pointer to an integer-typed data pool item.

This method implements the pointer link mechanism for integer-typed data.

Parameters:
id the data identifier of the data pool item to be read
Returns:
the pointer to the data with identifier id

Implements DataPool.

Definition at line 68 of file DC_BasicDataPool.cpp.

bool DC_BasicDataPool::isObjectConfigured void   )  [virtual]
 

Perform a class-specific configuration check on a data pool component: verify that the size of the data pool has been set.

See also:
reset
Returns:
true if the database object is configured, false otherwise

Reimplemented from CC_RootObject.

Definition at line 74 of file DC_BasicDataPool.cpp.

void DC_BasicDataPool::setDataPoolSize TD_DataPoolId  size  ) 
 

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.

Parameters:
size the size of the data pool in number of bytes

Definition at line 24 of file DC_BasicDataPool.cpp.

void DC_BasicDataPool::setValue TD_DataPoolId  id,
TD_Integer  newValue
[virtual]
 

Setter method for the value of an integer-typed data pool item.

Parameters:
id the data identifier of the data pool item to be set
newValue the new value to be set

Implements DataPool.

Definition at line 44 of file DC_BasicDataPool.cpp.

void DC_BasicDataPool::setValue TD_DataPoolId  id,
TD_Float  newValue
[virtual]
 

Setter method for the value of a real-typed data pool item.

Parameters:
id the data identifier of the data pool item to be set
newValue the new value to be set

Implements DataPool.

Definition at line 38 of file DC_BasicDataPool.cpp.


The documentation for this class was generated from the following files:
Copyright 2003 P&P Software GmbH - All Rights Reserved