Honeycomb  0.1
Component-Model Framework
Namespaces | Macros | Variables
Debug Mode Functions

Namespaces

 honey::debug
 Debug Mode Functions
 

Macros

#define assert(...)    EVAL(TOKCAT(assert_, NUMARGS(__VA_ARGS__))(__VA_ARGS__))
 Forwards to assert_#args. See assert_1(), assert_2(). More...
 
#define verify(...)    EVAL(TOKCAT(verify_, NUMARGS(__VA_ARGS__))(__VA_ARGS__))
 Forwards to verify_#args. See verify_1(), verify_2(). More...
 
#define debug_if(...)    __VA_ARGS__
 Evaluate expression in debug mode only, does nothing in final mode. More...
 
#define debug_print(...)    { honey::debug::platform::print(__VA_ARGS__); }
 Print string to debug output window. Does nothing in final mode. More...
 
#define debug_break(msg)    { try { error_(msg); } catch (...) {} }
 Cause debugger to break. Debugger must have exception breakpoints enabled. More...
 
#define assert_1(expr)    assert_2(expr, "")
 Assert that an expression is true, otherwise throws AssertionFailure with the expression. Does nothing in final mode. More...
 
#define assert_2(expr, msg)    if (!(expr)) { honey::debug::platform::assertFail(#expr, __FUNC__, __FILE__, __LINE__, (msg)); }
 Assert with extra message to be displayed on failure. More...
 
#define verify_1(expr)    assert_1(expr)
 Similar to assert() but evaluates the expression and throws an error even in final mode. More...
 
#define verify_2(expr, msg)    assert_2(expr, msg)
 Verify with extra message to be displayed on failure. Message ignored in final mode. More...
 
#define error_(msg)    assert_2(false, msg)
 Throw AssertionFailure with a message. Message ignored in final mode. More...
 

Variables

static const bool honey::debug::enabled = true
 Flag to check if debug mode is enabled at compile-time/runtime. More...
 

Detailed Description

Macro Definition Documentation

#define assert (   ...)    EVAL(TOKCAT(assert_, NUMARGS(__VA_ARGS__))(__VA_ARGS__))

Forwards to assert_#args. See assert_1(), assert_2().

Examples:
MtMap.cpp.
#define assert_1 (   expr)    assert_2(expr, "")

Assert that an expression is true, otherwise throws AssertionFailure with the expression. Does nothing in final mode.

#define assert_2 (   expr,
  msg 
)    if (!(expr)) { honey::debug::platform::assertFail(#expr, __FUNC__, __FILE__, __LINE__, (msg)); }

Assert with extra message to be displayed on failure.

#define debug_break (   msg)    { try { error_(msg); } catch (...) {} }

Cause debugger to break. Debugger must have exception breakpoints enabled.

#define debug_if (   ...)    __VA_ARGS__

Evaluate expression in debug mode only, does nothing in final mode.

#define debug_print (   ...)    { honey::debug::platform::print(__VA_ARGS__); }

Print string to debug output window. Does nothing in final mode.

Examples:
MtMap.cpp.
#define error_ (   msg)    assert_2(false, msg)

Throw AssertionFailure with a message. Message ignored in final mode.

#define verify (   ...)    EVAL(TOKCAT(verify_, NUMARGS(__VA_ARGS__))(__VA_ARGS__))

Forwards to verify_#args. See verify_1(), verify_2().

#define verify_1 (   expr)    assert_1(expr)

Similar to assert() but evaluates the expression and throws an error even in final mode.

#define verify_2 (   expr,
  msg 
)    assert_2(expr, msg)

Verify with extra message to be displayed on failure. Message ignored in final mode.

Variable Documentation

const bool honey::debug::enabled = true
static

Flag to check if debug mode is enabled at compile-time/runtime.