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