62 inline const std::string &
message()
const 88 inline void print(
bool doPrint =
true)
const 92 if (lineNumber_ < 0) {
93 std::cout << message_ <<
" in " << class_ <<
"::" << method_ << std::endl;
95 std::cout << file_ <<
":" << lineNumber_ <<
" method " << method_
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(),
112 : message_(message__)
113 , method_(methodName__)
114 , class_(className__)
123 : message_(source.message_)
124 , method_(source.method_)
125 , class_(source.class_)
126 , file_(source.file_)
127 , lineNumber_(source.lineNumber_)
136 message_ = rhs.message_;
137 method_ = rhs.method_;
140 lineNumber_ = rhs.lineNumber_;
155 std::string message_;
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.
const std::string & fileName() const
get name of file for assert
void CoinErrorUnitTest()
A function that tests the methods in the CoinError class.
virtual ~CoinError()
Destructor.
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.
void print(bool doPrint=true) const
Just print (for asserts)
friend void CoinErrorUnitTest()
A function that tests the methods in the CoinError class.
const std::string & message() const
get message text
int lineNumber() const
get line number of assert (-1 if not assert)
CoinError(const CoinError &source)
Copy constructor.
const std::string & className() const
get name of class instantiating error (or hint for assert)