Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ExtendSettingEnumWithSelectionField.h
Go to the documentation of this file.
1#ifndef EXTENDSETTINGENUMWITHSELECTIONFIELD_H
2#define EXTENDSETTINGENUMWITHSELECTIONFIELD_H
3
4#include <cassert>
5#include <string>
6
7#define ExtendEnumsWithSelectionField(NAME, ...) \
8 enum class NAME : int { __VA_ARGS__ }; \
9 enum class NAME##Selection : int{__VA_ARGS__, FROMSETTINGS}; \
10 std::string toString(NAME); \
11 inline NAME convert(NAME##Selection e) { \
12 assert(e != NAME##Selection::FROMSETTINGS); \
13 return static_cast<NAME>(e); \
14 } \
15 inline std::string toString(NAME##Selection e) { \
16 if (e == NAME##Selection::FROMSETTINGS) { \
17 return "[from settings]"; \
18 } else { \
19 return toString(convert(e)); \
20 } \
21 }
22
23#endif /* EXTENDSETTINGENUMWITHSELECTIONFIELD_H */