![]() |
|
|
Generated: 18 Jul 2008 |
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 // ============================================================================ 00028 // ============================================================================ 00029 DECLARE_TOOL_FACTORY(GslErrorCount) 00030 // ============================================================================ 00031 00032 // ============================================================================ 00038 // ============================================================================ 00039 GslErrorCount::GslErrorCount 00040 ( const std::string& type , 00041 const std::string& name , 00042 const IInterface* parent ) 00043 : AlgTool ( type, name , parent ) 00044 , m_counters () 00045 { declareInterface<IGslErrorHandler> (this);}; 00046 // ============================================================================ 00047 00048 // ============================================================================ 00050 // ============================================================================ 00051 GslErrorCount::~GslErrorCount(){}; 00052 // ============================================================================ 00053 00054 // ============================================================================ 00060 // ============================================================================ 00061 StatusCode GslErrorCount::finalize () 00062 { 00063 // printout the Error table 00064 MsgStream log( msgSvc() , name() ); 00065 const std::string stars( 78 , '*' ); 00066 log << MSG::INFO << stars << endreq ; 00067 log << MSG::ERROR << m_counters.size() << " GSL errors handled" << endreq ; 00068 for( Counters::const_iterator error = m_counters.begin() ; 00069 error != m_counters.end() ; ++error ) 00070 { 00071 log << MSG::ERROR 00072 << " #times " << error->second 00073 << " GSL code " << error->first.code 00074 << " Message '" << error->first.reason << "'" 00075 << " File '" << error->first.file << "'" 00076 << " Line " << error->first.line << endreq ; 00077 } 00078 log << MSG::INFO << stars << endreq ; 00079 // clear the counters 00080 m_counters.clear(); 00081 // finalze the base class 00082 return AlgTool::finalize (); 00083 }; 00084 // ============================================================================ 00085 00086 // ============================================================================ 00093 // ============================================================================ 00094 StatusCode GslErrorCount::handle 00095 ( const GslError& error ) const 00096 { 00097 // increase the counter 00098 m_counters[ error ] += 1 ; 00099 // 00100 return StatusCode::SUCCESS ; 00101 }; 00102 // ============================================================================ 00103 00104 00105 // ============================================================================ 00106 // The END 00107 // ============================================================================