64 inline const std::string &
message()
const 78 {
return lineNumber_; }
80 inline void print(
bool doPrint =
true)
const 85 std::cout<<message_<<
" in "<<class_<<
"::"<<method_<<std::endl;
87 std::cout<<file_<<
":"<<lineNumber_<<
" method "<<method_
88 <<
" : assertion \'"<<message_<<
"\' failed."<<std::endl;
90 std::cout<<
"Possible reason: "<<class_<<std::endl;
100 std::string message__,
101 std::string methodName__,
102 std::string className__,
103 std::string fileName_ = std::string(),
107 method_(methodName__),
118 message_(source.message_),
119 method_(source.method_),
120 class_(source.class_),
122 lineNumber_(source.lineNumber_)
131 message_=rhs.message_;
135 lineNumber_ = rhs.lineNumber_;
151 std::string message_;
169 #define __STRING(x) #x 172 #ifndef __GNUC_PREREQ 173 # define __GNUC_PREREQ(maj, min) (0) 177 # define CoinAssertDebug(expression) assert(expression) 178 # define CoinAssertDebugHint(expression,hint) assert(expression) 179 # define CoinAssert(expression) assert(expression) 180 # define CoinAssertHint(expression,hint) assert(expression) 183 # define CoinAssertDebug(expression) {} 184 # define CoinAssertDebugHint(expression,hint) {} 186 # if defined(__GNUC__) && __GNUC_PREREQ(2, 6) 187 # define CoinAssertDebug(expression) { \ 188 if (!(expression)) { \ 189 throw CoinError(__STRING(expression), __PRETTY_FUNCTION__, \ 190 "", __FILE__, __LINE__); \ 193 # define CoinAssertDebugHint(expression,hint) { \ 194 if (!(expression)) { \ 195 throw CoinError(__STRING(expression), __PRETTY_FUNCTION__, \ 196 hint, __FILE__,__LINE__); \ 200 # define CoinAssertDebug(expression) { \ 201 if (!(expression)) { \ 202 throw CoinError(__STRING(expression), "", \ 203 "", __FILE__,__LINE__); \ 206 # define CoinAssertDebugHint(expression,hint) { \ 207 if (!(expression)) { \ 208 throw CoinError(__STRING(expression), "", \ 209 hint, __FILE__,__LINE__); \ 214 # if defined(__GNUC__) && __GNUC_PREREQ(2, 6) 215 # define CoinAssert(expression) { \ 216 if (!(expression)) { \ 217 throw CoinError(__STRING(expression), __PRETTY_FUNCTION__, \ 218 "", __FILE__, __LINE__); \ 221 # define CoinAssertHint(expression,hint) { \ 222 if (!(expression)) { \ 223 throw CoinError(__STRING(expression), __PRETTY_FUNCTION__, \ 224 hint, __FILE__,__LINE__); \ 228 # define CoinAssert(expression) { \ 229 if (!(expression)) { \ 230 throw CoinError(__STRING(expression), "", \ 231 "", __FILE__,__LINE__); \ 234 # define CoinAssertHint(expression,hint) { \ 235 if (!(expression)) { \ 236 throw CoinError(__STRING(expression), "", \ 237 hint, __FILE__,__LINE__); \ 254 #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)