• 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 #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                 // 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 
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

Generated on Mon May 4 2015 08:27:42 for ACS-2015.4 C++ API by  doxygen 1.7.0