AGX Dynamics 2.39.0.0
Loading...
Searching...
No Matches
debug.h File Reference
#include <cassert>
#include <cstdlib>
#include <stdexcept>
#include <cstdarg>
#include <cstdio>
#include <string>
#include <agx/agxCore_export.h>

Go to the source code of this file.

Namespaces

namespace  agx
 The agx namespace contains the dynamics/math part of the AGX Dynamics API.
 

Macros

#define AGX_ASM_COMMENT(X)
 
#define agx_fprintf   fprintf
 
#define AGX_FUNCTION   __PRETTY_FUNCTION__
 
#define AGX_MACRO(x)   do {x} while(0)
 
#define AGX_NO_RETURN
 
#define agx_snprintf   snprintf
 
#define AGX_WHERE_AM_I   agx::buildErrorString("[%s:%u (%s)]", "", __FILE__, __LINE__, AGX_FUNCTION)
 
#define agxAbort()   AGX_MACRO(fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxAbort", "", __FILE__, __LINE__ ).c_str()); agx::abort();)
 
#define agxAbort1(msg)   AGX_MACRO(fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxAbort: ", "%s", __FILE__, __LINE__, agx::cStr(msg)).c_str()); agx::abort();)
 
#define agxAbortN(format, ...)   AGX_MACRO(fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxAbort: ", format, __FILE__, __LINE__, ##__VA_ARGS__).c_str()); agx::abort();)
 
#define agxAssert(expr)   AGX_MACRO(if (!(expr)) {fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxAssert failed: `%s'", "", __FILE__, __LINE__, #expr).c_str()); agx::abort();})
 
#define agxAssert1(expr, msg)   AGX_MACRO(if (!(expr)) {fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxAssert failed: `%s', ", "%s", __FILE__, __LINE__, #expr, agx::cStr(msg)).c_str()); agx::abort();})
 
#define agxAssertN(expr, format, ...)   AGX_MACRO(if (!(expr)) {fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxAssert failed: `%s', ", format, __FILE__, __LINE__, #expr, ##__VA_ARGS__).c_str()); agx::abort();})
 
#define agxAssertVoid()   AGX_MACRO( {fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxAssert failed: `%s'", "", __FILE__, __LINE__).c_str()); agx::abort();})
 
#define agxDebugVerify(expr)   agxAssert(expr)
 
#define agxDebugVerify1(expr, msg)   agxAssert1(expr, msg)
 
#define agxDebugVerifyN(expr, format, ...)   agxAssertN(expr, format, __VA_ARGS__)
 
#define agxThrow   throw agx_internal::ExceptionDescriber(AGX_WHERE_AM_I) %
 
#define agxVerify(expr)   AGX_MACRO(if (!(expr)) {fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxVerify failed: `%s'", "", __FILE__, __LINE__, #expr).c_str()); agx::abort();})
 
#define agxVerify1(expr, msg)   AGX_MACRO(if (!(expr)) {fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxVerify failed: `%s', ", "%s", __FILE__, __LINE__, #expr, agx::cStr(msg)).c_str()); agx::abort();})
 
#define agxVerifyN(expr, format, ...)   AGX_MACRO(if (!(expr)) {fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxVerify failed: `%s', ", format, __FILE__, __LINE__, #expr, ##__VA_ARGS__).c_str()); agx::abort();})
 
#define agxVerifyThrow(expr)   AGX_MACRO(if (!(expr)) {std::string errorMessage = agx::buildErrorString("[%s:%u] agxVerify failed: `%s'", "", __FILE__, __LINE__, #expr); agxThrow agx::Error(errorMessage);})
 
#define agxVerifyThrow1(expr, msg)   AGX_MACRO(if (!(expr)) {std::string errorMessage = agx::buildErrorString("[%s:%u] agxVerify failed: `%s', ", "%s", __FILE__, __LINE__, #expr, agx::cStr(msg)); agxThrow agx::Error(errorMessage);})
 
#define agxVerifyThrowN(expr, format, ...)   AGX_MACRO(if (!(expr)) {std::string errorMessage = agx::buildErrorString("[%s:%u] agxVerify failed: `%s', ", format, __FILE__, __LINE__, #expr, ##__VA_ARGS__); agxThrow agx::Error(errorMessage);})
 

Typedefs

typedef std::runtime_error agx::Error
 

Functions

AGXCORE_EXPORT void agx::abort () AGX_NO_RETURN
 
AGXCORE_EXPORT std::string agx::buildErrorString (const char *baseFormat, std::string msgFormat,...)
 
AGXCORE_EXPORT const char * agx::cStr (const char *str)
 
AGXCORE_EXPORT const char * agx::cStr (const std::string &str)
 
AGXCORE_EXPORT int agx::getExceptionNotifyLevel ()
 
AGXCORE_EXPORT void agx::log_throw (const std::string &where, const char *what)
 
AGXCORE_EXPORT int agx::setExceptionNotifyLevel (int level)
 

Macro Definition Documentation

◆ AGX_ASM_COMMENT

#define AGX_ASM_COMMENT (   X)

Definition at line 172 of file debug.h.

◆ agx_fprintf

#define agx_fprintf   fprintf

Definition at line 127 of file debug.h.

◆ AGX_FUNCTION

#define AGX_FUNCTION   __PRETTY_FUNCTION__

