All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DBFolder.h
Go to the documentation of this file.
1 #ifndef DBFOLDER_H
2 #define DBFOLDER_H
3 
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, const std::string& url, const std::string& url2,
19  const std::string& tag = "", bool useqlite=false, bool testmode=false);
20  virtual ~DBFolder();
21 
22  int GetNamedChannelData(DBChannelID_t channel, const std::string& name, bool& data);
23  int GetNamedChannelData(DBChannelID_t channel, const std::string& name, long& data);
24  int GetNamedChannelData(DBChannelID_t channel, const std::string& name, double& data);
25  int GetNamedChannelData(DBChannelID_t channel, const std::string& name, std::string& data);
26  //int GetNamedChannelData(DBChannelID_t channel, const std::string& name, std::vector<double>& data);
27 
28  const std::string& URL() const {return fURL;}
29  const std::string& FolderName() const {return fFolderName;}
30  const std::string& Tag() const {return fTag;}
31 
32  const IOVTimeStamp& CachedStart() const {return fCache.beginTime();}
33  const IOVTimeStamp& CachedEnd() const {return fCache.endTime();}
34 
35  bool UpdateData(DBTimeStamp_t raw_time);
36 
37  void GetSQLiteData(int t, DBDataset& data) const;
38 
39  int GetChannelList( std::vector<DBChannelID_t>& channels ) const;
40 
41  void DumpDataset(const DBDataset& data) const;
42 
43  bool CompareDataset(const DBDataset& data1, const DBDataset& data2) const;
44 
45  private:
46 
47  void GetRow(DBChannelID_t channel);
48  size_t GetColumn(const std::string& name) const;
49 
50  bool IsValid(const IOVTimeStamp& time) const {
51  if (time >= fCache.beginTime() && time < fCache.endTime()) return true;
52  else return false;
53  }
54 
55 
56  std::string fURL;
57  std::string fURL2;
58  std::string fFolderName;
59  std::string fTag;
60  bool fUseSQLite;
61  bool fTestMode;
62  std::string fSQLitePath;
64 
65  // Database cache.
66 
68 
69  // Database row cache.
70 
74  };
75 }
76 
77 #endif
const IOVTimeStamp & CachedEnd() const
Definition: DBFolder.h:33
std::string fURL
Definition: DBFolder.h:56
virtual ~DBFolder()
Definition: DBFolder.cxx:66
int GetNamedChannelData(DBChannelID_t channel, const std::string &name, bool &data)
Definition: DBFolder.cxx:70
const IOVTimeStamp & CachedStart() const
Definition: DBFolder.h:32
DBDataset fCache
Definition: DBFolder.h:67
int fCachedRowNumber
Definition: DBFolder.h:71
const std::string & URL() const
Definition: DBFolder.h:28
bool UpdateData(DBTimeStamp_t raw_time)
Definition: DBFolder.cxx:254
std::uint32_t DBChannelID_t
void GetRow(DBChannelID_t channel)
Definition: DBFolder.cxx:208
DBDataset::DBRow fCachedRow
Definition: DBFolder.h:73
std::uint64_t DBTimeStamp_t
void * Tuple
Definition: DBFolder.h:13
int GetChannelList(std::vector< DBChannelID_t > &channels) const
Definition: DBFolder.cxx:200
DBChannelID_t fCachedChannel
Definition: DBFolder.h:72
Class def header for a class IOVTimeStamp.
int fMaximumTimeout
Definition: DBFolder.h:63
bool IsValid(const IOVTimeStamp &time) const
Definition: DBFolder.h:50
const std::string & FolderName() const
Definition: DBFolder.h:29
std::string fURL2
Definition: DBFolder.h:57
const IOVTimeStamp & endTime() const
Definition: DBDataset.h:122
const std::string & Tag() const
Definition: DBFolder.h:30
void DumpDataset(const DBDataset &data) const
Definition: DBFolder.cxx:693
bool CompareDataset(const DBDataset &data1, const DBDataset &data2) const
Definition: DBFolder.cxx:749
const IOVTimeStamp & beginTime() const
Definition: DBDataset.h:121
std::string fFolderName
Definition: DBFolder.h:58
std::string fTag
Definition: DBFolder.h:59
void * Dataset
Definition: DBFolder.h:12
size_t GetColumn(const std::string &name) const
Definition: DBFolder.cxx:237
then echo fcl name
std::string fSQLitePath
Definition: DBFolder.h:62
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:335