EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FairDbLogEntry.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FairDbLogEntry.h
1 #ifndef FAIRDBLOGENTRY_H
2 #define FAIRDBLOGENTRY_H
3 
4 
5 #include <string>
6 using std::string;
7 #include <iosfwd>
8 
9 #include "TObject.h"
10 
11 #include "FairDb.h"
12 #include "Detector.h"
13 #include "SimFlag.h"
14 #include "FairDbTableRow.h"
15 #include "ValTimeStamp.h"
16 
17 class FairDbLogEntry;
18 class FairDbOutRowStream;
19 class FairDbResultSet;
20 class FairDbTableProxy;
21 class FairDbValidityRec;
22 
23 std::ostream& operator<<(std::ostream& s, const FairDbLogEntry& logEntry);
24 
26 {
27 
28  public:
29 
30  using TObject::Write;
31 
32 // Constructors and destructors.
33  FairDbLogEntry(const string& tableName = "",
34  const string& reason = "",
35  Int_t detMask = Detector::FullMask(),
36  Int_t simMask = SimFlag::FullMask(),
37  FairDb::Task task = 0,
38  Int_t logSeqNoMin = 0,
39  Int_t logSeqNoMax = 0,
40  Int_t logNumSeqNo = 0);
41  virtual ~FairDbLogEntry();
42 
43 // State testing member functions.
44 
45 // Inherited responsibilities.
46  virtual FairDbTableRow* CreateTableRow() const {
47  return new FairDbLogEntry;
48  }
49  Int_t GetAggregateNo() const { return -1; }
50 
51 // New member functions.
52  const string& GetLogTableName() const { return fLogTableName; }
53  Int_t GetDetectorMask() const { return fLogDetMask; }
54  Int_t GetLogSeqNoMin() const { return fLogSeqNoMin; }
55  Int_t GetLogSeqNoMax() const { return fLogSeqNoMax; }
56  Int_t GetLogNumSeqNo() const { return fLogNumSeqNo; }
57  Int_t GetSimMask() const { return fLogSimMask; }
58  FairDb::Task GetTask() const { return fLogTask; }
59  const string& GetUserName() const { return fUserName; }
60  const string& GetProcessName() const { return fProcessName; }
61  const string& GetHostName() const { return fHostName; }
62  const string& GetServerName() const { return fServerName; }
63  const string& GetReason() const { return fReason; }
65 
66  Bool_t HasReason() const { return fReason.size() > 0; }
67 
68 // State changing member functions
69  void SetReason(const string& reason);
70  void SetDetectorMask(Int_t detMask) { fLogDetMask = detMask; }
71  void SetSimMask(Int_t simMask) { fLogSimMask = simMask; }
72  void SetTask(FairDb::Task task) { fLogTask = task; }
73  void SetUpdateTime(const ValTimeStamp& updateTime) {
74  fUpdateTime = updateTime;
75  }
76  void Recreate (const string& tableName = "",
77  const string& reason = "",
78  Int_t detMask = Detector::FullMask(),
79  Int_t simMask = SimFlag::FullMask(),
80  FairDb::Task task = 0,
81  Int_t logSeqNoMin = 0,
82  Int_t logSeqNoMax = 0,
83  Int_t logNumSeqNo = 0);
84 
85 // I/O member functions
86  virtual void Fill(FairDbResultSet& rs,
87  const FairDbValidityRec* vrec);
88  virtual void Store(FairDbOutRowStream& ors,
89  const FairDbValidityRec* vrec) const;
90  Bool_t Write(UInt_t dbNo,Int_t logSeqNo=0);
91 
92  private:
93 // Constructors and destructors.
94  FairDbLogEntry(const FairDbLogEntry& from); // No!
95 
96  void SetServerName();
97 
98 // Data members
99 
101  UInt_t fDbNo;
102 
104  Int_t fSeqNo;
105 
108 
110  Int_t fLogDetMask;
111 
113  Int_t fLogSimMask;
114 
117 
120 
123 
126 
129 
131  string fUserName;
132 
134  string fProcessName;
135 
137  string fHostName;
138 
140  string fServerName;
141 
143  string fReason;
144 
145 
146 // Note: fLogDetMask,fLogSimMask,fLogTask,fUpdateTime are used to construct the FairDbValidityRec
147 // of the update; they are not store in main table.
148 
149  ClassDef(FairDbLogEntry,0) // Configuration data.
150 
151 };
152 
153 
154 #endif // FAIRDBLOGENTRY_H