00001 /*----------------------------------------------------------------------------* 00002 * Copyright (c) 2005 Southeastern Universities Research Association, * 00003 * Thomas Jefferson National Accelerator Facility * 00004 * * 00005 * This software was developed under a United States Government license * 00006 * described in the NOTICE file included as part of this distribution. * 00007 * * 00008 * E.Wolin, 25-Feb-2005, Jefferson Lab * 00009 * * 00010 * Authors: Elliott Wolin * 00011 * wolin@jlab.org Jefferson Lab, MS-6B * 00012 * Phone: (757) 269-7365 12000 Jefferson Ave. * 00013 * Fax: (757) 269-5519 Newport News, VA 23606 * 00014 * 00015 *----------------------------------------------------------------------------*/ 00016 00017 00018 #include <CodaException.hxx> 00019 00020 using namespace std; 00021 using namespace codaObject; 00022 00023 00024 //----------------------------------------------------------------------------- 00025 //----------------------------------------------------------------------------- 00026 00027 00032 CodaException::CodaException(const string &d) : descr(d), returnCode(0) {} 00033 00034 00035 //----------------------------------------------------------------------------- 00036 00037 00043 CodaException::CodaException(const string &d, int code) : descr(d), returnCode(code) {} 00044 00045 00046 //----------------------------------------------------------------------------- 00047 00048 00052 CodaException::~CodaException(void) throw() {} 00053 00054 00055 //----------------------------------------------------------------------------- 00056 00057 00062 void CodaException::setReturnCode(int code) throw() { 00063 returnCode=code; 00064 } 00065 00066 00067 //----------------------------------------------------------------------------- 00068 00069 00074 int CodaException::getReturnCode(void) const throw() { 00075 return(returnCode); 00076 } 00077 00078 00079 //----------------------------------------------------------------------------- 00080 00081 00082 00087 string CodaException::toString(void) const throw() { 00088 ostringstream oss; 00089 oss << "?CodaException code = " << returnCode << " descr = " << descr; 00090 return(oss.str()); 00091 } 00092 00093 00094 //----------------------------------------------------------------------------- 00095 00096 00102 const char *CodaException::what(void) const throw() { 00103 return(toString().c_str()); 00104 } 00105 00106 00107 //----------------------------------------------------------------------------- 00108 //-----------------------------------------------------------------------------