00b11eca3666049c25621515430b6703e417d37f
[u/mrichter/AliRoot.git] / STEER / AliCDBLocal.h
1 #ifndef ALI_CDB_LOCAL_H
2 #define ALI_CDB_LOCAL_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 AliCDBLocal                                              //
10 //  access class to a DataBase in a local storage                  //
11 //                                                                 //
12 /////////////////////////////////////////////////////////////////////
13
14 #include "AliCDBStorage.h"
15 #include "AliCDBManager.h"
16
17 class AliCDBLocal: public AliCDBStorage {
18         friend class AliCDBLocalFactory;
19
20 public:
21
22         virtual Bool_t IsReadOnly() const {return kFALSE;};
23         virtual Bool_t HasSubVersion() const {return kTRUE;};
24
25 protected:
26
27         virtual AliCDBEntry* GetEntry(const AliCDBId& queryId);
28         virtual TList* GetEntries(const AliCDBId& queryId);
29         virtual Bool_t PutEntry(AliCDBEntry* entry);
30
31 private:
32
33         AliCDBLocal(const char* baseDir);
34         virtual ~AliCDBLocal();
35         
36         Bool_t FilenameToId(const char* filename, AliCDBRunRange& runRange, 
37                         Int_t& version, Int_t& subVersion);
38         Bool_t IdToFilename(const AliCDBRunRange& runRange, Int_t version, 
39                         Int_t subVersion, TString& filename);
40
41         Bool_t PrepareId(AliCDBId& id);
42         AliCDBId GetId(const AliCDBId& query);
43
44         void GetEntriesForLevel0(const char* level0, const AliCDBId& query, TList* result);
45         void GetEntriesForLevel1(const char* level0, const char* Level1,
46                         const AliCDBId& query, TList* result);
47
48         TString fBaseDirectory; // path of the DB folder
49
50         ClassDef(AliCDBLocal, 0); // access class to a DataBase in a local storage
51 };
52
53 /////////////////////////////////////////////////////////////////////
54 //                                                                 //
55 //  class AliCDBLocalFactory                                       //
56 //                                                                 //
57 /////////////////////////////////////////////////////////////////////
58
59 class AliCDBLocalFactory: public AliCDBStorageFactory {
60
61 public:
62
63         virtual Bool_t Validate(const char* dbString);
64         virtual AliCDBParam* CreateParameter(const char* dbString);
65
66 protected:
67         virtual AliCDBStorage* Create(const AliCDBParam* param);
68
69         ClassDef(AliCDBLocalFactory, 0);
70 };
71
72 /////////////////////////////////////////////////////////////////////
73 //                                                                 //
74 //  class AliCDBLocalParam                                         //
75 //                                                                 //
76 /////////////////////////////////////////////////////////////////////
77
78 class AliCDBLocalParam: public AliCDBParam {
79         
80 public:
81         AliCDBLocalParam();
82         AliCDBLocalParam(const char* dbPath);
83         
84         virtual ~AliCDBLocalParam();
85
86         const TString& GetPath() const {return fDBPath;};
87
88         virtual AliCDBParam* CloneParam() const;
89
90         virtual ULong_t Hash() const;
91         virtual Bool_t IsEqual(const TObject* obj) const;
92
93 private:
94
95         TString fDBPath; // path of the DB folder
96
97         ClassDef(AliCDBLocalParam, 0);
98 };
99
100 #endif