12 #ifndef SPROCKIT_COMMON_DEBUG_H_INCLUDED 13 #define SPROCKIT_COMMON_DEBUG_H_INCLUDED 21 #define MAX_DEBUG_SLOT 63 //64 bit integer 61 operator bool()
const {
97 virtual std::string str() = 0;
158 register_debug_slot(
const std::string& str,
160 const std::string& docstring);
169 turn_on(
const std::string& str);
181 print_debug_string(
const std::string& str, std::ostream& os = std::cout);
201 print_all_debug_slots(std::ostream& os = std::cout);
231 const std::string& docstring){
244 #define DeclareDebugSlot(name) \ 245 namespace sprockit { namespace dbg { \ 246 extern debug_int name; \ 256 #define RegisterDebugSlot(name, ...) \ 257 namespace sprockit { \ 260 debug_register_slot name##_debug_registerer(#name, &name, "" __VA_ARGS__); \ 267 #define MakeDebugSlot(name, ...) \ 268 DeclareDebugSlot(name) \ 269 RegisterDebugSlot(name) 271 #ifdef SPROCKIT_DISABLE_DEBUG 272 #define debug_printf(...) //eliminate completely 275 #define debug_printf(slot_bitmask, ...) \ 276 if (::sprockit::debug::slot_active(slot_bitmask)){ \ 277 ::sprockit::debug::print_debug_string(::sprockit::printf(__VA_ARGS__)); \ The debug_register_slot class.
debug_int operator&(const debug_int &lhs, const debug_int &rhs)
static std::map< std::string, std::string > * docstrings_
static void register_debug_slot(const std::string &str, debug_int *dint_ptr, const std::string &docstring)
register_debug_slot Register a new debug slot that can be activated via the command line or input fil...
std::string to_string() const
debug_int & operator=(const debug_int &rhs)
debug_int operator|(const debug_int &lhs, const debug_int &rhs)
static int num_bits_assigned
The number of debug slots that have been assigned unique indices.
debug_register_slot(const std::string &str, debug_int *dint_ptr, const std::string &docstring)
static std::map< std::string, debug_int * > * debug_ints_
The debug_prefix_fxn class Produces a string prefix (dynamically, called every time) that can be regi...
static debug_int current_bitmask_
<= start_bitmask_ - some debug slots may have been selectively deactivated
The debug_int class is an opaque wrapper around an integer used for checking if debug slots are activ...
static debug_int start_bitmask_
The bitmask corresponding to all slots that were active at the beginning.
static debug_prefix_fxn * prefix_fxn