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
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__)
void WindowsErrorPopupBlocker()
A function to block the popup windows that windows creates when the code crashes.
void CoinErrorUnitTest()
A function that tests the methods in the CoinError class.
Error Class thrown by an exception.
void print(bool doPrint=true) const
Just print (for asserts)
const std::string & methodName() const
get name of method instantiating error
virtual ~CoinError()
Destructor.
const std::string & fileName() const
get name of file for assert
const std::string & className() const
get name of class instantiating error (or hint for assert)
int lineNumber_
Line number.
CoinError(std::string message__, std::string methodName__, std::string className__, std::string fileName_=std::string(), int line=-1)
Alternate Constructor.
static bool printErrors_
Whether to print every error.
const std::string & message() const
get message text
CoinError(const CoinError &source)
Copy constructor.
CoinError & operator=(const CoinError &rhs)
Assignment operator.
std::string message_
message test
std::string file_
file name
std::string class_
class name or hint
std::string method_
method name
friend void CoinErrorUnitTest()
A function that tests the methods in the CoinError class.
int lineNumber() const
get line number of assert (-1 if not assert)