Go to the documentation of this file.00001 #ifndef ACS_ALARMSOURCEIMPL_H
00002 #define ACS_ALARMSOURCEIMPL_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __cplusplus
00026 #error This is a C++ include file and cannot be used from plain C
00027 #endif
00028
00029 #include <map>
00030 #include <set>
00031 #include <memory>
00032
00033 #include "AlarmSource.h"
00034 #include "ACSAlarmSystemInterfaceFactory.h"
00035 #include "AlarmToQueue.h"
00036 #include "AlarmsMap.h"
00037
00038 #include <acsThread.h>
00039
00040 #include "maciS.h"
00041
00042 #include "ace/Task.h"
00043
00044 namespace acsalarm
00045 {
00046
00063 class AlarmSourceImpl: public AlarmSource, ACS::Thread {
00064 private:
00065
00066 bool m_disabled;
00067
00068
00069
00070 bool m_queuing;
00071
00072
00073 ACE_Recursive_Thread_Mutex m_mutex;
00074
00080 std::map<std::string, AlarmToQueue*> m_queue;
00081
00087 std::set<std::string> m_activatedAlarms;
00088
00093 AlarmsMap m_alarms;
00094
00098 auto_ptr<acsalarm::AlarmSystemInterface> m_alarmSource_ap;
00099
00100 public:
00101
00107 AlarmSourceImpl();
00108
00112 virtual ~AlarmSourceImpl();
00113
00117 void raiseAlarm(
00118 std::string faultFamily,
00119 std::string faultMember,
00120 int faultCode);
00121
00125 void raiseAlarm(
00126 std::string faultFamily,
00127 std::string faultMember,
00128 int faultCode,
00129 Properties properties);
00130
00134 void clearAlarm(
00135 std::string faultFamily,
00136 std::string faultMember,
00137 int faultCode);
00138
00142 void setAlarm(
00143 std::string faultFamily,
00144 std::string faultMember,
00145 int faultCode,
00146 Properties alarmProps,
00147 bool active);
00148
00152 void setAlarm(
00153 std::string faultFamily,
00154 std::string faultMember,
00155 int faultCode,
00156 bool active);
00157
00161 void terminateAllAlarms();
00162
00166 void queueAlarms(ACS::TimeInterval time);
00167
00171 void queueAlarms();
00172
00176 void flushAlarms();
00177
00181 void disableAlarms();
00182
00186 void enableAlarms();
00187
00191 void runLoop();
00192
00196 void start();
00197
00201 void tearDown();
00202 private:
00210 std::string buildAlarmID(std::string faultFamily, std::string faultMember, int faultCode);
00211
00223 void internalAlarmSender(
00224 std::string faultFamily,
00225 std::string faultMember,
00226 int faultCode,
00227 Properties alarmProps,
00228 bool active);
00229 };
00230
00231 }
00232
00233 #endif // ACS_ALARMSOURCEIMPL_H