10 #ifndef SOT_CORE_DEBUG_HH 11 #define SOT_CORE_DEBUG_HH 20 #define VP_DEBUG_MODE 0 23 #ifndef VP_TEMPLATE_DEBUG_MODE 24 #define VP_TEMPLATE_DEBUG_MODE 0 27 #define SOT_COMMON_TRACES \ 30 va_start(arg, format); \ 31 vsnprintf(charbuffer, SIZE, format, arg); \ 33 outputbuffer << tmpbuffer.str() << charbuffer << std::endl; \ 40 static const int SIZE = 512;
44 char charbuffer[SIZE + 1];
50 inline void trace(
const int level,
const char *format, ...) {
55 inline void trace(
const char *format, ...) {
60 inline void trace(
const int level = -1) {
61 if (level <= traceLevel) outputbuffer << tmpbuffer.str();
83 static void openFile(
const char *filename = DEBUG_FILENAME_DEFAULT);
84 static void closeFile(
const char *filename = DEBUG_FILENAME_DEFAULT);
94 __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") :" 97 "\t!! " << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") :" 99 #define sotDEBUG(level) \ 100 if ((level > VP_DEBUG_MODE) || \ 101 (!dynamicgraph::sot::sotDEBUGFLOW.outputbuffer.good())) \ 104 dynamicgraph::sot::sotDEBUGFLOW.outputbuffer << sotPREDEBUG 106 #define sotDEBUGMUTE(level) \ 107 if ((level > VP_DEBUG_MODE) || \ 108 (!dynamicgraph::sot::sotDEBUGFLOW.outputbuffer.good())) \ 111 dynamicgraph::sot::sotDEBUGFLOW.outputbuffer 114 if (!dynamicgraph::sot::sotDEBUGFLOW.outputbuffer.good()) \ 117 dynamicgraph::sot::sotERRORFLOW.outputbuffer << sotPREERROR 120 if (!dynamicgraph::sot::sotDEBUGFLOW.outputbuffer.good()) \ 123 dynamicgraph::sot::sotDEBUGFLOW \ 124 .pre(dynamicgraph::sot::sotDEBUGFLOW.tmpbuffer << sotPREDEBUG, \ 129 if (!dynamicgraph::sot::sotDEBUGFLOW.outputbuffer.good()) \ 132 sot::sotERRORFLOW.pre(sot::sotERRORFLOW.tmpbuffer << sotPREERROR).trace 135 #define sotTDEBUG(level) \ 136 if ((level > VP_TEMPLATE_DEBUG_MODE) || \ 137 (!dynamicgraph::sot::sotDEBUGFLOW.outputbuffer.good())) \ 140 dynamicgraph::sot::sotDEBUGFLOW.outputbuffer << sotPREDEBUG 143 if (!dynamicgraph::sot::sotDEBUGFLOW.outputbuffer.good()) \ 146 dynamicgraph::sot::sotDEBUGFLOW \ 147 .pre(dynamicgraph::sot::sotDEBUGFLOW.tmpbuffer << sotPREDEBUG, \ 148 VP_TEMPLATE_DEBUG_MODE) \ 163 #define sotPREERROR \ 164 "\t!! " << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") :" 165 #define sotDEBUG(level) \ 169 ::dynamicgraph::sot::__null_stream() 170 #define sotDEBUGMUTE(level) \ 174 ::dynamicgraph::sot::__null_stream() 175 #define sotERROR sotERRORFLOW.outputbuffer << sotPREERROR 186 static std::ostream os(NULL);
193 #define sotTDEBUG(level) \ 197 ::dynamicgraph::sot::__null_stream() 206 #define sotDEBUG_ENABLE(level) false 207 #define sotTDEBUG_ENABLE(level) false 211 #define sotDEBUGIN(level) sotDEBUG(level) << "# In {" << std::endl 212 #define sotDEBUGOUT(level) sotDEBUG(level) << "# Out }" << std::endl 213 #define sotDEBUGINOUT(level) sotDEBUG(level) << "# In/Out { }" << std::endl 215 #define sotTDEBUGIN(level) sotTDEBUG(level) << "# In {" << std::endl 216 #define sotTDEBUGOUT(level) sotTDEBUG(level) << "# Out }" << std::endl 217 #define sotTDEBUGINOUT(level) sotTDEBUG(level) << "# In/Out { }" << std::endl SOT_CORE_EXPORT DebugTrace sotERRORFLOW
void trace(const char *format,...)
DebugTrace(std::ostream &os)
#define sotTDEBUG_ENABLE(level)
DebugTrace & pre(const std::ostream &)
#define sotDEBUG_ENABLE(level)
std::ostream & __null_stream()
std::stringstream tmpbuffer
void sotTDEBUGF(const int, const char *,...)
void traceTemplate(const char *format,...)
void traceTemplate(const int level, const char *format,...)
void sotERRORF(const int, const char *,...)
void trace(const int level=-1)
#define SOT_COMMON_TRACES
VP_TEMPLATE_DEBUG_MODE.
void trace(const int level, const char *format,...)
DebugTrace & pre(const std::ostream &, int level)
void sotDEBUGF(const int, const char *,...)
#define VP_TEMPLATE_DEBUG_MODE
VP_DEBUG_MODE.
std::ostream & outputbuffer
SOT_CORE_EXPORT DebugTrace sotDEBUGFLOW
static const char * DEBUG_FILENAME_DEFAULT