#include <CoinError.hpp>
Public Member Functions | |
Get error attributes | |
const std::string & | message () const |
get message text | |
const std::string & | methodName () const |
get name of method instantiating error | |
const std::string & | className () const |
get name of class instantiating error | |
Constructors and destructors | |
CoinError () | |
Default Constructor. | |
CoinError (std::string message, std::string methodName, std::string className) | |
Alternate Constructor. | |
CoinError (const char *message, const char *methodName, const char *className) | |
Other alternate Constructor. | |
CoinError (const CoinError &source) | |
Copy constructor. | |
CoinError & | operator= (const CoinError &rhs) |
Assignment operator. | |
virtual | ~CoinError () |
Destructor. | |
Private Attributes | |
Private member data | |
std::string | message_ |
message test | |
std::string | method_ |
method name | |
std::string | class_ |
class name | |
Friends | |
void | CoinErrorUnitTest () |
This class is used when exceptions are thrown. It contains:
Definition at line 25 of file CoinError.hpp.
|
A function that tests the methods in the CoinError class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. Definition at line 12 of file CoinErrorTest.cpp.
00013 { 00014 00015 // Test default constructor 00016 { 00017 CoinError r; 00018 assert( r.message_=="" ); 00019 assert( r.method_=="" ); 00020 assert( r.class_=="" ); 00021 } 00022 00023 // Test alternate constructor and get method 00024 CoinError rhs; 00025 { 00026 CoinError a("msg","me.hpp","cl"); 00027 assert( a.message()=="msg" ); 00028 assert( a.methodName()=="me.hpp" ); 00029 assert( a.className()=="cl" ); 00030 00031 // Test copy constructor 00032 { 00033 CoinError c(a); 00034 assert( c.message()=="msg" ); 00035 assert( c.methodName()=="me.hpp" ); 00036 assert( c.className()=="cl" ); 00037 } 00038 00039 // Test assignment 00040 { 00041 CoinError a1("msg1","meth1","cl1"); 00042 assert( a1.message()=="msg1" ); 00043 assert( a1.methodName()=="meth1" ); 00044 assert( a1.className()=="cl1" ); 00045 rhs = a1; 00046 } 00047 } 00048 assert( rhs.message()=="msg1" ); 00049 assert( rhs.methodName()=="meth1" ); 00050 assert( rhs.className()=="cl1" ); 00051 00052 00053 } |