|
// // ABC Exception class for BRAT // // $Author: hagel $ // $Date: 2001/06/21 14:55:19 $ // $Copyright: Brahms collaboration // $Id: BrException.cxx,v 1.1.1.1 2001/06/21 14:55:19 hagel Exp $ // #include <stdarg.h> #include <cstdarg> #include <cstring> #include <cstdlib> #include <BrIostream.h> #include <Rtypes.h> #include <TObject.h> #include <TError.h> #include <TString.h> #include <BrException.h> #define MakeErrorString(X) \ va_list ap; \ va_start(ap,X); \ char buf[1024]; \ vsprintf(buf, fmt, ap); \ fErrorString = Form("%s: %s", fLocation, buf); \ va_end(ap); //_________________________________________________________________ ClassImp(BrException); // Exception class for BRAHMS //_________________________________________________________________ ClassImp(BrWarning); // Exception class for BRAHMS //_________________________________________________________________ ClassImp(BrError); // Exception class for BRAHMS //_________________________________________________________________ ClassImp(BrFatal); // Exception class for BRAHMS //_________________________________________________________________ BrException::BrException(Int_t exit, const Char_t* location) { fLocation = const_cast<Char_t*>(location); fExitCode = exit; } //_________________________________________________________________ BrWarning::BrWarning(const Char_t* location, const Char_t* fmt ...) : BrException(kWarning,location) { // Make a warning exception MakeErrorString(fmt); } //_________________________________________________________________ BrError::BrError(const Char_t* location, const Char_t* fmt ...) : BrException(kError,location) { // Make a error exception MakeErrorString(fmt); } //_________________________________________________________________ BrFatal::BrFatal(const Char_t* location, const Char_t* fmt ...) : BrException(kFatal,location) { // Make a fatal exception MakeErrorString(fmt); } // // Taken out, and replaced by expanded MakeErrorString, since it // doesn't seem to work proberly on Digital Unix. // // void // BrException::SetErrorString(const Char_t* fmt, va_list ap) // { // char buf[1024]; // vsprintf(buf, fmt, ap); // fErrorString = Form("%s: %s", fLocation, buf); // } //_________________________________________________________________ Char_t* BrException::GetErrorString(void) const { return fErrorString; } //_________________________________________________________________ ostream& operator<<(ostream& o, BrException& e) { o << e.GetErrorString() << flush; return o; } //_________________________________________________________________ ostream& operator<<(ostream& o, BrException* e) { o << e->GetErrorString() << flush; return o; } // $Log: BrException.cxx,v $ // Revision 1.1.1.1 2001/06/21 14:55:19 hagel // Initial revision of brat2 // // Revision 1.5 2001/01/23 16:32:28 cholm // Hack to make rootcint (CINT) ignore variadic arguments in BrException // classes. // fixed module stremaers. // // Revision 1.4 2000/09/04 13:38:33 videbaek // Use BrIostream.h to facilitate different iostream conventions. // // Revision 1.3 2000/03/24 21:09:45 videbaek // Moved linear equation routines from TpcClusterFinder class. // // Revision 1.2 2000/03/21 21:21:42 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. // // |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|