Defines madness::MadnessException
for exception handling.
More...
#include <cstdlib>
#include <iosfwd>
#include <exception>
#include <madness/madness_config.h>
Go to the source code of this file.
|
| madness |
| File holds all helper structures necessary for the CC_Operator and CC2 class.
|
|
Defines madness::MadnessException
for exception handling.
By default, the MADNESS_ASSERT
macro throws a madness::MadnessException
. Configure options can specify other behaviors: MADNESS_ASSERT
can be
- THROW: (default) throw a
madness::MadnessException
.
- ASSERT: defer to the standard
assert
function.
- DISABLE: do nothing (ignore the assertion).
- ABORT: abort execution.
◆ MADNESS_ASSERT
#define MADNESS_ASSERT |
( |
|
condition | ) |
|
Assert a condition that should be free of side-effects since in release builds this might be a no-op.
Depending on the configuration, one of the following happens if condition
is false:
- a
madness::MadnessException
is thrown.
assert(condition)
is called.
- execution is aborted.
- nothing.
- Parameters
-
[in] | condition | The condition to be asserted. |
◆ MADNESS_ASSERT_NOEXCEPT
#define MADNESS_ASSERT_NOEXCEPT |
( |
|
condition | ) |
|
Same as MADNESS_ASSERT , but never throws.
Behaves like MADNESS_ASSERT, except when the latter throws madness::MadnessException this aborts
- Parameters
-
[in] | condition | The condition to be asserted. |
◆ MADNESS_CHECK [1/2]
#define MADNESS_CHECK |
( |
|
condition | ) |
|
Check a condition — even in a release build the condition is always evaluated so it can have side effects.
Depending on the configuration, one of the following happens if condition
is false:
◆ MADNESS_CHECK [2/2]
#define MADNESS_CHECK |
( |
|
condition | ) |
|
Value: do { \
(#condition),0,__LINE__,__FUNCTION__,__FILE__); \
} \
} while (0)
Base class for exceptions thrown in MADNESS.
Definition: madness_exception.h:66
#define MADNESS_DISPLAY_EXCEPTION_BREAK_MESSAGE
Display the exception break message unless otherwise specified.
Definition: madness_exception.h:58
void exception_break(bool message)
This function is executed just before a MadnessException is thrown.
Definition: madness_exception.cc:59
Check a condition — even in a release build the condition is always evaluated so it can have side effects.
Depending on the configuration, one of the following happens if condition
is false:
◆ MADNESS_CHECK_THROW [1/2]
#define MADNESS_CHECK_THROW |
( |
|
condition, |
|
|
|
msg |
|
) |
| |
Check a condition — even in a release build the condition is always evaluated so it can have side effects.
will always throw a madness::MadnessException, but will not print to stderr
- Parameters
-
[in] | condition | The condition to be checked. |
[in] | msg | The message to be printed |
◆ MADNESS_CHECK_THROW [2/2]
#define MADNESS_CHECK_THROW |
( |
|
condition, |
|
|
|
msg |
|
) |
| |
Value: do { \
if (!(condition)) { \
} \
} while (0)
Check a condition — even in a release build the condition is always evaluated so it can have side effects.
will always throw a madness::MadnessException, but will not print to stderr
- Parameters
-
[in] | condition | The condition to be checked. |
[in] | msg | The message to be printed |
◆ MADNESS_DISPLAY_EXCEPTION_BREAK_MESSAGE
#define MADNESS_DISPLAY_EXCEPTION_BREAK_MESSAGE 1 |
Display the exception break message unless otherwise specified.
◆ MADNESS_EXCEPTION
#define MADNESS_EXCEPTION |
( |
|
msg, |
|
|
|
value |
|
) |
| |
Value:
Macro for throwing a MADNESS exception.
- Exceptions
-
- Parameters
-
[in] | msg | The error message. |
[in] | value | The value associated with the exception. |