C++ Extensions (cppx) Documentation Internal Version
Main | Namespaces | Classes | NamespaceMembers | ClassMembers | Files

stdxDebug.h Classes and Functions

A couple simple macros that make "printf" style debugging easier. Basically instead of having to to write something like the following:

 std::cout << " Here: numLines = " << numLines << std::endl;
 std::cout << " Here 12 " << std::endl;

One can write this:

 DEBUG_VAR( numLines );
 DEBUG_CHK;

Defines

Functions

Detailed Documentation

Define Documentation

#define DEBUG_PRETTY_FUNCTION   " : " << stdx::extractFunctionName( __PRETTY_FUNCTION__ ) << "()"
 

Simple macro that produces the namespace, class name, and function name of whatever function it is used in. It should only be used as input to an output stream.

Todo:
Somehow make this defined as nothing if configure detects that __PRETTY_FUNCTION__ is not supported.

#define DEBUG_VAR toPrint   
 

Value:

{ std::cout << " DEBUG: " << __FILE__ << ":" << __LINE__ \
              << DEBUG_PRETTY_FUNCTION << " : " \
              << #toPrint << " = " << toPrint << std::endl; }
Simple macro that makes it easier to do "printf" style debugging. To watch a variable for debugging simple use DEBUG_VAR( varname ) which will result in the following output:

 DEBUG: somefile.cc : Line 56 : varname = somevalue
 

#define DEBUG_CHK
 

Value:

{ std::cout << " DEBUG: " << __FILE__ << ":" << __LINE__ \
              << DEBUG_PRETTY_FUNCTION << " : Checkpoint" << std::endl; }
Simple macro that makes it easier to do "printf" style debugging, by checkpointing a location so as to track control flow. The resulting output will be:

 DEBUG: somefile.cc : Line 56 : Checkpoint
 

#define DEBUG_MSG msg   
 

Value:

{ std::cout << " DEBUG: " << __FILE__ << ":" << __LINE__ \
              << DEBUG_PRETTY_FUNCTION << " : Checkpoint - " << msg << std::endl; }
Simple macro that makes it easier to do "printf" style debugging, by checkpointing a location so as to track control flow. The resulting output for DEBUG_MSG( msg ) will be:

 DEBUG: somefile.cc : Line 56 : Checkpoint msg
 

Function Documentation

std::string extractFunctionName const std::string &    str
 

Simple function which when passed __PRETTY_FUNCTION__, it strips everything except the the namespace, class name, and function name.

Generated on Mon Aug 15 21:43:09 2005 by Doxygen 1.2.13-20020210 written by Dimitri van Heesch © 1997-2002