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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // meta data of run dependent objects //
22 ///////////////////////////////////////////////////////////////////////////////
27 #include "AliMetaData.h"
33 //_____________________________________________________________________________
34 AliMetaData::AliMetaData() :
41 // default constructor
42 // the default values mean no selection
46 //_____________________________________________________________________________
47 AliMetaData::AliMetaData(const char* name, Int_t firstRun, Int_t lastRun,
60 //_____________________________________________________________________________
61 AliMetaData::AliMetaData(const AliMetaData& entry) :
64 fFirstRun(entry.fFirstRun),
65 fLastRun(entry.fLastRun),
66 fVersion(entry.fVersion)
72 //_____________________________________________________________________________
73 AliMetaData& AliMetaData::operator = (const AliMetaData& entry)
75 // assignment operator
78 fFirstRun = entry.fFirstRun;
79 fLastRun = entry.fLastRun;
80 fVersion = entry.fVersion;
86 //_____________________________________________________________________________
87 const char* AliMetaData::GetName() const
95 //_____________________________________________________________________________
96 Bool_t AliMetaData::IsValid(Int_t runNumber, AliMetaData* metaData) const
98 // check the validity of the object
100 if ((fFirstRun >= 0) && (runNumber < fFirstRun)) return kFALSE;
101 if ((fLastRun >= 0) && (runNumber > fLastRun)) return kFALSE;
103 if ((metaData->fVersion >= 0) && (metaData->fVersion != fVersion))
109 //_____________________________________________________________________________
110 Int_t AliMetaData::Compare(const TObject* object) const
112 // check whether this is prefered to object
114 if (!object || !object->InheritsFrom(AliMetaData::Class())) return 1;
115 if (fVersion < ((AliMetaData*)object)->GetVersion()) return -1;
116 if (fVersion > ((AliMetaData*)object)->GetVersion()) return 1;
120 //_____________________________________________________________________________
121 Bool_t AliMetaData::Matches(const char* name, Int_t runNumber) const
123 // check whether name and run number match with this meta data
125 if ((fFirstRun >= 0) && (runNumber < fFirstRun)) return kFALSE;
126 if ((fLastRun >= 0) && (runNumber > fLastRun)) return kFALSE;
127 if (TString(name).Contains(TRegexp(fName))) return kTRUE;
132 //_____________________________________________________________________________
133 Bool_t operator == (const AliMetaData& entry1, const AliMetaData& entry2)
135 // compare two DB entries
137 if (strcmp(entry1.GetName(), entry2.GetName()) != 0) return kFALSE;
138 if (entry1.GetFirstRun() != entry2.GetFirstRun()) return kFALSE;
139 if (entry1.GetLastRun() != entry2.GetLastRun()) return kFALSE;
140 if (entry1.GetVersion() != entry2.GetVersion()) return kFALSE;