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