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
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 // ============================================================================
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Helper class to represent GSL errors.
Definition: GslError.h:17
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
Definition: AlgTool.cpp:434
virtual ~GslErrorCount()
destructor (protected and virtual)
virtual StatusCode finalize()
standard finalization of Tool
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
string type
Definition: gaudirun.py:126
IMessageSvc * msgSvc() const
Retrieve pointer to message service.
Definition: AlgTool.cpp:79
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Definition of the basic interface.
Definition: IInterface.h:160
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
virtual StatusCode handle(const GslError &error) const
handle the GSL error
Concrete GSL error handler It is just counts number of GSL errors.
Definition: GslErrorCount.h:25
Counters m_counters
Definition: GslErrorCount.h:61
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244