6 #ifndef DYNAMIC_GRAPH_DEBUG_HH 7 #define DYNAMIC_GRAPH_DEBUG_HH 17 #define VP_DEBUG_MODE 0 20 #ifndef VP_TEMPLATE_DEBUG_MODE 21 #define VP_TEMPLATE_DEBUG_MODE 0 24 #define DG_COMMON_TRACES \ 27 va_start(arg, format); \ 28 vsnprintf(charbuffer, SIZE, format, arg); \ 30 outputbuffer << tmpbuffer.str() << charbuffer << std::endl; \ 42 static const int SIZE = 512;
46 char charbuffer[SIZE + 1];
52 inline void trace(
const int level,
const char *format, ...) {
57 inline void trace(
const char *format, ...) {
62 inline void trace(
const int level = -1) {
63 if (level <= traceLevel) {
64 outputbuffer << tmpbuffer.str();
87 static void openFile(
const char *filename = DEBUG_FILENAME_DEFAULT);
88 static void closeFile(
const char *filename = DEBUG_FILENAME_DEFAULT);
97 #define dgPREDEBUG __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") :" 99 "\t!! " << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") :" 101 #define dgDEBUG(level) \ 102 if ((level > VP_DEBUG_MODE) || (!dgDEBUGFLOW.outputbuffer.good())) \ 105 dgDEBUGFLOW.outputbuffer << dgPREDEBUG 107 #define dgDEBUGMUTE(level) \ 108 if ((level > VP_DEBUG_MODE) || (!dgDEBUGFLOW.outputbuffer.good())) \ 111 dgDEBUGFLOW.outputbuffer 114 if (!dgDEBUGFLOW.outputbuffer.good()) \ 117 dgERRORFLOW.outputbuffer << dgPREERROR 120 if (!dgDEBUGFLOW.outputbuffer.good()) \ 123 dgDEBUGFLOW.pre(dgDEBUGFLOW.tmpbuffer << dgPREDEBUG, VP_DEBUG_MODE).trace 126 if (!dgDEBUGFLOW.outputbuffer.good()) \ 129 dgERRORFLOW.pre(dgERRORFLOW.tmpbuffer << dgPREERROR).trace 132 #define dgTDEBUG(level) \ 133 if ((level > VP_TEMPLATE_DEBUG_MODE) || (!dgDEBUGFLOW.outputbuffer.good())) \ 136 dgDEBUGFLOW.outputbuffer << dgPREDEBUG 139 if (!dgDEBUGFLOW.outputbuffer.good()) \ 143 .pre(dgDEBUGFLOW.tmpbuffer << dgPREDEBUG, VP_TEMPLATE_DEBUG_MODE) \ 155 "\t!! " << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") :" 157 #define dgDEBUG(level) \ 161 ::dynamicgraph::__null_stream() 163 #define dgDEBUGMUTE \ 165 else ::dynamicgraph::__null_stream() 167 #define dgERROR dgERRORFLOW.outputbuffer << dgPREERROR 169 inline void dgDEBUGF(
const int,
const char *, ...) {
return; }
171 inline void dgDEBUGF(
const char *, ...) {
return; }
173 inline void dgERRORF(
const int,
const char *, ...) {
return; }
175 inline void dgERRORF(
const char *, ...) {
return; }
181 static std::ostream os(NULL);
187 #define dgTDEBUG(level) \ 191 ::dynamicgraph::__null_stream() 193 inline void dgTDEBUGF(
const int,
const char *, ...) {
return; }
197 #define dgDEBUG_ENABLE(level) false 198 #define dgTDEBUG_ENABLE(level) false 202 #define dgDEBUGIN(level) dgDEBUG(level) << "# In {" << std::endl 204 #define dgDEBUGOUT(level) dgDEBUG(level) << "# Out }" << std::endl 206 #define dgDEBUGINOUT(level) dgDEBUG(level) << "# In/Out { }" << std::endl 208 #define dgTDEBUGIN(level) dgTDEBUG(level) << "# In {" << std::endl 210 #define dgTDEBUGOUT(level) dgTDEBUG(level) << "# Out }" << std::endl 212 #define dgTDEBUGINOUT(level) dgTDEBUG(level) << "# In/Out { }" << std::endl
DebugTrace & pre(const std::ostream &)
#define dgDEBUG_ENABLE(level)
std::ostream & outputbuffer
static const char * DEBUG_FILENAME_DEFAULT
void trace(const int level=-1)
void traceTemplate(const char *format,...)
void trace(const int level, const char *format,...)
#define DG_COMMON_TRACES
VP_TEMPLATE_DEBUG_MODE.
void trace(const char *format,...)
std::stringstream tmpbuffer
void dgTDEBUGF(const int, const char *,...)
DebugTrace & pre(const std::ostream &, int level)
DebugTrace(std::ostream &os)
void dgERRORF(const int, const char *,...)
#define VP_TEMPLATE_DEBUG_MODE
VP_DEBUG_MODE.
std::ostream & __null_stream()
void dgDEBUGF(const int, const char *,...)
#define dgTDEBUG_ENABLE(level)
DYNAMIC_GRAPH_DLLAPI DebugTrace dgERRORFLOW
void traceTemplate(const int level, const char *format,...)
DYNAMIC_GRAPH_DLLAPI DebugTrace dgDEBUGFLOW