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 #include "AlarmSourceThread.h"
00038
00039 #include <maciS.h>
00040 #include <acscommonC.h>
00041
00042 #include "ace/Task.h"
00043
00044 namespace acsalarm
00045 {
00046
00063 class AlarmSourceImpl: public AlarmSource {
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
00097 AlarmsMap m_alarms;
00098
00102 auto_ptr<acsalarm::AlarmSystemInterface> m_alarmSource_ap;
00103
00107 const AlarmSourceThread* m_updaterThread_p;
00108
00113 bool m_locallyInstantiatedThread;
00114
00118 ACS::Time m_nextMapUpdateTime;
00119
00125 ACS::Time m_nextFlushTime;
00126
00127
00128 public:
00129
00135 AlarmSourceImpl(const AlarmSourceThread* updaterThread);
00136
00143 AlarmSourceImpl();
00144
00148 virtual ~AlarmSourceImpl();
00149
00153 void raiseAlarm(
00154 std::string faultFamily,
00155 std::string faultMember,
00156 int faultCode);
00157
00161 void raiseAlarm(
00162 std::string faultFamily,
00163 std::string faultMember,
00164 int faultCode,
00165 Properties properties);
00166
00170 void clearAlarm(
00171 std::string faultFamily,
00172 std::string faultMember,
00173 int faultCode);
00174
00178 void setAlarm(
00179 std::string faultFamily,
00180 std::string faultMember,
00181 int faultCode,
00182 Properties alarmProps,
00183 bool active);
00184
00188 void setAlarm(
00189 std::string faultFamily,
00190 std::string faultMember,
00191 int faultCode,
00192 bool active);
00193
00197 void terminateAllAlarms();
00198
00202 void queueAlarms(ACS::TimeInterval time);
00203
00207 void queueAlarms();
00208
00212 void flushAlarms();
00213
00217 void disableAlarms();
00218
00222 void enableAlarms();
00223
00227 virtual void update(ACS::Time now);
00228
00232 void start();
00233
00237 void tearDown();
00238 private:
00246 std::string buildAlarmID(std::string faultFamily, std::string faultMember, int faultCode);
00247
00259 void internalAlarmSender(
00260 std::string faultFamily,
00261 std::string faultMember,
00262 int faultCode,
00263 Properties alarmProps,
00264 bool active);
00265 };
00266
00267 }
00268
00269 #endif // ACS_ALARMSOURCEIMPL_H