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 #ifndef _ORSA_ERROR_H_
00026 #define _ORSA_ERROR_H_
00027
00028 #include <cstdarg>
00029
00030 namespace orsa {
00031
00032 class Debug {
00033 public:
00034 static void construct();
00035 virtual ~Debug();
00036 virtual void set(const char *msg, const char *file, const int line);
00037 void trace(const char *fmt, ...);
00038 static void setDefaultOutput(bool);
00039 static Debug * obj();
00040 protected:
00041 Debug();
00042 virtual void vtrace(const char *fmt, std::va_list list);
00043 static Debug * m_instance;
00044 bool doTrace;
00045 bool doDefaultOutput;
00046 };
00047
00048 }
00049
00050
00051
00052
00053
00054 #define ORSA_DEBUG orsa::Debug::obj()->set("Debug:",__FILE__,__LINE__); orsa::Debug::obj()->trace
00055 #define ORSA_ERROR orsa::Debug::obj()->set("Error:",__FILE__,__LINE__); orsa::Debug::obj()->trace
00056 #define ORSA_WARNING orsa::Debug::obj()->set("Warning:",__FILE__,__LINE__); orsa::Debug::obj()->trace
00057 #define ORSA_DOMAIN_ERROR orsa::Debug::obj()->set("Domain Error:",__FILE__,__LINE__); orsa::Debug::obj()->trace
00058 #define ORSA_LOGIC_ERROR orsa::Debug::obj()->set("Logic Error (this shouldn't happen):",__FILE__,__LINE__); orsa::Debug::obj()->trace
00059 #define ORSA_LOGIC_WARNING orsa::Debug::obj()->set("Logic Warning (possibly unimplemented case):",__FILE__,__LINE__); orsa::Debug::obj()->trace
00060
00061 #endif // _ORSA_ERROR_H_