![]() |
IRSOL
C++ code implementing socket server for interacting with Baumer camera.
|
Assertion macros and utilities based on the PPK_ASSERT library. More...
#include <ppk_assert/ppk_assert.hpp>
Go to the source code of this file.
Namespaces | |
namespace | irsol |
namespace | irsol::internal |
Macros | |
#define | PPK_ASSERT_ENABLED 1 |
#define | IRSOL_ASSERT_DEBUG PPK_ASSERT_DEBUG |
Debug-level assertion macro. | |
#define | IRSOL_ASSERT_ERROR PPK_ASSERT_ERROR |
Error-level assertion macro. | |
#define | IRSOL_ASSERT_FATAL PPK_ASSERT_FATAL |
Fatal-level assertion macro. | |
#define | IRSOL_ASSERT_FALSE(message) IRSOL_ASSERT_FATAL(false, message) |
Assertion macro that always fails fatally. | |
#define | IRSOL_STATIC_ASSERT PPK_STATIC_ASSERT |
Compile-time static assertion macro. | |
Typedefs | |
using | irsol::AssertionException = ppk::assert::AssertionException |
typedef ppk::assert::implementation::AssertAction::AssertAction(* | irsol::AssertHandler) (const char *file, int line, const char *function, const char *expression, int level, const char *message) |
Functions | |
void | irsol::setAssertHandler (AssertHandler handler) |
Sets a custom assertion handler function. | |
void | irsol::initAssertHandler () |
Initializes the assertion handler system. | |
ppk::assert::implementation::AssertAction::AssertAction | irsol::internal::assertHandler (const char *file, int line, const char *function, const char *expression, int level, const char *message) |
Internal default assertion handler implementation. | |
Assertion macros and utilities based on the PPK_ASSERT library.
This header provides assertion macros with configurable behavior, exception types, and customizable assertion handlers for the irsol library. It wraps and controls usage of the underlying PPK_ASSERT assertion framework, allowing fine-grained control over debug, error, and fatal assertions.
The header supports disabling assertions via IRSOL_DISABLE_ASSERT
, with compile-time checks to prevent conflicting macros.
For more details on the usage of assertion mechanism, please see 00-logging-and-asserting. Assertions help catch programming errors and invalid states. This system supports multiple assertion levels with distinct semantics:
Level | When to Use | Behavior in Debug Mode | Behavior in Release Mode |
---|---|---|---|
IRSOL_ASSERT_DEBUG | Check internal invariants, sanity checks | Logs warning, continues execution (ignored) | Logs warning, continues execution (ignored) |
IRSOL_ASSERT_ERROR | Recoverable errors, invalid input detected | Logs error and throws an exception that can be caught | Logs error and throws an exception that can be caught |
IRSOL_ASSERT_FATAL | Critical failure, unrecoverable state | Logs error and aborts program immediately | Logs fatal and aborts program immediately |
Definition in file assert.hpp.
#define PPK_ASSERT_ENABLED 1 |
Definition at line 128 of file assert.hpp.