|
ATLAS Offline Software
|
Go to the documentation of this file. 1 #ifndef ROOT_CORE_UTILS__ASSERT_H
2 #define ROOT_CORE_UTILS__ASSERT_H
89 void fail (
const char *package,
const char *
file,
unsigned line,
99 template<
class T>
void
102 static_cast<const T *
>(
object)->testInvariant ();
137 #ifndef ROOTCORE_PACKAGE
138 #define ROOTCORE_PACKAGE 0
144 #define RCU_CHECK(type,condition,message) \
145 (condition) ? (void) 0 : ::RCU::Check::fail (ROOTCORE_PACKAGE, __FILE__, __LINE__, ::RCU::Check::type, message)
148 #define RCU_CHECK_JOIN2(a,b) RCU_CHECK_JOIN2_HIDDEN(a,b)
149 #define RCU_CHECK_JOIN2_HIDDEN(a,b) a ## b
153 #define RCU_REQUIRE_SOFT(x) \
154 RCU_CHECK (require_soft, x, #x)
155 #define RCU_REQUIRE2_SOFT(x,y) \
156 RCU_CHECK (require_soft, x, y)
157 #define RCU_REQUIRE0_SOFT(y) \
158 RCU_CHECK (require_soft, 0, y)
160 #define RCU_PROVIDE_SOFT(x) \
161 RCU_CHECK (provide_soft, x, #x)
162 #define RCU_PROVIDE2_SOFT(x,y) \
163 RCU_CHECK (provide_soft, x, y)
164 #define RCU_PROVIDE0_SOFT(y) \
165 RCU_CHECK (provide_soft, 0, y)
167 #define RCU_ASSERT_SOFT(x) \
168 RCU_CHECK (assert_soft, x, #x)
169 #define RCU_ASSERT2_SOFT(x,y) \
170 RCU_CHECK (assert_soft, x, y)
171 #define RCU_ASSERT0_SOFT(y) \
172 RCU_CHECK (assert_soft, 0, y)
176 #define RCU_REQUIRE_NOIMP(x) \
177 RCU_CHECK (require_noimp, x, #x)
178 #define RCU_REQUIRE2_NOIMP(x,y) \
179 RCU_CHECK (require_noimp, x, y)
180 #define RCU_REQUIRE0_NOIMP(y) \
181 RCU_CHECK (require_noimp, 0, y)
183 #define RCU_PROVIDE_NOIMP(x) \
184 RCU_CHECK (provide_noimp, x, #x)
185 #define RCU_PROVIDE2_NOIMP(x,y) \
186 RCU_CHECK (provide_noimp, x, y)
187 #define RCU_PROVIDE0_NOIMP(y) \
188 RCU_CHECK (provide_noimp, 0, y)
190 #define RCU_ASSERT_NOIMP(x) \
191 RCU_CHECK (assert_noimp, x, #x)
192 #define RCU_ASSERT2_NOIMP(x,y) \
193 RCU_CHECK (assert_noimp, x, y)
194 #define RCU_ASSERT0_NOIMP(y) \
195 RCU_CHECK (assert_noimp, 0, y)
201 #define RCU_INVARIANT(x) \
202 RCU_CHECK (invariant, x, #x)
203 #define RCU_INVARIANT2(x,y) \
204 RCU_CHECK (invariant, x, y)
205 #define RCU_INVARIANT0(y) \
206 RCU_CHECK (invariant, 0, y)
208 #define RCU_REQUIRE(x) \
209 RCU_CHECK (require_hard, x, #x)
210 #define RCU_REQUIRE2(x,y) \
211 RCU_CHECK (require_hard, x, y)
212 #define RCU_REQUIRE0(y) \
213 RCU_CHECK (require_hard, 0, y)
215 #define RCU_PROVIDE(x) \
216 RCU_CHECK (provide_hard, x, #x)
217 #define RCU_PROVIDE2(x,y) \
218 RCU_CHECK (provide_hard, x, y)
219 #define RCU_PROVIDE0(y) \
220 RCU_CHECK (provide_hard, 0, y)
222 #define RCU_ASSERT(x) \
223 RCU_CHECK (assert_hard, x, #x)
224 #define RCU_ASSERT2(x,y) \
225 RCU_CHECK (assert_hard, x, y)
226 #define RCU_ASSERT0(y) \
227 RCU_CHECK (assert_hard, 0, y)
229 #define RCU_READ_INVARIANT(x) \
230 (x)->testInvariant ()
231 #define RCU_CHANGE_INVARIANT(x) \
232 ::RCU::Check::TestInvariant RCU_CHECK_JOIN2 (invariant, __LINE__) = ::RCU::Check::invariant_tester (x);
233 #define RCU_NEW_INVARIANT(x) \
234 (x)->testInvariant ()
235 #define RCU_DESTROY_INVARIANT(x) \
236 (x)->testInvariant ()
242 #define RCU_INVARIANT(x) \
244 #define RCU_INVARIANT2(x,y) \
246 #define RCU_INVARIANT0(y) \
248 #define RCU_REQUIRE(x) \
250 #define RCU_REQUIRE2(x,y) \
252 #define RCU_REQUIRE0(y) \
254 #define RCU_PROVIDE(x) \
256 #define RCU_PROVIDE2(x,y) \
258 #define RCU_PROVIDE0(y) \
260 #define RCU_ASSERT(x) \
262 #define RCU_ASSERT2(x,y) \
264 #define RCU_ASSERT0(y) \
266 #define RCU_READ_INVARIANT(x) \
268 #define RCU_CHANGE_INVARIANT(x) \
270 #define RCU_NEW_INVARIANT(x) \
272 #define RCU_DESTROY_INVARIANT(x) \
281 #ifdef RCU_DEBUG_SLOW
283 #define RCU_REQUIRE_SLOW(x) \
285 #define RCU_REQUIRE2_SLOW(x,y) \
287 #define RCU_PROVIDE_SLOW(x) \
289 #define RCU_PROVIDE2_SLOW(x,y) \
291 #define RCU_ASSERT_SLOW(x) \
293 #define RCU_ASSERT2_SLOW(x,y) \
295 #define RCU_READ_INVARIANT_SLOW(x) \
296 RCU_READ_INVARIANT (x)
297 #define RCU_CHANGE_INVARIANT_SLOW(x) \
298 RCU_CHANGE_INVARIANT (x)
299 #define RCU_NEW_INVARIANT_SLOW(x) \
300 RCU_NEW_INVARIANT (x)
301 #define RCU_DESTROY_INVARIANT_SLOW(x) \
302 RCU_DESTROY_INVARIANT (x)
306 #define RCU_REQUIRE_SLOW(x) \
308 #define RCU_REQUIRE2_SLOW(x,y) \
310 #define RCU_PROVIDE_SLOW(x) \
312 #define RCU_PROVIDE2_SLOW(x,y) \
314 #define RCU_ASSERT_SLOW(x) \
316 #define RCU_ASSERT2_SLOW(x,y) \
318 #define RCU_READ_INVARIANT_SLOW(x) \
320 #define RCU_CHANGE_INVARIANT_SLOW(x) \
322 #define RCU_NEW_INVARIANT_SLOW(x) \
324 #define RCU_DESTROY_INVARIANT_SLOW(x) \
TestInvariant invariant_tester(T *object)
effects: create the right invariant testing object returns: the tester
@ require_soft
function parameter requirement
void fail(const char *package, const char *file, unsigned line, Type type, const char *error)
effects: report the error and abort either by exception or assert like guarantee: all-fail failures: ...
const char *const typeLiteral[typeNum]
This module defines a variety of assert style macros.
TestInvariant(TestInvariantFunction function, const void *object)
availability: experts only description: this class will perform an invariant test as the object goes ...
TestInvariantFunction m_function
void testInvariantVoid(const void *object)
@ invariant
invariant violation
const bool typeAbort[typeNum]
void(* TestInvariantFunction)(const void *object)
effects: apply the test invariant method on an object guarantee: no-fail availability: experts only r...
@ provide_soft
function postcondition
@ assert_soft
regular old style assertion