Gaudi Framework, version v21r6

Home   Generated: 11 Nov 2009

IncidentSvc.h

Go to the documentation of this file.
00001 // $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiSvc/src/IncidentSvc/IncidentSvc.h,v 1.7 2008/11/10 16:00:23 marcocle Exp $
00002 #ifndef IncidentSvc_IncidentSvc_H
00003 #define IncidentSvc_IncidentSvc_H
00004 
00005 // Include Files
00006 #include "GaudiKernel/Service.h"
00007 #include "GaudiKernel/SvcFactory.h"
00008 #include "GaudiKernel/IIncidentSvc.h"
00009 
00010 #include <map>
00011 #include <list>
00012 
00013 #include <boost/thread/recursive_mutex.hpp>
00014 
00015 // Forward declarations
00016 
00028 class IncidentSvc : public extends1<Service, IIncidentSvc> {
00029 
00030 public:
00031 
00032   struct Listener {
00033     IIncidentListener* iListener;
00034     long priority;
00035     bool rethrow;
00036     bool singleShot;
00037 
00038     Listener(IIncidentListener* il, long pri, bool thr=false, bool single=false):
00039       iListener(il), priority(pri), rethrow(thr), singleShot(single){}
00040 
00041   };
00042 
00043 // Typedefs
00044   typedef std::list<Listener> ListenerList;
00045   typedef std::map<std::string, ListenerList*> ListenerMap;
00046 
00047 // Inherited Service overrides:
00048 //
00049   virtual StatusCode initialize();
00050   virtual StatusCode finalize();
00051 
00052 // IIncidentSvc interfaces overwrite
00053 //
00054   virtual void addListener(IIncidentListener* lis, const std::string& type = "",
00055                            long priority = 0, bool rethrow=false, bool singleShot=false);
00056 
00057   virtual void removeListener(IIncidentListener* lis, const std::string& type = "");
00058   virtual void fireIncident( const Incident& incident );
00059 
00060   // Standard Constructor.
00061   IncidentSvc( const std::string& name, ISvcLocator* svc );
00062   // Destructor.
00063   virtual ~IncidentSvc();
00064 
00065 private:
00067   void i_fireIncident(const Incident& incident, const std::string& type);
00068 
00070   ListenerMap  m_listenerMap;
00071 
00074   const std::string *m_currentIncidentType;
00075 
00077   MsgStream m_log;
00078 
00080   boost::recursive_mutex m_listenerMapMutex;
00081 };
00082 
00083 #endif
00084 
00085 

Generated at Wed Nov 11 16:23:12 2009 for Gaudi Framework, version v21r6 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004