45#ifndef MADNESS_WORLD_MADNESS_EXCEPTION_H__INCLUDED
46#define MADNESS_WORLD_MADNESS_EXCEPTION_H__INCLUDED
52#ifdef MADNESS_ASSERTIONS_ASSERT
56#ifndef MADNESS_DISPLAY_EXCEPTION_BREAK_MESSAGE
58#define MADNESS_DISPLAY_EXCEPTION_BREAK_MESSAGE 1
86 int l,
const char *fn,
const char *
f)
97 virtual const char*
what()
const throw() {
107 std::ostream&
operator <<(std::ostream& out,
const MadnessException&
e);
119#define MADNESS_EXCEPTION(msg,value) { \
120 madness::exception_break(MADNESS_DISPLAY_EXCEPTION_BREAK_MESSAGE); \
121 throw madness::MadnessException(msg,0,value,__LINE__,__FUNCTION__,__FILE__); \
134#define MADNESS_ASSERT(condition)
141#define MADNESS_ASSERT_NOEXCEPT(condition)
142#undef MADNESS_ASSERT_NOEXCEPT
144#ifdef MADNESS_ASSERTIONS_ABORT
145# define MADNESS_ASSERT(condition) \
146 do {if (!(condition)) { std::abort(); }} while (0)
147# define MADNESS_ASSERT_NOEXCEPT(condition) MADNESS_ASSERT(condition)
150#ifdef MADNESS_ASSERTIONS_DISABLE
152# define MADNESS_ASSERT(condition) do { (void)sizeof(condition);} while (0)
153# define MADNESS_ASSERT_NOEXCEPT(condition) MADNESS_ASSERT(condition)
156#ifdef MADNESS_ASSERTIONS_ASSERT
157# define MADNESS_ASSERT(condition) assert(condition)
158# define MADNESS_ASSERT_NOEXCEPT(condition) MADNESS_ASSERT(condition)
161#ifdef MADNESS_ASSERTIONS_THROW
162# define MADNESS_ASSERT(condition) \
164 if (!(condition)) { \
165 madness::exception_break(MADNESS_DISPLAY_EXCEPTION_BREAK_MESSAGE); \
166 throw madness::MadnessException("MADNESS ASSERTION FAILED: " , \
167 (#condition),0,__LINE__,__FUNCTION__,__FILE__); \
170# define MADNESS_ASSERT_NOEXCEPT(condition) \
171 do {if (!(condition)) { std::abort(); }} while (0)
182#define MADNESS_CHECK(condition)
186#ifdef MADNESS_ASSERTIONS_ABORT
187# define MADNESS_CHECK(condition) \
188 do {if (!(condition)) { std::abort(); }} while (0)
190# define MADNESS_CHECK(condition) \
192 if (!(condition)) { \
193 madness::exception_break(MADNESS_DISPLAY_EXCEPTION_BREAK_MESSAGE); \
194 throw madness::MadnessException("MADNESS CHECK FAILED: " , \
195 (#condition),0,__LINE__,__FUNCTION__,__FILE__); \
207#define MADNESS_CHECK_THROW(condition,msg)
208#undef MADNESS_CHECK_THROW
210#define MADNESS_CHECK_THROW(condition,msg) \
212 if (!(condition)) { \
213 throw madness::MadnessException(msg, (#condition),0,__LINE__,__FUNCTION__,__FILE__); \
Base class for exceptions thrown in MADNESS.
Definition madness_exception.h:66
virtual const char * what() const
Returns the error message, as specified by std::exception.
Definition madness_exception.h:97
const char * function
Function where the exception occurred.
Definition madness_exception.h:72
MadnessException(const char *m, const char *a, int v, int l, const char *fn, const char *f)
Constructor that processes the requisite information.
Definition madness_exception.h:85
const char * msg
The error message.
Definition madness_exception.h:68
const int value
Value associated with the exception.
Definition madness_exception.h:70
const char * filename
File where the exception occurred.
Definition madness_exception.h:73
const int line
Line number where the exception occurred.
Definition madness_exception.h:71
const char * assertion
String describing the assertion.
Definition madness_exception.h:69
static const double v
Definition hatom_sf_dirac.cc:20
Macros and tools pertaining to the configuration of MADNESS.
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
std::ostream & operator<<(std::ostream &os, const particle< PDIM > &p)
Definition lowrankfunction.h:397
NDIM & f
Definition mra.h:2416
void exception_break(bool message)
This function is executed just before a MadnessException is thrown.
Definition madness_exception.cc:59
static const double a
Definition nonlinschro.cc:118
static const double m
Definition relops.cc:9
void e()
Definition test_sig.cc:75