Mercurial > hg > orthanc-stone
comparison Framework/StoneException.h @ 751:712ff6ff3c19
- undo redo now works fine for both measure tool creation commands
- added LayerHolder to streamline layer index management
- added overloads for ORTHANC_ASSERT with no string message (some heavy
preprocessor wizardry in there)
- fixing wasm BasicScene is *not* finished.
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Wed, 22 May 2019 11:55:52 +0200 |
parents | 28b9e3a54200 |
children | 92c400a09f1b |
comparison
equal
deleted
inserted
replaced
750:284f37dc1c66 | 751:712ff6ff3c19 |
---|---|
113 | 113 |
114 } | 114 } |
115 | 115 |
116 // See https://isocpp.org/wiki/faq/misc-technical-issues#macros-with-multi-stmts | 116 // See https://isocpp.org/wiki/faq/misc-technical-issues#macros-with-multi-stmts |
117 // (or google "Multiple lines macro C++ faq lite" if link is dead) | 117 // (or google "Multiple lines macro C++ faq lite" if link is dead) |
118 #define ORTHANC_ASSERT(cond,streamChainMessage) \ | 118 #define ORTHANC_ASSERT2(cond,streamChainMessage) \ |
119 if (!(cond)) { \ | 119 if (!(cond)) { \ |
120 std::stringstream sst; \ | 120 std::stringstream sst; \ |
121 sst << "Assertion failed. Condition = \"" #cond "\" Message = \"" << streamChainMessage << "\""; \ | 121 sst << "Assertion failed. Condition = \"" #cond "\" Message = \"" << streamChainMessage << "\""; \ |
122 std::string sstr = sst.str(); \ | 122 std::string sstr = sst.str(); \ |
123 throw OrthancException(ErrorCode_InternalError,sstr.c_str()); \ | 123 throw OrthancException(ErrorCode_InternalError,sstr.c_str()); \ |
124 } else (void)0 | 124 } else (void)0 |
125 | 125 |
126 #define ORTHANC_ASSERT1(cond) \ | |
127 if (!(cond)) { \ | |
128 std::stringstream sst; \ | |
129 sst << "Assertion failed. Condition = \"" #cond "\""; \ | |
130 std::string sstr = sst.str(); \ | |
131 throw OrthancException(ErrorCode_InternalError,sstr.c_str()); \ | |
132 } else (void)0 | |
133 | |
134 | |
135 | |
136 # define ORTHANC_EXPAND( x ) x | |
137 # define GET_ORTHANC_ASSERT(_1,_2,NAME,...) NAME | |
138 # define ORTHANC_ASSERT(...) ORTHANC_EXPAND(GET_ORTHANC_ASSERT(__VA_ARGS__, ORTHANC_ASSERT2, ORTHANC_ASSERT1, UNUSED)(__VA_ARGS__)) | |
139 | |
140 /* | |
141 Explanation: | |
142 | |
143 ORTHANC_ASSERT(a) | |
144 ORTHANC_EXPAND(GET_ORTHANC_ASSERT(a, ORTHANC_ASSERT2, ORTHANC_ASSERT1, UNUSED)(a)) | |
145 ORTHANC_EXPAND(ORTHANC_ASSERT1(a)) | |
146 ORTHANC_ASSERT1(a) | |
147 | |
148 ORTHANC_ASSERT(a,b) | |
149 ORTHANC_EXPAND(GET_ORTHANC_ASSERT(a, b, ORTHANC_ASSERT2, ORTHANC_ASSERT1, UNUSED)(a,b)) | |
150 ORTHANC_EXPAND(ORTHANC_ASSERT2(a,b)) | |
151 ORTHANC_ASSERT2(a,b) | |
152 | |
153 Note: ORTHANC_EXPAND is required for some older compilers (MS v100 cl.exe ) | |
154 */ | |
155 | |
156 | |
157 | |
158 | |
159 | |
160 |