$szTitle = "wxdebugcontext"; include "./_header.inc"; ?>
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 wxwidgets, i.e. if the __wxdebug__ symbol is defined. wxdebugcontext and related functions and macros can be compiled out by setting wxuse_debug_context to 0 is setup.h
derived from
no parent class.
include files
<wx/memory.h>
see also
members
wxdebugcontext::check
wxdebugcontext::dump
wxdebugcontext::getcheckprevious
wxdebugcontext::getdebugmode
wxdebugcontext::getlevel
wxdebugcontext::getstream
wxdebugcontext::getstreambuf
wxdebugcontext::hasstream
wxdebugcontext::printclasses
wxdebugcontext::printstatistics
wxdebugcontext::setcheckpoint
wxdebugcontext::setcheckprevious
wxdebugcontext::setdebugmode
wxdebugcontext::setfile
wxdebugcontext::setlevel
wxdebugcontext::setstandarderror
wxdebugcontext::setstream
int check()
checks the memory blocks for errors, starting from the currently set checkpoint.
return value
returns the number of errors, so a value of zero represents success. returns -1 if an error was detected that prevents further checking.
bool dump()
performs a memory dump from the currently set checkpoint, writing to the current debug stream. calls the dump member function for each wxobject derived instance.
return value
true if the function succeeded, false otherwise.
bool getcheckprevious()
returns true if the memory allocator checks all previous memory blocks for errors. by default, this is false since it slows down execution considerably.
see also
wxdebugcontext::setcheckprevious
bool getdebugmode()
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.
see also
int getlevel()
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.
this is obsolete, replaced by wxlog functionality.
see also
ostream& getstream()
returns the output stream associated with the debug context.
this is obsolete, replaced by wxlog functionality.
see also
streambuf* getstreambuf()
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.
this is obsolete, replaced by wxlog functionality.
bool hasstream()
returns true if there is a stream currently associated with the debug context.
this is obsolete, replaced by wxlog functionality.
see also
wxdebugcontext::setstream, wxdebugcontext::getstream
bool printclasses()
prints a list of the classes declared in this application, giving derivation and whether instances of this class can be dynamically created.
see also
wxdebugcontext::printstatistics
bool printstatistics(bool detailed = true)
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.
parameters
detailed
see also
wxdebugcontext::printstatistics
void setcheckpoint(bool all = false)
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.
parameters
all
void setcheckprevious(bool check)
tells the memory allocator to check all previous memory blocks for errors. by default, this is false since it slows down execution considerably.
see also
wxdebugcontext::getcheckprevious
void setdebugmode(bool debug)
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.
by default, debug mode is on if __wxdebug__ is defined. 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.
see also
bool setfile(const wxstring& filename)
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).
void setlevel(int level)
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.
this is obsolete, replaced by wxlog functionality.
see also
bool setstandarderror()
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.
this is obsolete, replaced by wxlog functionality.
void setstream(ostream* stream, streambuf* streambuf = null)
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).
this is obsolete, replaced by wxlog functionality.
parameters
stream
streambuf
see also
wxdebugcontext::getstream, wxdebugcontext::hasstream
include "./_footer.inc"; ?>