AbstractRTDeviceClass.h

Go to the documentation of this file.
00001 // Copyright CERN 2012 - Developed in collaboration with GSI
00002 
00003 #ifndef ABSTRACT_RT_DEVICE_CLASS_H_
00004 #define ABSTRACT_RT_DEVICE_CLASS_H_
00005 
00006 #include <string>
00007 #include <vector>
00008 #include <set>
00009 #include <map>
00010 #include <fesa-core/Core/AbstractDeviceClass.h>
00011 #include <fesa-core/Utilities/Thread.h>
00012 #include <fesa-core/RealTime/AbstractEventSourceFactory.h>
00013 #include <fesa-core/Utilities/XMLParser.h> 
00014 namespace fesa {
00015 
00016 const std::string DIAG_LAYER_NAME ="DiagnosticLayer";
00017 const std::string DIAG_EVENT_SOURCE_NAME ="DiagnosticEventSource";
00018 
00019 class AbstractDeviceFactory;
00020 class AbstractDevice;
00021 //class EventsMappingElement
00027 struct RTSchedulingUnitInfo {
00032         std::string name_;
00033 
00038         std::string actionName_;
00039 
00044         std::string className_;
00045 
00050         std::string selectionCriterion_;
00051 
00056         std::string eventName_;
00057 
00062         bool isEventOptional_;
00063 
00068         std::string eventField_;
00069 
00070 };
00071 
00072 /*
00073  * \struct RTActionInfo
00074  * \brief this structure contains the information related to the RealTime actions
00075  */
00076 struct RTActionInfo {
00081         std::string className_;
00082 
00087     std::set<std::string> automaticallyNotifiedPropertiesCol_;
00088 
00092         bool isGlobalPropertyToBeNotified_;
00093 
00098     std::set<std::string> manuallyNotifiedPropertiesCol_;
00099 
00100 };
00101 
00102 class AbstractRTActionFactory;
00103 
00108 class AbstractRTDeviceClass: public AbstractDeviceClass
00109 {
00110 
00111 public:
00112 
00113         typedef std::set<std::string> RTActionNameCol;
00114         typedef std::map<std::string, RTActionNameCol> DerivedClassesRTActionCol;
00115         typedef std::map<std::string, RTActionInfo*> RTActionInfoCol;
00116 
00121         AbstractRTDeviceClass(const std::string& name, const std::string& version);
00122 
00123         //To make it possible to mock this object
00124         AbstractRTDeviceClass();
00125 
00129         virtual ~AbstractRTDeviceClass();
00130 
00134         virtual AbstractRTActionFactory* getRTActionFactory();
00135 
00139         virtual AbstractEventSourceFactory* getEventSourceFactory();
00140 
00145         virtual void initialize();
00146 
00151         virtual void addDiagnosticSchedulingUnitInfo(std::vector<RTSchedulingUnitInfo*>& schedulingUnitInfo);
00152 
00157         virtual void addDiagnosticRTActionInfo(RTActionInfoCol& actionInfoCol);
00158 
00163         virtual void addDiagnosticEvents(ElementXML* xmlElementClass);
00164 
00165 protected:
00166 
00167         friend class RTController;
00168 
00172         virtual void fillRTSchedulingUnitsInfo(
00173                         std::vector<RTSchedulingUnitInfo*>& schedulingUnitInfo) = 0;
00174 
00178         virtual void fillRTActionInfo(RTActionInfoCol& actionInfo) = 0;
00179 
00181         AbstractRTActionFactory* rtActionFactory_;
00182 
00187         AbstractEventSourceFactory* eventSourceFactory_;
00188 
00189 private:
00190 
00195     ElementXML* getOrCreateXMLElement(ElementXML* baseElement,std::string name);
00196 
00201     void addXMLAttribute(ElementXML* baseElement,std::string name,std::string value);
00202 
00203 
00204 };
00205 
00206 /*************************************************************************/
00207 
00209 inline AbstractRTActionFactory* AbstractRTDeviceClass::getRTActionFactory() {
00210         return rtActionFactory_;
00211 }
00212 
00213 inline AbstractEventSourceFactory* AbstractRTDeviceClass::getEventSourceFactory() {
00214         return eventSourceFactory_;
00215 }
00216 
00217 }
00218 
00219 #endif /* ABSTRACT_RT_DEVICE_CLASS_H_ */

Generated on 18 Jan 2013 for Fesa by  doxygen 1.6.1