LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
DBFolder.h
Go to the documentation of this file.
1 #ifndef DBFOLDER_H
2 #define DBFOLDER_H
3 
5 #include "larevt/CalibrationDBI/Interface/CalibrationDBIFwd.h"
7 #include <string>
8 #include <vector>
9 
10 namespace lariov {
11 
12  typedef void* Dataset;
13  typedef void* Tuple;
14 
15  class DBFolder {
16 
17  public:
18  DBFolder(const std::string& name,
19  const std::string& url,
20  const std::string& url2,
21  const std::string& tag = "",
22  bool useqlite = false,
23  bool testmode = false);
24  virtual ~DBFolder();
25 
26  int GetNamedChannelData(DBChannelID_t channel, const std::string& name, bool& data);
27  int GetNamedChannelData(DBChannelID_t channel, const std::string& name, long& data);
28  int GetNamedChannelData(DBChannelID_t channel, const std::string& name, double& data);
29  int GetNamedChannelData(DBChannelID_t channel, const std::string& name, std::string& data);
30  //int GetNamedChannelData(DBChannelID_t channel, const std::string& name, std::vector<double>& data);
31 
32  const std::string& URL() const { return fURL; }
33  const std::string& FolderName() const { return fFolderName; }
34  const std::string& Tag() const { return fTag; }
35 
36  const IOVTimeStamp& CachedStart() const { return fCache.beginTime(); }
37  const IOVTimeStamp& CachedEnd() const { return fCache.endTime(); }
38 
39  bool UpdateData(DBTimeStamp_t raw_time);
40 
41  void GetSQLiteData(int t, DBDataset& data) const;
42 
43  int GetChannelList(std::vector<DBChannelID_t>& channels) const;
44 
45  void DumpDataset(const DBDataset& data) const;
46 
47  bool CompareDataset(const DBDataset& data1, const DBDataset& data2) const;
48 
49  private:
50  void GetRow(DBChannelID_t channel);
51  size_t GetColumn(const std::string& name) const;
52 
53  bool IsValid(const IOVTimeStamp& time) const
54  {
55  if (time >= fCache.beginTime() && time < fCache.endTime())
56  return true;
57  else
58  return false;
59  }
60 
61  std::string fURL;
62  std::string fURL2;
63  std::string fFolderName;
64  std::string fTag;
65  bool fUseSQLite;
66  bool fTestMode;
67  std::string fSQLitePath;
69 
70  // Database cache.
71 
73 
74  // Database row cache.
75 
77  DBChannelID_t fCachedChannel;
79  };
80 }
81 
82 #endif
const IOVTimeStamp & CachedEnd() const
Definition: DBFolder.h:37
std::string fURL
Definition: DBFolder.h:61
virtual ~DBFolder()
Definition: DBFolder.cxx:72
int GetNamedChannelData(DBChannelID_t channel, const std::string &name, bool &data)
Definition: DBFolder.cxx:76
const IOVTimeStamp & CachedStart() const
Definition: DBFolder.h:36
DBDataset fCache
Definition: DBFolder.h:72
int fCachedRowNumber
Definition: DBFolder.h:76
const std::string & URL() const
Definition: DBFolder.h:32
bool UpdateData(DBTimeStamp_t raw_time)
Definition: DBFolder.cxx:267
void GetRow(DBChannelID_t channel)
Definition: DBFolder.cxx:221
DBDataset::DBRow fCachedRow
Definition: DBFolder.h:78
void * Tuple
Definition: DBFolder.h:13
int GetChannelList(std::vector< DBChannelID_t > &channels) const
Definition: DBFolder.cxx:212
DBChannelID_t fCachedChannel
Definition: DBFolder.h:77
Class def header for a class IOVTimeStamp.
int fMaximumTimeout
Definition: DBFolder.h:68
bool IsValid(const IOVTimeStamp &time) const
Definition: DBFolder.h:53
const std::string & FolderName() const
Definition: DBFolder.h:33
std::string fURL2
Definition: DBFolder.h:62
const IOVTimeStamp & endTime() const
Definition: DBDataset.h:116
const std::string & Tag() const
Definition: DBFolder.h:34
void DumpDataset(const DBDataset &data) const
Definition: DBFolder.cxx:714
bool CompareDataset(const DBDataset &data1, const DBDataset &data2) const
Definition: DBFolder.cxx:771
const IOVTimeStamp & beginTime() const
Definition: DBDataset.h:115
std::string fFolderName
Definition: DBFolder.h:63
std::string fTag
Definition: DBFolder.h:64
Filters for channels, events, etc.
void * Dataset
Definition: DBFolder.h:12
size_t GetColumn(const std::string &name) const
Definition: DBFolder.cxx:250
std::string fSQLitePath
Definition: DBFolder.h:67
DBFolder(const std::string &name, const std::string &url, const std::string &url2, const std::string &tag="", bool useqlite=false, bool testmode=false)
Definition: DBFolder.cxx:19
void GetSQLiteData(int t, DBDataset &data) const
Definition: DBFolder.cxx:351