fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType > Class Template Reference

The DeviceFactory is designed as a bridge pattern to allow sub-classing of the class interface (DeviceFactory) and the class implementation (this one) separately. This DeviceFactoryImp is the abstract-class that declares the interface to the underlying device-factory implementation (Shm, Heap). It instantiates all devices, global-device, domain-store and initializes everything. More...

#include <DeviceFactoryImp.h>

Inheritance diagram for fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >:
fesa::HeapFactory< GlobalDeviceType, DomainStoreType, DevInstType > fesa::ShmFactory< GlobalDeviceType, DomainStoreType, DevInstType >

List of all members.

Public Member Functions

 DeviceFactoryImp (const std::string &className)
 Constructor.
virtual ~DeviceFactoryImp ()
 destructor
const std::vector< DevInstType * > & getDeviceCollection ()
 Method retrieves all concrete devices which belong to device factory.
GlobalDeviceType * getGlobalDevice ()
 Method retrieves global device which belongs to device factory.
DevInstType * getDevice (const std::string &deviceName)
 this method retrieves the device instance by its name
void initialize ()
 this method is responsible for the device data initialization:

  • extracts data from the XML documents
  • instantiates the devices and set-up the deviceCollection
  • instantiates the domain data-store
  • initializes all the fields

Protected Member Functions

virtual bool setUpMemory ()=0
 creates the shared-memory, maps and initializes all the fields
void computeMemorySize ()
 computes the heap memory size relying on fields size and multiplexing depth in particular.
void mapFields (char *p, bool initializeFields)
 maps the fields-value object into the heap-memory space
void unmapFields ()
 unmaps the fields-value object into the heap-memory space
void registerPersistenceFields ()
 registers persistent fields in persistency unit needed for persistency mechanism

Protected Attributes

std::vector< DevInstType * > pDeviceCol_
 vector of devices that belong to device factory
std::vector< DomainStoreType * > pDomainStoreCol_
 vector of domain stores that belong to device factory
GlobalDeviceType * pGlobalDevice_
 global device that belong to device factory
int32_t size_
 memory size of complete heap that is used
int32_t globalDeviceSize_
 size of memory for global device
int32_t domainStoreSize_
 size of memory for domain store
int32_t devicesSize_
 size of memory for devices
int32_t muxManagersSize_
 size of memory for multiplexing managers
int32_t equimentDataSize_
 size of the equipment data

Private Member Functions

void createDevices (const std::vector< DeviceElement * > &pDeviceElementCol)
 create the devices
void createDomainStores (const std::vector< DomainStoreElement * > &pDomainStoreElementCol)
 Initializes domain store fields with initial values from initialization document.
void createGlobalDevice (GlobalDeviceElement &pGlobalDeviceElement)
 Initializes global device fields with initial values from initialization document.
void configureFields (DataStore *dataStore, DataStoreElement *dataStoreElement)
 initializes the fields of a datastore
void initializeDevices (const std::vector< DeviceElement * > &pDeviceElementCol)
 Initializes device fields with initial values from initialization document.
void initializeDomainStores (const std::vector< DomainStoreElement * > &pDomainStoreElementCol)
 Initializes domain store fields with initial values from initialization document.
void initializeGlobalDevice (GlobalDeviceElement &pGlobalDeviceElement)
 Initializes global device fields with initial values from initialization document.

Private Attributes

std::string className_
 name of class to which the device factory belongs

Detailed Description

template<typename GlobalDeviceType, typename DomainStoreType, typename DevInstType>
class fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >

The DeviceFactory is designed as a bridge pattern to allow sub-classing of the class interface (DeviceFactory) and the class implementation (this one) separately. This DeviceFactoryImp is the abstract-class that declares the interface to the underlying device-factory implementation (Shm, Heap). It instantiates all devices, global-device, domain-store and initializes everything.

Parameters:
GlobalDeviceType is the type of the concrete GlobalDevice class
DomainStoreType is the type of the concrete DomainStore class
DevInstType is the type of the concrete Device class

Definition at line 38 of file DeviceFactoryImp.h.


Constructor & Destructor Documentation

template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::DeviceFactoryImp ( const std::string &  className  )  [inline]

Constructor.

Parameters:
className name of the class to which the device factory belongs

Definition at line 205 of file DeviceFactoryImp.h.

template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::~DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType > (  )  [inline, virtual]

destructor


Member Function Documentation

