19 #ifndef __NX_TOOLS_H__ 20 #define __NX_TOOLS_H__ 28 #include <yat/threading/Utilities.h> 29 #include <yat/threading/Mutex.h> 35 #define DBG_PREFIX(x) "[" << std::hex << std::setfill(' ') << std::setw(10)\ 36 << (void*)(x) << "][" << std::setfill('0') << std::setw(8)\ 37 << yat::ThreadingUtilities::self() << "] " << std::dec 45 dbg_helper(
const std::string &s,
void* this_object) : _s(s), _this_object(this_object)
47 yat::AutoMutex<> lock(mutex());
48 std::cout << DBG_PREFIX(_this_object) << indent() <<
"> " << _s << std::endl;
49 indent().append(2,
' ');
53 yat::AutoMutex<> lock(mutex());
55 std::cout << DBG_PREFIX(_this_object) << indent() <<
"< " << _s << std::endl;
57 static std::string& indent()
59 static std::string s_indent;
62 static yat::Mutex& mutex()
64 static yat::Mutex s_mtx;
68 #define NX_SCOPE_DBG(s) dbg_helper _scope_dbg(s, (void*)this) 71 yat::AutoMutex<> lock(dbg_helper::mutex()); \ 72 std::cout << DBG_PREFIX((void*)this) << dbg_helper::indent() << s << std::endl; \ 77 #define NX_SCOPE_DBG(s)