Definition at line 60 of file debug.h.

◆ AGX_MACRO

#define AGX_MACRO (   x)    do {x} while(0)

Definition at line 125 of file debug.h.

◆ AGX_NO_RETURN

#define AGX_NO_RETURN

Definition at line 32 of file debug.h.

◆ agx_snprintf

#define agx_snprintf   snprintf

Definition at line 126 of file debug.h.

◆ AGX_WHERE_AM_I

#define AGX_WHERE_AM_I   agx::buildErrorString("[%s:%u (%s)]", "", __FILE__, __LINE__, AGX_FUNCTION)

Definition at line 64 of file debug.h.

◆ agxAbort

#define agxAbort ( )    AGX_MACRO(fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxAbort", "", __FILE__, __LINE__ ).c_str()); agx::abort();)

Definition at line 164 of file debug.h.

◆ agxAbort1

#define agxAbort1 (   msg)    AGX_MACRO(fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxAbort: ", "%s", __FILE__, __LINE__, agx::cStr(msg)).c_str()); agx::abort();)

Definition at line 165 of file debug.h.

◆ agxAbortN

#define agxAbortN (   format,
  ... 
)    AGX_MACRO(fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxAbort: ", format, __FILE__, __LINE__, ##__VA_ARGS__).c_str()); agx::abort();)

Definition at line 166 of file debug.h.

◆ agxAssert

#define agxAssert (   expr)    AGX_MACRO(if (!(expr)) {fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxAssert failed: `%s'", "", __FILE__, __LINE__, #expr).c_str()); agx::abort();})

Definition at line 143 of file debug.h.

◆ agxAssert1

#define agxAssert1 (   expr,
  msg 
)    AGX_MACRO(if (!(expr)) {fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxAssert failed: `%s', ", "%s", __FILE__, __LINE__, #expr, agx::cStr(msg)).c_str()); agx::abort();})

Definition at line 144 of file debug.h.

◆ agxAssertN

#define agxAssertN (   expr,
  format,
  ... 
)    AGX_MACRO(if (!(expr)) {fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxAssert failed: `%s', ", format, __FILE__, __LINE__, #expr, ##__VA_ARGS__).c_str()); agx::abort();})

Definition at line 145 of file debug.h.

◆ agxAssertVoid

#define agxAssertVoid ( )    AGX_MACRO( {fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxAssert failed: `%s'", "", __FILE__, __LINE__).c_str()); agx::abort();})

Definition at line 142 of file debug.h.

◆ agxDebugVerify

#define agxDebugVerify (   expr)    agxAssert(expr)

Definition at line 148 of file debug.h.

◆ agxDebugVerify1

#define agxDebugVerify1 (   expr,
  msg 
)    agxAssert1(expr, msg)

Definition at line 149 of file debug.h.

◆ agxDebugVerifyN

#define agxDebugVerifyN (   expr,
  format,
  ... 
)    agxAssertN(expr, format, __VA_ARGS__)

Definition at line 150 of file debug.h.

◆ agxThrow

#define agxThrow   throw agx_internal::ExceptionDescriber(AGX_WHERE_AM_I) %

Definition at line 109 of file debug.h.

◆ agxVerify

#define agxVerify (   expr)    AGX_MACRO(if (!(expr)) {fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxVerify failed: `%s'", "", __FILE__, __LINE__, #expr).c_str()); agx::abort();})

Definition at line 131 of file debug.h.

◆ agxVerify1

#define agxVerify1 (   expr,
  msg 
)    AGX_MACRO(if (!(expr)) {fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxVerify failed: `%s', ", "%s", __FILE__, __LINE__, #expr, agx::cStr(msg)).c_str()); agx::abort();})

Definition at line 132 of file debug.h.

◆ agxVerifyN

#define agxVerifyN (   expr,
  format,
  ... 
)    AGX_MACRO(if (!(expr)) {fprintf(stderr, "%s\n", agx::buildErrorString("[%s:%u] agxVerify failed: `%s', ", format, __FILE__, __LINE__, #expr, ##__VA_ARGS__).c_str()); agx::abort();})

Definition at line 133 of file debug.h.

◆ agxVerifyThrow

#define agxVerifyThrow (   expr)    AGX_MACRO(if (!(expr)) {std::string errorMessage = agx::buildErrorString("[%s:%u] agxVerify failed: `%s'", "", __FILE__, __LINE__, #expr); agxThrow agx::Error(errorMessage);})

Definition at line 135 of file debug.h.

◆ agxVerifyThrow1

#define agxVerifyThrow1 (   expr,
  msg 
)    AGX_MACRO(if (!(expr)) {std::string errorMessage = agx::buildErrorString("[%s:%u] agxVerify failed: `%s', ", "%s", __FILE__, __LINE__, #expr, agx::cStr(msg)); agxThrow agx::Error(errorMessage);})

Definition at line 136 of file debug.h.

◆ agxVerifyThrowN

#define agxVerifyThrowN (   expr,
  format,
  ... 
)    AGX_MACRO(if (!(expr)) {std::string errorMessage = agx::buildErrorString("[%s:%u] agxVerify failed: `%s', ", format, __FILE__, __LINE__, #expr, ##__VA_ARGS__); agxThrow agx::Error(errorMessage);})

Definition at line 137 of file debug.h.