Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

debuget.h File Reference

Defines several debugging functions and macros, including ASSERT (and variations). More...

#include <stdio.h>
#include <ctype.h>
#include <iostream>
#include <string.h>
#include <sstream>
#include <fstream>
Include dependency graph for debuget.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  debuget
 

contains some debugging functions and ASSERT macros (although the macros don't respect the namespace scoping...)


Defines

#define ASSERT(b, msgstream)   {if(!(b)) { std::stringstream DEBUGET_ss; DEBUGET_ss << msgstream; debuget::displayAssert(__FILE__,__LINE__,DEBUGET_ss.str().c_str()); }}
 if the bool b is false, std::cout the string
#define ASSERTRET(b, msgstream)   {if(!(b)) { std::stringstream DEBUGET_ss; DEBUGET_ss << msgstream; debuget::displayAssert(__FILE__,__LINE__,DEBUGET_ss.str().c_str()); return; }}
 if the bool b is false, std::cout the string and return
#define ASSERTRETVAL(b, msgstream, v)   {if(!(b)) { std::stringstream DEBUGET_ss; DEBUGET_ss << msgstream; debuget::displayAssert(__FILE__,__LINE__,DEBUGET_ss.str().c_str()); return v; }}
 if the bool b is false, std::cout the string and return the value
#define ASSERTFATAL(b, msgstream, x)   {if(!(b)) { std::stringstream DEBUGET_ss; DEBUGET_ss << msgstream; debuget::displayAssert(__FILE__,__LINE__,DEBUGET_ss.str().c_str()); exit(x); }}
 if the bool b is false, std::cout the string and exit(x)
#define ASSERTIF(b, msgstream)   if(!(b)) { std::stringstream DEBUGET_ss; DEBUGET_ss << msgstream; debuget::displayAssert(__FILE__,__LINE__,DEBUGET_ss.str().c_str()); } else
 sets up an 'if' statement so the following block won't be executed if the ASSERT fails

Functions

const char * debuget::extractFilename (const char *path)
 for display, just use the filename, not the whole path
void debuget::displayAssert (const char *file, unsigned int line, const char *msg)
 mostly for use with a debugger -- set a breakpoint on this function and you can catch anytime an assertion is generated
char debuget::hexdigit (int c)
 returns the hex char that corresponds to c, which should be 0-16 (returns '.' otherwise)
void debuget::charhexout (char c)
 printf's the two hex digits coresponding to a byte
void debuget::hexout (const void *p, size_t n)
 charhexout's n bytes starting at p
void debuget::hexout2 (const void *p, size_t size)
 displays hex and ascii values of size bytes from p
void debuget::hexout3 (const char *buf, size_t size)
 displays hex and ascii values of size bytes from p

Detailed Description

Defines several debugging functions and macros, including ASSERT (and variations).

Author:
ejt (Creator)

Definition in file debuget.h.


Define Documentation

#define ASSERT ( b,
msgstream   )     {if(!(b)) { std::stringstream DEBUGET_ss; DEBUGET_ss << msgstream; debuget::displayAssert(__FILE__,__LINE__,DEBUGET_ss.str().c_str()); }}
#define ASSERTFATAL ( b,
msgstream,
 )     {if(!(b)) { std::stringstream DEBUGET_ss; DEBUGET_ss << msgstream; debuget::displayAssert(__FILE__,__LINE__,DEBUGET_ss.str().c_str()); exit(x); }}

if the bool b is false, std::cout the string and exit(x)

Definition at line 37 of file debuget.h.

#define ASSERTIF ( b,
msgstream   )     if(!(b)) { std::stringstream DEBUGET_ss; DEBUGET_ss << msgstream; debuget::displayAssert(__FILE__,__LINE__,DEBUGET_ss.str().c_str()); } else

sets up an 'if' statement so the following block won't be executed if the ASSERT fails

Definition at line 39 of file debuget.h.

Referenced by Transition::doFire().

#define ASSERTRETVAL ( b,
msgstream,
 )     {if(!(b)) { std::stringstream DEBUGET_ss; DEBUGET_ss << msgstream; debuget::displayAssert(__FILE__,__LINE__,DEBUGET_ss.str().c_str()); return v; }}

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:55 2016 by Doxygen 1.6.3