fesa-core  4.2.0
fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType > Class Template Referenceabstract

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::MemoryMappedFileFactory< GlobalDeviceType, DomainStoreType, DevInstType >

Public Member Functions

 DeviceFactoryImp (const std::string &className, const std::string &classVersion)
 Constructor. More...
 
virtual ~DeviceFactoryImp ()
 destructor
 
const std::vector< DevInstType * > & getDeviceCollection () const
 Method retrieves all concrete devices which belong to device factory. More...
 
const std::vector
< DomainStoreType * > & 
getDomainStoreCollection () const
 Method retrieves all concrete domain stores which belong to device factory. More...
 
GlobalDeviceType * getGlobalDevice () const
 Method retrieves global device which belongs to device factory. More...
 
DevInstType * getDevice (const std::string &deviceName) const
 this method retrieves the device instance by its name More...
 
DomainStoreType * getDomainStore (const std::string &domainStoreName) const
 this method retrieves the domain store instance by its name More...
 
void initialize (boost::shared_ptr< ClassElement > &instantiationXMLElementClass)
 this method is responsible for the device data initialization: More...
 

Protected Member Functions

virtual bool setUpMemory ()=0
 creates the shared-memory, maps and initializes all the fields More...
 
void computeMemorySize ()
 computes the heap memory size relying on fields size and multiplexing depth in particular. More...
 
void mapFields (char *p, bool initializeFields)
 maps the fields-value object into the heap-memory space More...
 
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
 
std::size_t size_
 memory size of complete heap that is used
 
std::size_t globalDeviceSize_
 size of memory for global device
 
std::size_t domainStoreSize_
 size of memory for domain store
 
std::size_t devicesSize_
 size of memory for devices
 
std::size_t muxManagersSize_
 size of memory for multiplexing managers
 
std::string className_
 name of class to which the device factory belongs
 
std::string classVersion_
 version of the 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
GlobalDeviceTypeis the type of the concrete GlobalDevice class
DomainStoreTypeis the type of the concrete DomainStore class
DevInstTypeis the type of the concrete Device class

Constructor & Destructor Documentation

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

Constructor.

Parameters
classNamename of the class to which the device factory belongs
classVersionversion of the class to which the device factory belongs

Member Function Documentation

template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
void fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::computeMemorySize ( )
protected

computes the heap memory size relying on fields size and multiplexing depth in particular.

Exceptions
FesaException
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
DevInstType * fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::getDevice ( const std::string &  deviceName) const
inline

this method retrieves the device instance by its name

Parameters
deviceNamethe name of the device
Returns
concrete device reference or NULL if the device is not found
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
const std::vector< DevInstType * > & fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::getDeviceCollection ( ) const
inline

Method retrieves all concrete devices which belong to device factory.

Returns
vector of devices
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
DomainStoreType * fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::getDomainStore ( const std::string &  domainStoreName) const
inline

this method retrieves the domain store instance by its name

Parameters
domainStoreNamethe name of the device
Returns
concrete domain store reference or NULL if the domain store is not found
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
const std::vector< DomainStoreType * > & fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::getDomainStoreCollection ( ) const
inline

Method retrieves all concrete domain stores which belong to device factory.

Returns
vector of domain stores
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
GlobalDeviceType * fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::getGlobalDevice ( ) const
inline

Method retrieves global device which belongs to device factory.

Returns
global device
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
void fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::initialize ( boost::shared_ptr< ClassElement > &  instantiationXMLElementClass)

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
    Parameters
    instantiationXMLElementClassUsed to access the class-specific XML-data of the instantiation-file
    Exceptions
    FesaException
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
void fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::mapFields ( char *  p,
bool  initializeFields 
)
protected

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

Exceptions
FesaException
template<typename GlobalDeviceType , typename DomainStoreType , typename DevInstType >
virtual bool fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::setUpMemory ( )
protectedpure 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::MemoryMappedFileFactory< GlobalDeviceType, DomainStoreType, DevInstType >, and fesa::HeapFactory< GlobalDeviceType, DomainStoreType, DevInstType >.


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