// -*- mode: c++ -*- // // $Id: BrException.h,v 1.1.1.1 2001/06/21 14:55:19 hagel Exp $ // $Author: hagel $ // $Date: 2001/06/21 14:55:19 $ // $Copyrigth: BRAHMS Collaboration 2000 // #ifndef BRAT_BrException #define BRAT_BrException #if defined(__linux__) #include #endif #include #include #include #ifndef ROOT_Varargs #include "Varargs.h" #endif class BrException : public TObject { protected: Int_t fExitCode; // What to exit with Char_t* fLocation; // Where the exception was thrown Char_t* fErrorString; // What to write out public: BrException(Int_t exit=kError, const char* location=NULL); virtual void* Execute(void* arg=0)=0; // virtual void SetErrorString(const Char_t* fmt, va_list ap); virtual Char_t* GetErrorString(void) const; virtual Int_t GetExitCode(void) const { return fExitCode; } ClassDef(BrException,0) // ABC Exception class for BRAHMS DBM } ; //_________________________________________________________________ class BrWarning : public BrException { public: #ifndef __CINT__ // Temporary hack for CINT 5.14.71 BrWarning(const char* location, const char* fmt ...); #else BrWarning(const char* location, const char* fmt, int) : BrException(kWarning, location) { fErrorString = fmt; } #endif void* Execute(void* arg=0) { return &fExitCode; } ClassDef(BrWarning,0) // Warning exception class for BRAHMS DBM } ; //_________________________________________________________________ class BrError : public BrException { public: #ifndef __CINT__ // Temporary hack for CINT 5.14.71 BrError(const char* location, const char* fmt ...); #else BrError(const char* location, const char* fmt, int) : BrException(kError, location) { fErrorString = fmt; } #endif void* Execute(void* arg=0) { return &fExitCode; } ClassDef(BrError,0) // Error exception class for BRAHMS DBM } ; //_________________________________________________________________ class BrFatal : public BrException { public: #ifndef __CINT__ // Temporary hack for CINT 5.14.71 BrFatal(const char* location, const char* fmt ...); #else BrFatal(const char* location, const char* fmt, int) : BrException(kFatal, location) { fErrorString = fmt; } #endif void* Execute(void* arg=0) { exit(fExitCode); } ClassDef(BrFatal,0) // Error exception class for BRAHMS DBM } ; ostream& operator<<(ostream& o, BrException& e); ostream& operator<<(ostream& o, BrException* e); #endif // // $Log: BrException.h,v $ // Revision 1.1.1.1 2001/06/21 14:55:19 hagel // Initial revision of brat2 // // Revision 1.6 2001/01/23 16:31:49 cholm // Hack to make rootcint (CINT) ignore variadic arguments in BrException // classes. // // Revision 1.5 2000/12/20 01:56:03 hagel // Added missing includes for system calls (abort, exit, abs) // // Revision 1.4 2000/11/23 01:30:23 brahmlib // Changed name/title types to const Char_t* instead of Char_t* in CTOR. // // Revision 1.3 2000/09/04 13:34:10 videbaek // Move CVS log. Use BrIostream to include std iostream. // // Revision 1.2 2000/03/21 21:21:38 cholm // Several changes: A few hacks where needed to compile on Digital Unix, noticably in my - Christian Holm - classes for the DB and Exceptions. Proberly still need to do something to some of Konstantins stuff. Also, I removed a lot of warnings fromt the compiler, by teddying up the code. Several places, old C-style indecies in for loops were assumed. Corrected. Unused variables have been commented out. // //