![]() |
|
|
Generated: 8 Jan 2009 |
00001 // $Id: Guards.cpp,v 1.4 2008/11/11 14:43:37 marcocle Exp $ 00002 // ============================================================================ 00003 // Include files 00004 // ============================================================================ 00005 // STD & STL 00006 // ============================================================================ 00007 #include <exception> 00008 // ============================================================================ 00009 // GaudiKernel 00010 // ============================================================================ 00011 #include "GaudiKernel/Guards.h" 00012 #include "GaudiKernel/System.h" 00013 #include "GaudiKernel/MsgStream.h" 00014 #include "GaudiKernel/GaudiException.h" 00015 // ============================================================================ 00022 // ============================================================================ 00023 // Local handle (print) of GaudiException 00024 // ============================================================================ 00025 void Gaudi::Guards::ExceptionGuard::handle 00026 ( const GaudiException& exc , MsgStream& log ) 00027 { 00028 // the general printout 00029 log << MSG::FATAL 00030 << System::typeinfoName( typeid ( exc ) ) 00031 << "('" << exc.tag() << "') is caught!" << endreq ; 00032 // print the detailes about the exception: 00033 log << MSG::ERROR << exc << endreq ; 00034 // get the status code form the exception: 00035 m_sc = exc.code() ; 00036 } 00037 // ============================================================================ 00038 // Local handle (print) of std::exception 00039 // ============================================================================ 00040 void Gaudi::Guards::ExceptionGuard::handle 00041 ( const std::exception& exc , MsgStream& log ) 00042 { 00043 // the general printout 00044 log << MSG::FATAL 00045 << System::typeinfoName( typeid ( exc ) ) << " is caught!" << endreq ; 00046 // print the detailes abotu the exception: 00047 log << MSG::ERROR << exc.what() << endreq ; 00048 } 00049 // ============================================================================ 00050 // Local handle (print) of unknown exception 00051 // ============================================================================ 00052 void Gaudi::Guards::ExceptionGuard::handle 00053 ( MsgStream& log ) 00054 { 00055 // the general printout 00056 log << MSG::FATAL << "UNKNOWN exception is caught!" << endreq ; 00057 } 00058 // ============================================================================ 00059 // dectructor 00060 // ============================================================================ 00061 Gaudi::Guards::ExceptionGuard::~ExceptionGuard() { m_sc.ignore() ; } 00062 // ============================================================================ 00063 // constructor with standard post-action 00064 // ============================================================================ 00065 Gaudi::Guards::AuditorGuard::AuditorGuard ( INamedInterface* obj , 00066 IAuditor* svc , 00067 IAuditor::StandardEventType evt ): 00068 m_obj(obj), 00069 m_objName(), 00070 m_svc(svc), 00071 m_evt(evt), 00072 m_cevt(), 00073 m_sc(0), 00074 m_customEvtType(false) 00075 { 00076 i_before(); 00077 } 00078 Gaudi::Guards::AuditorGuard::AuditorGuard ( INamedInterface* obj , 00079 IAuditor* svc , 00080 IAuditor::CustomEventTypeRef evt ): 00081 m_obj(obj), 00082 m_objName(), 00083 m_svc(svc), 00084 m_evt(IAuditor::Initialize), // Windows needs an explicit value 00085 m_cevt(evt), 00086 m_sc(0), 00087 m_customEvtType(true) 00088 { 00089 i_before(); 00090 } 00091 Gaudi::Guards::AuditorGuard::AuditorGuard ( INamedInterface* obj , 00092 IAuditor* svc , 00093 IAuditor::StandardEventType evt , 00094 const StatusCode &sc ): 00095 m_obj(obj), 00096 m_objName(), 00097 m_svc(svc), 00098 m_evt(evt), 00099 m_cevt(), 00100 m_sc(&sc), 00101 m_customEvtType(false) 00102 { 00103 i_before(); 00104 } 00105 Gaudi::Guards::AuditorGuard::AuditorGuard ( INamedInterface* obj , 00106 IAuditor* svc , 00107 IAuditor::CustomEventTypeRef evt , 00108 const StatusCode &sc ): 00109 m_obj(obj), 00110 m_objName(), 00111 m_svc(svc), 00112 m_evt(IAuditor::Initialize), // Windows needs an explicit value 00113 m_cevt(evt), 00114 m_sc(&sc), 00115 m_customEvtType(true) 00116 { 00117 i_before(); 00118 } 00119 Gaudi::Guards::AuditorGuard::AuditorGuard ( const std::string &name , 00120 IAuditor* svc , 00121 IAuditor::StandardEventType evt ): 00122 m_obj(0), 00123 m_objName(name), 00124 m_svc(svc), 00125 m_evt(evt), 00126 m_cevt(), 00127 m_sc(0), 00128 m_customEvtType(false) 00129 { 00130 i_before(); 00131 } 00132 Gaudi::Guards::AuditorGuard::AuditorGuard ( const std::string &name , 00133 IAuditor* svc , 00134 IAuditor::CustomEventTypeRef evt ): 00135 m_obj(0), 00136 m_objName(name), 00137 m_svc(svc), 00138 m_evt(IAuditor::Initialize), // Windows needs an explicit value 00139 m_cevt(evt), 00140 m_sc(0), 00141 m_customEvtType(true) 00142 { 00143 i_before(); 00144 } 00145 Gaudi::Guards::AuditorGuard::AuditorGuard ( const std::string &name , 00146 IAuditor* svc , 00147 IAuditor::StandardEventType evt , 00148 const StatusCode &sc ): 00149 m_obj(0), 00150 m_objName(name), 00151 m_svc(svc), 00152 m_evt(evt), 00153 m_cevt(), 00154 m_sc(&sc), 00155 m_customEvtType(false) 00156 { 00157 i_before(); 00158 } 00159 Gaudi::Guards::AuditorGuard::AuditorGuard ( const std::string &name , 00160 IAuditor* svc , 00161 IAuditor::CustomEventTypeRef evt , 00162 const StatusCode &sc ): 00163 m_obj(0), 00164 m_objName(name), 00165 m_svc(svc), 00166 m_evt(IAuditor::Initialize), // Windows needs an explicit value 00167 m_cevt(evt), 00168 m_sc(&sc), 00169 m_customEvtType(true) 00170 { 00171 i_before(); 00172 } 00173 // ============================================================================ 00174 // dectructor 00175 // ============================================================================ 00176 Gaudi::Guards::AuditorGuard::~AuditorGuard() 00177 { 00178 i_after(); 00179 } 00180 // ============================================================================ 00182 // ============================================================================