Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
macros.h
Go to the documentation of this file.
1
#ifndef STORM_UTILITY_MACROS_H_
2
#define STORM_UTILITY_MACROS_H_
3
4
#include "
storm/utility/logging.h
"
5
6
#include <cassert>
7
#include <iosfwd>
8
9
// Define STORM_LOG_ASSERT which is only checked when NDEBUG is not set.
10
#ifndef NDEBUG
11
#define STORM_LOG_ASSERT(cond, message) \
12
do { \
13
if (!(cond)) { \
14
STORM_LOG_ERROR(message); \
15
assert(cond); \
16
} \
17
} while (false)
18
#define STORM_LOG_WARN_COND_DEBUG(cond, message) \
19
do { \
20
if (!(cond)) { \
21
STORM_LOG_WARN(message); \
22
} \
23
} while (false)
24
#else
25
#define STORM_LOG_ASSERT(cond, message)
26
#define STORM_LOG_WARN_COND_DEBUG(cond, message)
27
#endif
28
29
// Define STORM_LOG_THROW to always throw the exception with the given message if the condition fails to hold.
30
#define STORM_LOG_THROW(cond, exception, message) \
31
do { \
32
if (!(cond)) { \
33
STORM_LOG_ERROR(message); \
34
throw exception() << message; \
35
} \
36
} while (false)
37
38
#define STORM_LOG_WARN_COND(cond, message) \
39
do { \
40
if (!(cond)) { \
41
STORM_LOG_WARN(message); \
42
} \
43
} while (false)
44
45
#define STORM_LOG_INFO_COND(cond, message) \
46
do { \
47
if (!(cond)) { \
48
STORM_LOG_INFO(message); \
49
} \
50
} while (false)
51
52
#define STORM_LOG_ERROR_COND(cond, message) \
53
do { \
54
if (!(cond)) { \
55
STORM_LOG_ERROR(message); \
56
} \
57
} while (false)
58
62
#define STORM_PRINT(message) \
63
do { \
64
std::cout << message; \
65
std::cout.flush(); \
66
} while (false)
67
68
#define STORM_PRINT_AND_LOG(message) \
69
do { \
70
STORM_LOG_INFO(message); \
71
STORM_PRINT(message); \
72
} while (false)
73
74
#endif
/* STORM_UTILITY_MACROS_H_ */
logging.h
src
storm
utility
macros.h
Generated by
1.9.8