![]() |
|
|
Generated: 18 Jul 2008 |
00001 // $Header: /local/reps/Gaudi/GaudiSvc/src/IncidentSvc/IncidentSvc.h,v 1.5 2007/05/24 17:05:07 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 // Forward declarations 00014 00015 //------------------------------------------------------------------ 00016 // 00017 // ClassName: IncidentSvc 00018 // 00019 // Description: This service manages Auditors. 00020 // Auditors can be inserted in the system to audit the Algorithms is 00021 // in their functions. 00022 //------------------------------------------------------------------ 00023 class IncidentSvc : public Service, virtual public IIncidentSvc { 00024 00025 public: 00026 00027 struct Listener { 00028 IIncidentListener* iListener; 00029 long priority; 00030 bool rethrow; 00031 bool singleShot; 00032 00033 Listener(IIncidentListener* il, long pri, bool thr=false, bool single=false): 00034 iListener(il), priority(pri), rethrow(thr), singleShot(single){} 00035 00036 }; 00037 00038 // Typedefs 00039 // typedef std::pair<IIncidentListener*,long> Listener; 00040 typedef std::list<Listener> ListenerList; 00041 typedef std::map<std::string, ListenerList*> ListenerMap; 00042 00043 // Inherited Service overrides: 00044 // 00045 virtual StatusCode initialize(); 00046 virtual StatusCode finalize(); 00047 virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface ); 00048 00049 // IIncidentSvc interfaces overwrite 00050 // 00051 virtual void addListener(IIncidentListener* lis, const std::string& type = "", 00052 long priority = 0, bool rethrow=false, bool singleShot=false); 00053 virtual void removeListener(IIncidentListener* lis, const std::string& type = ""); 00054 virtual void fireIncident( const Incident& incident ); 00055 00056 // Standard Constructor. 00057 IncidentSvc( const std::string& name, ISvcLocator* svc ); 00058 // Destructor. 00059 virtual ~IncidentSvc(); 00060 00061 private: 00062 // List of auditor names 00063 ListenerMap m_listenerMap; 00066 const std::string *m_currentIncidentType; 00067 }; 00068 00069 #endif 00070 00071