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