|
||||
File indexing completed on 2025-01-18 09:57:34
0001 /***********************************************************************************\ 0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations * 0003 * * 0004 * This software is distributed under the terms of the Apache version 2 licence, * 0005 * copied verbatim in the file "LICENSE". * 0006 * * 0007 * In applying this licence, CERN does not waive the privileges and immunities * 0008 * granted to it by virtue of its status as an Intergovernmental Organization * 0009 * or submit itself to any jurisdiction. * 0010 \***********************************************************************************/ 0011 #ifndef GAUDIALG_IERRORTOOL_H 0012 #define GAUDIALG_IERRORTOOL_H 1 0013 // ============================================================================ 0014 // Include files 0015 // ============================================================================ 0016 // STD & STL 0017 // ============================================================================ 0018 #include <string> 0019 // ============================================================================ 0020 // GaudiKernel 0021 // ============================================================================ 0022 #include "GaudiKernel/IAlgTool.h" 0023 #include "GaudiKernel/IMessageSvc.h" 0024 #include "GaudiKernel/StatusCode.h" 0025 // ============================================================================ 0026 class GaudiException; 0027 0028 /** @class IErrorTool IErrorTool.h GaudiTools/IErrorTool.h 0029 * 0030 * 0031 * @author Ivan BELYAEV 0032 * @date 2004-06-28 0033 */ 0034 class GAUDI_API IErrorTool : virtual public IAlgTool { 0035 public: 0036 /// InterfaceID 0037 DeclareInterfaceID( IErrorTool, 2, 0 ); 0038 0039 public: 0040 /** Print the error message, return status code 0041 * and perform the statistics of error messages 0042 * 0043 * @code 0044 * 0045 * IErrorTool* tool = .. ; 0046 * if( a < 0 ) { return tool->Error(" 'a' is negative!") ;} 0047 * if( b < 0 ) { return tool->Error(" 'b' is illegal!" , StatusCode(25) ); 0048 * if( c < 0 ) 0049 * { return tool->Error(" 'c' is negative" , StatusCode(35) , 50 ); 0050 * 0051 * @endcode 0052 * 0053 * @see MsgStream 0054 * @see IMessageSvc 0055 * @see StatusCode 0056 * @param msg error message 0057 * @param st status code 0058 * @param mx maximal number of printouts 0059 * @return status code 0060 */ 0061 virtual StatusCode Error( const std::string& msg, const StatusCode st = StatusCode::FAILURE, 0062 const size_t mx = 10 ) const = 0; 0063 0064 /** Print the warning message, return status code 0065 * and perform the statistics of warning messages 0066 * @see MsgStream 0067 * @see IMessageSvc 0068 * @see StatusCode 0069 * @param msg warning message 0070 * @param st statsu code 0071 * @param mx maximal number of printouts 0072 * @return status code 0073 */ 0074 virtual StatusCode Warning( const std::string& msg, const StatusCode st = StatusCode::FAILURE, 0075 const size_t mx = 10 ) const = 0; 0076 0077 /** Print the message and return status code 0078 * @see MsgStream 0079 * @see IMessageSvc 0080 * @see StatusCode 0081 * @param msg warning message 0082 * @param st status code 0083 * @param lev print level 0084 * @return status code 0085 */ 0086 virtual StatusCode Print( const std::string& msg, const StatusCode st = StatusCode::SUCCESS, 0087 const MSG::Level lev = MSG::INFO ) const = 0; 0088 0089 /** Assertion - throw exception, if condition is not fulfilled 0090 * @see CaloException 0091 * @see GaudiException 0092 * @exception CaloException for invalid condition 0093 * @param ok condition which should be "true" 0094 * @param message message to be associated with the exception 0095 * @param sc status code to be returned (artificial) 0096 * @return status code 0097 */ 0098 virtual void Assert( const bool ok, const std::string& message = "", 0099 const StatusCode sc = StatusCode::FAILURE ) const = 0; 0100 0101 /** Create and (re)-throw the exception 0102 * @see GaudiException 0103 * @exception CaudiException always! 0104 * @param msg exception message 0105 * @param exc (previous) exception of type GaudiException 0106 * @param sc status code 0107 * @return status code (fictive) 0108 */ 0109 virtual void Exception( const std::string& msg, const GaudiException& exc, 0110 const StatusCode sc = StatusCode::FAILURE ) const = 0; 0111 0112 /** Create and (re)-throw the exception 0113 * @see GaudiException 0114 * @exception GaudiException always! 0115 * @param msg exception message 0116 * @param exc (previous) exception of type std::exception 0117 * @param sc status code 0118 * @return status code (fictive) 0119 */ 0120 virtual void Exception( const std::string& msg, const std::exception& exc, 0121 const StatusCode sc = StatusCode::FAILURE ) const = 0; 0122 0123 /** Create and throw the exception 0124 * @see GaudiException 0125 * @exception GaudiException always! 0126 * @param msg exception message 0127 * @param sc status code 0128 * @return status code (fictive) 0129 */ 0130 virtual void Exception( const std::string& msg = "no message", const StatusCode sc = StatusCode::FAILURE ) const = 0; 0131 0132 protected: 0133 // protected destructor 0134 virtual ~IErrorTool() = default; 0135 }; 0136 0137 // ============================================================================ 0138 #endif // GAUDIALG_IERRORTOOL_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |