]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliCDBId.h
Fixed Mem leaks occuring with Analysis Manager and coding violations
[u/mrichter/AliRoot.git] / STEER / AliCDBId.h
1 #ifndef ALI_CDB_ID_H
2 #define ALI_CDB_ID_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 AliCDBId                                                 //
10 //  Identity of an object stored into a database:                  //
11 //  path, run validity range, version, subVersion                  //
12 //                                                                 //
13 /////////////////////////////////////////////////////////////////////
14
15 #include "AliCDBPath.h"
16 #include "AliCDBRunRange.h"
17
18 #include <TObject.h>
19
20 class AliCDBId: public TObject {
21
22 public:
23
24         AliCDBId();
25
26         AliCDBId(const AliCDBId& other);
27
28         AliCDBId(const AliCDBPath& path, const AliCDBRunRange& runRange,
29                 Int_t version = -1, Int_t subVersion = -1);
30
31         AliCDBId(const AliCDBPath& path, 
32                 Int_t firstRun , Int_t lastRun , Int_t verison = -1, 
33                 Int_t subVersion = -1); 
34
35         virtual ~AliCDBId();
36
37         const AliCDBPath&       GetAliCDBPath() const {return fPath;}
38         const TString&          GetPath() const {return fPath.GetPath();}
39         const TString           GetPathLevel(Int_t i) const {return fPath.GetLevel(i);}
40         Bool_t                  IsWildcard() const {return fPath.IsWildcard();}
41
42         void    SetPath(const char* path) {fPath.SetPath(path);}
43
44         const           AliCDBRunRange& GetAliCDBRunRange() const {return fRunRange;}
45         AliCDBRunRange& GetAliCDBRunRange() {return fRunRange;}
46         Int_t           GetFirstRun() const {return fRunRange.GetFirstRun();}
47         Int_t           GetLastRun() const {return fRunRange.GetLastRun();}
48         void            SetFirstRun(Int_t firstRun) {fRunRange.SetFirstRun(firstRun);}
49         void            SetLastRun(Int_t lastRun) {fRunRange.SetLastRun(lastRun);}
50         void            SetRunRange(Int_t firstRun, Int_t lastRun)
51                         {fRunRange.SetRunRange(firstRun, lastRun);}
52
53
54         Bool_t  IsAnyRange() const {return fRunRange.IsAnyRange();}
55
56
57         Int_t   GetVersion() const {return fVersion;}
58         Int_t   GetSubVersion() const {return fSubVersion;}
59         void    SetVersion(Int_t version) {fVersion = version;}
60         void    SetSubVersion(Int_t subVersion) {fSubVersion = subVersion;}
61
62         const TString&  GetLastStorage() const {return fLastStorage;}
63         void            SetLastStorage(TString& lastStorage){fLastStorage = lastStorage;}
64
65         Bool_t IsValid() const; 
66         Bool_t IsSpecified() const {return !(IsWildcard() || IsAnyRange());}
67
68         Bool_t HasVersion() const {return fVersion >= 0;}
69         Bool_t HasSubVersion() const {return fSubVersion >= 0;}
70
71         Bool_t Comprises(const AliCDBId& other) const
72                 {return fPath.Comprises(other.fPath)
73                          && fRunRange.Comprises(other.fRunRange);}
74
75         virtual Bool_t IsEqual(const TObject *obj) const;
76
77         TString ToString() const;
78         void Print(Option_t* option="") const;
79
80 private:
81
82         AliCDBPath fPath;               // path 
83         AliCDBRunRange fRunRange;       // run range
84         Int_t fVersion;                 // version
85         Int_t fSubVersion;              // subversion
86         TString fLastStorage;           // previous storage place (new, grid, local, dump)
87
88         ClassDef(AliCDBId, 1);
89 };
90
91 #endif