| The Gaudi Framework v32r1 (f65d50dc)

ErrorTool.h
Go to the documentation of this file.
1 #ifndef GAUDIALG_ERRORTOOL_H
2 #define GAUDIALG_ERRORTOOL_H 1
3 // ============================================================================
4 // Include files
5 // ============================================================================
6 // Gaudi
7 // ============================================================================
8 #include "GaudiAlg/GaudiTool.h"
9 #include "GaudiAlg/IErrorTool.h"
10 // ============================================================================
11
12 // ============================================================================
19 // ============================================================================
20
21 class ErrorTool : public GaudiTool, virtual public IErrorTool {
22
23 public:
31 ErrorTool( const std::string& type, const std::string& name, const IInterface* parent );
32
33 public:
55 StatusCode Error( const std::string& msg, const StatusCode st = StatusCode::FAILURE,
56 const size_t mx = 10 ) const override {
57 return GaudiTool::Error( msg, st, mx );
58 }
59
70 StatusCode Warning( const std::string& msg, const StatusCode st = StatusCode::FAILURE,
71 const size_t mx = 10 ) const override {
72 return GaudiTool::Warning( msg, st, mx );
73 }
74
84 StatusCode Print( const std::string& msg, const StatusCode st = StatusCode::SUCCESS,
85 const MSG::Level lev = MSG::INFO ) const override {
86 return GaudiTool::Print( msg, st, lev );
87 }
88
98 void Assert( const bool ok, const std::string& message = "",
99 const StatusCode sc = StatusCode::FAILURE ) const override {
100 GaudiTool::Assert( ok, message, sc );
101 }
102
111 void Exception( const std::string& msg, const GaudiException& exc,
112 const StatusCode sc = StatusCode::FAILURE ) const override {
113 GaudiTool::Exception( msg, exc, sc );
114 }
115
124 void Exception( const std::string& msg, const std::exception& exc,
125 const StatusCode sc = StatusCode::FAILURE ) const override {
126 GaudiTool::Exception( msg, exc, sc );
127 }
128
136 void Exception( const std::string& msg = "no message", const StatusCode sc = StatusCode::FAILURE ) const override {
137 GaudiTool::Exception( msg, sc );
138 }
139 };
140
141 #endif // GAUDIALG_ERRORTOOL_H
ErrorTool::Print
StatusCode Print(const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const override
Print the message and return status code.
Definition: ErrorTool.h:84
GaudiTool::Error
StatusCode Error(const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
Print the error message and return with the given StatusCode.
Definition: GaudiTool.h:663
IErrorTool.h
GaudiTool.h
Header file for class GaudiAlgorithm.
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:21
GaudiCommon< CounterHolder< AlgTool > >::Exception
void Exception(const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
Create and (re)-throw a given GaudiException.
Definition: GaudiCommon.icpp:374
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
ErrorTool::Exception
void Exception(const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode::FAILURE) const override
Create and (re)-throw the exception.
Definition: ErrorTool.h:111
INamedInterface::name
virtual const std::string & name() const =0
Retrieve the name of the instance.
std::string
STL class.
MSG::Level
Level
Definition: IMessageSvc.h:15
GaudiCommon< CounterHolder< AlgTool > >::Assert
void Assert(const bool ok, const std::string &message="", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
Assertion - throw exception if the given condition is not fulfilled.
Definition: GaudiCommonImp.h:155
GaudiTool::Warning
StatusCode Warning(const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
Print the warning message and return with the given StatusCode.
Definition: GaudiTool.h:689
IErrorTool
Definition: IErrorTool.h:24
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
IInterface
Definition of the basic interface.
Definition: IInterface.h:244
ErrorTool
Definition: ErrorTool.h:21
IAlgTool::type
virtual const std::string & type() const =0
The type of an AlgTool, meaning the concrete AlgTool class.
std::exception
STL class.
ErrorTool::ErrorTool
ErrorTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition: ErrorTool.cpp:32
IAlgTool::parent
virtual const IInterface * parent() const =0
The parent of the concrete AlgTool.
ErrorTool::Assert
void Assert(const bool ok, const std::string &message="", const StatusCode sc=StatusCode::FAILURE) const override
Assertion - throw exception, if condition is not fulfilled.
Definition: ErrorTool.h:98
ErrorTool::Exception
void Exception(const std::string &msg, const std::exception &exc, const StatusCode sc=StatusCode::FAILURE) const override
Create and (re)-throw the exception.
Definition: ErrorTool.h:124
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:8
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
GaudiTool
The useful base class for tools.
Definition: GaudiTool.h:101
GaudiCommon< CounterHolder< AlgTool > >::Print
WARN_UNUSED StatusCode Print(const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const
Print the message and return with the given StatusCode.
Definition: GaudiCommon.icpp:343
ErrorTool::Error
StatusCode Error(const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const override
Print the error message, return status code and perform the statistics of error messages.
Definition: ErrorTool.h:55
ErrorTool::Exception
void Exception(const std::string &msg="no message", const StatusCode sc=StatusCode::FAILURE) const override
Create and throw the exception.
Definition: ErrorTool.h:136
MSG::INFO
Definition: IMessageSvc.h:15
ErrorTool::Warning
StatusCode Warning(const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const override
Print the warning message, return status code and perform the statistics of warning messages.
Definition: ErrorTool.h:70