CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/EventFilter/StorageManager/interface/AlarmHandler.h

Go to the documentation of this file.
00001 // $Id: AlarmHandler.h,v 1.10 2011/11/08 10:48:39 mommsen Exp $
00003 
00004 #ifndef EventFilter_StorageManager_AlarmHandler_h
00005 #define EventFilter_StorageManager_AlarmHandler_h
00006 
00007 #include <string>
00008 
00009 #include "boost/shared_ptr.hpp"
00010 #include "boost/thread/mutex.hpp"
00011 
00012 #include "xcept/Exception.h"
00013 #include "xdaq/Application.h"
00014 #include "xdata/InfoSpace.h"
00015 
00016 
00017 namespace stor {
00018 
00019   class SharedResources;
00020 
00021 
00030   class AlarmHandler
00031   {
00032 
00033   public:
00034 
00035     enum ALARM_LEVEL { OKAY, WARNING, ERROR, FATAL };
00036     
00037     // Constructor for MockAlarmHandler (unit tests)
00038     AlarmHandler() {};
00039 
00040     // Constructor for SMProxy
00041     explicit AlarmHandler(xdaq::Application*);
00042 
00043     // Constructor for SM
00044     AlarmHandler
00045     (
00046       xdaq::Application*,
00047       boost::shared_ptr<SharedResources>
00048     );
00049 
00050     virtual ~AlarmHandler() {};
00051 
00055     virtual void notifySentinel
00056     (
00057       const ALARM_LEVEL,
00058       xcept::Exception&
00059     );
00060 
00064     virtual void raiseAlarm
00065     (
00066       const std::string name,
00067       const ALARM_LEVEL,
00068       xcept::Exception&
00069     );
00070 
00074     virtual void revokeAlarm(const std::string name);
00075 
00079     void clearAllAlarms();
00080 
00084     virtual void moveToFailedState( xcept::Exception& );
00085 
00090     void localDebug( const std::string& message ) const;
00091 
00095     Logger& getLogger() const
00096     { return app_->getApplicationLogger(); }
00097 
00098 
00099   private:
00100 
00101     bool raiseAlarm
00102     (
00103       const std::string name,
00104       const std::string level,
00105       xcept::Exception&
00106     );
00107 
00108     xdaq::Application* app_;
00109     boost::shared_ptr<SharedResources> sharedResources_;
00110     xdata::InfoSpace* alarmInfoSpace_;
00111 
00112     mutable boost::mutex mutex_;
00113 
00114   };
00115   
00116   typedef boost::shared_ptr<AlarmHandler> AlarmHandlerPtr;
00117 
00118 } // namespace stor
00119 
00120 #endif // EventFilter_StorageManager_AlarmHandler_h 
00121 
00122