Storm
1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
macros.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
storm/utility/logging.h
"
4
5
#include <cassert>
6
7
// Define STORM_LOG_ASSERT which is only checked when NDEBUG is not set.
8
#ifndef NDEBUG
9
#define STORM_LOG_ASSERT(cond, message) \
10
do { \
11
if (!(cond)) { \
12
STORM_LOG_ERROR(message); \
13
assert(cond); \
14
} \
15
} while (false)
16
#define STORM_LOG_WARN_COND_DEBUG(cond, message) \
17
do { \
18
if (!(cond)) { \
19
STORM_LOG_WARN(message); \
20
} \
21
} while (false)
22
// The warning is emitted from the initializer of a function-local static, whose initialization is thread-safe and
23
// happens exactly once. A plain flag would be read and written without synchronization by concurrent first calls.
24
#define STORM_LOG_DEPRECATED(message) \
25
do { \
26
static bool const storm_deprecation_reported = [&] { \
27
STORM_LOG_WARN("Deprecated: " << message); \
28
return true; \
29
}(); \
30
(void)storm_deprecation_reported; \
31
} while (false)
32
#else
33
#define STORM_LOG_ASSERT(cond, message)
34
#define STORM_LOG_WARN_COND_DEBUG(cond, message)
35
#define STORM_LOG_DEPRECATED(message)
36
#endif
37
38
// Define STORM_LOG_THROW to always throw the exception with the given message if the condition fails to hold.
39
#define STORM_LOG_THROW(cond, exception, message) \
40
do { \
41
if (!(cond)) { \
42
STORM_LOG_ERROR(message); \
43
throw exception() << message; \
44
} \
45
} while (false)
46
47
// Unconditionally logs and throws the given exception.
48
#define STORM_LOG_THROW_UNCONDITIONALLY(exception, message) \
49
do { \
50
STORM_LOG_ERROR(message); \
51
throw exception() << message; \
52
} while (false)
53
54
#define STORM_LOG_WARN_COND(cond, message) \
55
do { \
56
if (!(cond)) { \
57
STORM_LOG_WARN(message); \
58
} \
59
} while (false)
60
61
#define STORM_LOG_INFO_COND(cond, message) \
62
do { \
63
if (!(cond)) { \
64
STORM_LOG_INFO(message); \
65
} \
66
} while (false)
67
68
#define STORM_LOG_ERROR_COND(cond, message) \
69
do { \
70
if (!(cond)) { \
71
STORM_LOG_ERROR(message); \
72
} \
73
} while (false)
logging.h
src
storm
utility
macros.h
Generated by
1.15.0