New version of the CDB classes. Run number added (A.Colla).
[u/mrichter/AliRoot.git] / STEER / AliCDBDump.h
1 #ifndef ALI_CDB_DUMP_H
2 #define ALI_CDB_DUMP_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 AliCDBDump                                               //
10 //  access class to a DataBase in a dump storage (single file)     //
11 //                                                                 //
12 /////////////////////////////////////////////////////////////////////
13
14 #include "AliCDBStorage.h"
15 #include "AliCDBManager.h"
16
17 class TDirectory;
18 class TFile;
19
20 class AliCDBDump: public AliCDBStorage {
21         friend class AliCDBDumpFactory;
22
23 public:
24
25         virtual Bool_t IsReadOnly() const {return fReadOnly;};
26         virtual Bool_t HasSubVersion() const {return kFALSE;};
27         virtual Bool_t Contains(const char* path) const;
28
29 protected:
30
31         virtual AliCDBEntry*    GetEntry(const AliCDBId& query);
32         virtual TList*          GetEntries(const AliCDBId& query);
33         virtual Bool_t          PutEntry(AliCDBEntry* entry);
34         virtual TList*          GetIdListFromFile(const char* fileName);
35
36 private:
37
38         AliCDBDump(const char* dbFile, Bool_t readOnly);
39         virtual ~AliCDBDump();  
40
41         Bool_t KeyNameToId(const char* keyname, AliCDBRunRange& runRange,
42                         Int_t& version, Int_t& subVersion);
43         Bool_t IdToKeyName(const AliCDBRunRange& runRange, Int_t version,
44                         Int_t subVersion, TString& keyname);    
45
46         Bool_t MkDir(const TString& dir);
47
48
49         Bool_t PrepareId(AliCDBId& id);
50         Bool_t GetId(const AliCDBId& query, AliCDBId& result);
51
52
53         void GetEntriesForLevel0(const AliCDBId& query, TList* result);
54         void GetEntriesForLevel1(const AliCDBId& query, TList* result);
55
56         TFile* fFile;           // Dump file
57         Bool_t fReadOnly;       // ReadOnly flag
58
59         ClassDef(AliCDBDump, 0);
60 };
61
62 /////////////////////////////////////////////////////////////////////
63 //                                                                 //
64 //  class AliCDBDumpFactory                                        //
65 //                                                                 //
66 /////////////////////////////////////////////////////////////////////
67
68 class AliCDBDumpFactory: public AliCDBStorageFactory {
69
70 public:
71
72         virtual Bool_t Validate(const char* dbString);
73         virtual AliCDBParam* CreateParameter(const char* dbString);
74
75 protected:
76         virtual AliCDBStorage* Create(const AliCDBParam* param);
77
78         ClassDef(AliCDBDumpFactory, 0);
79 };
80
81 /////////////////////////////////////////////////////////////////////
82 //                                                                 //
83 //  class AliCDBDumpParam                                          //
84 //                                                                 //
85 /////////////////////////////////////////////////////////////////////
86
87 class AliCDBDumpParam: public AliCDBParam {
88
89 public:
90         AliCDBDumpParam();
91         AliCDBDumpParam(const char* dbPath, Bool_t readOnly = kFALSE);
92         
93         virtual ~AliCDBDumpParam();
94
95         const TString& GetPath() const {return fDBPath;};
96         Bool_t IsReadOnly() const {return fReadOnly;};
97
98         virtual AliCDBParam* CloneParam() const;
99
100         virtual ULong_t Hash() const;
101         virtual Bool_t IsEqual(const TObject* obj) const;
102         
103 private:
104
105         TString fDBPath;        // Dump file path name
106         Bool_t fReadOnly;       // ReadOnly flag
107
108         ClassDef(AliCDBDumpParam, 0);
109 };
110
111 #endif