]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliCDBStorage.h
Updated version of the CDB classes. Bug fix in AliCDBGrid. New AliCDBStorage function...
[u/mrichter/AliRoot.git] / STEER / AliCDBStorage.h
1 #ifndef ALI_CDB_STORAGE_H
2 #define ALI_CDB_STORAGE_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 /////////////////////////////////////////////////////////////////////
8 //                                                                 //
9 //  class AliCDBStorage                                            //
10 //  interface to specific storage classes                          //
11 //  (AliCDBGrid, AliCDBLocal, AliCDBDump)                          //
12 //                                                                 //
13 /////////////////////////////////////////////////////////////////////
14
15 #include "AliCDBId.h"
16 #include "AliCDBMetaData.h"
17
18 #include <TList.h>
19
20 class AliCDBEntry;
21 class AliCDBPath;
22
23 class AliCDBStorage: public TObject {
24
25 public:
26         AliCDBStorage();
27
28         void SetURI(const TString& uri) {fURI = uri;}
29         const TString& GetURI() const {return fURI;}
30         const TString& GetType() const {return fType;}
31         const TString& GetBaseFolder() const {return fBaseFolder;}
32
33
34         void ReadSelectionFromFile(const char *fileName);
35         
36         void AddSelection(const AliCDBId& selection);
37
38         void AddSelection(const AliCDBPath& path, 
39                         const AliCDBRunRange& runRange,
40                         Int_t version,
41                         Int_t subVersion = -1);
42         
43         void AddSelection(const AliCDBPath& path,
44                         Int_t firstRun,
45                         Int_t lastRun,
46                         Int_t version,
47                         Int_t subVersion = -1);
48                         
49         void RemoveSelection(const AliCDBId& selection);
50
51         void RemoveSelection(const AliCDBPath& path,
52                         const AliCDBRunRange& runRange);
53         
54         void RemoveSelection(const AliCDBPath& path,
55                         Int_t firstRun = -1,
56                         Int_t lastRun = -1);
57
58         void RemoveSelection(int position);
59         void RemoveAllSelections();
60                 
61         void PrintSelectionList();
62
63         AliCDBEntry* Get(const AliCDBId& query);
64         AliCDBEntry* Get(const AliCDBPath& path, Int_t runNumber, 
65                                 Int_t version = -1, Int_t subVersion = -1);
66         AliCDBEntry* Get(const AliCDBPath& path, const AliCDBRunRange& runRange,
67                                  Int_t version = -1, Int_t subVersion = -1);
68
69         TList* GetAll(const AliCDBId& query);
70         TList* GetAll(const AliCDBPath& path, Int_t runNumber, 
71                                 Int_t version = -1, Int_t subVersion = -1);
72         TList* GetAll(const AliCDBPath& path, const AliCDBRunRange& runRange,
73                                  Int_t version = -1, Int_t subVersion = -1);
74         
75         Bool_t Put(TObject* object, AliCDBId& id,  AliCDBMetaData* metaData);
76         Bool_t Put(AliCDBEntry* entry);
77
78
79         virtual Bool_t IsReadOnly() const = 0;
80         virtual Bool_t HasSubVersion() const = 0;
81         virtual Bool_t Contains(const char* path) const = 0;
82         virtual Bool_t IdToFilename(const AliCDBId& id, TString& filename) const = 0;
83
84         void QueryCDB(Int_t run, const char* pathFilter="*",
85                         Int_t version=-1, AliCDBMetaData *mdFilter=0);
86         void PrintQueryCDB();
87         TList* GetQueryCDBList() {return &fValidFileIds;}
88
89         virtual Int_t GetLatestVersion(const char* path, Int_t run)=0;
90         virtual Int_t GetLatestSubVersion(const char* path, Int_t run, Int_t version=-1)=0;
91
92 protected:
93
94         virtual ~AliCDBStorage();
95         void    GetSelection(/*const*/ AliCDBId* id);
96         virtual AliCDBEntry* GetEntry(const AliCDBId& query) = 0;
97         virtual TList* GetEntries(const AliCDBId& query) = 0;
98         virtual Bool_t PutEntry(AliCDBEntry* entry) = 0;
99         virtual TList *GetIdListFromFile(const char* fileName)=0;
100         virtual void   QueryValidFiles() = 0;
101
102         TList fValidFileIds;    // list of Id's of the files valid for a given run (cached as fRun)
103         Int_t fRun;             // run number, used to manage list of valid files
104         AliCDBPath fPathFilter; // path filter, used to manage list of valid files
105         Int_t fVersion;         // version, used to manage list of valid files
106         AliCDBMetaData* fMetaDataFilter; // metadata, used to manage list of valid files
107
108         TList fSelections;      // list of selection criteria
109         TString fURI;           // storage URI;
110         TString fType;    //! Local, Grid: base folder name - Dump: file name
111         TString fBaseFolder;    //! Local, Grid: base folder name - Dump: file name
112
113 private:
114         AliCDBStorage(const AliCDBStorage & source);
115         AliCDBStorage & operator=(const AliCDBStorage & source);
116
117         ClassDef(AliCDBStorage, 0);
118 };
119
120 #endif