• Classes
  • Modules
  • Namespaces
  • Files
  • Related Pages
  • File List
  • File Members

AlarmSourceImpl.h

Go to the documentation of this file.
00001 #ifndef ACS_ALARMSOURCEIMPL_H
00002 #define ACS_ALARMSOURCEIMPL_H
00003 /*
00004  *    ALMA - Atacama Large Millimiter Array
00005  *    (c) European Southern Observatory, 2011
00006  *    Copyright by ESO (in the framework of the ALMA collaboration),
00007  *    All rights reserved
00008  *
00009  *    This library is free software; you can redistribute it and/or
00010  *    modify it under the terms of the GNU Lesser General Public
00011  *    License as published by the Free Software Foundation; either
00012  *    version 2.1 of the License, or (at your option) any later version.
00013  *
00014  *    This library is distributed in the hope that it will be useful,
00015  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  *    Lesser General Public License for more details.
00018  *
00019  *    You should have received a copy of the GNU Lesser General Public
00020  *    License along with this library; if not, write to the Free Software
00021  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00022  *    MA 02111-1307  USA
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                 // true if the sending of alarms has been disabled
00066                 bool m_disabled;
00067 
00068                 // Signal if the object is locally queuing alarms instead of
00069                 // sending them immediately to the alarm server
00070                 bool m_queuing;
00071 
00072                 // Synchronize access to shared vars
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

Generated on Thu Jan 12 2012 23:13:50 for ACS-10.0 C++ API by  doxygen 1.7.0