Gaudi Framework, version v21r8

Home   Generated: 17 Mar 2010

IncidentSvc.h

Go to the documentation of this file.
00001 // $Id:$
00002 // ============================================================================
00003 #ifndef IncidentSvc_IncidentSvc_H
00004 #define IncidentSvc_IncidentSvc_H
00005 // ============================================================================
00006 // Include Files
00007 // ============================================================================
00008 // STD & STL 
00009 // ============================================================================
00010 #include <map>
00011 #include <list>
00012 // ============================================================================
00013 // GaudiKernel
00014 // ============================================================================
00015 #include "GaudiKernel/Service.h"
00016 #include "GaudiKernel/SvcFactory.h"
00017 #include "GaudiKernel/IIncidentSvc.h"
00018 #include "GaudiKernel/StringKey.h"
00019 #include "GaudiKernel/StringKey.h"
00020 #include "GaudiKernel/HashMap.h"
00021 #include "GaudiKernel/ChronoEntity.h"
00022 // ============================================================================
00023 // Booots 
00024 // ============================================================================
00025 #include "boost/thread/recursive_mutex.hpp"
00026 // ============================================================================
00037 class IncidentSvc : public extends1<Service, IIncidentSvc> 
00038 {
00039   // ==========================================================================
00040 public:
00041   // ==========================================================================
00042   struct Listener 
00043   {
00044     IIncidentListener* iListener;
00045     long priority;
00046     bool rethrow;
00047     bool singleShot;
00048     
00049     Listener(IIncidentListener* il, long pri, bool thr=false, bool single=false):
00050       iListener(il), priority(pri), rethrow(thr), singleShot(single){}
00051     
00052   };
00053   
00054   // Typedefs
00055   typedef std::list<Listener> ListenerList;
00056   // typedef std::map<std::string, ListenerList*> ListenerMap;
00057   typedef GaudiUtils::HashMap<Gaudi::StringKey, ListenerList*> ListenerMap;
00058   
00059   // Inherited Service overrides:
00060   //
00061   virtual StatusCode initialize();
00062   virtual StatusCode finalize();
00063   
00064   // IIncidentSvc interfaces overwrite
00065   //
00066   virtual void addListener 
00067   ( IIncidentListener* lis       , 
00068     const std::string& type = "" ,
00069     long priority   = 0          ,
00070     bool rethrow    = false      , 
00071     bool singleShot = false      ) ;
00072   
00073   virtual void removeListener 
00074   ( IIncidentListener* lis       , 
00075     const std::string& type = "" ) ;
00076   virtual void fireIncident
00077   ( const Incident&    incident  ) ;
00078   
00079   // Standard Constructor.
00080   IncidentSvc( const std::string& name, ISvcLocator* svc );
00081   // Destructor.
00082   virtual ~IncidentSvc();
00083   
00084 private:
00085   // ==========================================================================
00087   void i_fireIncident(const Incident& incident, const std::string& type);
00088   
00090   ListenerMap  m_listenerMap;
00091   
00094   const std::string *m_currentIncidentType;
00095   
00097   MsgStream m_log;
00098   
00100   boost::recursive_mutex m_listenerMapMutex;
00101   
00103   mutable ChronoEntity m_timer     ;
00104   mutable bool         m_timerLock ;
00105   // ==========================================================================
00106 
00107 };
00108 // ============================================================================
00109 // The END 
00110 // ============================================================================
00111 #endif
00112 // ============================================================================
00113 
00114 

Generated at Wed Mar 17 18:06:46 2010 for Gaudi Framework, version v21r8 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004