8997905bc84f34ecd2ae8f99535844a8426ad6b8
[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         virtual Bool_t Contains(const char* path) const;
25         virtual Int_t  GetLatestVersion(const char* path, Int_t run);
26         virtual Int_t  GetLatestSubVersion(const char* path, Int_t run, Int_t version=-1);
27         virtual Bool_t IdToFilename(const AliCDBId& id, TString& filename) const;
28
29 protected:
30
31         virtual AliCDBEntry*    GetEntry(const AliCDBId& queryId);
32         virtual TList*          GetEntries(const AliCDBId& queryId);
33         virtual Bool_t          PutEntry(AliCDBEntry* entry);
34         virtual TList*          GetIdListFromFile(const char* fileName);
35
36 private:
37
38         AliCDBLocal(const AliCDBLocal & source);
39         AliCDBLocal & operator=(const AliCDBLocal & source);
40         AliCDBLocal(const char* baseDir);
41         virtual ~AliCDBLocal();
42         
43         Bool_t FilenameToId(const char* filename, AliCDBRunRange& runRange, 
44                         Int_t& version, Int_t& subVersion);
45
46         Bool_t PrepareId(AliCDBId& id);
47         Bool_t GetId(const AliCDBId& query, AliCDBId& result);
48
49         virtual void QueryValidFiles();
50
51         void GetEntriesForLevel0(const char* level0, const AliCDBId& query, TList* result);
52         void GetEntriesForLevel1(const char* level0, const char* Level1,
53                         const AliCDBId& query, TList* result);
54
55         TString fBaseDirectory; // path of the DB folder
56
57         ClassDef(AliCDBLocal, 0); // access class to a DataBase in a local storage
58 };
59
60 /////////////////////////////////////////////////////////////////////
61 //                                                                 //
62 //  class AliCDBLocalFactory                                       //
63 //                                                                 //
64 /////////////////////////////////////////////////////////////////////
65
66 class AliCDBLocalFactory: public AliCDBStorageFactory {
67
68 public:
69
70         virtual Bool_t Validate(const char* dbString);
71         virtual AliCDBParam* CreateParameter(const char* dbString);
72
73 protected:
74         virtual AliCDBStorage* Create(const AliCDBParam* param);
75
76         ClassDef(AliCDBLocalFactory, 0);
77 };
78
79 /////////////////////////////////////////////////////////////////////
80 //                                                                 //
81 //  class AliCDBLocalParam                                         //
82 //                                                                 //
83 /////////////////////////////////////////////////////////////////////
84
85 class AliCDBLocalParam: public AliCDBParam {
86         
87 public:
88         AliCDBLocalParam();
89         AliCDBLocalParam(const char* dbPath);
90         
91         virtual ~AliCDBLocalParam();
92
93         const TString& GetPath() const {return fDBPath;};
94
95         virtual AliCDBParam* CloneParam() const;
96
97         virtual ULong_t Hash() const;
98         virtual Bool_t IsEqual(const TObject* obj) const;
99
100 private:
101
102         TString fDBPath; // path of the DB folder
103
104         ClassDef(AliCDBLocalParam, 0);
105 };
106
107 #endif