| The Gaudi Framework v27r1

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

- File List
- File Members

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 ,
22 virtual public IErrorTool
23 {
24
25 public:
26
34 ErrorTool ( const std::string& type,
35 const std::string& name,
36 const IInterface* parent);
37
39 ~ErrorTool( ) override = default;
40
41 public:
42
64 StatusCode Error
65 ( const std::string& msg ,
66 const StatusCode st = StatusCode::FAILURE ,
67 const size_t mx = 10 ) const override
68 { return GaudiTool::Error ( msg , st, mx ) ; }
69
80 StatusCode Warning
81 ( const std::string& msg ,
82 const StatusCode st = StatusCode::FAILURE ,
83 const size_t mx = 10 ) const override
84 { return GaudiTool::Warning( msg , st , mx ) ; }
85
95 StatusCode Print
96 ( const std::string& msg ,
97 const StatusCode st = StatusCode::SUCCESS ,
98 const MSG::Level lev = MSG::INFO ) const override
99 { return GaudiTool::Print( msg , st , lev ) ; }
100
110 void Assert
111 ( const bool ok ,
112 const std::string& message = "" ,
113 const StatusCode sc = StatusCode::FAILURE ) const override
114 { GaudiTool::Assert ( ok , message , sc ) ; }
115
124 void Exception
125 ( const std::string & msg ,
126 const GaudiException & exc ,
127 const StatusCode sc = StatusCode::FAILURE ) const override
128 { GaudiTool::Exception ( msg , exc , sc ) ; }
129
138 void Exception
139 ( const std::string & msg ,
140 const std::exception & exc ,
141 const StatusCode sc = StatusCode::FAILURE ) const override
142 { GaudiTool::Exception ( msg , exc , sc ) ; }
143
151 void Exception
152 ( const std::string& msg = "no message" ,
153 const StatusCode sc = StatusCode::FAILURE ) const override
154 { GaudiTool::Exception ( msg , sc ) ; }
155
156 };
157
158 #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:96
IErrorTool.h
CommonMessagingBase::msg
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:133
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:721
GaudiTool.h
Header file for class GaudiAlgorithm.
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23
merge_files.sc
int sc
Definition: merge_files.py:167
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:125
std::string
STL class.
MSG::Level
Level
Definition: IMessageSvc.h:15
StatusCode::FAILURE
Definition: StatusCode.h:29
IErrorTool
Definition: IErrorTool.h:24
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IInterface
Definition of the basic interface.
Definition: IInterface.h:234
ErrorTool
Definition: ErrorTool.h:21
GaudiCommon< AlgTool >::Print
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.
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:111
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:689
GaudiCommon< 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.
GaudiTool
The useful base class for tools.
Definition: GaudiTool.h:98
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:65
MSG::INFO
Definition: IMessageSvc.h:19
ErrorTool::~ErrorTool
~ErrorTool() override=default
virtual and protected destructor
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:81
AlgTool::name
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:65
GaudiCommon< 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.