// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. #ifndef CoinError_H #define CoinError_H #include #include #include #include #include "CoinUtilsConfig.h" #include "CoinPragma.hpp" /** A function to block the popup windows that windows creates when the code crashes */ void WindowsErrorPopupBlocker(); //------------------------------------------------------------------- // // Error class used to throw exceptions // // Errors contain: // //------------------------------------------------------------------- /** Error Class thrown by an exception This class is used when exceptions are thrown. It contains:
  • message text
  • name of method throwing exception
  • name of class throwing exception or hint
  • name of file if assert
  • line number
For asserts class=> optional hint */ class CoinError { friend void CoinErrorUnitTest(); private: CoinError() : message_(), method_(), class_(), file_(), lineNumber_() { // nothing to do here } public: //------------------------------------------------------------------- // Get methods //------------------------------------------------------------------- /**@name Get error attributes */ //@{ /// get message text inline const std::string & message() const { return message_; } /// get name of method instantiating error inline const std::string & methodName() const { return method_; } /// get name of class instantiating error (or hint for assert) inline const std::string & className() const { return class_; } /// get name of file for assert inline const std::string & fileName() const { return file_; } /// get line number of assert (-1 if not assert) inline int lineNumber() const { return lineNumber_; } /// Just print (for asserts) inline void print(bool doPrint = true) const { if (! doPrint) return; if (lineNumber_<0) { std::cout<