10 #ifndef SOT_CORE_DEBUG_HH 11 #define SOT_CORE_DEBUG_HH 19 #define VP_DEBUG_MODE 0 22 #ifndef VP_TEMPLATE_DEBUG_MODE 23 #define VP_TEMPLATE_DEBUG_MODE 0 26 #define SOT_COMMON_TRACES \ 29 va_start(arg, format); \ 30 vsnprintf(charbuffer, SIZE, format, arg); \ 32 outputbuffer << tmpbuffer.str() << charbuffer << std::endl; \ 39 static const int SIZE = 512;
43 char charbuffer[SIZE + 1];
49 inline void trace(
const int level,
const char *format, ...) {
50 if (level <= traceLevel)
55 inline void trace(
const char *format, ...) {
60 inline void trace(
const int level = -1) {
61 if (level <= traceLevel)
62 outputbuffer << tmpbuffer.str();
67 if (level <= traceLevelTemplate)
85 static void openFile(
const char *filename = DEBUG_FILENAME_DEFAULT);
86 static void closeFile(
const char *filename = DEBUG_FILENAME_DEFAULT);
96 __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") :" 99 "\t!! " << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") :" 101 #define sotDEBUG(level) \ 102 if ((level > VP_DEBUG_MODE) || \ 103 (!dynamicgraph::sot::sotDEBUGFLOW.outputbuffer.good())) \ 106 dynamicgraph::sot::sotDEBUGFLOW.outputbuffer << sotPREDEBUG 108 #define sotDEBUGMUTE(level) \ 109 if ((level > VP_DEBUG_MODE) || \ 110 (!dynamicgraph::sot::sotDEBUGFLOW.outputbuffer.good())) \ 113 dynamicgraph::sot::sotDEBUGFLOW.outputbuffer 116 if (!dynamicgraph::sot::sotDEBUGFLOW.outputbuffer.good()) \ 119 dynamicgraph::sot::sotERRORFLOW.outputbuffer << sotPREERROR 122 if (!dynamicgraph::sot::sotDEBUGFLOW.outputbuffer.good()) \ 125 dynamicgraph::sot::sotDEBUGFLOW \ 126 .pre(dynamicgraph::sot::sotDEBUGFLOW.tmpbuffer << sotPREDEBUG, \ 131 if (!dynamicgraph::sot::sotDEBUGFLOW.outputbuffer.good()) \ 134 sot::sotERRORFLOW.pre(sot::sotERRORFLOW.tmpbuffer << sotPREERROR).trace 137 #define sotTDEBUG(level) \ 138 if ((level > VP_TEMPLATE_DEBUG_MODE) || \ 139 (!dynamicgraph::sot::sotDEBUGFLOW.outputbuffer.good())) \ 142 dynamicgraph::sot::sotDEBUGFLOW.outputbuffer << sotPREDEBUG 145 if (!dynamicgraph::sot::sotDEBUGFLOW.outputbuffer.good()) \ 148 dynamicgraph::sot::sotDEBUGFLOW \ 149 .pre(dynamicgraph::sot::sotDEBUGFLOW.tmpbuffer << sotPREDEBUG, \ 150 VP_TEMPLATE_DEBUG_MODE) \ 165 #define sotPREERROR \ 166 "\t!! " << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") :" 167 #define sotDEBUG(level) \ 171 ::dynamicgraph::sot::__null_stream() 172 #define sotDEBUGMUTE(level) \ 176 ::dynamicgraph::sot::__null_stream() 177 #define sotERROR sotERRORFLOW.outputbuffer << sotPREERROR 188 static std::ostream os(NULL);
195 #define sotTDEBUG(level) \ 199 ::dynamicgraph::sot::__null_stream() 208 #define sotDEBUG_ENABLE(level) false 209 #define sotTDEBUG_ENABLE(level) false 213 #define sotDEBUGIN(level) sotDEBUG(level) << "# In {" << std::endl 214 #define sotDEBUGOUT(level) sotDEBUG(level) << "# Out }" << std::endl 215 #define sotDEBUGINOUT(level) sotDEBUG(level) << "# In/Out { }" << std::endl 217 #define sotTDEBUGIN(level) sotTDEBUG(level) << "# In {" << std::endl 218 #define sotTDEBUGOUT(level) sotTDEBUG(level) << "# Out }" << std::endl 219 #define sotTDEBUGINOUT(level) sotTDEBUG(level) << "# In/Out { }" << std::endl void trace(const char *format,...)
Definition: debug.hh:55
DebugTrace(std::ostream &os)
Definition: debug.hh:47
#define VP_DEBUG_MODE
Definition: debug.hh:19
#define sotTDEBUG_ENABLE(level)
Definition: debug.hh:209
SOT_CORE_EXPORT DebugTrace sotDEBUGFLOW
DebugTrace & pre(const std::ostream &)
Definition: debug.hh:77
#define sotDEBUG_ENABLE(level)
Definition: debug.hh:208
std::ostream & __null_stream()
Definition: debug.hh:185
std::stringstream tmpbuffer
Definition: debug.hh:41
void sotTDEBUGF(const int, const char *,...)
Definition: debug.hh:203
SOT_CORE_EXPORT DebugTrace sotERRORFLOW
void traceTemplate(const char *format,...)
Definition: debug.hh:72
#define SOT_CORE_EXPORT
Definition: api.hh:20
void traceTemplate(const int level, const char *format,...)
Definition: debug.hh:66
void sotERRORF(const int, const char *,...)
Definition: debug.hh:183
void trace(const int level=-1)
Definition: debug.hh:60
int traceLevelTemplate
Definition: debug.hh:45
#define SOT_COMMON_TRACES
VP_TEMPLATE_DEBUG_MODE.
Definition: debug.hh:26
void trace(const int level, const char *format,...)
Definition: debug.hh:49
int traceLevel
Definition: debug.hh:44
DebugTrace & pre(const std::ostream &, int level)
Definition: debug.hh:79
void sotDEBUGF(const int, const char *,...)
Definition: debug.hh:181
#define VP_TEMPLATE_DEBUG_MODE
VP_DEBUG_MODE.
Definition: debug.hh:23
std::ostream & outputbuffer
Definition: debug.hh:42
Definition: abstract-sot-external-interface.hh:17
static const char * DEBUG_FILENAME_DEFAULT
Definition: debug.hh:84