All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GslErrorCount.cpp
Go to the documentation of this file.
1 // $Id: GslErrorCount.cpp,v 1.2 2006/01/10 20:00:05 hmd Exp $
2 // Include files
3 // from Gaudi
4 #include "GaudiKernel/ToolFactory.h"
5 #include "GaudiKernel/MsgStream.h"
6 #include "GaudiKernel/IChronoStatSvc.h"
7 #include "GaudiKernel/Stat.h"
8 // local
9 #include "GslErrorCount.h"
10 
11 // ============================================================================
19 // ============================================================================
21 // ============================================================================
22 
23 // ============================================================================
29 // ============================================================================
31 ( const std::string& type ,
32  const std::string& name ,
33  const IInterface* parent )
34  : base_class ( type, name , parent )
35  , m_counters ()
36 {}
37 // ============================================================================
38 
39 // ============================================================================
41 // ============================================================================
43 // ============================================================================
44 
45 // ============================================================================
51 // ============================================================================
53 {
54  // printout the Error table
55  MsgStream log( msgSvc() , name() );
56  const std::string stars( 78 , '*' );
57  log << MSG::INFO << stars << endmsg ;
58  log << MSG::ERROR << m_counters.size() << " GSL errors handled" << endmsg ;
59  for( Counters::const_iterator error = m_counters.begin() ;
60  error != m_counters.end() ; ++error )
61  {
62  log << MSG::ERROR
63  << " #times " << error->second
64  << " GSL code " << error->first.code
65  << " Message '" << error->first.reason << "'"
66  << " File '" << error->first.file << "'"
67  << " Line " << error->first.line << endmsg ;
68  }
69  log << MSG::INFO << stars << endmsg ;
70  // clear the counters
71  m_counters.clear();
72  // finalize the base class
73  return AlgTool::finalize ();
74 }
75 // ============================================================================
76 
77 // ============================================================================
84 // ============================================================================
86 ( const GslError& error ) const
87 {
88  // increase the counter
89  m_counters[ error ] += 1 ;
90  //
91  return StatusCode::SUCCESS ;
92 }
93 // ============================================================================
94 
95 
96 // ============================================================================
97 // The END
98 // ============================================================================