CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/Utilities/General/interface/CMSexception.h

Go to the documentation of this file.
00001 #ifndef Utilities_CMSexception_H
00002 #define Utilities_CMSexception_H
00003 //
00004 //  VI 1.0  3/4/2002
00005 //  exception with trace back and chaining
00006 //
00007 
00008 # include "FWCore/Utilities/interface/Exception.h"
00009 
00010 
00011 
00014 class CMSexception : public cms::Exception {
00015 public:
00016   CMSexception() throw() : cms::Exception("") {}
00017   virtual ~CMSexception() throw() {}
00018   virtual const char* what() const throw() = 0;
00019   virtual std::string explainSelf (void) const { return what();}
00020 };
00021 
00024 class Fastexception: public CMSexception  {
00025 public:
00026   Fastexception() throw() {}
00027   virtual ~Fastexception() throw() {}
00028   virtual const char* what() const throw() { return 0;}
00029   virtual std::string explainSelf (void) const { return "";}
00030   virtual cms::Exception *     clone (void) const { return new Fastexception(*this);}
00031   virtual void        rethrow (void) { throw *this;}
00032 };
00033 
00034 
00035 #include <string>
00036 
00039 class BaseGenexception: public CMSexception  {
00040 public:
00041   BaseGenexception() throw();
00042   BaseGenexception(const std::string & mess) throw();
00043   virtual ~BaseGenexception() throw();
00044   virtual const char* what() const throw() { return message.c_str();}
00045   virtual cms::Exception *     clone (void) const { return new BaseGenexception(*this);}
00046   virtual void        rethrow (void) { throw *this;}
00047 
00048 private:
00049   std::string message;
00050 };
00051 
00052 
00053 
00054 #include "Utilities/General/interface/own_ptr.h"
00055 #include<iosfwd>
00056 
00059 class Genexception: public BaseGenexception  {
00060 public:
00061   Genexception() throw();
00062   Genexception(const std::string & mess) throw();
00063   virtual ~Genexception() throw();
00064   const std::string & trace() const throw() { return trace_;}
00065 
00066   void add(Genexception * in) throw();
00067 
00068   void dump(std::ostream & o, bool it=false) const throw(); 
00069   virtual cms::Exception *  clone (void) const { return new Genexception(*this);}
00070   virtual void        rethrow (void) { throw *this;}
00071 
00072 private:
00073   void traceit() throw();
00074 
00075 private:
00076   std::string trace_;
00077 
00078   own_ptr<Genexception> next;
00079 };
00080 
00081 namespace Capri {
00082 
00083   class Error : public Genexception {
00084   public:
00085     Error(const std::string & level, const std::string & mess) throw();
00086   };
00087   
00088   
00089   class Warning : public Error {
00090   public: 
00091     explicit Warning(const std::string & mess) throw() : Error("Warning",mess){}
00092   };
00093   
00094   class Severe : public Error {
00095   public:
00096     explicit Severe(const std::string & mess) throw() : Error("Severe",mess){}
00097   };
00098   
00099   class Fatal : public Error {
00100   public:
00101     explicit Fatal(const std::string & mess) throw() : Error("Fatal",mess){}
00102   };
00103 
00104 
00105 }
00106 
00109 class GenTerminate: public Genexception  {
00110 public:
00111   GenTerminate() throw();
00112   GenTerminate(const std::string & mess) throw();
00113   virtual ~GenTerminate() throw();
00114 
00115 };
00116 
00117 
00120 class Success {
00121 public:
00122   Success();
00123   ~Success();
00124 
00125 private:
00126   std::string message;
00127 };
00128 
00129 #endif
00130