fesa-core  5.0.1
fesa::AbstractComponentEquipment Class Referenceabstract

This class is an abstraction of the components of an equipment. It contains common services shared by both the server and real time parts. More...

#include <AbstractComponentEquipment.h>

Inheritance diagram for fesa::AbstractComponentEquipment:
fesa::AbstractRTEquipment fesa::AbstractServerEquipment

Public Member Functions

virtual void initialize ()
 This method configures the equipment component and calls the initialize method of all the classes registered in it.
 
virtual void specificInit ()=0
 Custom initialization of the Equipment.
 
virtual void start (RunMode runMode)=0
 
virtual void shutDown ()
 Shut down the equipment component.
 
const std::vector
< AbstractDeviceClass * > & 
getDeviceClassCol ()
 This method returns all abstract device classes, managed by this equipment. More...
 
AbstractDeviceClassgetDeviceClass (const std::string &className)
 This method returns a pointer to the requested abstract device class. More...
 
const std::string & getServerName ()
 This method returns the server name. More...
 
void registerDeviceClass (AbstractDeviceClass *abstractDeviceClass)
 This method registers abstract device class in vector abstractDeviceClassCol_. More...
 
void deregisterDeviceClass (const std::string &className)
 this method removes the abstract class passed by parameter from vector abstractDeviceClassCol_ More...
 
bool isFirstProcess () const
 
virtual ~AbstractComponentEquipment ()
 Destructor.
 

Protected Member Functions

 AbstractComponentEquipment ()
 Constructor.
 
void mapEquipmentSharedMemory ()
 
void registerSettingFields (const std::vector< AbstractField * > &fields)
 
void setupSignalHandlers (const sigset_t &sigset) const
 
void waitForSignal (int &signo) const
 
virtual void signalHandlingLoop ()=0
 

Protected Attributes

std::vector
< AbstractDeviceClass * > 
abstractDeviceClassCol_
 contains the complete list of device classes
 
bool firstProcess_
 
void * equipmentSharedMemory_
 
std::size_t equipmentSharedMemorySize_
 

Detailed Description

This class is an abstraction of the components of an equipment. It contains common services shared by both the server and real time parts.

Member Function Documentation

void fesa::AbstractComponentEquipment::deregisterDeviceClass ( const std::string &  className)

this method removes the abstract class passed by parameter from vector abstractDeviceClassCol_

Parameters
classNamethe name of the class to deregister
AbstractDeviceClass * fesa::AbstractComponentEquipment::getDeviceClass ( const std::string &  className)

This method returns a pointer to the requested abstract device class.

Parameters
classNamethe name of the class we are looking for
Returns
AbstractDeviceClass reference if device class is found
Exceptions
FesaExceptionif class is not found
const std::vector< AbstractDeviceClass * > & fesa::AbstractComponentEquipment::getDeviceClassCol ( )
inline

This method returns all abstract device classes, managed by this equipment.

Returns
a vector of device class pointers
const std::string & fesa::AbstractComponentEquipment::getServerName ( )

This method returns the server name.

Returns
server-name
bool fesa::AbstractComponentEquipment::isFirstProcess ( ) const
Returns
true if the process running this component is the first to run; false otherwise. In mixed mode or single process mode, true if this component was the first to be instantiated; false otherwise. In split mode, true if the process running this component was the first to run; false otherwise. In split mode, this can be used to decide whether to initialize the shared memory or just attach to it.
void fesa::AbstractComponentEquipment::mapEquipmentSharedMemory ( )
protected

Maps the equipment (DU) shared memory. If this is the first process, the shared memory will be created; otherwise it will be attached.

void fesa::AbstractComponentEquipment::registerDeviceClass ( AbstractDeviceClass abstractDeviceClass)
inline

This method registers abstract device class in vector abstractDeviceClassCol_.

Parameters
abstractDeviceClassThe class we want to register
void fesa::AbstractComponentEquipment::registerSettingFields ( const std::vector< AbstractField * > &  fields)
protected

Helper method which iterates over a vector of fields, and registers those of them which are shared setting fields.

Parameters
fieldsvector of fields. Can contain any type of field.
void fesa::AbstractComponentEquipment::setupSignalHandlers ( const sigset_t &  sigset) const
protected

Sets signal handlers for all signals that can be processed, and creates necessary objects to handle signals. Signals in sigset_t can later be handled by calling waitForSignal(). This method must be called only once in the whole process, otherwise results are unexpected.

Parameters
sigsetlist of signals for which a handler must be set.
Exceptions
FesaExceptionif a handler cannot be set
virtual void fesa::AbstractComponentEquipment::signalHandlingLoop ( )
protectedpure virtual

Waits for and treats signals. Never returns, unless a non-fatal terminating signal has been received by the process, to let it shutdown gracefully. Non-fatal terminating signals are: SIGINT, SIGTERM, SIGHUP.

Implemented in fesa::AbstractRTEquipment, and fesa::AbstractServerEquipment.

virtual void fesa::AbstractComponentEquipment::start ( RunMode  runMode)
pure virtual

Starts the component equipment. This method can only be called only once with blocking runMode, otherwise results are unexpected (static objects are used for signal handling). If runMode is nonBlocking, this method returns immediately. If runMode is blocking:

  • This method never returns, unless a non-fatal terminating signal has been received by the process, to let it shutdown gracefully.
  • Non-fatal terminating signals are: SIGINT, SIGTERM, SIGHUP.

Implemented in fesa::AbstractRTEquipment, and fesa::AbstractServerEquipment.

void fesa::AbstractComponentEquipment::waitForSignal ( int &  signo) const
protected

Waits for a signal for which a handler has been previously set using setupSignalHandlers(). Stores the signal number in signo.

Exceptions
FesaException

Member Data Documentation

void* fesa::AbstractComponentEquipment::equipmentSharedMemory_
protected

Pointer to the base of the equipment shared memory.

std::size_t fesa::AbstractComponentEquipment::equipmentSharedMemorySize_
protected

Size of the equipment shared memory.

bool fesa::AbstractComponentEquipment::firstProcess_
protected

In mixed mode or single process mode, true if this component was the first to be instantiated; false otherwise. In split mode, true if the process running this component was the first to run; false otherwise.


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