]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliCDBId.cxx
Callback function for additional information about the stamp (Marian)
[u/mrichter/AliRoot.git] / STEER / AliCDBId.cxx
index f1523537f9c4771d32a045f37718e885d930103c..a5053da1cd9cf6800b442d91bada4f8854aec3c0 100644 (file)
@@ -85,7 +85,7 @@ AliCDBId::~AliCDBId() {
 //_____________________________________________________________________________
 Bool_t AliCDBId::IsValid() const {
 // validity check
-       
+
        if (!(fPath.IsValid() && fRunRange.IsValid())) {
                return kFALSE;
        }
@@ -94,21 +94,30 @@ Bool_t AliCDBId::IsValid() const {
        return !(!HasVersion() && HasSubVersion());
 }
 
+//___________________________________________________________________________
+Bool_t AliCDBId::IsEqual(const TObject* obj) const {
+// check if this id is equal to other id (compares path, run range, versions)
+
+        if (this == obj) {
+                return kTRUE;
+        }
+
+        if (AliCDBId::Class() != obj->IsA()) {
+                return kFALSE;
+        }
+        AliCDBId* other = (AliCDBId*) obj;
+       return fPath.GetPath() == other->GetPath() && fRunRange.IsEqual(&other->GetAliCDBRunRange()) &&
+               fVersion == other->GetVersion() && fSubVersion == other->GetSubVersion();
+}
+
 //_____________________________________________________________________________
 TString AliCDBId::ToString() const {
 // returns a string of Id data
 
-       TString result;
-       result += "path \"";
-       result += GetPath();
-       result += "\"; run range [";
-       result += GetFirstRun();
-       result += ",";
-       result += GetLastRun();
-       result += "]; version v";
-       result += GetVersion();
-       result += "_s";
-       result += GetSubVersion();
-       
-       return result;  
+       TString result = Form("path: \"%s\"; run range: [%d,%d]",
+                               GetPath().Data(), GetFirstRun(), GetLastRun());
+
+       if(GetVersion() >= 0) result += Form("; version: v%d", GetVersion());
+       if(GetSubVersion() >= 0) result += Form("_s%d", GetSubVersion());
+       return result;
 }