|
Gaudi Framework, version v22r0 |
| Home | Generated: 9 Feb 2011 |
00001 // $Id: GslErrorCount.cpp,v 1.2 2006/01/10 20:00:05 hmd Exp $ 00002 // Include files 00003 // from Gaudi 00004 #include "GaudiKernel/ToolFactory.h" 00005 #include "GaudiKernel/MsgStream.h" 00006 #include "GaudiKernel/IChronoStatSvc.h" 00007 #include "GaudiKernel/Stat.h" 00008 // local 00009 #include "GslErrorCount.h" 00010 00011 // ============================================================================ 00019 // ============================================================================ 00020 00021 // ============================================================================ 00027 // ============================================================================ 00028 DECLARE_TOOL_FACTORY(GslErrorCount) 00029 // ============================================================================ 00030 00031 // ============================================================================ 00037 // ============================================================================ 00038 GslErrorCount::GslErrorCount 00039 ( const std::string& type , 00040 const std::string& name , 00041 const IInterface* parent ) 00042 : base_class ( type, name , parent ) 00043 , m_counters () 00044 {} 00045 // ============================================================================ 00046 00047 // ============================================================================ 00049 // ============================================================================ 00050 GslErrorCount::~GslErrorCount(){} 00051 // ============================================================================ 00052 00053 // ============================================================================ 00059 // ============================================================================ 00060 StatusCode GslErrorCount::finalize () 00061 { 00062 // printout the Error table 00063 MsgStream log( msgSvc() , name() ); 00064 const std::string stars( 78 , '*' ); 00065 log << MSG::INFO << stars << endmsg ; 00066 log << MSG::ERROR << m_counters.size() << " GSL errors handled" << endmsg ; 00067 for( Counters::const_iterator error = m_counters.begin() ; 00068 error != m_counters.end() ; ++error ) 00069 { 00070 log << MSG::ERROR 00071 << " #times " << error->second 00072 << " GSL code " << error->first.code 00073 << " Message '" << error->first.reason << "'" 00074 << " File '" << error->first.file << "'" 00075 << " Line " << error->first.line << endmsg ; 00076 } 00077 log << MSG::INFO << stars << endmsg ; 00078 // clear the counters 00079 m_counters.clear(); 00080 // finalize the base class 00081 return AlgTool::finalize (); 00082 } 00083 // ============================================================================ 00084 00085 // ============================================================================ 00092 // ============================================================================ 00093 StatusCode GslErrorCount::handle 00094 ( const GslError& error ) const 00095 { 00096 // increase the counter 00097 m_counters[ error ] += 1 ; 00098 // 00099 return StatusCode::SUCCESS ; 00100 } 00101 // ============================================================================ 00102 00103 00104 // ============================================================================ 00105 // The END 00106 // ============================================================================