fIsValid(kTRUE),
fIsWildcard(kFALSE)
{
-// default constructor
+ // default constructor
}
fIsValid(other.fIsValid),
fIsWildcard(other.fIsWildcard)
{
-// constructor
- Init();
- InitPath();
+ // constructor
+ Init();
+ InitPath();
}
//_____________________________________________________________________________
AliCDBPath::AliCDBPath(const char* level0, const char* level1,
- const char* level2):
+ const char* level2):
TObject(),
fPath(""),
fLevel0(level0),
fIsValid(kTRUE),
fIsWildcard(kFALSE)
{
-// constructor
-
- fPath += level0;
- fPath += '/';
- fPath += level1;
- fPath += '/';
- fPath += level2;
-
- if ((IsWord(fLevel0) || fLevel0 == "*")
- && (IsWord(fLevel1) || fLevel1 == "*")
- && (IsWord(fLevel2) || fLevel2 == "*")) {
-
- fIsValid = kTRUE;
- } else {
- fIsValid = kFALSE;
- AliError(Form("Invalid AliCDBPath <%s/%s/%s>!",
- level0, level1, level2));
- }
-
- Init();
+ // constructor
+
+ fPath += level0;
+ fPath += '/';
+ fPath += level1;
+ fPath += '/';
+ fPath += level2;
+
+ if ((IsWord(fLevel0) || fLevel0 == "*")
+ && (IsWord(fLevel1) || fLevel1 == "*")
+ && (IsWord(fLevel2) || fLevel2 == "*")) {
+
+ fIsValid = kTRUE;
+ } else {
+ fIsValid = kFALSE;
+ AliError(Form("Invalid AliCDBPath <%s/%s/%s>!",
+ level0, level1, level2));
+ }
+
+ Init();
}
//_____________________________________________________________________________
fIsValid(kTRUE),
fIsWildcard(kFALSE)
{
-// constructor
+ // constructor
- Init();
- InitPath();
+ Init();
+ InitPath();
}
//_____________________________________________________________________________
fIsValid(kTRUE),
fIsWildcard(kFALSE)
{
- Init();
- InitPath();
+ Init();
+ InitPath();
}
//_____________________________________________________________________________
void AliCDBPath::InitPath() {
-// sets fLevel0, fLevel1, fLevel2, validity flagss from fPath
-
- TSubString strippedString = fPath.Strip(TString::kBoth);
- TString aString(strippedString);
- strippedString = aString.Strip(TString::kBoth, '/');
-
- TObjArray* anArray = TString(strippedString).Tokenize("/");
- Int_t paramCount = anArray->GetEntriesFast();
-
- if (paramCount == 1) {
- if (fPath == "*") {
- fLevel0 = "*";
- fLevel1 = "*";
- fLevel2 = "*";
-
- fIsValid = kTRUE;
- } else {
- fIsValid = kFALSE;
- }
-
- } else if (paramCount == 2) {
- fLevel0 = ((TObjString*) anArray->At(0))->GetString();
- TString bString = ((TObjString*) anArray->At(1))->GetString();
-
- if (IsWord(fLevel0) && bString == "*") {
- fLevel1 = "*";
- fLevel2 = "*";
-
- fIsValid = kTRUE;
-
- } else {
- fIsValid = kFALSE;
- }
-
- } else if (paramCount == 3) {
- fLevel0 = ((TObjString*) anArray->At(0))->GetString();
- fLevel1 = ((TObjString*) anArray->At(1))->GetString();
- fLevel2 = ((TObjString*) anArray->At(2))->GetString();
-
- if ((IsWord(fLevel0) || fLevel0 == "*")
- && (IsWord(fLevel1) || fLevel1 == "*")
- && (IsWord(fLevel2) || fLevel2 == "*")) {
-
- fIsValid = kTRUE;
- } else {
- fIsValid = kFALSE;
- }
-
- } else {
- fIsValid = kFALSE;
-
- }
-
- if (!fIsValid) {
- AliInfo(Form("Invalid AliCDBPath <%s>!", fPath.Data()));
- } else {
- fPath = Form("%s/%s/%s", fLevel0.Data(), fLevel1.Data(), fLevel2.Data());
- }
-
- delete anArray;
-
- Init();
+ // sets fLevel0, fLevel1, fLevel2, validity flagss from fPath
+
+ TSubString strippedString = fPath.Strip(TString::kBoth);
+ TString aString(strippedString);
+ strippedString = aString.Strip(TString::kBoth, '/');
+
+ TObjArray* anArray = TString(strippedString).Tokenize("/");
+ Int_t paramCount = anArray->GetEntriesFast();
+
+ if (paramCount == 1) {
+ if (fPath == "*") {
+ fLevel0 = "*";
+ fLevel1 = "*";
+ fLevel2 = "*";
+
+ fIsValid = kTRUE;
+ } else {
+ fIsValid = kFALSE;
+ }
+
+ } else if (paramCount == 2) {
+ fLevel0 = ((TObjString*) anArray->At(0))->GetString();
+ TString bString = ((TObjString*) anArray->At(1))->GetString();
+
+ if (IsWord(fLevel0) && bString == "*") {
+ fLevel1 = "*";
+ fLevel2 = "*";
+
+ fIsValid = kTRUE;
+
+ } else {
+ fIsValid = kFALSE;
+ }
+
+ } else if (paramCount == 3) {
+ fLevel0 = ((TObjString*) anArray->At(0))->GetString();
+ fLevel1 = ((TObjString*) anArray->At(1))->GetString();
+ fLevel2 = ((TObjString*) anArray->At(2))->GetString();
+
+ if ((IsWord(fLevel0) || fLevel0 == "*")
+ && (IsWord(fLevel1) || fLevel1 == "*")
+ && (IsWord(fLevel2) || fLevel2 == "*")) {
+
+ fIsValid = kTRUE;
+ } else {
+ fIsValid = kFALSE;
+ }
+
+ } else {
+ fIsValid = kFALSE;
+
+ }
+
+ if (!fIsValid) {
+ AliInfo(Form("Invalid AliCDBPath <%s>!", fPath.Data()));
+ } else {
+ fPath = Form("%s/%s/%s", fLevel0.Data(), fLevel1.Data(), fLevel2.Data());
+ }
+
+ delete anArray;
+
+ Init();
}
//_____________________________________________________________________________
AliCDBPath::~AliCDBPath() {
-// destructor
+ // destructor
}
//_____________________________________________________________________________
Bool_t AliCDBPath::IsWord(const TString& str) {
-// check if string is a word
+ // check if string is a word
- TRegexp pattern("^[a-zA-Z0-9_.-]+$");
+ TRegexp pattern("^[a-zA-Z0-9_.-]+$");
- return str.Contains(pattern);
+ return str.Contains(pattern);
}
//_____________________________________________________________________________
void AliCDBPath::Init() {
-// set fIsWildcard flag
+ // set fIsWildcard flag
- fIsWildcard = fPath.MaybeWildcard();
+ fIsWildcard = fPath.MaybeWildcard();
}
//_____________________________________________________________________________
Bool_t AliCDBPath::Level0Comprises(const TString& str) const {
-// check if Level0 is wildcard or is equal to str
-
- if (fLevel0 == "*") {
- return kTRUE;
- }
+ // check if Level0 is wildcard or is equal to str
- return fLevel0 == str;
+ if (fLevel0 == "*") {
+ return kTRUE;
+ }
+
+ return fLevel0 == str;
}
//_____________________________________________________________________________
Bool_t AliCDBPath::Level1Comprises(const TString& str) const {
-// check if Level1 is wildcard or is equal to str
+ // check if Level1 is wildcard or is equal to str
- if (fLevel1 == "*") {
- return kTRUE;
- }
+ if (fLevel1 == "*") {
+ return kTRUE;
+ }
- return fLevel1 == str;
+ return fLevel1 == str;
}
//_____________________________________________________________________________
Bool_t AliCDBPath::Level2Comprises(const TString& str) const {
-// check if Level2 is wildcard or is equal to str
-
- if (fLevel2 == "*") {
- return kTRUE;
- }
+ // check if Level2 is wildcard or is equal to str
+
+ if (fLevel2 == "*") {
+ return kTRUE;
+ }
- return fLevel2 == str;
+ return fLevel2 == str;
}
//_____________________________________________________________________________
Bool_t AliCDBPath::Comprises(const AliCDBPath& other) const {
-// check if path is wildcard and comprises other
+ // check if path is wildcard and comprises other
- return Level0Comprises(other.fLevel0)
- && Level1Comprises(other.fLevel1)
- && Level2Comprises(other.fLevel2);
+ return Level0Comprises(other.fLevel0)
+ && Level1Comprises(other.fLevel1)
+ && Level2Comprises(other.fLevel2);
}
//_____________________________________________________________________________
const char* AliCDBPath::GetLevel(Int_t i) const {
-// return level i of the path
-
- switch (i) {
- case 0:
- return fLevel0.Data();
- break;
- case 1:
- return fLevel1.Data();
- break;
- case 2:
- return fLevel2.Data();
- break;
- default:
- return 0;
- }
+ // return level i of the path
+
+ switch (i) {
+ case 0:
+ return fLevel0.Data();
+ break;
+ case 1:
+ return fLevel1.Data();
+ break;
+ case 2:
+ return fLevel2.Data();
+ break;
+ default:
+ return 0;
+ }
}