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 // ============================================================================
20 
21 // ============================================================================
27 // ============================================================================
29 // ============================================================================
30 
31 // ============================================================================
37 // ============================================================================
39 ( const std::string& type ,
40  const std::string& name ,
41  const IInterface* parent )
42  : base_class ( type, name , parent )
43  , m_counters ()
44 {}
45 // ============================================================================
46 
47 // ============================================================================
49 // ============================================================================
51 // ============================================================================
52 
53 // ============================================================================
59 // ============================================================================
61 {
62  // printout the Error table
63  MsgStream log( msgSvc() , name() );
64  const std::string stars( 78 , '*' );
65  log << MSG::INFO << stars << endmsg ;
66  log << MSG::ERROR << m_counters.size() << " GSL errors handled" << endmsg ;
67  for( Counters::const_iterator error = m_counters.begin() ;
68  error != m_counters.end() ; ++error )
69  {
70  log << MSG::ERROR
71  << " #times " << error->second
72  << " GSL code " << error->first.code
73  << " Message '" << error->first.reason << "'"
74  << " File '" << error->first.file << "'"
75  << " Line " << error->first.line << endmsg ;
76  }
77  log << MSG::INFO << stars << endmsg ;
78  // clear the counters
79  m_counters.clear();
80  // finalize the base class
81  return AlgTool::finalize ();
82 }
83 // ============================================================================
84 
85 // ============================================================================
92 // ============================================================================
94 ( const GslError& error ) const
95 {
96  // increase the counter
97  m_counters[ error ] += 1 ;
98  //
99  return StatusCode::SUCCESS ;
100 }
101 // ============================================================================
102 
103 
104 // ============================================================================
105 // The END
106 // ============================================================================
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:428
virtual ~GslErrorCount()
destructor (protected and virtual)
virtual StatusCode finalize()
standard finalization of Tool
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:35
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
std
AIDA -> ROTO converter.
Definition: GaudiAlgs.py:73
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:243