The Gaudi Framework  v38r0 (2143aa4c)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
ErrorTool.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef GAUDIALG_ERRORTOOL_H
12 #define GAUDIALG_ERRORTOOL_H 1
13 // ============================================================================
14 // Include files
15 // ============================================================================
16 // Gaudi
17 // ============================================================================
18 #include "GaudiAlg/GaudiTool.h"
19 #include "GaudiAlg/IErrorTool.h"
20 // ============================================================================
21 
22 // ============================================================================
29 // ============================================================================
30 
31 class ErrorTool : public GaudiTool, virtual public IErrorTool {
32 
33 public:
41  ErrorTool( const std::string& type, const std::string& name, const IInterface* parent );
42 
43 public:
66  const size_t mx = 10 ) const override {
67  return GaudiTool::Error( msg, st, mx );
68  }
69 
81  const size_t mx = 10 ) const override {
82  return GaudiTool::Warning( msg, st, mx );
83  }
84 
95  const MSG::Level lev = MSG::INFO ) const override {
96  return GaudiTool::Print( msg, st, lev );
97  }
98 
108  void Assert( const bool ok, const std::string& message = "",
109  const StatusCode sc = StatusCode::FAILURE ) const override {
110  GaudiTool::Assert( ok, message, sc );
111  }
112 
121  void Exception( const std::string& msg, const GaudiException& exc,
122  const StatusCode sc = StatusCode::FAILURE ) const override {
123  GaudiTool::Exception( msg, exc, sc );
124  }
125 
134  void Exception( const std::string& msg, const std::exception& exc,
135  const StatusCode sc = StatusCode::FAILURE ) const override {
136  GaudiTool::Exception( msg, exc, sc );
137  }
138 
146  void Exception( const std::string& msg = "no message", const StatusCode sc = StatusCode::FAILURE ) const override {
147  GaudiTool::Exception( msg, sc );
148  }
149 };
150 
151 #endif // GAUDIALG_ERRORTOOL_H
GaudiTool.h
ErrorTool
Definition: ErrorTool.h:31
GaudiHive.precedence.message
message
Definition: precedence.py:19
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:80
std::string
STL class.
std::exception
STL class.
MSG::INFO
@ INFO
Definition: IMessageSvc.h:25
GaudiCommon< AlgTool >::Assert
void Assert(const bool ok, std::string_view message="", const StatusCode sc=StatusCode::FAILURE) const
Assertion - throw exception if the given condition is not fulfilled.
Definition: GaudiCommonImp.h:175
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:94
GaudiException
Definition: GaudiException.h:31
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:698
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:19
INamedInterface::name
virtual const std::string & name() const =0
Retrieve the name of the instance.
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:672
IErrorTool.h
StatusCode
Definition: StatusCode.h:65
GaudiCommon< AlgTool >::Print
StatusCode Print(std::string_view 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:314
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:121
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:108
IErrorTool
Definition: IErrorTool.h:34
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:134
IAlgTool::type
virtual const std::string & type() const =0
The type of an AlgTool, meaning the concrete AlgTool class.
ErrorTool::ErrorTool
ErrorTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition: ErrorTool.cpp:42
MSG::Level
Level
Definition: IMessageSvc.h:25
IAlgTool::parent
virtual const IInterface * parent() const =0
The parent of the concrete AlgTool.
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
GaudiCommon< AlgTool >::Exception
void Exception(std::string_view msg, const GaudiException &exc, const StatusCode sc=StatusCode::FAILURE) const
Create and (re)-throw a given GaudiException.
Definition: GaudiCommon.icpp:345
IInterface
Definition: IInterface.h:237
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
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
GaudiTool
Definition: GaudiTool.h:110
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:146