54 #include <visp/vpConfig.h>
62 # define __FUNCTION__ " "
67 # define VP_DEBUG_MODE 0
140 const char* currentFile;
141 const char* currentFunc;
159 vpTraceOutput(
const char* file,
int line,
const char* func,
bool error=
false,
const char * s=NULL) :
175 if(VP_DEBUG_MODE >= niv)
179 va_start(args, format);
182 std::cerr <<
"(N" << niv <<
") " ;
184 std::cout <<
"(N" << niv <<
") " ;
201 va_start(args, format);
222 void display(
const char* format, va_list args)
228 if(header != NULL) std::cerr<<header;
230 std::cerr <<
"!!\t" << currentFile <<
": " <<currentFunc <<
"(#" << currentLine <<
") :" ;
232 vfprintf (stderr, format, args);
233 fprintf (stderr,
"\n");
240 if(header != NULL) std::cout<<header;
242 std::cout <<currentFile <<
": " << currentFunc <<
"(#" << currentLine <<
") :" ;
244 vprintf (format, args);
275 #define vpIN_FCT (vpTraceOutput(__FILE__,__LINE__, __FUNCTION__, false, "begin "))
295 #define vpOUT_FCT (vpTraceOutput(__FILE__,__LINE__, __FUNCTION__, false, "end "))
327 #define vpCTRACE std::cout << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") :"
354 #define vpCERROR std::cerr << "!!\t" << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") :"
379 #define vpERROR_TRACE (vpTraceOutput( __FILE__,__LINE__, __FUNCTION__, true))
401 #define vpTRACE (vpTraceOutput( __FILE__,__LINE__, __FUNCTION__, false))
431 #define vpDERROR_TRACE (vpTraceOutput( __FILE__,__LINE__, __FUNCTION__, true))
454 #define vpDEBUG_TRACE (vpTraceOutput( __FILE__,__LINE__, __FUNCTION__, false))
478 #define vpCDEBUG(niv) if (VP_DEBUG_MODE < niv) ; else \
479 std::cout << "(N" << niv << ") "<< __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") :"
502 #define vpDEBUG_ENABLE(niv) (VP_DEBUG_MODE >= niv)
509 #define vpCDEBUG(niv) if(false) std::cout // Warning C4127
510 #define vpDEBUG_ENABLE(niv) (false) // Warning C4127
518 #define DEFENSIF(a) (a)
520 #define DEFENSIF(a) (0)
This class is used to display debug or error messages.
vpTraceOutput(const char *file, int line, const char *func, bool error=false, const char *s=NULL)
void operator()(const char *format,...)
void display(const char *format, va_list args)
void operator()(int niv, const char *format,...)