New version of the CDB classes. Run number added (A.Colla).
[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
22 class AliCDBStorage: public TObject {
23
24 public:
25         AliCDBStorage();
26
27         void ReadSelectionFromFile(const char *fileName);
28         
29         void AddSelection(const AliCDBId& selection);
30
31         void AddSelection(const AliCDBPath& path, 
32                         const AliCDBRunRange& runRange,
33                         Int_t version,
34                         Int_t subVersion = -1);
35         
36         void AddSelection(const AliCDBPath& path,
37                         Int_t firstRun,
38                         Int_t lastRun,
39                         Int_t version,
40                         Int_t subVersion = -1);
41                         
42         void RemoveSelection(const AliCDBId& selection);
43
44         void RemoveSelection(const AliCDBPath& path,
45                         const AliCDBRunRange& runRange);
46         
47         void RemoveSelection(const AliCDBPath& path,
48                         Int_t firstRun = -1,
49                         Int_t lastRun = -1);
50
51         void RemoveSelection(int position);
52         void RemoveAllSelections();
53                 
54         void PrintSelectionList();
55
56         AliCDBEntry* Get(const AliCDBId& query);
57         AliCDBEntry* Get(const AliCDBPath& path, Int_t runNumber, 
58                                 Int_t version = -1, Int_t subVersion = -1);
59         AliCDBEntry* Get(const AliCDBPath& path, const AliCDBRunRange& runRange,
60                                  Int_t version = -1, Int_t subVersion = -1);
61
62         TList* GetAll(const AliCDBId& query);
63         TList* GetAll(const AliCDBPath& path, Int_t runNumber, 
64                                 Int_t version = -1, Int_t subVersion = -1);
65         TList* GetAll(const AliCDBPath& path, const AliCDBRunRange& runRange,
66                                  Int_t version = -1, Int_t subVersion = -1); 
67         
68         Bool_t Put(TObject* object, AliCDBId& id,  AliCDBMetaData* metaData);
69         Bool_t Put(AliCDBEntry* entry);
70
71
72         virtual Bool_t IsReadOnly() const = 0;
73         virtual Bool_t HasSubVersion() const = 0;
74
75         virtual Bool_t Contains(const char* path) const = 0;
76
77 protected:
78                 
79         virtual ~AliCDBStorage();       
80         void    GetSelection(/*const*/ AliCDBId* id);
81         virtual AliCDBEntry* GetEntry(const AliCDBId& query) = 0;
82         virtual TList* GetEntries(const AliCDBId& query) = 0;
83         virtual Bool_t PutEntry(AliCDBEntry* entry) = 0; 
84         virtual TList *GetIdListFromFile(const char* fileName)=0;
85
86 private:
87
88         TList fSelections; // list of selection criteria
89
90         ClassDef(AliCDBStorage, 0);
91 };
92
93 #endif