EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FairDbExceptionLog.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FairDbExceptionLog.h
1 #ifndef FAIRDBEXCEPTIONLOG
2 #define FAIRDBEXCEPTIONLOG
3 
4 
5 #include <iosfwd>
6 #include <string>
7 #include <vector>
8 
9 #include "Rtypes.h"
10 
11 #include "FairDbException.h"
12 
13 class TSQLServer;
14 class TSQLStatement;
15 class FairDbExceptionLog;
16 
17 std::ostream& operator<<(std::ostream& s, const FairDbExceptionLog& el);
18 
20 
21 {
22 
23  public:
25  virtual ~FairDbExceptionLog();
26 
27 // State testing member functions
28 
29  Bool_t IsEmpty() const { return fEntries.size() == 0; }
30  const std::vector<FairDbException>&
31  GetEntries() const { return fEntries; }
32  void Print() const;
33  UInt_t Size() const { return fEntries.size(); }
34  void Copy(FairDbExceptionLog& that, UInt_t start=0) const;
35 
36 // State changing member functions
37 
38  void AddLog(const FairDbExceptionLog& el);
39  void AddEntry(const FairDbException& e) { fEntries.push_back(e); }
40  void AddEntry(const char* errMsg, Int_t code = -1, Int_t dbType = -1) {
41  this->AddEntry(FairDbException(errMsg,code,dbType));
42  }
43  void AddEntry(const std::string& errMsg, Int_t code = -1, Int_t dbType = -1) {
44  this->AddEntry(FairDbException(errMsg.c_str(),code,dbType));
45  }
46  void AddEntry(const TSQLServer& server, Int_t dbType = -1) {
47  this->AddEntry(FairDbException(server,dbType));
48  }
49  void AddEntry(const TSQLStatement& statement, Int_t dbType = -1) {
50  this->AddEntry(FairDbException(statement,dbType));
51  }
52  void Clear() { fEntries.clear(); }
53 
54 // The Global Exception Log
55  static FairDbExceptionLog& GetGELog() { return fgGELog;}
56 
57  private:
58 
59 
60 // Data members
61 
62  private:
63 
65  std::vector<FairDbException> fEntries;
66 
69 
70  ClassDef(FairDbExceptionLog,0) // Object to hold database exceptions
71 
72 };
73 
74 #endif // FAIRDBEXCEPTIONLOG
75