1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /////////////////////////////////////////////////////////////////////
19 // Identity of an object stored into a database: //
20 // path, run validity range, version, subVersion //
22 /////////////////////////////////////////////////////////////////////
25 #include <Riostream.h>
29 //_____________________________________________________________________________
41 //_____________________________________________________________________________
42 AliCDBId::AliCDBId(const AliCDBId& other):
45 fRunRange(other.fRunRange),
46 fVersion(other.fVersion),
47 fSubVersion(other.fSubVersion),
48 fLastStorage(other.fLastStorage)
54 //_____________________________________________________________________________
55 AliCDBId::AliCDBId(const AliCDBPath& path, Int_t firstRun, Int_t lastRun,
56 Int_t version, Int_t subVersion):
58 fRunRange(firstRun, lastRun),
60 fSubVersion(subVersion),
67 //_____________________________________________________________________________
68 AliCDBId::AliCDBId(const AliCDBPath& path, const AliCDBRunRange& runRange,
69 Int_t version, Int_t subVersion):
73 fSubVersion(subVersion),
80 //_____________________________________________________________________________
81 AliCDBId::~AliCDBId() {
86 //_____________________________________________________________________________
87 Bool_t AliCDBId::IsValid() const {
90 if (!(fPath.IsValid() && fRunRange.IsValid())) {
94 // FALSE if doesn't have version but has subVersion
95 return !(!HasVersion() && HasSubVersion());
98 //___________________________________________________________________________
99 Bool_t AliCDBId::IsEqual(const TObject* obj) const {
100 // check if this id is equal to other id (compares path, run range, versions)
106 if (AliCDBId::Class() != obj->IsA()) {
109 AliCDBId* other = (AliCDBId*) obj;
110 return fPath.GetPath() == other->GetPath() && fRunRange.IsEqual(&other->GetAliCDBRunRange()) &&
111 fVersion == other->GetVersion() && fSubVersion == other->GetSubVersion();
114 //_____________________________________________________________________________
115 TString AliCDBId::ToString() const {
116 // returns a string of Id data
118 TString result = Form("path: \"%s\"; run range: [%d,%d]",
119 GetPath().Data(), GetFirstRun(), GetLastRun());
121 if(GetVersion() >= 0) result += Form("; version: v%d", GetVersion());
122 if(GetSubVersion() >= 0) result += Form("_s%d", GetSubVersion());
126 //_____________________________________________________________________________
127 void AliCDBId::Print(Option_t* /*option*/) const {
130 cout << ToString().Data() << endl;