]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliCDBManager.h
Errors available at the VertexFinding step. A bug fix in deleting an array. (Andrea...
[u/mrichter/AliRoot.git] / STEER / AliCDBManager.h
CommitLineData
9e1ceb13 1#ifndef ALI_CDB_MANAGER_H
2#define ALI_CDB_MANAGER_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 AliCDBManager //
10// //
11/////////////////////////////////////////////////////////////////////
12
13#include <TObject.h>
14#include <TList.h>
15#include <TMap.h>
16
fdf65bb5 17class AliCDBEntry;
02c4845e 18class AliCDBId;
19class AliCDBPath;
20class AliCDBRunRange;
21class AliCDBMetaData;
9e1ceb13 22class AliCDBStorage;
23class AliCDBStorageFactory;
24class AliCDBParam;
25
26class AliCDBManager: public TObject {
27
28 public:
b8ec52f6 29 enum DataType {kCondition=0, kReference, kPrivate};
9e1ceb13 30
31 void RegisterFactory(AliCDBStorageFactory* factory);
32
fdf65bb5 33 Bool_t HasStorage(const char* dbString) const;
9e1ceb13 34
fdf65bb5 35 AliCDBParam* CreateParameter(const char* dbString) const;
b8ec52f6 36 AliCDBParam* GetCondParam() const {return fCondParam;}
37 AliCDBParam* GetRefParam() const {return fRefParam;}
38 static const char* GetDataTypeName(DataType type);
9e1ceb13 39
40 AliCDBStorage* GetStorage(const char* dbString);
41 AliCDBStorage* GetStorage(const AliCDBParam* param);
b8ec52f6 42
9e1ceb13 43 TList* GetActiveStorages();
44
45 void SetDefaultStorage(const char* dbString);
46 void SetDefaultStorage(const AliCDBParam* param);
47 void SetDefaultStorage(AliCDBStorage *storage);
9e1ceb13 48
02c4845e 49 Bool_t IsDefaultStorageSet() const {return fDefaultStorage != 0;}
fdf65bb5 50 AliCDBStorage* GetDefaultStorage() const {return fDefaultStorage;}
b05400be 51 void UnsetDefaultStorage() {fDefaultStorage = 0x0;}
b8ec52f6 52
024cf675 53 void SetSpecificStorage(const char* calibType, const char* dbString);
54 void SetSpecificStorage(const char* calibType, AliCDBParam* param);
02c4845e 55
024cf675 56 AliCDBStorage* GetSpecificStorage(const char* calibType);
9e1ceb13 57
58 void SetDrain(const char* dbString);
59 void SetDrain(const AliCDBParam* param);
60 void SetDrain(AliCDBStorage *storage);
61
fdf65bb5 62 Bool_t IsDrainSet() const {return fDrainStorage != 0;}
9e1ceb13 63
64 Bool_t Drain(AliCDBEntry* entry);
65
b05400be 66 void UnsetDrain(){fDrainStorage = 0x0;}
9e1ceb13 67
02c4845e 68 AliCDBEntry* Get(const AliCDBId& query);
62032124 69 AliCDBEntry* Get(const AliCDBPath& path, Int_t runNumber=-1,
02c4845e 70 Int_t version = -1, Int_t subVersion = -1);
71 AliCDBEntry* Get(const AliCDBPath& path, const AliCDBRunRange& runRange,
72 Int_t version = -1, Int_t subVersion = -1);
73
74 TList* GetAll(const AliCDBId& query);
62032124 75 TList* GetAll(const AliCDBPath& path, Int_t runNumber=-1,
02c4845e 76 Int_t version = -1, Int_t subVersion = -1);
77 TList* GetAll(const AliCDBPath& path, const AliCDBRunRange& runRange,
78 Int_t version = -1, Int_t subVersion = -1);
79
b8ec52f6 80 Bool_t Put(TObject* object, AliCDBId& id,
81 AliCDBMetaData* metaData, DataType type=kPrivate);
82 Bool_t Put(AliCDBEntry* entry, DataType type=kPrivate);
83
4b5e0dce 84 void SetCacheFlag(Bool_t cacheFlag) {fCache=cacheFlag;}
e1e6896f 85 Bool_t GetCacheFlag() const {return fCache;}
4b5e0dce 86
c3a7b59a 87 void SetRun(Int_t run);
88 Int_t GetRun() const {return fRun;}
4b5e0dce 89
024cf675 90 // AliCDBEntry* Get(const char* path);
02c4845e 91
9e1ceb13 92 void DestroyActiveStorages();
93 void DestroyActiveStorage(AliCDBStorage* storage);
917a098b 94
62032124 95 void QueryCDB();
96
917a098b 97 void Print(Option_t* option="") const;
98
9e1ceb13 99 static void Destroy();
100 ~AliCDBManager();
101
8e245d15 102 void ClearCache();
4005d0b5 103 void UnloadFromCache(const char* path);
8e245d15 104
4005d0b5 105 static AliCDBManager* Instance();
9e1ceb13 106
107 private:
b8ec52f6 108
109 static TString fgkCondUri; // URI of the Conditions data base folder
110 static TString fgkRefUri; // URI of the Reference data base folder
111 AliCDBParam* fCondParam; // Conditions data storage parameters
112 AliCDBParam* fRefParam; // Reference data storage parameters
113
9e1ceb13 114 AliCDBManager();
fe12e09c 115 AliCDBManager(const AliCDBManager & source);
116 AliCDBManager & operator=(const AliCDBManager & source);
117
fdf65bb5 118 static AliCDBManager* fgInstance; // AliCDBManager instance
9e1ceb13 119
120 AliCDBStorage* GetActiveStorage(const AliCDBParam* param);
121 void PutActiveStorage(AliCDBParam* param, AliCDBStorage* storage);
917a098b 122
4b5e0dce 123 void CacheEntry(const char* path, AliCDBEntry* entry);
8e245d15 124
024cf675 125 AliCDBParam* SelectSpecificStorage(const TString& path);
126
9e1ceb13 127
128 void Init();
129
b05400be 130 TList fFactories; //! list of registered storage factories
131 TMap fActiveStorages; //! list of active storages
02c4845e 132 TMap fSpecificStorages; //! list of detector-specific storages
4b5e0dce 133
b05400be 134 AliCDBStorage *fDefaultStorage; //! pointer to default storage
135 AliCDBStorage *fDrainStorage; //! pointer to drain storage
9e1ceb13 136
4b5e0dce 137 TMap fEntryCache; //! cache of the retrieved objects
138
139 Bool_t fCache; //! The cache flag
c3a7b59a 140 Int_t fRun; //! The run number
4b5e0dce 141
9e1ceb13 142 ClassDef(AliCDBManager, 0);
143};
144
145
146/////////////////////////////////////////////////////////////////////
147// //
148// class AliCDBStorageFactory //
149// //
150/////////////////////////////////////////////////////////////////////
151
152class AliCDBParam;
153class AliCDBStorageFactory: public TObject {
154 friend class AliCDBManager;
155
156public:
e1e6896f 157 virtual ~AliCDBStorageFactory(){}
9e1ceb13 158 virtual Bool_t Validate(const char* dbString) = 0;
b05400be 159 virtual AliCDBParam* CreateParameter(const char* dbString) = 0;
9e1ceb13 160
161protected:
162 virtual AliCDBStorage* Create(const AliCDBParam* param) = 0;
163
164 ClassDef(AliCDBStorageFactory, 0);
165};
166
167/////////////////////////////////////////////////////////////////////
168// //
169// class AliCDBParam //
170// //
171/////////////////////////////////////////////////////////////////////
172
173class AliCDBParam: public TObject {
174
175public:
176
177 AliCDBParam();
178 virtual ~AliCDBParam();
179
180 const TString& GetType() const {return fType;};
181 const TString& GetURI() const {return fURI;};
182
183 virtual AliCDBParam* CloneParam() const = 0;
184
185protected:
186
187 void SetType(const char* type) {fType = type;};
188 void SetURI(const char* uri) {fURI = uri;};
189
190private:
191
917a098b 192 TString fType; //! CDB type
193 TString fURI; //! CDB URI
9e1ceb13 194
195 ClassDef(AliCDBParam, 0);
196};
197
198#endif