Visual Servoing Platform  version 3.6.1 under development (2024-03-18)
Debug and exceptions

Classes

class  vpTraceOutput
 
class  vpDisplayException
 
class  vpException
 
class  vpImageException
 
class  vpIoException
 
class  vpMatrixException
 
class  vpTrackingException
 

Macros

#define vpIN_FCT   (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, false, "begin "))
 
#define vpOUT_FCT   (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, false, "end "))
 
#define vpCTRACE   std::cout << "(L0) " << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") : "
 
#define vpCERROR   std::cerr << "(L0) " << "!!\t" << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") : "
 
#define vpERROR_TRACE   (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, true))
 
#define vpTRACE   (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, false))
 
#define vpDERROR_TRACE   (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, true))
 
#define vpDEBUG_TRACE   (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, false))
 
#define vpCDEBUG(level)
 
#define vpDEBUG_ENABLE(level)   (VP_DEBUG_MODE >= level)
 

Detailed Description

Debug and exceptions.

Macro Definition Documentation

◆ vpCDEBUG

#define vpCDEBUG (   level)
Value:
if (VP_DEBUG_MODE < level) \
; \
else \
std::cout << "(L" << level << ") " << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") : "

vpCDEBUG(level) work like the C++ output stream std::cout.

#define VP_DEBUG // Activate the debug mode
#define VP_DEBUG_MODE 2 // Activate debug level 1 and 2
#include <visp3/core/vpDebug.h>
int main()
{
// C++-like debug printings
vpCTRACE << "C++-like trace" << std::endl; // stdout
vpCERROR << "C++-like error trace" << std::endl; // stderr
// Printing if VP_DEBUG defined and VP_DEBUG_MODE value >= 2
vpCDEBUG(2) << "C++-like debug trace level 2" << std::endl; // stdout
}
#define vpCTRACE
Definition: vpDebug.h:329
#define vpCDEBUG(level)
Definition: vpDebug.h:497
#define vpCERROR
Definition: vpDebug.h:356
See also
vpCTRACE(), vpCERROR()
Examples
tutorial-trace.cpp.

Definition at line 497 of file vpDebug.h.

◆ vpCERROR

#define vpCERROR   std::cerr << "(L0) " << "!!\t" << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") : "

Used to display error messages on the error stream (C++). Use like this : vpCERROR<<"my message"<<std::endl;

#define VP_TRACE // To activate trace mode
#define VP_DEBUG // To activate the debug mode
#define VP_DEBUG_MODE 2 // To activate debug level 1 and 2
#include <visp3/core/vpDebug.h>
int main()
{
// C++-like debug printings
vpCTRACE << "C++-like trace" << std::endl; // stdout
vpCERROR << "C++-like error trace" << std::endl; // stderr
// Printing if VP_DEBUG defined and VP_DEBUG_MODE value >= 2
vpCDEBUG(2) << "C++-like debug trace level 2" << std::endl; // stdout
}
See also
vpCTRACE(), vpCDEBUG()
Examples
test1394TwoGrabber.cpp, test1394TwoResetBus.cpp, testPylonGrabber.cpp, and tutorial-trace.cpp.

Definition at line 356 of file vpDebug.h.

◆ vpCTRACE

#define vpCTRACE   std::cout << "(L0) " << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") : "

Used to display trace messages on the standard stream (C++). Use like this : vpCTRACE << "my message" << std::endl;

#define VP_TRACE // To activate trace mode
#define VP_DEBUG // To activate the debug mode
#define VP_DEBUG_MODE 2 // To activate debug level 1 and 2
#include <visp3/core/vpDebug.h>
int main()
{
// C++-like debug printings
vpCTRACE << "C++-like trace" << std::endl; // stdout
vpCERROR << "C++-like error trace" << std::endl; // stderr
// Printing if VP_DEBUG defined and VP_DEBUG_MODE value >= 2
vpCDEBUG(2) << "C++-like debug trace level 2" << std::endl; // stdout
}
See also
vpTRACE(), vpCERROR(), vpCDEBUG()
Examples
AROgre.cpp, AROgreBasic.cpp, grabDirectShow.cpp, movePtu46.cpp, testClick.cpp, testTrackDot.cpp, testVideoDevice.cpp, trackDot.cpp, trackDot2.cpp, trackDot2WithAutoDetection.cpp, trackMeCircle.cpp, trackMeLine.cpp, and tutorial-trace.cpp.

Definition at line 329 of file vpDebug.h.

◆ vpDEBUG_ENABLE

#define vpDEBUG_ENABLE (   level)    (VP_DEBUG_MODE >= level)

vpDEBUG_ENABLE(level) is equal to 1 if the debug level level is greater than the debug mode VP_DEBUG_MODE, 0 else.

