Logo ROOT  
Reference Guide
TError.h
Go to the documentation of this file.
1// @(#)root/base:$Id$
2// Author: Fons Rademakers 29/07/95
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TError
13#define ROOT_TError
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// Error handling routines. //
19// //
20// This file defines a number of global error handling routines: //
21// Warning(), Error(), SysError() and Fatal(). They all take a //
22// location string (where the error happened) and a printf style format //
23// string plus vararg's. In the end these functions call an //
24// errorhanlder function. By default DefaultErrorHandler() is used. //
25// //
26//////////////////////////////////////////////////////////////////////////
27
28
29#include "RtypesCore.h"
30#include <stdarg.h>
31
32
33class TVirtualMutex;
34
35const Int_t kUnset = -1;
36const Int_t kPrint = 0;
37const Int_t kInfo = 1000;
38const Int_t kWarning = 2000;
39const Int_t kError = 3000;
40const Int_t kBreak = 4000;
41const Int_t kSysError = 5000;
42const Int_t kFatal = 6000;
43
45
46typedef void (*ErrorHandlerFunc_t)(int level, Bool_t abort, const char *location,
47 const char *msg);
48
49extern "C" void ErrorHandler(int level, const char *location, const char *fmt,
50 va_list va);
51
52extern void DefaultErrorHandler(int level, Bool_t abort, const char *location,
53 const char *msg);
54
57
58extern void Info(const char *location, const char *msgfmt, ...)
59#if defined(__GNUC__) && !defined(__CINT__)
60__attribute__((format(printf, 2, 3)))
61#endif
62;
63extern void Warning(const char *location, const char *msgfmt, ...)
64#if defined(__GNUC__) && !defined(__CINT__)
65__attribute__((format(printf, 2, 3)))
66#endif
67;
68extern void Error(const char *location, const char *msgfmt, ...)
69#if defined(__GNUC__) && !defined(__CINT__)
70__attribute__((format(printf, 2, 3)))
71#endif
72;
73extern void Break(const char *location, const char *msgfmt, ...)
74#if defined(__GNUC__) && !defined(__CINT__)
75__attribute__((format(printf, 2, 3)))
76#endif
77;
78extern void SysError(const char *location, const char *msgfmt, ...)
79#if defined(__GNUC__) && !defined(__CINT__)
80__attribute__((format(printf, 2, 3)))
81#endif
82;
83extern void Fatal(const char *location, const char *msgfmt, ...)
84#if defined(__GNUC__) && !defined(__CINT__)
85__attribute__((format(printf, 2, 3)))
86#endif
87;
88
89extern void AbstractMethod(const char *method);
90extern void MayNotUse(const char *method);
91extern void Obsolete(const char *function, const char *asOfVers, const char *removedFromVers);
92
94R__EXTERN const char *kCheckMsg;
95
96#define R__ASSERT(e) \
97 do { \
98 if (!(e)) ::Fatal("", kAssertMsg, _QUOTE_(e), __LINE__, __FILE__); \
99 } while (false)
100#define R__CHECK(e) \
101 do { \
102 if (!(e)) ::Warning("", kCheckMsg, _QUOTE_(e), __LINE__, __FILE__); \
103 } while (false)
104
108
109#endif
#define R__EXTERN
Definition: DllImport.h:27
int Int_t
Definition: RtypesCore.h:43
bool Bool_t
Definition: RtypesCore.h:61
void DefaultErrorHandler(int level, Bool_t abort, const char *location, const char *msg)
The default error handler function.
Definition: TError.cxx:125
R__EXTERN const char * kAssertMsg
Definition: TError.h:93
const Int_t kPrint
Definition: TError.h:36
const Int_t kError
Definition: TError.h:39
const Int_t kSysError
Definition: TError.h:41
R__EXTERN const char * kCheckMsg
Definition: TError.h:94
ErrorHandlerFunc_t GetErrorHandler()
Returns the current error handler function.
Definition: TError.cxx:116
void Info(const char *location, const char *msgfmt,...)
const Int_t kUnset
Definition: TError.h:35
void ErrorHandler(int level, const char *location, const char *fmt, va_list va)
General error handler function. It calls the user set error handler.
Definition: TError.cxx:202
const Int_t kFatal
Definition: TError.h:42
void Error(const char *location, const char *msgfmt,...)
const Int_t kBreak
Definition: TError.h:40
R__EXTERN Int_t gErrorAbortLevel
Definition: TError.h:106
void AbstractMethod(const char *method)
This function can be used in abstract base classes in case one does not want to make the class a "rea...
Definition: TError.cxx:260
const Int_t kWarning
Definition: TError.h:38
R__EXTERN Bool_t gPrintViaErrorHandler
Definition: TError.h:107
void SysError(const char *location, const char *msgfmt,...)
void(* ErrorHandlerFunc_t)(int level, Bool_t abort, const char *location, const char *msg)
Definition: TError.h:46
void Break(const char *location, const char *msgfmt,...)
void MayNotUse(const char *method)
This function can be used in classes that should override a certain function, but in the inherited cl...
Definition: TError.cxx:269
R__EXTERN TVirtualMutex * gErrorMutex
Definition: TError.h:44
R__EXTERN Int_t gErrorIgnoreLevel
Definition: TError.h:105
void Obsolete(const char *function, const char *asOfVers, const char *removedFromVers)
Use this function to declare a function obsolete.
Definition: TError.cxx:278
void Warning(const char *location, const char *msgfmt,...)
ErrorHandlerFunc_t SetErrorHandler(ErrorHandlerFunc_t newhandler)
Set an errorhandler function. Returns the old handler.
Definition: TError.cxx:106
void Fatal(const char *location, const char *msgfmt,...)
const Int_t kInfo
Definition: TError.h:37
typedef void((*Func_t)())
This class implements a mutex interface.
Definition: TVirtualMutex.h:34
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Definition: RExports.h:151