All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GslErrorCount.cpp
Go to the documentation of this file.
1 // Include files
2 // from Gaudi
5 #include "GaudiKernel/Stat.h"
6 // local
7 #include "GslErrorCount.h"
8 
9 // ============================================================================
17 // ============================================================================
19 // ============================================================================
20 
21 // ============================================================================
27 // ============================================================================
29 ( const std::string& type ,
30  const std::string& name ,
31  const IInterface* parent )
32  : base_class ( type, name , parent )
33 {}
34 // ============================================================================
35 
36 // ============================================================================
42 // ============================================================================
44 {
45  // printout the Error table
46  MsgStream log( msgSvc() , name() );
47  const std::string stars( 78 , '*' );
48  log << MSG::INFO << stars << endmsg ;
49  log << MSG::ERROR << m_counters.size() << " GSL errors handled" << endmsg ;
50  for( const auto& error : m_counters )
51  {
52  log << MSG::ERROR
53  << " #times " << error.second
54  << " GSL code " << error.first.code
55  << " Message '" << error.first.reason << "'"
56  << " File '" << error.first.file << "'"
57  << " Line " << error.first.line << endmsg ;
58  }
59  log << MSG::INFO << stars << endmsg ;
60  // clear the counters
61  m_counters.clear();
62  // finalize the base class
63  return AlgTool::finalize ();
64 }
65 // ============================================================================
66 
67 // ============================================================================
74 // ============================================================================
76 ( const GslError& error ) const
77 {
78  ++m_counters[ error ];
79  return StatusCode::SUCCESS ;
80 }
81 // ============================================================================
82 
83 
84 // ============================================================================
85 // The END
86 // ============================================================================
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StatusCode handle(const GslError &error) const override
handle the GSL error
Helper class to represent GSL errors.
Definition: GslError.h:15
STL namespace.
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
STL class.
StatusCode finalize() override
Definition: AlgTool.cpp:297
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
void clear(STATE_TYPE _i=std::ios_base::failbit)
Definition: MsgStream.h:222
Definition of the basic interface.
Definition: IInterface.h:234
T size(T...args)
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:63
Concrete GSL error handler It is just counts number of GSL errors.
Definition: GslErrorCount.h:23
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Counters m_counters
Definition: GslErrorCount.h:59
StatusCode finalize() override
standard finalization of Tool
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244