#define VP_DEBUG // Activate the debug mode
#define VP_DEBUG_MODE 2 // Activate debug level 1 and 2
#include <visp3/core/vpDebug.h>
int main()
{
// Check the active debug levels
std::cout << "Debug level 1 active: " << vpDEBUG_ENABLE(1) << std::endl;
std::cout << "Debug level 2 active: " << vpDEBUG_ENABLE(2) << std::endl;
std::cout << "Debug level 3 active: " << vpDEBUG_ENABLE(3) << std::endl;
}
#define vpDEBUG_ENABLE(level)
Definition: vpDebug.h:524
Examples
tutorial-trace.cpp.

Definition at line 524 of file vpDebug.h.

◆ vpDEBUG_TRACE

#define vpDEBUG_TRACE   (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, false))

vpDEBUG_TRACE works like printf, but prints only if the tracing level level is greater than the debug level VP_DEBUG_MODE.

#define VP_DEBUG // Activate the debug mode
#define VP_DEBUG_MODE 2 // Activate debug level 1 and 2
#include <visp3/core/vpDebug.h>
int main()
{
// Printing if VP_DEBUG defined and VP_DEBUG_MODE value >= 2
vpDEBUG_TRACE(2, "C-like debug trace level 2"); // stdout
vpDERROR_TRACE(2, "C-like error trace level 2"); // stderr
}
#define vpDEBUG_TRACE
Definition: vpDebug.h:473
#define vpDERROR_TRACE
Definition: vpDebug.h:450
See also
vpDERROR_TRACE()
Examples
servoPtu46Point2DArtVelocity.cpp, and tutorial-trace.cpp.

Definition at line 473 of file vpDebug.h.

◆ vpDERROR_TRACE

#define vpDERROR_TRACE   (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, true))

vpDERROR_TRACE works like printf, but prints only if the tracing level is smaller than the debug level VP_DEBUG_MODE.

#define VP_DEBUG // Activate the debug mode
#define VP_DEBUG_MODE 2 // Activate debug level 1 and 2
#include <visp3/core/vpDebug.h>
int main()
{
// Printing if VP_DEBUG defined and VP_DEBUG_MODE value >= 2
vpDEBUG_TRACE(2, "C-like debug trace level 2"); // stdout
vpDERROR_TRACE(2, "C-like error trace level 2"); // stderr
}
See also
vpDEBUG_TRACE()
Examples
tutorial-trace.cpp.

Definition at line 450 of file vpDebug.h.

◆ vpERROR_TRACE

#define vpERROR_TRACE   (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, true))

Used to display error messages on the error stream. Prints the name of the file, the function name and the line where it was used. Use like this : vpERROR_TRACE("my error message number %d", i); with any "printf" string.

#define VP_TRACE // To activate trace mode
#define VP_DEBUG_MODE 2 // Activate debug level 1 and 2
#include <visp3/core/vpDebug.h>
int main()
{
// Printing depend only VP_DEBUG_MODE value is >= 1
vpTRACE(1, "C-like trace level 1"); // stdout
vpERROR_TRACE(1, "C-like error trace level 1"); // stderr
}
#define vpTRACE
Definition: vpDebug.h:405
#define vpERROR_TRACE
Definition: vpDebug.h:382
See also
vpTRACE()
Examples
AROgre.cpp, AROgreBasic.cpp, movePtu46.cpp, servoPtu46Point2DArtVelocity.cpp, servoSimuCylinder2DCamVelocityDisplay.cpp, servoSimuLine2DCamVelocityDisplay.cpp, servoSimuSquareLine2DCamVelocityDisplay.cpp, testClick.cpp, testIoPPM.cpp, testMouseEvent.cpp, testNurbs.cpp, testTrackDot.cpp, testVideoDevice.cpp, testVideoDeviceDual.cpp, and tutorial-trace.cpp.

Definition at line 382 of file vpDebug.h.

◆ vpIN_FCT

#define vpIN_FCT   (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, false, "begin "))

Works like vpTRACE() and should be used at the beginning of a function.

#define VP_TRACE // To activate the trace mode
#include <visp3/core/vpDebug.h>
int main()
{
vpIN_FCT("main()");
// the body of the main() function
vpOUT_FCT("main()");
}
#define vpIN_FCT
Definition: vpDebug.h:269
#define vpOUT_FCT
Definition: vpDebug.h:289
See also
vpOUT_FCT
Examples
tutorial-trace.cpp.

Definition at line 269 of file vpDebug.h.

◆ vpOUT_FCT

#define vpOUT_FCT   (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, false, "end "))

Works like vpTRACE() and should be used at the end of a function.

#define VP_TRACE // To activate the trace mode
#include <visp3/core/vpDebug.h>
int main()
{
vpIN_FCT("main()");
// the body of the main() function
vpOUT_FCT("main()");
}
See also
vpIN_FCT
Examples
tutorial-trace.cpp.

Definition at line 289 of file vpDebug.h.

◆ vpTRACE

#define vpTRACE   (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, false))