![]() |
ImFusion SDK 4.3
|
Assertion library. More...
Assertion library.
More powerful and flexible alternative to the basic assert()
of the C standard library. The assertion macro takes a condition to check and an optional message to display on failure.
Assertions are only checked if IMFUSION_ENABLE_ASSERTIONS
is defined.
As a library developer you can register a custom HanderFunction that should be called in case an assertion fails. The default handler function will print an error message to std::cout and offer the user the choice of ignoring once, ignoring always, debug trap, or quitting the application.
Macros | |
#define | IMFUSION_ASSERT(...) |
ImFusion assertion macro, supports two overloads: | |
Typedefs | |
using | HandlerFunction |
Alias for a function pointer that can be used to handle trapped assertions. | |
Functions | |
IMFUSION_CORE_API HandlerFunction | handler () |
Returns the currently set assertion handler function. | |
IMFUSION_CORE_API void | setHandler (HandlerFunction handler) |
Sets the assertion handler function to use. | |
IMFUSION_CORE_API void | defaultHandler (const char *condition, const char *message, const char *fileName, const char *functionName, int line) |
Handler function that is used by default to handle trapped assertions. | |
#define IMFUSION_ASSERT | ( | ... | ) |
#include <ImFusion/Core/Assert.h>
ImFusion assertion macro, supports two overloads:
Assertions are only checked if IMFUSION_ENABLE_ASSERTIONS
is defined.
IMFUSION_ASSERT_NOFUNCNAME()
which will forward an empty string as functionName to the registered HandlerFunction. This can help reducing binary bloat in templated header-only code where there are many different instantiations of the same template. using HandlerFunction |
#include <ImFusion/Core/Assert.h>
Alias for a function pointer that can be used to handle trapped assertions.
condition | Verbatim code of the assertion condition that trapped. |
message | Message that was attached to the assertion. |
fileName | Filename in which the assertion trapped. |
functionName | Function name where the assertion trapped. |
line | Line number in fileName where the assertion trapped. |
IMFUSION_CORE_API HandlerFunction handler | ( | ) |
#include <ImFusion/Core/Assert.h>
Returns the currently set assertion handler function.
IMFUSION_CORE_API void setHandler | ( | HandlerFunction | handler | ) |
#include <ImFusion/Core/Assert.h>
Sets the assertion handler function to use.
IMFUSION_CORE_API void defaultHandler | ( | const char * | condition, |
const char * | message, | ||
const char * | fileName, | ||
const char * | functionName, | ||
int | line ) |
#include <ImFusion/Core/Assert.h>
Handler function that is used by default to handle trapped assertions.
Will offer the user the choice of ignoring once, ignoring always, debug trap, or quitting the application.