| # Gaudi Framework, version v20r4
Generated: 8 Jan 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 Service, virtual public 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   virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface );
    00052
    00053 // IIncidentSvc interfaces overwrite
    00054 //
    00055   virtual void addListener(IIncidentListener* lis, const std::string& type = "",
    00056                            long priority = 0, bool rethrow=false, bool singleShot=false);
    00057
    00058   virtual void removeListener(IIncidentListener* lis, const std::string& type = "");
    00059   virtual void fireIncident( const Incident& incident );
    00060
    00061   // Standard Constructor.
    00062   IncidentSvc( const std::string& name, ISvcLocator* svc );
    00063   // Destructor.
    00064   virtual ~IncidentSvc();
    00065
    00066 private:
    00068   void i_fireIncident(const Incident& incident, const std::string& type);
    00069
    00071   ListenerMap  m_listenerMap;
    00072
    00075   const std::string *m_currentIncidentType;
    00076
    00078   MsgStream m_log;
    00079
    00081   boost::recursive_mutex m_listenerMapMutex;
    00082 };
    00083
    00084 #endif
    00085
    00086