]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliCDBId.cxx
Updated PaintContour() method
[u/mrichter/AliRoot.git] / STEER / AliCDBId.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /////////////////////////////////////////////////////////////////////
17 //                                                                 //
18 //  class AliCDBId                                                 //
19 //  Identity of an object stored into a database:                  //
20 //  path, run validity range, version, subVersion                  //
21 //                                                                 //
22 /////////////////////////////////////////////////////////////////////
23
24 #include "AliCDBId.h"
25
26 ClassImp(AliCDBId)
27
28 //_____________________________________________________________________________
29 AliCDBId::AliCDBId():
30 fPath(), 
31 fRunRange(-1,-1), 
32 fVersion(-1), 
33 fSubVersion(-1),
34 fLastStorage("new")
35 {
36 // constructor
37
38 }
39
40 //_____________________________________________________________________________
41 AliCDBId::AliCDBId(const AliCDBId& other):
42 TObject(),
43 fPath(other.fPath), 
44 fRunRange(other.fRunRange),
45 fVersion(other.fVersion), 
46 fSubVersion(other.fSubVersion),
47 fLastStorage(other.fLastStorage)
48 {
49 // constructor
50
51 }
52
53 //_____________________________________________________________________________
54 AliCDBId::AliCDBId(const AliCDBPath& path, Int_t firstRun, Int_t lastRun, 
55         Int_t version, Int_t subVersion):
56 fPath(path), 
57 fRunRange(firstRun, lastRun), 
58 fVersion(version), 
59 fSubVersion(subVersion),
60 fLastStorage("new")
61 {
62 // constructor
63
64
65
66 //_____________________________________________________________________________
67 AliCDBId::AliCDBId(const AliCDBPath& path, const AliCDBRunRange& runRange, 
68         Int_t version, Int_t subVersion):
69 fPath(path), 
70 fRunRange(runRange), 
71 fVersion(version),
72 fSubVersion(subVersion),
73 fLastStorage("new")
74 {
75 // constructor
76
77 }
78
79 //_____________________________________________________________________________
80 AliCDBId::~AliCDBId() {
81 //destructor
82
83 }
84
85 //_____________________________________________________________________________
86 Bool_t AliCDBId::IsValid() const {
87 // validity check
88
89         if (!(fPath.IsValid() && fRunRange.IsValid())) {
90                 return kFALSE;
91         }
92         
93         // FALSE if doesn't have version but has subVersion
94         return !(!HasVersion() && HasSubVersion());
95 }
96
97 //___________________________________________________________________________
98 Bool_t AliCDBId::IsEqual(const TObject* obj) const {
99 // check if this id is equal to other id (compares path, run range, versions)
100
101         if (this == obj) {
102                 return kTRUE;
103         }
104
105         if (AliCDBId::Class() != obj->IsA()) {
106                 return kFALSE;
107         }
108         AliCDBId* other = (AliCDBId*) obj;
109         return fPath.GetPath() == other->GetPath() && fRunRange.IsEqual(&other->GetAliCDBRunRange()) &&
110                 fVersion == other->GetVersion() && fSubVersion == other->GetSubVersion();
111 }
112
113 //_____________________________________________________________________________
114 TString AliCDBId::ToString() const {
115 // returns a string of Id data
116
117         TString result = Form("path: \"%s\"; run range: [%d,%d]",
118                                 GetPath().Data(), GetFirstRun(), GetLastRun());
119
120         if(GetVersion() >= 0) result += Form("; version: v%d", GetVersion());
121         if(GetSubVersion() >= 0) result += Form("_s%d", GetSubVersion());
122         return result;
123 }