00001 // $Id: DbiExceptionLog.cxx,v 1.5 2007/04/26 14:19:57 west Exp $ 00002 00003 00007 00008 #include <iostream> 00009 00010 #include "DatabaseInterface/DbiExceptionLog.h" 00011 #include "LeakChecker/Lea.h" 00012 #include "MessageService/MsgService.h" 00013 00014 ClassImp(DbiExceptionLog) 00015 00016 // Definition of static data members 00017 // ********************************* 00018 00019 CVSID("$Id: DbiExceptionLog.cxx,v 1.5 2007/04/26 14:19:57 west Exp $"); 00020 00021 DbiExceptionLog DbiExceptionLog::fgGELog; 00022 00023 // Definition of all member functions (static or otherwise) 00024 // ******************************************************* 00025 // 00026 // - ordered: ctors, dtor, operators then in alphabetical order. 00027 00028 //..................................................................... 00029 00030 DbiExceptionLog::DbiExceptionLog(const DbiException* e) { 00031 00032 LEA_CTOR //Leak Checker 00033 MSG("Dbi", Msg::kVerbose) << "Creating DbiExceptionLog" << endl; 00034 if ( e ) this->AddEntry(*e); 00035 00036 } 00037 //..................................................................... 00038 00039 00040 DbiExceptionLog::~DbiExceptionLog() { 00041 00042 00043 LEA_DTOR //Leak Checker 00044 MSG("Dbi", Msg::kVerbose) << "Destroying DbiExceptionLog" << endl; 00045 00046 } 00047 00048 //..................................................................... 00049 00050 std::ostream& operator<<(std::ostream& os, const DbiExceptionLog& el) { 00051 00052 if ( el.IsEmpty() ) { 00053 os << "The database exception log is empty" << endl; 00054 } 00055 else { 00056 os << "Database exception log:-" << endl; 00057 std::vector<DbiException>::const_iterator itr(el.GetEntries().begin()), 00058 itrEnd(el.GetEntries().end()); 00059 while ( itr != itrEnd ) { 00060 os << *itr << endl; 00061 ++itr; 00062 } 00063 } 00064 00065 return os; 00066 00067 } 00068 00069 //..................................................................... 00070 00071 void DbiExceptionLog::AddLog(const DbiExceptionLog& el) { 00072 // 00073 // 00074 // Purpose: Add all entries from el. 00075 00076 const std::vector<DbiException>& ve = el.GetEntries(); 00077 std::vector<DbiException>::const_iterator itr(ve.begin()), itrEnd(ve.end()); 00078 while ( itr != itrEnd ) this->AddEntry(*itr++); 00079 00080 } 00081 00082 //..................................................................... 00083 00084 void DbiExceptionLog::Copy(DbiExceptionLog& that, UInt_t start) const { 00085 // 00086 // 00087 // Purpose: Copy exception log starting at 'start' (default 0) 00088 00089 UInt_t maxEntry = fEntries.size(); 00090 while (start <= maxEntry ) that.AddEntry(fEntries[start++]); 00091 00092 } 00093 //..................................................................... 00094 00095 void DbiExceptionLog::Print () const { 00096 // 00097 // 00098 // Purpose: Print contents to cout. 00099 00100 std::cout << *this << std::endl; 00101 00102 } 00103 00104 00105
1.3.9.1