KaliVeda
Toolkit for HIC analysis
KVSQLROOTFile.h
1 #ifndef __KVSQLROOTFILE_H
2 #define __KVSQLROOTFILE_H
3 
4 #include "KVBase.h"
5 #include "TFile.h"
6 #include "SQLiteDB.h"
7 #include <unordered_map>
8 
76 class KVSQLROOTFile : public KVBase {
77  std::unique_ptr<TFile> fObjStore;
78  std::unique_ptr<KVSQLite::database> fObjDB;
79 
82  {
84  }
86  {
87  savDir->cd();
88  }
89 
91  {
92  return fObjDB->get_table("objTable");
93  }
95  {
96  return fObjDB->get_table("objInfos");
97  }
98 
99  mutable std::unordered_map<std::string, TObject*> fObjList;
100 
101  KVString UUID_for_object(const KVString&) const;
102  TObject* get_object_with_UUID(const KVString& name) const;
103 
105 public:
106  KVSQLROOTFile(const KVString& filepath, Option_t* option = "READ");
107 
108  ~KVSQLROOTFile();
109 
110  void WriteObject(const TObject*, const KVNameValueList&);
111 
112  TObject* Get(const KVString& name) const;
113 
114  void ls(Option_t* = "") const;
115 
116  void FillListOfObjectsWithSelection(KVSeqCollection* list, const KVString& where);
117  void FillListOfObjectsWithSelection(KVSeqCollection* list, const KVString& where, const KVString& numberlist_column,
118  int value);
119 
120  ClassDef(KVSQLROOTFile, 1) //Combine ROOT file containing objects with SQLite database with info on the objects
121 };
122 
123 #endif
const char Option_t
#define ClassDef(name, id)
#define gDirectory
Base class for KaliVeda framework.
Definition: KVBase.h:142
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
Combine ROOT file containing objects with SQLite database with info on the objects.
Definition: KVSQLROOTFile.h:76
void WriteObject(const TObject *, const KVNameValueList &)
void FillListOfObjectsWithSelection(KVSeqCollection *list, const KVString &where)
KVSQLite::table & get_objTable() const
Definition: KVSQLROOTFile.h:90
KVSQLite::table & get_objInfos() const
Definition: KVSQLROOTFile.h:94
TObject * Get(const KVString &name) const
Return pointer to object with given name.
void ls(Option_t *="") const
List the contents of the file with associated infos.
std::unordered_map< std::string, TObject * > fObjList
for quick look-up of objects using unique id
Definition: KVSQLROOTFile.h:99
TObject * get_object_with_UUID(const KVString &name) const
Retrieve object from file using its name.
void restore_working_directory()
Definition: KVSQLROOTFile.h:85
KVString UUID_for_object(const KVString &) const
Return unique identifier used to store object with given name in ROOT file.
std::unique_ptr< TFile > fObjStore
Definition: KVSQLROOTFile.h:77
TDirectory * savDir
Definition: KVSQLROOTFile.h:80
TString fCurrentROOTFilePath
full path to current ROOT file
std::unique_ptr< KVSQLite::database > fObjDB
Definition: KVSQLROOTFile.h:78
KVSQLROOTFile(const KVString &filepath, Option_t *option="READ")
void save_working_directory()
Definition: KVSQLROOTFile.h:81
KaliVeda extensions to ROOT collection classes.
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
virtual Bool_t cd()