| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

GslErrorCount.cpp
Go to the documentation of this file.
1 // Include files
2 // from Gaudi
3 #include "GaudiKernel/MsgStream.h"
4 #include "GaudiKernel/IChronoStatSvc.h"
5 #include "GaudiKernel/Stat.h"
6 // local
7 #include "GslErrorCount.h"
8
9 // ============================================================================
17 // ============================================================================
18 DECLARE_COMPONENT(GslErrorCount)
19 // ============================================================================
20
21 // ============================================================================
27 // ============================================================================
28 GslErrorCount::GslErrorCount
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 // ============================================================================
43 StatusCode GslErrorCount::finalize ()
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 // ============================================================================
75 StatusCode GslErrorCount::handle
76 ( const GslError& error ) const
77 {
78 ++m_counters[ error ];
79 return StatusCode::SUCCESS ;
80 }
81 // ============================================================================
82
83
84 // ============================================================================
85 // The END
86 // ============================================================================
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StatusCode::SUCCESS
Definition: StatusCode.h:30
GslErrorCount::handle
StatusCode handle(const GslError &error) const override
handle the GSL error
Definition: GslErrorCount.cpp:76
GslError
Helper class to represent GSL errors.
Definition: GslError.h:15
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
MsgStream.h
std
STL namespace.
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
std::string
STL class.
AlgTool::finalize
StatusCode finalize() override
Definition: AlgTool.cpp:297
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
GslErrorCount.h
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
MsgStream::clear
void clear(STATE_TYPE _i=std::ios_base::failbit)
Definition: MsgStream.h:222
IInterface
Definition of the basic interface.
Definition: IInterface.h:234
gaudirun.type
type
Definition: gaudirun.py:125
std::map::size
T size(T...args)
AlgTool::name
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:63
GslErrorCount
Concrete GSL error handler It is just counts number of GSL errors.
Definition: GslErrorCount.h:23
CommonMessaging
Definition: CommonMessaging.h:55
CommonMessagingBase::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:70
Stat.h
MSG::ERROR
Definition: IMessageSvc.h:21
IChronoStatSvc.h
GslErrorCount::m_counters
Counters m_counters
Definition: GslErrorCount.h:59
MSG::INFO
Definition: IMessageSvc.h:19
GslErrorCount::finalize
StatusCode finalize() override
standard finalization of Tool
Definition: GslErrorCount.cpp:43
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Gaudi.Configuration.log
log
Definition: Configuration.py:13