Go to the documentation of this file.00001 #ifndef _ALARM_SYSTEM_MONITOR_BASE_H
00002 #define _ALARM_SYSTEM_MONITOR_BASE_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef __cplusplus
00034 #error This is a C++ include file and cannot be used from plain C
00035 #endif
00036
00037 #include <AlarmSystemInterface.h>
00038 #include <baciEvent.h>
00039
00040 namespace baci
00041 {
00042
00047 class baci_EXPORT AlarmSystemMonitorBase : public EventStrategy
00048 {
00049 public:
00050
00051 AlarmSystemMonitorBase(EventDispatcher * eventDispatcher);
00052
00053 virtual ~AlarmSystemMonitorBase();
00054
00055 bool failed();
00056 void succeeded();
00057
00058 virtual bool isSuspended() { return false; }
00059
00060
00061 virtual int getId(void){ return -1; }
00062
00063 virtual const char* getName(void){ return ""; }
00064
00065 virtual const char* getObjectState(void){ return ""; }
00066
00067 virtual void setObjectState(const char * state){}
00068
00069 virtual void suspend () {}
00070
00071 virtual void resume () {}
00072
00073 virtual void destroy () {}
00074
00079 void setLevel(int level){ alarmLevel_m = level; }
00080
00085 void setFaultFamily(const char *ff);
00086
00091 void setFaultMember(const char *fm);
00092
00093 int isAlarmRaised(){ return alarmRaised_m; }
00094
00095 protected:
00096
00097 virtual void check(BACIValue &val,
00098 const ACSErr::Completion & c,
00099 const ACS::CBDescOut & desc )=0;
00100
00106 virtual void sendAlarm(int code, bool active);
00107
00108
00113 virtual void clearAlarm();
00114
00115
00120 virtual void recheckAlarm();
00121
00129 void setProperty(const char *name, const char *prop);
00130
00131 template <class VT>
00132 void setProperty(const char *name, VT value)
00133 {
00134 std::ostringstream ostr;
00135 std::string ts;
00136
00137 ostr << value << std::ends;
00138 ts = ostr.str();
00139 setProperty(name, ts.c_str());
00140 }
00141
00142
00143 private:
00144
00148 void operator=(const AlarmSystemMonitorBase&);
00149
00153 AlarmSystemMonitorBase(const AlarmSystemMonitorBase&);
00154
00155
00156 protected:
00157 ACE_CString name_m;
00158
00159 bool suspended_m;
00160
00161 int failureCount_m;
00162
00163 CBDescIn desc_mIn;
00164
00165 ACS::TimeInterval interval_m;
00166
00167 EventDispatcher * eventDispatcher_mp;
00168
00169
00170
00171 acsalarm::AlarmSystemInterface* alarmSource_map;
00172
00176 int alarmRaised_m;
00177
00178 std::string faultMember_m;
00179 std::string faultFamily_m;
00180
00181 int alarmLevel_m;
00182
00183
00184 int lastAlarmFaultCode_m;
00185 BACIValue lastAlarmValue_m;
00186
00187
00188 std::map<std::string, std::string> alarmProperties_m;
00189
00190 ACE_Recursive_Thread_Mutex faultStructMutex_m;
00191 };
00192
00193 }
00194
00195 #endif