template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
void fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::computeMemorySize (  )  [inline, protected]
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
void fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::configureFields ( DataStore dataStore,
DataStoreElement dataStoreElement 
) [inline, private]
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
void fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::createDevices ( const std::vector< DeviceElement * > &  pDeviceElementCol  )  [inline, private]
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
void fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::createDomainStores ( const std::vector< DomainStoreElement * > &  pDomainStoreElementCol  )  [inline, private]
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
void fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::createGlobalDevice ( GlobalDeviceElement pGlobalDeviceElement  )  [inline, private]
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
DevInstType * fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::getDevice ( const std::string &  deviceName  )  [inline]

this method retrieves the device instance by its name

Parameters:
deviceName the name of the device
Returns:
concrete device reference or NULL if the device is not found

Definition at line 311 of file DeviceFactoryImp.h.

References fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::pDeviceCol_.

template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
const std::vector< DevInstType * > & fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::getDeviceCollection (  )  [inline]

Method retrieves all concrete devices which belong to device factory.

Returns:
vector of devices

Definition at line 324 of file DeviceFactoryImp.h.

References fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::pDeviceCol_.

template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
GlobalDeviceType * fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::getGlobalDevice (  )  [inline]

Method retrieves global device which belongs to device factory.

Returns:
global device

Definition at line 305 of file DeviceFactoryImp.h.

References fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::pGlobalDevice_.

template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
void fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::initialize (  )  [inline]

this method is responsible for the device data initialization:

  • extracts data from the XML documents
  • instantiates the devices and set-up the deviceCollection
  • instantiates the domain data-store
  • initializes all the fields

Exceptions:
FesaException 

Definition at line 228 of file DeviceFactoryImp.h.

References fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::className_, fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::createDevices(), fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::createDomainStores(), fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::createGlobalDevice(), FesaErrorOpenXMLFile, fesa::AbstractEquipment::getDeviceDataFileName(), fesa::PersistencyManager::getInstance(), fesa::EquipmentData::getInstance(), fesa::AbstractEquipment::getInstance(), fesa::AbstractEquipment::getPersistencyFileName(), fesa::EquipmentData::initialize(), fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::initializeDevices(), fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::initializeDomainStores(), fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::initializeGlobalDevice(), fesa::AbstractEquipment::isClassOptional(), fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::pDeviceCol_, fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::pDomainStoreCol_, fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::pGlobalDevice_, fesa::StoreManager::restore(), fesa::InitializeDataStoreManager::retrieveDeviceElements(), fesa::InitializeDataStoreManager::retrieveDomainStoreElements(), fesa::InitializeDataStoreManager::retrieveGlobalDeviceElement(), and fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::setUpMemory().

template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
void fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::initializeDevices ( const std::vector< DeviceElement * > &  pDeviceElementCol  )  [inline, private]
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
void fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::initializeDomainStores ( const std::vector< DomainStoreElement * > &  pDomainStoreElementCol  )  [inline, private]
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
void fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::initializeGlobalDevice ( GlobalDeviceElement pGlobalDeviceElement  )  [inline, private]

Initializes global device fields with initial values from initialization document.

Definition at line 491 of file DeviceFactoryImp.h.

References fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::pGlobalDevice_.

Referenced by fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::initialize().

template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
void fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::mapFields ( char *  p,
bool  initializeFields 
) [inline, protected]
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
void fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::registerPersistenceFields (  )  [protected]

registers persistent fields in persistency unit needed for persistency mechanism

template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
virtual bool fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::setUpMemory (  )  [protected, pure virtual]

creates the shared-memory, maps and initializes all the fields

Returns:
true: shared-memory has been created
false: shared-memory already exist, has been attached only

Implemented in fesa::HeapFactory< GlobalDeviceType, DomainStoreType, DevInstType >, and fesa::ShmFactory< GlobalDeviceType, DomainStoreType, DevInstType >.

Referenced by fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::initialize().

template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
void fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::unmapFields (  )  [inline, protected]

unmaps the fields-value object into the heap-memory space

Definition at line 617 of file DeviceFactoryImp.h.

References fesa::EquipmentData::getInstance(), and fesa::EquipmentData::isInitialize_.

Referenced by fesa::ShmFactory< GlobalDeviceType, DomainStoreType, DevInstType >::setUpMemory().


Member Data Documentation

template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
std::string fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::className_ [private]
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
int32_t fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::devicesSize_ [protected]
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
int32_t fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::domainStoreSize_ [protected]
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
int32_t fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::equimentDataSize_ [protected]
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
int32_t fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::globalDeviceSize_ [protected]
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
int32_t fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::muxManagersSize_ [protected]
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
std::vector<DevInstType *> fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::pDeviceCol_ [protected]
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
std::vector<DomainStoreType*> fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::pDomainStoreCol_ [protected]
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
GlobalDeviceType* fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::pGlobalDevice_ [protected]
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
int32_t fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::size_ [protected]

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

Generated on 18 Jan 2013 for Fesa by  doxygen 1.6.1