utilities for custom assertions More...
#include <stdexcept>
#include <vector>
#include <string>
#include <omp.h>
#include "config.hpp"
Classes | |
class | hexed::assert::Exception |
class | hexed::assert::Numerical_exception |
represents a fatal problem in the numerics of the code (such as nonphysical values) More... | |
class | hexed::assert::User_error |
represents an exception which clearly results from a mistake made by the user More... | |
Namespaces | |
namespace | hexed |
Global namespace for all of the C++ API of Hexed. | |
namespace | hexed::assert |
utilities for custom assertions | |
Macros | |
#define | HEXED_THROW(message, ...) |
Throws an exception with an informative error message. | |
#define | HEXED_ASSERT(expression, message, ...) |
Assert something with an informative error message. | |
Functions | |
template<typename... format_args> | |
std::string | hexed::format_str (int max_chars, std::string fstring, format_args... args) |
Standard string formatting. | |
template<typename except_t = std::runtime_error> | |
void | hexed::assert::throw_critical (const char *message) |
utilities for custom assertions
#define HEXED_ASSERT | ( | expression, | |
message, | |||
... ) |
Assert something with an informative error message.
If expression
is false, throws an exception with HEXED_THROW
. message
and an optional third argument are passed to HEXED_THROW
.
#define HEXED_THROW | ( | message, | |
... ) |
Throws an exception with an informative error message.
Throws an exception with a message that includes message
plus some additional info for debugging. Works inside single-threaded regions as well as OpenMP parallel regions. If desired, supply the type of exception as the third argument. Exception type must be constructible from a string. Defaults to std::runtime_error
.