42 #ifndef SCI_Containers_Assert_h
43 #define SCI_Containers_Assert_h 1
45 #include <sci_defs/error_defs.h>
52 #define ASSERTFAIL(string) \
53 SCI_THROW(SCIRun::AssertionFailed(string, __FILE__, __LINE__));
55 #define ASSERTMSG_LEGACY(condition,message) \
57 SCI_THROW(SCIRun::AssertionFailed(message, __FILE__, __LINE__)); \
60 #if SCI_ASSERTION_LEVEL >= 1
61 # define IFASSERT(x) x
62 # define ASSERTL1(condition) \
64 SCI_THROW(SCIRun::AssertionFailed(#condition, __FILE__, __LINE__)); \
67 # define ASSERTL1(condition)
70 #if SCI_ASSERTION_LEVEL >= 2
71 # define ASSERTL2(condition) \
73 SCI_THROW(SCIRun::AssertionFailed(#condition, __FILE__, __LINE__)); \
76 # define ASSERTL2(condition)
79 #if SCI_ASSERTION_LEVEL >= 3
80 # define ASSERTL3(condition) \
82 SCI_THROW(SCIRun::AssertionFailed(#condition, __FILE__, __LINE__)); \
84 # define CHECKARRAYBOUNDS(value, lower, upper) \
85 if(value < lower || value >= upper){ \
86 SCI_THROW(SCIRun::ArrayIndexOutOfBounds(value, lower, upper, __FILE__, __LINE__)); \
89 # define ASSERTL3(condition)
90 # define CHECKARRAYBOUNDS(value, lower, upper)
93 #if SCI_ASSERTION_LEVEL == 0
94 # define USE_IF_ASSERTS_ON(line)
95 # define ASSERTL1(condition)
96 # define ASSERTL2(condition)
97 # define ASSERTL3(condition)
98 # define ASSERTEQ(c1, c2)
99 # define ASSERTRANGE(c, l, h)
102 # define USE_IF_ASSERTS_ON(line) line
110 #define ASSERT(condition) ASSERTL2(condition)
Generic exception for internal errors.
Exception to indicate a failed bounds check.