00001 #ifndef CDEBUG_H 00002 #define CDEBUG_H 00003 00011 class CDebug { 00012 private: 00014 static CDebug *unique_instance; 00015 00016 /* Outlaw public use of constructor and destructor, copy 00017 and '-' operator, etc... */ 00018 CDebug() { } 00019 CDebug(CDebug &); 00020 CDebug &operator=(CDebug &); 00021 ~CDebug() { } 00022 public: 00027 void log_error(const char *err_msg, int fatal=0); 00028 00032 static void log(const char *err_msg, int fatal=0) { 00033 get_instance()->log_error(err_msg, fatal); 00034 } 00035 00038 static CDebug *get_instance() { 00039 if (!unique_instance) { 00040 unique_instance = new CDebug(); 00041 } 00042 return unique_instance; 00043 } 00044 }; 00045 00046 #endif
1.3.3