62 inline const std::string &
message()
const
78 inline void print(
bool doPrint =
true)
const
86 <<
" : assertion \'"<<
message_<<
"\' failed."<<std::endl;
88 std::cout<<
"Possible reason: "<<
class_<<std::endl;
98 std::string message__,
99 std::string methodName__,
100 std::string className__,
101 std::string fileName_ = std::string(),
167 #define __STRING(x) #x
170 #ifndef __GNUC_PREREQ
171 # define __GNUC_PREREQ(maj, min) (0)
175 # define CoinAssertDebug(expression) assert(expression)
176 # define CoinAssertDebugHint(expression,hint) assert(expression)
177 # define CoinAssert(expression) assert(expression)
178 # define CoinAssertHint(expression,hint) assert(expression)
181 # define CoinAssertDebug(expression) {}
182 # define CoinAssertDebugHint(expression,hint) {}
184 # if defined(__GNUC__) && __GNUC_PREREQ(2, 6)
185 # define CoinAssertDebug(expression) { \
186 if (!(expression)) { \
187 throw CoinError(__STRING(expression), __PRETTY_FUNCTION__, \
188 "", __FILE__, __LINE__); \
191 # define CoinAssertDebugHint(expression,hint) { \
192 if (!(expression)) { \
193 throw CoinError(__STRING(expression), __PRETTY_FUNCTION__, \
194 hint, __FILE__,__LINE__); \
198 # define CoinAssertDebug(expression) { \
199 if (!(expression)) { \
200 throw CoinError(__STRING(expression), "", \
201 "", __FILE__,__LINE__); \
204 # define CoinAssertDebugHint(expression,hint) { \
205 if (!(expression)) { \
206 throw CoinError(__STRING(expression), "", \
207 hint, __FILE__,__LINE__); \
212 # if defined(__GNUC__) && __GNUC_PREREQ(2, 6)
213 # define CoinAssert(expression) { \
214 if (!(expression)) { \
215 throw CoinError(__STRING(expression), __PRETTY_FUNCTION__, \
216 "", __FILE__, __LINE__); \
219 # define CoinAssertHint(expression,hint) { \
220 if (!(expression)) { \
221 throw CoinError(__STRING(expression), __PRETTY_FUNCTION__, \
222 hint, __FILE__,__LINE__); \
226 # define CoinAssert(expression) { \
227 if (!(expression)) { \
228 throw CoinError(__STRING(expression), "", \
229 "", __FILE__,__LINE__); \
232 # define CoinAssertHint(expression,hint) { \
233 if (!(expression)) { \
234 throw CoinError(__STRING(expression), "", \
235 hint, __FILE__,__LINE__); \
252 #define CoinErrorFL(x, y, z) CoinError((x), (y), (z), __FILE__, __LINE__)
std::string file_
file name
int lineNumber() const
get line number of assert (-1 if not assert)
void WindowsErrorPopupBlocker()
A function to block the popup windows that windows creates when the code crashes. ...
const std::string & className() const
get name of class instantiating error (or hint for assert)
CoinError & operator=(const CoinError &rhs)
Assignment operator.
friend void CoinErrorUnitTest()
A function that tests the methods in the CoinError class.
std::string message_
message test
int lineNumber_
Line number.
const std::string & fileName() const
get name of file for assert
virtual ~CoinError()
Destructor.
void print(bool doPrint=true) const
Just print (for asserts)
const std::string & methodName() const
get name of method instantiating error
std::string method_
method name
Error Class thrown by an exception.
const std::string & message() const
get message text
std::string class_
class name or hint
static bool printErrors_
Whether to print every error.
CoinError(const CoinError &source)
Copy constructor.
void CoinErrorUnitTest()
A function that tests the methods in the CoinError class.