Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

CoinError.hpp

00001 // Copyright (C) 2000, International Business Machines
00002 // Corporation and others.  All Rights Reserved.
00003 #ifndef CoinError_H
00004 #define CoinError_H
00005 
00006 #include <string>
00007 //-------------------------------------------------------------------
00008 //
00009 // Error class used to throw exceptions
00010 //
00011 // Errors contain:
00012 //
00013 //-------------------------------------------------------------------
00014 
00025 class CoinError  {
00026    friend void CoinErrorUnitTest();
00027 
00028 public:
00029     
00030   //-------------------------------------------------------------------
00031   // Get methods
00032   //-------------------------------------------------------------------   
00035 
00036     const std::string & message() const 
00037     { return message_; }
00039     const std::string & methodName() const 
00040     { return method_;  }
00042     const std::string & className() const 
00043     { return class_;   }
00045   
00046     
00049 
00050     CoinError ()
00051       :
00052       message_(),
00053       method_(),
00054       class_()
00055     {
00056       // nothing to do here
00057     }
00058   
00060     CoinError ( 
00061       std::string message, 
00062       std::string methodName, 
00063       std::string className)
00064       :
00065       message_(message),
00066       method_(methodName),
00067       class_(className)
00068     {
00069       // nothing to do here
00070     }
00071 
00073     CoinError ( 
00074       const char * message, 
00075       const char * methodName, 
00076       const char * className)
00077       :
00078       message_(message),
00079       method_(methodName),
00080       class_(className)
00081     {
00082       // nothing to do here
00083     }
00084 
00086     CoinError (const CoinError & source)
00087       :
00088       message_(source.message_),
00089       method_(source.method_),
00090       class_(source.class_)
00091     {
00092       // nothing to do here
00093     }
00094 
00096     CoinError & operator=(const CoinError& rhs)
00097     {
00098       if (this != &rhs) {
00099         message_=rhs.message_;
00100         method_=rhs.method_;
00101         class_=rhs.class_;
00102       }
00103       return *this;
00104     }
00105 
00107     virtual ~CoinError ()
00108     {
00109       // nothing to do here
00110     }
00112     
00113 private:
00114     
00117 
00118     std::string message_;
00120     std::string method_;
00122     std::string class_;
00124 };
00125 
00126 //#############################################################################
00132 void
00133 CoinErrorUnitTest();
00134 
00135 #endif

Generated on Wed Dec 3 14:34:16 2003 for Coin by doxygen 1.3.5