Main Page | Class List | File List | Class Members | File Members | Related Pages

CSCReadException.h

00001 
00005 #include <iostream>
00006 #include <exception>
00007 
00008 #define SEV_INFO 0
00009 #define SEV_WARN 1
00010 #define SEV_ERROR 2
00011 #define SEV_FATAL 4
00012 
00013 /*
00014 class CSCReadException : public std::exception{
00015 public:
00016   CSCReadException(const std::string &file, unsigned int line, const std::string &message = ""):file(file), line(line), message(message){}
00017 virtual
00018   ~CSCReadException() throw() {printf("destru\n");}
00019 
00020  public:
00021   std::string file, message;
00022   unsigned int line;
00023 };
00024 
00025 */
00026 
00027 
00028 class CSCReadException : public std::exception
00029 {
00030 private:
00031     std::string file, message;
00032     unsigned int line;
00033     char txt[200];
00034     int severity;
00035 
00036 public:
00037     CSCReadException(const std::string &file, unsigned int line, const std::string &message = "", int severity = 0);
00038     CSCReadException(const std::string &message = "");
00039     virtual ~CSCReadException() throw();
00040     virtual const char * what() const throw();
00041     int IsInfo()    {return (severity==SEV_INFO);};
00042     int isWarning() {return (severity==SEV_WARN);};
00043     int isError() {return (severity==SEV_ERROR);};
00044     int isFatal() {return (severity==SEV_FATAL);};
00045     int GetSeverity() {return severity;};
00046 
00047 };
00048 // Macro for throwing the exception with current line number and file: 
00049 #define THROW_EXCEPTION(ErrorString, severity) throw CSCReadException(__FILE__, __LINE__, ErrorString, severity)
00050 
00051 //#define THROW_EXCEPTION(ErrorString) throw CSCReadException(ErrorString)

Generated on Wed Oct 29 10:35:18 2008 for CSCRead by  doxygen 1.3.9.1