KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVSQLROOTFile.h
Go to the documentation of this file.
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 
19 class KVSQLROOTFile : public KVBase {
20  std::unique_ptr<TFile> fObjStore;
21  std::unique_ptr<KVSQLite::database> fObjDB;
22 
25  {
27  }
29  {
30  savDir->cd();
31  }
32 
34  {
35  return fObjDB->get_table("objTable");
36  }
38  {
39  return fObjDB->get_table("objInfos");
40  }
41 
42  mutable std::unordered_map<std::string, TObject*> fObjList;
43 
44  KVString UUID_for_object(const KVString&) const;
45  TObject* get_object_with_UUID(const KVString& name) const;
46 
47 public:
48  KVSQLROOTFile(const KVString& filepath, Option_t* option = "READ");
49 
50  void WriteObject(const TObject*, const KVNameValueList&);
51 
52  TObject* Get(const KVString& name) const;
53 
54  void ls(Option_t* = "") const;
55 
57  void FillListOfObjectsWithSelection(KVSeqCollection* list, const KVString& where, const KVString& numberlist_column,
58  int value);
59 
60  ClassDef(KVSQLROOTFile, 1) //Combine ROOT file containing objects with SQLite database with info on the objects
61 };
62 
63 #endif
const char Option_t
#define ClassDef(name, id)
#define gDirectory
Base class for KaliVeda framework.
Definition: KVBase.h:141
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:19
void WriteObject(const TObject *, const KVNameValueList &)
Write object in ROOT file, store infos given in list.
void FillListOfObjectsWithSelection(KVSeqCollection *list, const KVString &where)
KVSQLite::table & get_objTable() const
Definition: KVSQLROOTFile.h:33
KVSQLite::table & get_objInfos() const
Definition: KVSQLROOTFile.h:37
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:42
TObject * get_object_with_UUID(const KVString &name) const
Retrieve object from file using its name.
void restore_working_directory()
Definition: KVSQLROOTFile.h:28
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:20
TDirectory * savDir
Definition: KVSQLROOTFile.h:23
std::unique_ptr< KVSQLite::database > fObjDB
Definition: KVSQLROOTFile.h:21
KVSQLROOTFile(const KVString &filepath, Option_t *option="READ")
void save_working_directory()
Definition: KVSQLROOTFile.h:24
KaliVeda extensions to ROOT collection classes.
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
virtual Bool_t cd(const char *path=nullptr)