64 inline const std::string &
message()
const
80 inline void print(
bool doPrint =
true)
const
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(),
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__)
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.