All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ErrorTool.h
Go to the documentation of this file.
1 // $Id: ErrorTool.h,v 1.3 2006/11/30 10:16:12 mato Exp $
2 // ============================================================================
3 #ifndef GAUDIALG_ERRORTOOL_H
4 #define GAUDIALG_ERRORTOOL_H 1
5 // ============================================================================
6 // Include files
7 // ============================================================================
8 // Gaudi
9 // ============================================================================
10 #include "GaudiAlg/GaudiTool.h"
11 #include "GaudiAlg/IErrorTool.h"
12 // ============================================================================
13 
14 // ============================================================================
21 // ============================================================================
22 
23 class ErrorTool : public GaudiTool ,
24  virtual public IErrorTool
25 {
26 
27 public:
28 
36  ErrorTool ( const std::string& type,
37  const std::string& name,
38  const IInterface* parent);
39 
41  virtual ~ErrorTool( );
42 
43 public:
44 
66  virtual StatusCode Error
67  ( const std::string& msg ,
68  const StatusCode st = StatusCode::FAILURE ,
69  const size_t mx = 10 ) const
70  { return GaudiTool::Error ( msg , st, mx ) ; }
71 
82  virtual StatusCode Warning
83  ( const std::string& msg ,
84  const StatusCode st = StatusCode::FAILURE ,
85  const size_t mx = 10 ) const
86  { return GaudiTool::Warning( msg , st , mx ) ; }
87 
97  virtual StatusCode Print
98  ( const std::string& msg ,
99  const StatusCode st = StatusCode::SUCCESS ,
100  const MSG::Level lev = MSG::INFO ) const
101  { return GaudiTool::Print( msg , st , lev ) ; }
102 
112  virtual void Assert
113  ( const bool ok ,
114  const std::string& message = "" ,
115  const StatusCode sc = StatusCode::FAILURE ) const
116  { GaudiTool::Assert ( ok , message , sc ) ; }
117 
126  virtual void Exception
127  ( const std::string & msg ,
128  const GaudiException & exc ,
129  const StatusCode sc = StatusCode::FAILURE ) const
130  { Exception ( msg , exc , sc ) ; }
131 
140  virtual void Exception
141  ( const std::string & msg ,
142  const std::exception & exc ,
143  const StatusCode sc = StatusCode::FAILURE ) const
144  { Exception ( msg , exc , sc ) ; }
145 
153  virtual void Exception
154  ( const std::string& msg = "no message" ,
155  const StatusCode sc = StatusCode::FAILURE ) const
156  { Exception ( msg , sc ) ; }
157 
158 };
159 
160 #endif // GAUDIALG_ERRORTOOL_H
Header file for class GaudiAlgorithm.
Define general base for Gaudi exception.
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.
virtual StatusCode Error(const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
Print the error message, return status code and perform the statistics of error messages.
Definition: ErrorTool.h:67
virtual ~ErrorTool()
virtual and protected destrcutor
Definition: ErrorTool.cpp:44
virtual void Assert(const bool ok, const std::string &message="", const StatusCode sc=StatusCode::FAILURE) const
Assertion - throw exception, if condition is not fulfilled.
Definition: ErrorTool.h:113
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Definition of the basic interface.
Definition: IInterface.h:160
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.
MsgStream & msg() const
shortcut for the method msgStream ( MSG::INFO )
Definition: GaudiCommon.h:503
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.
virtual const std::string & type() const =0
The type of an AlgTool, meaning the concrete AlgTool class.
virtual StatusCode Print(const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const
Print the message and return status code.
Definition: ErrorTool.h:98
ErrorTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition: ErrorTool.cpp:32
virtual const IInterface * parent() const =0
The parent of the concrete AlgTool.
virtual StatusCode Warning(const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
Print the warning message, return status code and perform the statistics of warning messages...
Definition: ErrorTool.h:83
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.
The useful base class for tools.
Definition: GaudiTool.h:99
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
virtual void Exception(const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode::FAILURE) const
Create and (re)-throw the exception.
Definition: ErrorTool.h:127