StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StExceptions.hh
1 #include "Stiostream.h"
2 #include <string>
3 #include <typeinfo>
4 
5 #ifndef StExceptions_hh
6 #define StExceptions_hh
7 
8 class StException {
9 private:
10  std::string mName;
11  std::string mMessage;
12 public:
13  StException(const char* c="unknown", const char* m="") : mName(c),mMessage(m) { /* no-op */ }
14  virtual ~StException() {}
15  virtual std::string name() {return mName;}
16  virtual std::string message() {return mMessage; }
17  virtual void print() { cout << "*** StException * " << name() << " *** " << message() << endl; }
18 };
19 
21 private:
22 public:
23  StExceptionNullPointer(const char* message="") : StException("nullPointer",message) { /* -no-op */ }
24  virtual ~StExceptionNullPointer() {}
25 };
26 
28 private:
29 public:
30  StExceptionBadFlag(const char* message="") : StException("badFlag",message) { /* no-op */ }
31  virtual ~StExceptionBadFlag() {}
32 };
33 
35 private:
36  float mValue;
37 public:
38  StExceptionBadValue(const char* message="", float value=0) : StException("badValue",message) , mValue(value) { /* no-op */ }
39  virtual ~StExceptionBadValue() {}
40  virtual void print() { cout << "*** StException * " << name() << " *** " << message() << " " << mValue << endl; }
41 };
42 
43 class StExceptionEOF : public StException {
44 private:
45 public:
46  StExceptionEOF(const char* message="") : StException("end of file",message) { /* no-op */ }
47  virtual ~StExceptionEOF() {}
48 };
49 
50 #endif
51