Proton  1.1.1
Make porting easy from Python to C++11
Debug utilities

Macros, global variables, classes for debug. More...

Classes

class  proton::err
 The exception class. More...

Macros

#define PROTON_DEBUG_OPT   1
 Control debug macros.
#define PROTON_LOG(lvl, out)
 Log messages to cerr.
#define PROTON_THROW_IF(cond, out)
 Proton's inverse assert.
#define PROTON_ERR(out)
 Throw an err.

Variables

int proton::debug_level
 The level controls output of PROTON_LOG().
bool proton::log_console
 true: PROTON_LOG/PROTON_THROW_IF/PROTON_ERR will output to console, false: no console output for these macros.
int proton::wait_on_err
 0: nonstop, 1: stop on PROTON_ERR, 2: stop on PROTON_THROW_IF assert

Detailed Description

Macros, global variables, classes for debug.


Macro Definition Documentation

#define PROTON_DEBUG_OPT   1

Control debug macros.

1: enable PROTON_LOG/PROTON_THROW_IF/PROTON_ERR, 0: disable them.

Definition at line 65 of file base.hpp.

#define PROTON_ERR (   out)

Throw an err.

Throw a proton::err("err"), and output a message. If proton::wait_on_err >= 1, it will hold the program and wait for any key. You can use gdb to attach the process to check what's happened.

Parameters:
outthe message describing what's happened.

Definition at line 115 of file base.hpp.

#define PROTON_LOG (   lvl,
  out 
)

Log messages to cerr.

Output messages when lvl <= proton::debug_level.

Parameters:
lvlthe log level.
outmessages to be outputed, they can be concatenated using "<<".

Definition at line 75 of file base.hpp.

#define PROTON_THROW_IF (   cond,
  out 
)

Proton's inverse assert.

Throw if cond is true, and output the reason. If proton::wait_on_err >= 2, it will hold the program and wait for any key. You can use gdb to attach the process to check what's happened.

Parameters:
condthe condition to check, throw proton::err("assert") if it's true.
outthe message describing what's happened.
Examples:
deque.cpp, functor.cpp, string.cpp, tuple.cpp, and vector.cpp.

Definition at line 90 of file base.hpp.

Referenced by proton::ref_< objT, allocator >::operator()(), proton::operator>>(), proton::ref_< objT, allocator >::operator[](), proton::set_< T, C, A >::pop(), proton::map_< K, T, C, A >::pop(), and proton::map_< K, T, C, A >::popitem().