Data field, setter and getter for the storage URI (Alberto)
[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 SetURI(const TString& uri) {fURI = uri;}
28         const TString& GetURI() const {return fURI;}
29
30         void ReadSelectionFromFile(const char *fileName);
31         
32         void AddSelection(const AliCDBId& selection);
33
34         void AddSelection(const AliCDBPath& path, 
35                         const AliCDBRunRange& runRange,
36                         Int_t version,
37                         Int_t subVersion = -1);
38         
39         void AddSelection(const AliCDBPath& path,
40                         Int_t firstRun,
41                         Int_t lastRun,
42                         Int_t version,
43                         Int_t subVersion = -1);
44                         
45         void RemoveSelection(const AliCDBId& selection);
46
47         void RemoveSelection(const AliCDBPath& path,
48                         const AliCDBRunRange& runRange);
49         
50         void RemoveSelection(const AliCDBPath& path,
51                         Int_t firstRun = -1,
52                         Int_t lastRun = -1);
53
54         void RemoveSelection(int position);
55         void RemoveAllSelections();
56                 
57         void PrintSelectionList();
58
59         AliCDBEntry* Get(const AliCDBId& query);
60         AliCDBEntry* Get(const AliCDBPath& path, Int_t runNumber, 
61                                 Int_t version = -1, Int_t subVersion = -1);
62         AliCDBEntry* Get(const AliCDBPath& path, const AliCDBRunRange& runRange,
63                                  Int_t version = -1, Int_t subVersion = -1);
64
65         TList* GetAll(const AliCDBId& query);
66         TList* GetAll(const AliCDBPath& path, Int_t runNumber, 
67                                 Int_t version = -1, Int_t subVersion = -1);
68         TList* GetAll(const AliCDBPath& path, const AliCDBRunRange& runRange,
69                                  Int_t version = -1, Int_t subVersion = -1);
70         
71         Bool_t Put(TObject* object, AliCDBId& id,  AliCDBMetaData* metaData);
72         Bool_t Put(AliCDBEntry* entry);
73
74
75         virtual Bool_t IsReadOnly() const = 0;
76         virtual Bool_t HasSubVersion() const = 0;
77
78         virtual Bool_t Contains(const char* path) const = 0;
79
80 protected:
81                 
82         virtual ~AliCDBStorage();       
83         void    GetSelection(/*const*/ AliCDBId* id);
84         virtual AliCDBEntry* GetEntry(const AliCDBId& query) = 0;
85         virtual TList* GetEntries(const AliCDBId& query) = 0;
86         virtual Bool_t PutEntry(AliCDBEntry* entry) = 0; 
87         virtual TList *GetIdListFromFile(const char* fileName)=0;
88
89 private:
90
91         TList fSelections;      // list of selection criteria
92         TString fURI;           //! storage URI;
93
94         ClassDef(AliCDBStorage, 0);
95 };
96
97 #endif