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

debug.hpp

00001 /* $Id: debug.hpp,v 1.1.1.1 2005/04/22 17:18:53 ndsdev Exp $ */
00002 
00003 #ifndef DEBUG_HPP
00004 #define DEBUG_HPP
00005 
00011 #define MAX_DEBUG_LINE_LENGTH 80
00012 
00017 #define MAX_DEBUG_LINES 200
00018 
00019 #ifndef DEBUG
00020 
00021 // Debugging disabled...
00022 #define dbg_printf(format, ...)
00023 #define dbg_printf2(format, ...)
00024 #define dbg_printf3(format, ...)
00025 #define dbg_process_update false
00026 
00027 #else
00028 
00038 #define dbg_printf(format, ...) \
00039     (Debug::Inst().getLogLevel() <= 1)? \
00040         false : Debug::Inst().dbg_printf(format, ## __VA_ARGS__)
00041 
00049 #define dbg_printf2(format, ...) \
00050     (Debug::Inst().getLogLevel() <= 2)? \
00051         false : Debug::Inst().dbg_printf(format, ## __VA_ARGS__)
00052 
00060 #define dbg_printf3(format, ...) \
00061     (Debug::Inst().getLogLevel() <= 3)? \
00062         false : Debug::Inst().dbg_printf(format, ## __VA_ARGS__)
00063 
00069 #define dbg_process_update \
00070     (Debug::Inst().update())
00071 
00072 #endif
00073 
00083 typedef bool (*triggerFunc)(void);
00084 
00164 class Debug
00165 {
00170   Debug();
00171 
00176   Debug(const Debug&);
00177 
00182   Debug& operator=(const Debug&);
00183 public:
00184 
00189   static Debug& Inst(void);
00190 
00195   static void setTriggerFunc(triggerFunc trigger);
00196 
00208   bool update(void) const;
00209 
00214   int getLogLevel(void) const;
00215 
00225   void setLogLevel(int l);
00226 
00240   bool dbg_printf(const char* fmt, ...);
00241 
00256   bool debug(void) const;
00257 };
00258 
00259 #endif

Generated on Fri Apr 22 13:47:42 2005 for PhoenixRising NDS Library by doxygen 1.3.6