| kassert
    1.0.0
    Assertion library for KaMPIng | 
Macros for asserting runtime checks. More...
#include <iostream>#include <string_view>#include <type_traits>#include <utility>#include <vector>#include "./internal/assertion_macros.hpp"#include "./internal/expression_decomposition.hpp"#include "./internal/logger.hpp"
Go to the source code of this file.
| Classes | |
| struct | kassert::internal::SourceLocation | 
| Describes a source code location.  More... | |
| class | kassert::KassertException | 
| The default exception type used together with THROWING_KASSERT. Reports the erroneous expression together with a custom error message.  More... | |
| Namespaces | |
| namespace | kassert::assert | 
| Assertion levels. | |
| Macros | |
| #define | KASSERT_ASSERTION_LEVEL_KTHROW 10 | 
| Assertion level for exceptions if exception mode is disabled. | |
| #define | KASSERT_ASSERTION_LEVEL_NORMAL 30 | 
| Default assertion level. This level is used if no assertion level is specified. | |
| #define | KASSERT_ASSERTION_LEVEL KASSERT_ASSERTION_LEVEL_NORMAL | 
| Default assertion level to kassert::assert::normalif not set explicitly. | |
| #define | KASSERT(...) | 
| Assertion macro. Accepts between one and three parameters. | |
| #define | THROWING_KASSERT(...) | 
| Macro for throwing exceptions. Accepts between one and three parameters. | |
| #define | THROWING_KASSERT_SPECIFIED(expression, message, exception_type, ...) KASSERT_KASSERT_HPP_THROWING_KASSERT_CUSTOM_IMPL(expression, exception_type, message, ##__VA_ARGS__) | 
| Macro for throwing custom exception. | |
| #define | KASSERT_ENABLED(level) level <= KASSERT_ASSERTION_LEVEL | 
| Checks if a assertion of the given level is enabled. This is controlled by the CMake option KASSERT_ASSERTION_LEVEL. This is the macro version of assertion_enabled for use in the preprocessor. | |
| Functions | |
| std::string | kassert::internal::build_what (std::string const &expression, SourceLocation const where, std::string const &message) | 
| Builds the description for an exception. | |
| constexpr bool | kassert::internal::assertion_enabled (int level) | 
| Checks if a assertion of the given level is enabled. This is controlled by the CMake option KASSERT_ASSERTION_LEVEL. | |
| bool | kassert::internal::evaluate_and_print_assertion (char const *type, bool result, SourceLocation const &where, char const *expr_str) | 
| Evaluates an assertion that could not be decomposed (i.e., expressions that use && or ||). If the assertion fails, prints an error describing the failed assertion. | |
| bool | kassert::internal::evaluate_and_print_assertion (char const *type, Expression &&expr, SourceLocation const &where, char const *expr_str) | 
| Evaluates an assertion expression. If the assertion fails, prints an error describing the failed assertion. | |
| Variables | |
| constexpr int | kassert::assert::kthrow = KASSERT_ASSERTION_LEVEL_KTHROW | 
| Assertion level for exceptions if exception mode is disabled. | |
| constexpr int | kassert::assert::normal = KASSERT_ASSERTION_LEVEL_NORMAL | 
| Default assertion level. This level is used if no assertion level is specified. | |
Macros for asserting runtime checks.
| #define KASSERT_ENABLED | ( | level | ) | level <= KASSERT_ASSERTION_LEVEL | 
Checks if a assertion of the given level is enabled. This is controlled by the CMake option KASSERT_ASSERTION_LEVEL. This is the macro version of assertion_enabled for use in the preprocessor. 
| level | The level of the assertion. | 
| 
 | constexpr | 
Checks if a assertion of the given level is enabled. This is controlled by the CMake option KASSERT_ASSERTION_LEVEL. 
| level | The level of the assertion. | 
| 
 | inline | 
Builds the description for an exception.
| expression | Expression that caused this exception to be thrown. | 
| where | Source code location where the exception was thrown. | 
| message | User message describing this exception. | 
| 
 | inline | 
Evaluates an assertion that could not be decomposed (i.e., expressions that use && or ||). If the assertion fails, prints an error describing the failed assertion.
| type | Actual type of this check. In exception mode, this parameter has always value ASSERTION, otherwise it names the type of the exception that would have been thrown. | 
| result | Assertion expression result to be checked. | 
| where | Source code location of the assertion. | 
| expr_str | Stringified assertion expression. | 
| 
 | inline | 
Evaluates an assertion expression. If the assertion fails, prints an error describing the failed assertion.
| type | Actual type of this check. In exception mode, this parameter has always value ASSERTION, otherwise it names the type of the exception that would have been thrown. | 
| expr | Assertion expression to be checked. | 
| where | Source code location of the assertion. | 
| expr_str | Stringified assertion expression. |