LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
DBFolder.h
Go to the documentation of this file.
1 #ifndef DBFOLDER_H
2 #define DBFOLDER_H
3 
4 #include "larevt/CalibrationDBI/IOVData/IOVTimeStamp.h"
5 #include "larevt/CalibrationDBI/Interface/CalibrationDBIFwd.h"
6 #include <string>
7 #include <vector>
8 #include <memory>
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& tag = "");
19  virtual ~DBFolder();
20 
21  int GetNamedChannelData(DBChannelID_t channel, const std::string& name, bool& data);
22  int GetNamedChannelData(DBChannelID_t channel, const std::string& name, long& data);
23  int GetNamedChannelData(DBChannelID_t channel, const std::string& name, double& data);
24  int GetNamedChannelData(DBChannelID_t channel, const std::string& name, std::string& data);
25  int GetNamedChannelData(DBChannelID_t channel, const std::string& name, std::vector<double>& data);
26 
27  const std::string& URL() const {return fURL;}
28  const std::string& FolderName() const {return fFolderName;}
29  const std::string& Tag() const {return fTag;}
30 
31  const IOVTimeStamp& CachedStart() const {return fCachedStart;}
32  const IOVTimeStamp& CachedEnd() const {return fCachedEnd;}
33 
34  bool UpdateData(DBTimeStamp_t raw_time);
35 
36  int GetChannelList( std::vector<DBChannelID_t>& channels ) const;
37 
38  private:
39  size_t GetTupleColumn( DBChannelID_t channel, const std::string& name, Tuple& tup );
40 
41  bool IsValid(const IOVTimeStamp& time) const {
42  if (time >= fCachedStart && time < fCachedEnd) return true;
43  else return false;
44  }
45 
46 
47  std::string fURL;
48  std::string fFolderName;
49  std::string fTag;
51 
52  Dataset fCachedDataset;
53  int fNRows; //Number of channels in cached dataset
54  IOVTimeStamp fCachedStart;
55  IOVTimeStamp fCachedEnd;
56  std::vector<std::string> fColumns; //Column names
57  std::vector<std::string> fTypes; //Column types
58  int fCachedRow; //Cache most recently retrieved row and channel numbers
59  DBChannelID_t fCachedChannel;
60  };
61 }
62 
63 #endif
const IOVTimeStamp & CachedEnd() const
Definition: DBFolder.h:32
std::string fURL
Definition: DBFolder.h:47
virtual ~DBFolder()
Definition: DBFolder.cxx:45
int GetNamedChannelData(DBChannelID_t channel, const std::string &name, bool &data)
Definition: DBFolder.cxx:49
const IOVTimeStamp & CachedStart() const
Definition: DBFolder.h:31
const std::string & URL() const
Definition: DBFolder.h:27
bool UpdateData(DBTimeStamp_t raw_time)
Definition: DBFolder.cxx:232
size_t GetTupleColumn(DBChannelID_t channel, const std::string &name, Tuple &tup)
Definition: DBFolder.cxx:172
IOVTimeStamp fCachedStart
Definition: DBFolder.h:54
DBFolder(const std::string &name, const std::string &url, const std::string &tag="")
Definition: DBFolder.cxx:25
void * Tuple
Definition: DBFolder.h:13
int GetChannelList(std::vector< DBChannelID_t > &channels) const
Definition: DBFolder.cxx:156
DBChannelID_t fCachedChannel
Definition: DBFolder.h:59
int fMaximumTimeout
Definition: DBFolder.h:50
bool IsValid(const IOVTimeStamp &time) const
Definition: DBFolder.h:41
std::vector< std::string > fTypes
Definition: DBFolder.h:57
const std::string & FolderName() const
Definition: DBFolder.h:28
const std::string & Tag() const
Definition: DBFolder.h:29
std::string fFolderName
Definition: DBFolder.h:48
IOVTimeStamp fCachedEnd
Definition: DBFolder.h:55
std::string fTag
Definition: DBFolder.h:49
Filters for channels, events, etc.
void * Dataset
Definition: DBFolder.h:12
Dataset fCachedDataset
Definition: DBFolder.h:52
std::vector< std::string > fColumns
Definition: DBFolder.h:56