TDbiExceptionLog.hxx

Go to the documentation of this file.
00001 #ifndef DBIEXCEPTIONLOG
00002 #define DBIEXCEPTIONLOG
00003 
00004 
00005 //////////////////////////////////////////////////////////////////////////
00006 ////////////////////////////     ROOT API     ////////////////////////////
00007 //////////////////////////////////////////////////////////////////////////
00008 
00009 /**
00010  *
00011  * $Id: TDbiExceptionLog.hxx,v 1.1 2011/01/18 05:49:19 finch Exp $
00012  *
00013  * \class TDbiExceptionLog
00014  *
00015  *
00016  * \brief
00017  * <b>Concept</b> An object that records database exceptions
00018  *
00019  * \brief
00020  * <b>Purpose</b>To provide a place to record (in memory) exceptions from the time
00021  * they arise in the lower levels of the DBI and below until they can be
00022  * analysed in the upper levels of the DBI and beyond. They are stored in a std::vector 
00023  * of TDbiException s
00024  *
00025  * Contact: A.Finch@lancaster.ac.uk
00026  *
00027  *
00028  */
00029 
00030 #include <iosfwd>
00031 #include <string>
00032 #include <vector>
00033 
00034 #include "Rtypes.h"
00035 
00036 #include "TDbiException.hxx"
00037 
00038 class TSQLServer;
00039 class TSQLStatement;
00040 
00041 class TDbiExceptionLog;
00042 
00043 
00044 std::ostream& operator<<(std::ostream& s, const TDbiExceptionLog& el);
00045 
00046 
00047 class TDbiExceptionLog
00048 
00049 {
00050 
00051 public:
00052            TDbiExceptionLog(const TDbiException* e = 0);
00053   virtual ~TDbiExceptionLog();
00054 
00055 // State testing member functions
00056 
00057     Bool_t IsEmpty() const { return fEntries.size() == 0; }
00058 const std::vector<TDbiException>&
00059            GetEntries() const { return fEntries; }
00060       void Print() const;
00061     UInt_t Size() const { return fEntries.size(); }
00062       void Copy(TDbiExceptionLog& that, UInt_t start=0) const;
00063 
00064 // State changing member functions
00065 
00066  void AddLog(const TDbiExceptionLog& el);
00067  void AddEntry(const TDbiException& e) { fEntries.push_back(e); }
00068  void AddEntry(const char* errMsg, Int_t code = -1) {
00069    this->AddEntry(TDbiException(errMsg,code));}
00070  void AddEntry(const std::string& errMsg, Int_t code = -1) {
00071    this->AddEntry(TDbiException(errMsg.c_str(),code));}
00072  void AddEntry(const TSQLServer& server) {
00073    this->AddEntry(TDbiException(server));}
00074  void AddEntry(const TSQLStatement& statement) {
00075    this->AddEntry(TDbiException(statement));}
00076  void Clear() { fEntries.clear(); }
00077 
00078 // The Global Exception Log
00079  static TDbiExceptionLog& GetGELog() { return fgGELog;}
00080 
00081  private:
00082 
00083 
00084 // Data members
00085 
00086 private:
00087 
00088 /// The exception entries.
00089   std::vector<TDbiException> fEntries;
00090 
00091  /// Global Exception Log
00092    static TDbiExceptionLog fgGELog;
00093 
00094  ClassDef(TDbiExceptionLog,0) // Object to hold database exceptions
00095 
00096 };
00097 
00098 
00099 #endif // DBIEXCEPTIONLOG
00100 
00101 

Generated on 11 Aug 2013 for SKDatabase by  doxygen 1.6.1