/*
$Log$
+Revision 1.16 2007/01/18 11:10:35 jgrosseo
+adding the possibility of defining DCS alias and data points with patterns
+first pattern introduced: [N..M] to add all names between the two digits, this works also recursively.
+
Revision 1.15 2007/01/15 18:27:11 acolla
implementation of sending mail to subdetector expert in case the preprocessor fails.
shuttle.schema updated with expert's email entry
//______________________________________________________________________________________________
void AliShuttleConfig::AliShuttleConfigHolder::ExpandAndAdd(TObjArray* target, const char* entry)
{
- //
- // adds <entry> to <target> applying expanding of the name
- // [N..M] creates M-N+1 names with the corresponding digits
- //
+ //
+ // adds <entry> to <target> applying expanding of the name
+ // [N..M] creates M-N+1 names with the corresponding digits
+ //
- TString entryStr(entry);
+ TString entryStr(entry);
- Int_t begin = entryStr.Index("[");
- Int_t end = entryStr.Index("]");
- if (begin != -1 && end != -1 && end > begin)
- {
- TString before(entryStr(0, begin));
- TString after(entryStr(end+1, entryStr.Length()));
+ Int_t begin = entryStr.Index("[");
+ Int_t end = entryStr.Index("]");
+ if (begin != -1 && end != -1 && end > begin)
+ {
+ TString before(entryStr(0, begin));
+ TString after(entryStr(end+1, entryStr.Length()));
- AliDebug(2, Form("Found [] pattern. Splitted input string %s %s", before.Data(), after.Data()));
+ AliDebug(2, Form("Found [] pattern. Splitted input string %s %s", before.Data(), after.Data()));
- Int_t dotdot = entryStr.Index("..");
+ Int_t dotdot = entryStr.Index("..");
- TString nStr(entryStr(begin+1, dotdot-begin-1));
- TString mStr(entryStr(dotdot+2, end-dotdot-2));
+ TString nStr(entryStr(begin+1, dotdot-begin-1));
+ TString mStr(entryStr(dotdot+2, end-dotdot-2));
- AliDebug(2, Form("Found [N..M] pattern. %s %s", nStr.Data(), mStr.Data()));
+ AliDebug(2, Form("Found [N..M] pattern. %s %s", nStr.Data(), mStr.Data()));
- if (nStr.IsDigit() && mStr.IsDigit())
- {
- Int_t n = nStr.Atoi();
- Int_t m = mStr.Atoi();
+ if (nStr.IsDigit() && mStr.IsDigit())
+ {
+ Int_t n = nStr.Atoi();
+ Int_t m = mStr.Atoi();
- Int_t nDigits = nStr.Length();
- TString formatStr;
- formatStr.Form("%%s%%0%dd%%s", nDigits);
+ Int_t nDigits = nStr.Length();
+ TString formatStr;
+ formatStr.Form("%%s%%0%dd%%s", nDigits);
- AliDebug(2, Form("Format string is %s", formatStr.Data()));
+ AliDebug(2, Form("Format string is %s", formatStr.Data()));
- for (Int_t current = n; current<=m; ++current)
- {
- TString newEntry;
- newEntry.Form(formatStr.Data(), before.Data(), current, after.Data());
+ for (Int_t current = n; current<=m; ++current)
+ {
+ TString newEntry;
+ newEntry.Form(formatStr.Data(), before.Data(), current, after.Data());
- AliDebug(2, Form("Calling recursive with %s", newEntry.Data()));
+ AliDebug(2, Form("Calling recursive with %s", newEntry.Data()));
- // and go recursive
- ExpandAndAdd(target, newEntry);
- }
+ // and go recursive
+ ExpandAndAdd(target, newEntry);
+ }
- // return here because we processed the entries already recursively.
- return;
- }
- }
+ // return here because we processed the entries already recursively.
+ return;
+ }
+ }
- AliDebug(2, Form("Adding name %s", entry));
- target->AddLast(new TObjString(entry));
+ AliDebug(2, Form("Adding name %s", entry));
+ target->AddLast(new TObjString(entry));
}
//______________________________________________________________________________________________