62 inline const std::string &
message()
const
88 inline void print(
bool doPrint =
true)
const
96 <<
" : assertion \'" <<
message_ <<
"\' failed." << std::endl;
98 std::cout <<
"Possible reason: " <<
class_ << std::endl;
107 std::string message__,
108 std::string methodName__,
109 std::string className__,
110 std::string fileName_ = std::string(),
173 #define __STRING(x) #x
176 #ifndef __GNUC_PREREQ
177 #define __GNUC_PREREQ(maj, min) (0)
181 #define CoinAssertDebug(expression) assert(expression)
182 #define CoinAssertDebugHint(expression, hint) assert(expression)
183 #define CoinAssert(expression) assert(expression)
184 #define CoinAssertHint(expression, hint) assert(expression)
187 #define CoinAssertDebug(expression) \
190 #define CoinAssertDebugHint(expression, hint) \
194 #if defined(__GNUC__) && __GNUC_PREREQ(2, 6)
195 #define CoinAssertDebug(expression) \
197 if (!(expression)) { \
198 throw CoinError(__STRING(expression), __PRETTY_FUNCTION__, \
199 "", __FILE__, __LINE__); \
202 #define CoinAssertDebugHint(expression, hint) \
204 if (!(expression)) { \
205 throw CoinError(__STRING(expression), __PRETTY_FUNCTION__, \
206 hint, __FILE__, __LINE__); \
210 #define CoinAssertDebug(expression) \
212 if (!(expression)) { \
213 throw CoinError(__STRING(expression), "", \
214 "", __FILE__, __LINE__); \
217 #define CoinAssertDebugHint(expression, hint) \
219 if (!(expression)) { \
220 throw CoinError(__STRING(expression), "", \
221 hint, __FILE__, __LINE__); \
226 #if defined(__GNUC__) && __GNUC_PREREQ(2, 6)
227 #define CoinAssert(expression) \
229 if (!(expression)) { \
230 throw CoinError(__STRING(expression), __PRETTY_FUNCTION__, \
231 "", __FILE__, __LINE__); \
234 #define CoinAssertHint(expression, hint) \
236 if (!(expression)) { \
237 throw CoinError(__STRING(expression), __PRETTY_FUNCTION__, \
238 hint, __FILE__, __LINE__); \
242 #define CoinAssert(expression) \
244 if (!(expression)) { \
245 throw CoinError(__STRING(expression), "", \
246 "", __FILE__, __LINE__); \
249 #define CoinAssertHint(expression, hint) \
251 if (!(expression)) { \
252 throw CoinError(__STRING(expression), "", \
253 hint, __FILE__, __LINE__); \
268 #define CoinErrorFL(x, y, z) CoinError((x), (y), (z), __FILE__, __LINE__)
static bool printErrors_
Whether to print every error.
Error Class thrown by an exception.
void CoinErrorUnitTest()
A function that tests the methods in the CoinError class.
virtual ~CoinError()
Destructor.
int lineNumber_
Line number.
int lineNumber() const
get line number of assert (-1 if not assert)
std::string class_
class name or hint
CoinError & operator=(const CoinError &rhs)
Assignment operator.
const std::string & methodName() const
get name of method instantiating error
void WindowsErrorPopupBlocker()
A function to block the popup windows that windows creates when the code crashes. ...
const std::string & message() const
get message text
const std::string & className() const
get name of class instantiating error (or hint for assert)
const std::string & fileName() const
get name of file for assert
friend void CoinErrorUnitTest()
A function that tests the methods in the CoinError class.
std::string method_
method name
std::string file_
file name
std::string message_
message test
CoinError(const CoinError &source)
Copy constructor.
void print(bool doPrint=true) const
Just print (for asserts)