|
#define | NF_ERROR_MESSAGE(message) "Error: " << message << "\nFile: " << __FILE__ << "\nLine: " << __LINE__ << "\n" |
| Macro for generating an error message without debug information.
|
|
#define | NF_ERROR_EXIT(message) |
| Macro for printing an error message and aborting the program.
|
|
#define | NF_THROW(message) throw NeoFOAM::NeoFOAMException((std::stringstream() << NF_ERROR_MESSAGE(message)).str()) |
| Macro for throwing a NeoFOAMException with the specified error message.
|
|
#define | NF_ASSERT(condition, message) |
| Macro for asserting a condition and printing an error message if the condition is false.
|
|
#define | NF_ASSERT_THROW(condition, message) |
| Macro for asserting a condition and throwing a NeoFOAMException if the condition is false.
|
|
#define | NF_DEBUG_ASSERT(condition, message) ((void)0) |
| Macro for asserting a condition and printing an error message if the condition is false (only in debug mode).
|
|
#define | NF_DEBUG_ASSERT_THROW(condition, message) ((void)0) |
| Macro for asserting a condition and throwing a NeoFOAMException if the condition is false (only in debug mode).
|
|
#define | NF_ASSERT_EQUAL(a, b) NF_ASSERT(a == b, "Expected " << b << ", got " << a) |
| Macro for asserting that two values are equal and printing an error message if they are not.
|
|
#define | NF_DEBUG_ASSERT_EQUAL(a, b) NF_DEBUG_ASSERT(a == b, "Expected " << b << ", got " << a) |
| Macro for asserting that two values are equal and printing an error message if they are not (only in debug mode).
|
|
#define | NF_ASSERT_EQUAL_THROW(a, b) NF_ASSERT_THROW(a == b, "Expected " << b << ", got " << a) |
| Macro for asserting that two values are equal and throwing a NeoFOAMException if they are not.
|
|
#define | NF_DEBUG_ASSERT_EQUAL_THROW(a, b) NF_DEBUG_ASSERT_THROW(a == b, "Expected " << b << ", got " << a) |
| Macro for asserting that two values are equal and throwing a NeoFOAMException if they are not (only in debug mode).
|
|
#define NF_ASSERT |
( |
|
condition, |
|
|
|
message |
|
) |
| |
Value: do \
{ \
if (!(condition)) [[unlikely]] \
{ \
NF_ERROR_EXIT("Assertion `" #condition "` failed.\n " << message); \
} \
} \
while (false)
Macro for asserting a condition and printing an error message if the condition is false.
This macro checks the specified condition and, if it evaluates to false, prints an error message to the standard error stream, including the current file name and current line number, and then calls std::abort() to terminate the program.
- Parameters
-
condition | The condition to be checked. |
message | The error message to be printed if the condition is false. |
Definition at line 142 of file error.hpp.
#define NF_ASSERT_EQUAL |
( |
|
a, |
|
|
|
b |
|
) |
| NF_ASSERT(a == b, "Expected " << b << ", got " << a) |
Macro for asserting that two values are equal and printing an error message if they are not.
This macro checks that the two specified values are equal and, if they are not, prints an error message to the standard error stream, including the expected and actual values, the current file name, and the current line number, and then calls std::abort() to terminate the program.
- Parameters
-
a | The actual value to be compared. |
b | The expected value to be compared. |
Definition at line 239 of file error.hpp.
#define NF_ASSERT_EQUAL_THROW |
( |
|
a, |
|
|
|
b |
|
) |
| NF_ASSERT_THROW(a == b, "Expected " << b << ", got " << a) |
Macro for asserting that two values are equal and throwing a NeoFOAMException if they are not.
This macro checks that the two specified values are equal and, if they are not, constructs a std::stringstream to concatenate the expected and actual values with the current file name and current line number, and then throws a NeoFOAMException with the resulting string as the error message.
- Parameters
-
a | The actual value to be compared. |
b | The expected value to be compared. |
Definition at line 266 of file error.hpp.
#define NF_ASSERT_THROW |
( |
|
condition, |
|
|
|
message |
|
) |
| |
Value: do \
{ \
if (!(condition)) [[unlikely]] \
{ \
NF_THROW("Assertion `" #condition "` failed.\n " << message); \
} \
} \
while (false)
Macro for asserting a condition and throwing a NeoFOAMException if the condition is false.
This macro checks the specified condition and, if it evaluates to false, constructs a std::stringstream to concatenate the specified error message with the current file name and current line number, and then throws a NeoFOAMException with the resulting string as the error message.
- Parameters
-
condition | The condition to be checked. |
message | The error message to be included in the exception if the condition is false. |
Definition at line 165 of file error.hpp.