EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FairDbResPtr.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FairDbResPtr.h
1 #ifndef FAIRDBRESULTPTR_H
2 #define FAIRDBRESULTPTR_H
3 
4 #include <map>
5 #include <string>
6 using std::string;
7 
8 #include "FairDb.h"
9 #include "FairDbResult.h"
10 #include "FairDbValidityRec.h"
11 #include "ValContext.h"
12 
13 class FairDbResult;
14 class FairDbResultKey;
15 class FairDbSqlContext;
16 class FairDbTableProxy;
17 
18 template <class T> class FairDbResultPtr
19 {
20 
21  public:
22 
23 // Constructors and destructors.
25  FairDbResultPtr(const FairDbResultPtr& that);
26  FairDbResultPtr(const ValContext& vc,
29  Bool_t findFullTimeWindow = true);
30  FairDbResultPtr(const string& tableName,
31  const ValContext& vc,
34  Bool_t findFullTimeWindow = true);
35  FairDbResultPtr(const string& tableName,
36  const FairDbSqlContext& context,
37  const FairDb::Task& task = FairDb::kAnyTask,
38  const string& data = "",
39  const string& fillOpts = "",
41  FairDbResultPtr(const string& tableName,
42  const FairDbValidityRec& vrec,
44  FairDbResultPtr(const string& tableName,
45  UInt_t seqNo,
46  UInt_t dbNo,
48  virtual ~FairDbResultPtr();
49 
50 
51 // State testing member functions
52  const FairDbResultKey* GetKey() const;
53  UInt_t GetNumRows() const;
54  const FairDbResult* GetResult() const { return fResult; }
55  Int_t GetResultID() const;
56  const T* GetRow(UInt_t rowNum) const;
57  const T* GetRowByIndex(UInt_t index) const;
58  const FairDbValidityRec* GetValidityRec(const FairDbTableRow* row=0) const;
60  Bool_t ResultsFromDb() const;
61 
63  static FairDbTableProxy& GetTableProxy(const string& tableName);
64 
65 // State changing member functions
66  UInt_t NextQuery(Bool_t forwards = kTRUE);
67  UInt_t NewQuery(ValContext vc,
68  FairDb::Task task=0,
69  Bool_t findFullTimeWindow = true);
70  UInt_t NewQuery(const FairDbSqlContext& context,
71  const FairDb::Task& task = 0,
72  const string& data = "",
73  const string& fillOpts = "");
74  UInt_t NewQuery(const FairDbValidityRec& vrec);
75  UInt_t NewQuery(UInt_t seqNo,UInt_t dbNo);
76 
77 
78  private:
79  void Disconnect();
80  void SetContext(const FairDbValidityRec& vrec);
81  Bool_t ApplyAbortTest();
82 
84 
90 
91 #ifndef __CINT__ // Hide map from CINT; it complains about missing Streamer() etc.
92  static std::map<string,FairDbTableProxy*> fgNameToProxy;
93 #endif // __CINT__
95 
96  ClassDefT(FairDbResultPtr<T>,0) // ResultPtr for specific database table.
97 
98 };
100 
101 #endif // FAIRDBRESULT_H