]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/debugcxt.tex
image update
[wxWidgets.git] / docs / latex / wx / debugcxt.tex
CommitLineData
a660d684
KB
1\section{\class{wxDebugContext}}\label{wxdebugcontext}
2
3A class for performing various debugging and memory tracing
4operations. Full functionality (such as printing out objects
5currently allocated) is only present in a debugging build of wxWindows,
6i.e. if the DEBUG symbol is defined and non-zero. wxDebugContext
7and related functions and macros can be compiled out by setting
8USE\_DEBUG\_CONTEXT to 0 is wx\_setup.h
9
10\wxheading{Derived from}
11
12No parent class.
13
14\wxheading{See also}
15
16\overview{Overview}{wxdebugcontextoverview}
17
18\latexignore{\rtfignore{\wxheading{Members}}}
19
20\membersection{wxDebugContext::Check}\label{wxdebugcontextcheck}
21
22\func{int}{Check}{\void}
23
24Checks the memory blocks for errors, starting from the currently set
25checkpoint.
26
27\wxheading{Return value}
28
29Returns the number of errors,
30so a value of zero represents success. Returns -1 if an error
31was detected that prevents further checking.
32
33\membersection{wxDebugContext::Dump}\label{wxdebugcontextdump}
34
35\func{bool}{Dump}{\void}
36
37Performs a memory dump from the currently set checkpoint, writing to the
38current debug stream. Calls the {\bf Dump} member function for each wxObject
39derived instance.
40
41\wxheading{Return value}
42
43TRUE if the function succeeded, FALSE otherwise.
44
45\membersection{wxDebugContext::GetCheckPrevious}\label{wxdebugcontextgetcheckprevious}
46
47\func{bool}{GetCheckPrevious}{\void}
48
49Returns TRUE if the memory allocator checks all previous memory blocks for errors.
50By default, this is FALSE since it slows down execution considerably.
51
52\wxheading{See also}
53
54\helpref{wxDebugContext::SetCheckPrevious}{wxdebugcontextsetcheckprevious}
55
56\membersection{wxDebugContext::GetDebugMode}\label{wxdebugcontextgetdebugmode}
57
58\func{bool}{GetDebugMode}{\void}
59
60Returns TRUE if debug mode is on. If debug mode is on, the wxObject new and delete
61operators store or use information about memory allocation. Otherwise,
62a straight malloc and free will be performed by these operators.
63
64\wxheading{See also}
65
66\helpref{wxDebugContext::SetDebugMode}{wxdebugcontextsetdebugmode}
67
68\membersection{wxDebugContext::GetLevel}\label{wxdebugcontextgetlevel}
69
70\func{int}{GetLevel}{\void}
71
72Gets the debug level (default 1). The debug level is used by the wxTraceLevel function and
73the WXTRACELEVEL macro to specify how detailed the trace information is; setting
74a different level will only have an effect if trace statements in the application
75specify a value other than one.
76
6fb26ea3
JS
77This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
78
a660d684
KB
79\wxheading{See also}
80
81\helpref{wxDebugContext::SetLevel}{wxdebugcontextsetlevel}
82
83\membersection{wxDebugContext::GetStream}\label{wxdebugcontextgetstream}
84
85\func{ostream\&}{GetStream}{\void}
86
87Returns the output stream associated with the debug context.
88
6fb26ea3
JS
89This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
90
a660d684
KB
91\wxheading{See also}
92
93\helpref{wxDebugContext::SetStream}{wxdebugcontextsetstream}
94
95\membersection{wxDebugContext::GetStreamBuf}\label{wxdebugcontextgetstreambuf}
96
97\func{streambuf*}{GetStreamBuf}{\void}
98
99Returns a pointer to the output stream buffer associated with the debug context.
100There may not necessarily be a stream buffer if the stream has been set
101by the user.
102
6fb26ea3
JS
103This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
104
a660d684
KB
105\membersection{wxDebugContext::HasStream}\label{wxdebugcontexthasstream}
106
107\func{bool}{HasStream}{\void}
108
109Returns TRUE if there is a stream currently associated
110with the debug context.
111
6fb26ea3
JS
112This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
113
a660d684
KB
114\wxheading{See also}
115
116\helpref{wxDebugContext::SetStream}{wxdebugcontextsetstream}, \helpref{wxDebugContext::GetStream}{wxdebugcontextgetstream}
117
118\membersection{wxDebugContext::PrintClasses}\label{wxdebugcontextprintclasses}
119
120\func{bool}{PrintClasses}{\void}
121
122Prints a list of the classes declared in this application, giving derivation
123and whether instances of this class can be dynamically created.
124
125\wxheading{See also}
126
127\helpref{wxDebugContext::PrintStatistics}{wxdebugcontextprintstatistics}
128
129\membersection{wxDebugContext::PrintStatistics}\label{wxdebugcontextprintstatistics}
130
131\func{bool}{PrintStatistics}{\param{bool}{ detailed = TRUE}}
132
133Performs a statistics analysis from the currently set checkpoint, writing
134to the current debug stream. The number of object and non-object
135allocations is printed, together with the total size.
136
137\wxheading{Parameters}
138
139\docparam{detailed}{If TRUE, the function will also print how many
140objects of each class have been allocated, and the space taken by
141these class instances.}
142
143\wxheading{See also}
144
145\helpref{wxDebugContext::PrintStatistics}{wxdebugcontextprintstatistics}
146
147\membersection{wxDebugContext::SetCheckpoint}\label{wxdebugcontextsetcheckpoint}
148
149\func{void}{SetCheckpoint}{\param{bool}{ all = FALSE}}
150
151Sets the current checkpoint: Dump and PrintStatistics operations will
152be performed from this point on. This allows you to ignore allocations
153that have been performed up to this point.
154
155\wxheading{Parameters}
156
157\docparam{all}{If TRUE, the checkpoint is reset to include all
158memory allocations since the program started.}
159
160\membersection{wxDebugContext::SetCheckPrevious}\label{wxdebugcontextsetcheckprevious}
161
162\func{void}{SetCheckPrevious}{\param{bool}{ check}}
163
164Tells the memory allocator to check all previous memory blocks for errors.
165By default, this is FALSE since it slows down execution considerably.
166
167\wxheading{See also}
168
169\helpref{wxDebugContext::GetCheckPrevious}{wxdebugcontextgetcheckprevious}
170
171\membersection{wxDebugContext::SetDebugMode}\label{wxdebugcontextsetdebugmode}
172
173\func{void}{SetDebugMode}{\param{bool}{ debug}}
174
175Sets the debug mode on or off. If debug mode is on, the wxObject new and delete
176operators store or use information about memory allocation. Otherwise,
177a straight malloc and free will be performed by these operators.
178
179By default, debug mode is on if DEBUG is non-zero. If the application
180uses this function, it should make sure that all object memory allocated
181is deallocated with the same value of debug mode. Otherwise, the
182delete operator might try to look for memory information that does not
183exist.
184
185\wxheading{See also}
186
187\helpref{wxDebugContext::GetDebugMode}{wxdebugcontextgetdebugmode}
188
189\membersection{wxDebugContext::SetFile}\label{wxdebugcontextsetfile}
190
191\func{bool}{SetFile}{\param{const wxString\& }{filename}}
192
193Sets the current debug file and creates a stream. This will delete any existing
194stream and stream buffer. By default, the debug context stream
195outputs to the debugger (Windows) or standard error (other platforms).
196
197\membersection{wxDebugContext::SetLevel}\label{wxdebugcontextsetlevel}
198
199\func{void}{SetLevel}{\param{int}{ level}}
200
201Sets the debug level (default 1). The debug level is used by the wxTraceLevel function and
202the WXTRACELEVEL macro to specify how detailed the trace information is; setting
203a different level will only have an effect if trace statements in the application
204specify a value other than one.
205
6fb26ea3
JS
206This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
207
a660d684
KB
208\wxheading{See also}
209
210\helpref{wxDebugContext::GetLevel}{wxdebugcontextgetlevel}
211
212\membersection{wxDebugContext::SetStandardError}\label{wxdebugcontextsetstandarderror}
213
214\func{bool}{SetStandardError}{\void}
215
216Sets the debugging stream to be the debugger (Windows) or standard error (other platforms).
217This is the default setting. The existing stream will be flushed and deleted.
218
6fb26ea3
JS
219This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
220
a660d684
KB
221\membersection{wxDebugContext::SetStream}\label{wxdebugcontextsetstream}
222
223\func{void}{SetStream}{\param{ostream* }{stream}, \param{streambuf* }{streamBuf = NULL}}
224
225Sets the stream and optionally, stream buffer associated with the debug context.
226This operation flushes and deletes the existing stream (and stream buffer if any).
227
6fb26ea3
JS
228This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
229
a660d684
KB
230\wxheading{Parameters}
231
232\docparam{stream}{Stream to associate with the debug context. Do not set this to NULL.}
233
234\docparam{streamBuf}{Stream buffer to associate with the debug context.}
235
236\wxheading{See also}
237
238\helpref{wxDebugContext::GetStream}{wxdebugcontextgetstream}, \helpref{wxDebugContext::HasStream}{wxdebugcontexthasstream}
239
240\section{\class{wxDebugStreamBuf}}\label{wxdebugstreambuf}
241
242This class allows you to treat debugging output in a similar
243(stream-based) fashion on different platforms. Under
244Windows, an ostream constructed with this buffer outputs
245to the debugger, or other program that intercepts debugging
246output. On other platforms, the output goes to standard error (cerr).
247
6fb26ea3
JS
248This is soon to be obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
249
a660d684
KB
250\wxheading{Derived from}
251
252streambuf
253
254\wxheading{Example}
255
256\begin{verbatim}
257 wxDebugStreamBuf streamBuf;
258 ostream stream(&streamBuf);
259
260 stream << "Hello world!" << endl;
261\end{verbatim}
262
263\wxheading{See also}
264
265\overview{Overview}{wxdebugcontextoverview}
266
267