Visual Servoing Platform  version 3.6.1 under development (2024-07-27)
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>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
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:348
#define vpCDEBUG(level)
Definition: vpDebug.h:540
#define vpCERROR
Definition: vpDebug.h:379
See also
vpCTRACE(), vpCERROR()
Examples
tutorial-trace.cpp.

Definition at line 540 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>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
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 379 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>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
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 348 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>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
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:571
Examples
tutorial-trace.cpp.

Definition at line 571 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>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
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:512
#define vpDERROR_TRACE
Definition: vpDebug.h:485
See also
vpDERROR_TRACE()
Examples
servoPtu46Point2DArtVelocity.cpp, and tutorial-trace.cpp.

Definition at line 512 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>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
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 485 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>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
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:436
#define vpERROR_TRACE
Definition: vpDebug.h:409
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 409 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>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
int main()
{
vpIN_FCT("main()");
// the body of the main() function
vpOUT_FCT("main()");
}
#define vpIN_FCT
Definition: vpDebug.h:280
#define vpOUT_FCT
Definition: vpDebug.h:304
See also
vpOUT_FCT
Examples
tutorial-trace.cpp.

Definition at line 280 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>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
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 304 of file vpDebug.h.

◆ vpTRACE

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

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

#define VP_TRACE // To activate trace mode
#include <visp3/core/vpDebug.h>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
int main()
{
// C-like debug printings
vpTRACE("C-like trace"); // stdout
}
See also
vpCTRACE(), vpERROR_TRACE()
Examples
histogram.cpp, homographyHartleyDLT2DObject.cpp, mbtEdgeKltTracking.cpp, mbtEdgeTracking.cpp, mbtKltTracking.cpp, servoAfma4Point2DArtVelocity.cpp, servoAfma4Point2DCamVelocity.cpp, servoAfma62DhalfCamVelocity.cpp, servoAfma6Cylinder2DCamVelocity.cpp, servoAfma6Cylinder2DCamVelocitySecondaryTask.cpp, servoAfma6Ellipse2DCamVelocity.cpp, servoAfma6FourPoints2DArtVelocity.cpp, servoAfma6Line2DCamVelocity.cpp, servoAfma6Point2DArtVelocity.cpp, servoAfma6Points2DCamVelocityEyeToHand.cpp, servoAfma6SquareLines2DCamVelocity.cpp, servoAfma6TwoLines2DCamVelocity.cpp, servoPtu46Point2DArtVelocity.cpp, servoSimuAfma6FourPoints2DCamVelocity.cpp, servoViper850FourPoints2DArtVelocityLs_cur.cpp, servoViper850FourPoints2DArtVelocityLs_des.cpp, servoViper850FourPoints2DCamVelocityLs_cur.cpp, servoViper850FourPointsKinect.cpp, servoViper850Point2DArtVelocity.cpp, test1394TwoGrabber.cpp, test1394TwoResetBus.cpp, testPoint.cpp, testPylonGrabber.cpp, testTwistMatrix.cpp, testXmlParser.cpp, trackMeCircle.cpp, trackMeLine.cpp, and tutorial-trace.cpp.

Definition at line 436 of file vpDebug.h.