TError.h

Go to the documentation of this file.
00001 // @(#)root/base:$Id: TError.h 35549 2010-09-21 14:18:04Z rdm $
00002 // Author: Fons Rademakers   29/07/95
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TError
00013 #define ROOT_TError
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // Error handling routines.                                             //
00019 //                                                                      //
00020 // This file defines a number of global error handling routines:        //
00021 // Warning(), Error(), SysError() and Fatal(). They all take a          //
00022 // location string (where the error happened) and a printf style format //
00023 // string plus vararg's. In the end these functions call an             //
00024 // errorhanlder function. By default DefaultErrorHandler() is used.     //
00025 //                                                                      //
00026 //////////////////////////////////////////////////////////////////////////
00027 
00028 
00029 #ifndef ROOT_Rtypes
00030 #include "Rtypes.h"
00031 #endif
00032 #include <stdarg.h>
00033 
00034 
00035 class TVirtualMutex;
00036 
00037 const Int_t kUnset    =  -1;
00038 const Int_t kPrint    =   0;
00039 const Int_t kInfo     =   1000;
00040 const Int_t kWarning  =   2000;
00041 const Int_t kError    =   3000;
00042 const Int_t kBreak    =   4000;
00043 const Int_t kSysError =   5000;
00044 const Int_t kFatal    =   6000;
00045 
00046 R__EXTERN TVirtualMutex *gErrorMutex;
00047 
00048 typedef void (*ErrorHandlerFunc_t)(int level, Bool_t abort, const char *location,
00049               const char *msg);
00050 
00051 extern "C" void ErrorHandler(int level, const char *location, const char *fmt,
00052                              va_list va);
00053 
00054 extern void DefaultErrorHandler(int level, Bool_t abort, const char *location,
00055                                 const char *msg);
00056 
00057 extern ErrorHandlerFunc_t SetErrorHandler(ErrorHandlerFunc_t newhandler);
00058 extern ErrorHandlerFunc_t GetErrorHandler();
00059 
00060 extern void Info(const char *location, const char *msgfmt, ...)
00061 #if defined(__GNUC__) && !defined(__CINT__)
00062 __attribute__((format(printf, 2, 3)))
00063 #endif
00064 ;
00065 extern void Warning(const char *location, const char *msgfmt, ...)
00066 #if defined(__GNUC__) && !defined(__CINT__)
00067 __attribute__((format(printf, 2, 3)))
00068 #endif
00069 ;
00070 extern void Error(const char *location, const char *msgfmt, ...)
00071 #if defined(__GNUC__) && !defined(__CINT__)
00072 __attribute__((format(printf, 2, 3)))
00073 #endif
00074 ;
00075 extern void Break(const char *location, const char *msgfmt, ...)
00076 #if defined(__GNUC__) && !defined(__CINT__)
00077 __attribute__((format(printf, 2, 3)))
00078 #endif
00079 ;
00080 extern void SysError(const char *location, const char *msgfmt, ...)
00081 #if defined(__GNUC__) && !defined(__CINT__)
00082 __attribute__((format(printf, 2, 3)))
00083 #endif
00084 ;
00085 extern void Fatal(const char *location, const char *msgfmt, ...)
00086 #if defined(__GNUC__) && !defined(__CINT__)
00087 __attribute__((format(printf, 2, 3)))
00088 #endif
00089 ;
00090 
00091 extern void AbstractMethod(const char *method);
00092 extern void MayNotUse(const char *method);
00093 
00094 R__EXTERN const char *kAssertMsg;
00095 R__EXTERN const char *kCheckMsg;
00096 
00097 #define R__ASSERT(e) \
00098    do { \
00099       if (!(e)) ::Fatal("", kAssertMsg, _QUOTE_(e), __LINE__, __FILE__); \
00100    } while (0)
00101 #define R__CHECK(e) \
00102    do { \
00103       if (!(e)) ::Warning("", kCheckMsg, _QUOTE_(e), __LINE__, __FILE__); \
00104    } while (0)
00105 
00106 R__EXTERN Int_t  gErrorIgnoreLevel;
00107 R__EXTERN Int_t  gErrorAbortLevel;
00108 R__EXTERN Bool_t gPrintViaErrorHandler;
00109 
00110 #endif

Generated on Tue Jul 5 14:10:26 2011 for ROOT_528-00b_version by  doxygen 1.5.1