- Correct setting of FUDGEM parameter.
[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;
9e1ceb13 18class AliCDBStorage;
19class AliCDBStorageFactory;
20class AliCDBParam;
21
22class AliCDBManager: public TObject {
23
24 public:
25
26 void RegisterFactory(AliCDBStorageFactory* factory);
27
fdf65bb5 28 Bool_t HasStorage(const char* dbString) const;
9e1ceb13 29
fdf65bb5 30 AliCDBParam* CreateParameter(const char* dbString) const;
9e1ceb13 31
32 AliCDBStorage* GetStorage(const char* dbString);
33 AliCDBStorage* GetStorage(const AliCDBParam* param);
34
35 TList* GetActiveStorages();
36
37 void SetDefaultStorage(const char* dbString);
38 void SetDefaultStorage(const AliCDBParam* param);
39 void SetDefaultStorage(AliCDBStorage *storage);
40
fdf65bb5 41 Bool_t IsDefaultStorageSet() const {return fDefaultStorage != 0;}
9e1ceb13 42
fdf65bb5 43 AliCDBStorage* GetDefaultStorage() const {return fDefaultStorage;}
9e1ceb13 44
45 void RemoveDefaultStorage();
46
47 void SetDrain(const char* dbString);
48 void SetDrain(const AliCDBParam* param);
49 void SetDrain(AliCDBStorage *storage);
50
fdf65bb5 51 Bool_t IsDrainSet() const {return fDrainStorage != 0;}
9e1ceb13 52
53 Bool_t Drain(AliCDBEntry* entry);
54
55 void RemoveDrain();
56
57 void DestroyActiveStorages();
58 void DestroyActiveStorage(AliCDBStorage* storage);
59
60 static void Destroy();
61 ~AliCDBManager();
62
63 static AliCDBManager* Instance();
64
65 private:
66
67 AliCDBManager();
fdf65bb5 68 static AliCDBManager* fgInstance; // AliCDBManager instance
9e1ceb13 69
70 AliCDBStorage* GetActiveStorage(const AliCDBParam* param);
71 void PutActiveStorage(AliCDBParam* param, AliCDBStorage* storage);
72
73 void Init();
74
75 TList fFactories; // list of registered storage factories
76 TMap fActiveStorages; // list of active storages
77 AliCDBStorage *fDefaultStorage; // pointer to default storage
78 AliCDBStorage *fDrainStorage; // pointer to drain storage
79
80 ClassDef(AliCDBManager, 0);
81};
82
83
84/////////////////////////////////////////////////////////////////////
85// //
86// class AliCDBStorageFactory //
87// //
88/////////////////////////////////////////////////////////////////////
89
90class AliCDBParam;
91class AliCDBStorageFactory: public TObject {
92 friend class AliCDBManager;
93
94public:
95 virtual Bool_t Validate(const char* dbString) = 0;
fdf65bb5 96 virtual AliCDBParam* CreateParameter(const char* dbString) = 0;
97 virtual ~AliCDBStorageFactory(){}
9e1ceb13 98
99protected:
100 virtual AliCDBStorage* Create(const AliCDBParam* param) = 0;
101
102 ClassDef(AliCDBStorageFactory, 0);
103};
104
105/////////////////////////////////////////////////////////////////////
106// //
107// class AliCDBParam //
108// //
109/////////////////////////////////////////////////////////////////////
110
111class AliCDBParam: public TObject {
112
113public:
114
115 AliCDBParam();
116 virtual ~AliCDBParam();
117
118 const TString& GetType() const {return fType;};
119 const TString& GetURI() const {return fURI;};
120
121 virtual AliCDBParam* CloneParam() const = 0;
122
123protected:
124
125 void SetType(const char* type) {fType = type;};
126 void SetURI(const char* uri) {fURI = uri;};
127
128private:
129
fdf65bb5 130 TString fType; // CDB type?
131 TString fURI; // CDB URI?
9e1ceb13 132
133 ClassDef(AliCDBParam, 0);
134};
135
136#endif