bbtkException.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00047 #ifndef __bbtkException_h__
00048 #define __bbtkException_h__
00049
00050 #include "bbtkSystem.h"
00051 #include <exception>
00052
00053 namespace bbtk
00054 {
00055
00056 inline std::string bbGetObjectDescription() { return(""); }
00057
00058 class BBTK_EXPORT Exception : public std::exception
00059 {
00060 public:
00061 Exception(const std::string& object,
00062 const std::string& source_file,
00063 const std::string& message) throw()
00064 : mObject(object),
00065 mSourceFile(source_file),
00066 mMessage(message)
00067 {}
00068 ~Exception() throw() {}
00069 void Print() throw()
00070 {
00071 std::cerr << "* ERROR : " << mMessage <<std::endl;
00072 int lev = bbtk::MessageManager::GetMessageLevel("Error");
00073 if (lev > 0) {
00074 std::cerr << "* OBJECT : " <<mObject<<std::endl;
00075 std::cerr << "* FILE : " <<mSourceFile<<std::endl;
00076 }
00077 }
00078
00079 const std::string& GetObject() const { return mObject; }
00080 const std::string& GetSourceFile() const { return mSourceFile; }
00081 const std::string& GetErrorMessage() const { return mMessage; }
00082 private:
00083 std::string mObject;
00084 std::string mSourceFile;
00085 std::string mMessage;
00086 };
00087
00088 }
00089
00090 #endif