Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
XDebug.h
1// XDebug.h: interface for the debugging purpose classes
2//
3//////////////////////////////////////////////////////////////////////
4
5#if !defined(CXDEBUG_INCLUDE_H)
6#define CXDEBUG_INCLUDE_H
7
8#ifdef _MSC_VER
9#pragma once
10#endif // _MSC_VER
11
12BEGIN_MOOTOOLS_NAMESPACE
13
14#if defined(_DEBUG) && !defined(MOOTOOLS_NO_TRACE)
15 DLL_TOOLSFUNCTION void XTRACE(unsigned int traceID, const wchar_t *lpszFormat, ...);
16 DLL_TOOLSFUNCTION void XTRACE(unsigned int traceID, const char *lpszFormat, ...);
17 DLL_TOOLSFUNCTION void XTRACE(unsigned int traceID, unsigned int level, const wchar_t *lpszFormat, ...);
18 DLL_TOOLSFUNCTION void XTRACE(unsigned int traceID, unsigned int level, const char *lpszFormat, ...);
19 DLL_TOOLSFUNCTION void XTRACE(const wchar_t *lpszFormat, ...);
20 DLL_TOOLSFUNCTION void XTRACE(const char *lpszFormat, ...);
21
22 #define XTRACE_IF(cond, ...) \
23 if (cond) XTRACE(__VA_ARGS__);
24 #define XTRACE2_IF(trace, cond, ...) \
25 if (cond) XTRACE(trace, __VA_ARGS__);
26#else
27 #define XTRACE(...) __noop
28 #define XTRACE_IF(cond, ...) __noop
29 #define XTRACE2_IF(cond, ...) __noop
30#endif
31
32
33#ifndef MOOTOOLS_MFC_PRODUCT_BUILD
34#define traceAppMsg (MAKE_CUSTOM_ID('A', 'P', 'P', 'M'))
35#define traceStruct (MAKE_CUSTOM_ID('T', 'R', 'S', 'T'))
36#define traceDeiModule (MAKE_CUSTOM_ID('T', 'O', 'O', 'M'))
37#define traceBitmapModule (MAKE_CUSTOM_ID('B', 'M', 'M', 'O'))
38#define trace3DModule (MAKE_CUSTOM_ID('3', 'D', 'M', 'O'))
39#define trace3DBrowser (MAKE_CUSTOM_ID('3', 'D', 'B', 'R'))
40#define tracePLY (MAKE_CUSTOM_ID('P', 'L', 'Y', 'C'))
41#define traceInternet (MAKE_CUSTOM_ID('I', 'N', 'T', 'E'))
42
43#if defined(_DEBUG) && !defined(MOOTOOLS_NO_TRACE)
44 class CXTrace;
46 DLL_TOOLSFUNCTION bool TraceToFile(LPCTSTR filename);
47 DLL_TOOLSFUNCTION bool EnableTrace(unsigned int traceID, unsigned int level = -1); // return true if some output will be done and the trace is enabled. (level == -1 means that the trace is disabled)
48 DLL_TOOLSFUNCTION bool IsTraceEnabled(unsigned int traceID, unsigned int level = -1); // Check if the level is displayed for the trace
49
50
51 class CXObject;
52 class DLL_TOOLSFUNCTION CXTrace
53 {
54 public:
55 friend DLL_TOOLSFUNCTION void XTRACE(unsigned int, unsigned int, const wchar_t *, ...);
56 friend DLL_TOOLSFUNCTION void XTRACE(unsigned int, unsigned int, const char *, ...);
57 friend DLL_TOOLSFUNCTION void XTRACE(unsigned int, const wchar_t *, ...);
58 friend DLL_TOOLSFUNCTION void XTRACE(unsigned int, const char *, ...);
59 friend DLL_TOOLSFUNCTION void XTRACE(const wchar_t *, ...);
60 friend DLL_TOOLSFUNCTION void XTRACE(const char *, ...);
61
62 CXTrace();
63 virtual ~CXTrace();
64
65 bool OpenFile(LPCTSTR filename);
66 void CloseFile();
67
68 // Operations
70 #ifdef _UNICODE
72 #else
74 #endif
75 CXTrace& operator<<(const void* ptr);
76 CXTrace& operator<<(const CXObject* pOb);
77 CXTrace& operator<<(char value);
78 CXTrace& operator<<(unsigned char value);
79 CXTrace& operator<<(short value);
80 CXTrace& operator<<(unsigned short value);
81 CXTrace& operator<<(int value);
82 CXTrace& operator<<(unsigned int value);
85 CXTrace& operator<<(float f);
86 CXTrace& operator<<(double d);
87 void HexDump(LPCTSTR lpszLine, void *bytes, int count, int printWidth);
88
89 bool IsEnabled(unsigned int traceID, unsigned int level = -1) const;
90 void Enable(unsigned int traceID, unsigned int level = -1);
91 void EnableWarnings(bool enable);
92
93 protected:
94 void OutputString(const CXString& txt);
95 void OutputString(unsigned int classid, unsigned int level, const CXString& txt);
96
97 void *privateData;
98 };
99
100#endif // _DEBUG
101#else
102 #ifdef _DEBUG
103 #ifndef DECLARE_CUSTOM_TRACE_CATEGORY
104 #if _MFC_VER < 0x0C00
105 #define DECLARE_CUSTOM_TRACE_CATEGORY(name, id) extern DLL_TOOLSFUNCTION ATL::CTraceCategory name;
106 #else
107 #define DECLARE_CUSTOM_TRACE_CATEGORY(name, id) extern DLL_TOOLSFUNCTION ATL::CTraceCategoryEx<ATL::CTraceCategoryEx<>::TraceUser+id> name;
108 #endif
109 #endif
110
111 #define traceStruct traceMootools
112 #define traceDeiModule traceMootools
113 #define traceDeiModule traceMootools
114 #define traceBitmapModule traceMootools
115 #define trace3DModule traceMootools
116 #define trace3DBrowser traceMootools
117 #define tracePLY traceMootools
118
120
122
123 class DLL_TOOLSFUNCTION CDebugCheckMemory
124 {
125 BOOL set;
126
127 public:
130 };
131
132 DLL_TOOLSFUNCTION BOOL DebugCheckMemory(BOOL debug);
133 #endif // _DEBUG
134#endif
135
136END_MOOTOOLS_NAMESPACE
137
138
139#endif // !defined(CXDEBUG_INCLUDE_H)
The class defines an x, y, z 3D point which can use int, float or double.
Definition 3DPoint.h:27