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 void trace(const char *format,...)
Definition: debug.hh:55
DebugTrace(std::ostream &os)
Definition: debug.hh:48
#define VP_DEBUG_MODE
Definition: debug.hh:20
#define sotTDEBUG_ENABLE(level)
Definition: debug.hh:207
SOT_CORE_EXPORT DebugTrace sotDEBUGFLOW
DebugTrace & pre(const std::ostream &)
Definition: debug.hh:75
#define sotDEBUG_ENABLE(level)
Definition: debug.hh:206
std::ostream & __null_stream()
Definition: debug.hh:183
std::stringstream tmpbuffer
Definition: debug.hh:42
void sotTDEBUGF(const int, const char *,...)
Definition: debug.hh:201
SOT_CORE_EXPORT DebugTrace sotERRORFLOW
void traceTemplate(const char *format,...)
Definition: debug.hh:70
#define SOT_CORE_EXPORT
Definition: api.hh:20
void traceTemplate(const int level, const char *format,...)
Definition: debug.hh:65
void sotERRORF(const int, const char *,...)
Definition: debug.hh:181
void trace(const int level=-1)
Definition: debug.hh:60
int traceLevelTemplate
Definition: debug.hh:46
#define SOT_COMMON_TRACES
VP_TEMPLATE_DEBUG_MODE.
Definition: debug.hh:27
void trace(const int level, const char *format,...)
Definition: debug.hh:50
int traceLevel
Definition: debug.hh:45
DebugTrace & pre(const std::ostream &, int level)
Definition: debug.hh:77
void sotDEBUGF(const int, const char *,...)
Definition: debug.hh:179
#define VP_TEMPLATE_DEBUG_MODE
VP_DEBUG_MODE.
Definition: debug.hh:24
std::ostream & outputbuffer
Definition: debug.hh:43
Definition: abstract-sot-external-interface.hh:17
static const char * DEBUG_FILENAME_DEFAULT
Definition: debug.hh:82