fesa-core  5.0.1
fesa::DataStore Class Reference

Base class for field-storage classes in the framework: Device, GlobalDevice and DomainStore. More...

#include <DataStore.h>

Inheritance diagram for fesa::DataStore:
fesa::AbstractDevice fesa::DomainStore fesa::GlobalDevice

Public Member Functions

 DataStore ()
 Constructor.
 
virtual ~DataStore ()
 destructor
 
virtual const std::string & getName () const
 Get the name of the data store.
 
boost::optional< int64_t > getId () const
 
FaultSeverity::FaultSeverity getStatus (const MultiplexingContext *context, std::vector< const char * > &faultDescriptions) const
 Get the status of the data store. More...
 
const std::vector
< AbstractField * > & 
getFieldCollection () const
 Retrieve the collection of fields. More...
 
const std::vector
< AbstractField * > & 
getPersistentFieldsCollection () const
 Method to retrieve the setting field collection of that data store. More...
 
AbstractFieldgetField (const std::string &name) const
 Retrieves a pointer to a concrete field. More...
 
std::size_t getMemorySizeToAllocate (bool multiProcess) const
 Returns the size of the shared fields of this object.
 
void mapMemory (char *p, bool multiProcess, bool initializeFields)
 Maps shared fields and attributes to memory. More...
 
void registerFaultField (AbstractField *field)
 Register a fault field in the data store. More...
 

Protected Member Functions

void initializeFieldDefaultValues (const boost::shared_ptr< DataStoreElement > &dataStoreElement)
 initializes all fields of this device with default-values from the instantiation-file More...
 
virtual void initializeOtherFieldValues (const boost::shared_ptr< DataStoreElement > &dataStoreElement)
 
void initializeFieldDimensions (const boost::shared_ptr< DataStoreElement > &dataStoreElement)
 initializes all fields of this data-store with the dimensions, defined in the instantiation-file More...
 
virtual void initialize ()
 This method initialize the datastore.
 
virtual void restoreFromElement (PersistanceDataStoreElement &element)
 this method restores the data store with the element passed as a parameter More...
 
virtual void registerField (AbstractField *field)
 Registers a new field in the current field collection. More...
 
void registerRelatedField (AbstractField *mainField, AbstractField *relatedField)
 Registers a related field of a field. Initializing the dimensions of the field will initialize the dimensions of its related field with the same value. This is a unidirectional relation. A related field cannot be the main field of another field. More...
 
virtual std::size_t getSizeOfAdditionalFields () const
 Get the size related to non-Fesa-type fields. More...
 
virtual void mapAdditionalFields (char *p)
 Map the non-Fesa-type fields. More...
 

Protected Attributes

std::vector< AbstractField * > fields_
 field collection containing all fields of the data store
 
std::vector< AbstractField * > persistentFields_
 setting collection containing all the persistent fields
 
std::map< AbstractField
*, AbstractField * > 
relatedFields_
 maps a field to its related field. Used for example by history fields, so that initializing dimensions of the main field also initializes dimensions of the related field. This is a unidirectional relation. Bidirectional relations are forbidden as they may produce infinite loops.
 
RWLockpRWLock_
 read-write lock used to lock data store during synchronization of setting fields
 

Detailed Description

Base class for field-storage classes in the framework: Device, GlobalDevice and DomainStore.

Member Function Documentation

AbstractField * fesa::DataStore::getField ( const std::string &  name) const

Retrieves a pointer to a concrete field.

Parameters
namename of the field
Returns
a AbstractField pointer to the field searched, or NULL if the field doesn't exist.
const std::vector< AbstractField * > & fesa::DataStore::getFieldCollection ( ) const
inline

Retrieve the collection of fields.

Returns
The collection of all fields
boost::optional< int64_t > fesa::DataStore::getId ( ) const

Returns the unique identifier of this device, if available.

const std::vector< AbstractField * > & fesa::DataStore::getPersistentFieldsCollection ( ) const
inline

Method to retrieve the setting field collection of that data store.

Returns
a vector of AbstractFields containing all the setting fields
std::size_t fesa::DataStore::getSizeOfAdditionalFields ( ) const
protectedvirtual

Get the size related to non-Fesa-type fields.

Returns
The size related to specific non-Fesa-type fields

Reimplemented in fesa::AbstractDevice, and fesa::DomainStore.

FaultSeverity::FaultSeverity fesa::DataStore::getStatus ( const MultiplexingContext context,
std::vector< const char * > &  faultDescriptions 
) const

Get the status of the data store.

Parameters
contextThe multiplexing context
faultDescriptionsThe descriptions of all the raised fault fields of the warning or error severity
Returns
The highest severity of all the raised fault fields
void fesa::DataStore::initializeFieldDefaultValues ( const boost::shared_ptr< DataStoreElement > &  dataStoreElement)
protected

initializes all fields of this device with default-values from the instantiation-file

Parameters
dataStoreElementdata-store-element from the instantiation-file
void fesa::DataStore::initializeFieldDimensions ( const boost::shared_ptr< DataStoreElement > &  dataStoreElement)
protected

initializes all fields of this data-store with the dimensions, defined in the instantiation-file

Parameters
dataStoreElementdata-store-element from the instantiation-file
void fesa::DataStore::initializeOtherFieldValues ( const boost::shared_ptr< DataStoreElement > &  dataStoreElement)
protectedvirtual

Extension point called at the end of initializeFieldDefaultValues. Can be used by child classes to initialize fields which are not initialized by initializeFieldDefaultValues.

Reimplemented in fesa::AbstractDevice.

void fesa::DataStore::mapAdditionalFields ( char *  p)
protectedvirtual

Map the non-Fesa-type fields.

Parameters
Pointerto the allocated memory

Reimplemented in fesa::AbstractDevice, and fesa::DomainStore.

void fesa::DataStore::mapMemory ( char *  p,
bool  multiProcess,
bool  initializeFields 
)

Maps shared fields and attributes to memory.

Parameters
ppointer to the memory allocated to be used by the data store
multiProcesstrue if multiple processes will access the shared fields and attributes
initializeFieldsindicates if the field object has to be initialized.
void fesa::DataStore::registerFaultField ( AbstractField field)

Register a fault field in the data store.

Parameters
fieldThe field to be registered in the data store
void fesa::DataStore::registerField ( AbstractField field)
protectedvirtual

Registers a new field in the current field collection.

Parameters
fieldpointer to the AbstractField to be registered in the field collection
void fesa::DataStore::registerRelatedField ( AbstractField mainField,
AbstractField relatedField 
)
protected

Registers a related field of a field. Initializing the dimensions of the field will initialize the dimensions of its related field with the same value. This is a unidirectional relation. A related field cannot be the main field of another field.

Exceptions
FesaExceptionif relatedField is already registered as a main field
void fesa::DataStore::restoreFromElement ( PersistanceDataStoreElement element)
protectedvirtual

this method restores the data store with the element passed as a parameter

Parameters
PersistanceDataStoreElementthat contains the information

Reimplemented in fesa::AbstractDevice.


The documentation for this class was generated from the following files: