34 ClassImp(TAlienResult);
39 TAlienResult::~TAlienResult()
42 while (TMap * obj = (TMap *) next()) {
50 void TAlienResult::DumpResult()
52 std::cout <<
"BEGIN DUMP" << std::endl;
55 while ((map = (TMap *) next())) {
56 TIter next2(map->GetTable());
58 while ((pair = (TPair *) next2())) {
59 TObjString *keyStr = dynamic_cast < TObjString * >(pair->Key());
60 TObjString *valueStr =
61 dynamic_cast < TObjString * >(pair->Value());
64 std::cout <<
"Key: " << keyStr->GetString() <<
" ";
67 std::cout <<
"Value: " << valueStr->GetString();
69 std::cout << std::endl;
73 std::cout <<
"END DUMP" << std::endl;
79 const char *TAlienResult::GetFileName(UInt_t i)
const
83 if ((entry = (TObjString *) ((TMap *) At(i))->GetValue(
"name"))) {
84 return entry->GetName();
93 const TEntryList *TAlienResult::GetEntryList(UInt_t i)
const
97 if ((entry = (TEntryList *) ((TMap *) At(i))->GetValue(
"evlist"))) {
107 const char *TAlienResult::GetFileNamePath(UInt_t i)
const
111 if ((entry = (TObjString *) ((TMap *) At(i))->GetValue(
"name"))) {
113 if ((path = (TObjString *) ((TMap *) At(i))->GetValue(
"path"))) {
115 TString(path->GetName()) + TString(entry->GetName());
126 const char *TAlienResult::GetPath(UInt_t i)
const
130 if ((entry = (TObjString *) ((TMap *) At(i))->GetValue(
"path"))) {
131 return entry->GetName();
140 const char *TAlienResult::GetKey(UInt_t i,
const char *key)
const
144 if ((entry = (TObjString *) ((TMap *) At(i))->GetValue(key))) {
145 return entry->GetName();
154 Bool_t TAlienResult::SetKey(UInt_t i,
const char *key,
const char *value)
158 if ((entry = (TPair *) ((TMap *) At(i))->FindObject(key))) {
159 TObject *val = ((TMap *) At(i))->Remove((TObject *) entry->Key());
164 ((TMap *) At(i))->Add(
new TObjString(key),
new TObjString(value));
173 TList *TAlienResult::GetFileInfoList()
const
175 TList *newfileinfolist =
new TList();
177 newfileinfolist->SetOwner(kTRUE);
179 for (Int_t i = 0; i < GetSize(); i++) {
182 if (GetKey(i,
"size"))
183 size = atol(GetKey(i,
"size"));
185 const char *md5 = GetKey(i,
"md5");
186 const char *uuid = GetKey(i,
"guid");
187 const char *msd = GetKey(i,
"msd");
191 if (uuid && !uuid[0])
196 TString turl = GetKey(i,
"turl");
200 TString options = urlturl.GetOptions();
203 urlturl.SetOptions(options);
204 turl = urlturl.GetUrl();
206 Info(
"GetFileInfoList",
"Adding Url %s with Msd %s\n", turl.Data(),
208 newfileinfolist->Add(
new TFileInfo(turl, size, uuid, md5));
210 return newfileinfolist;
216 void TAlienResult::Print(Option_t * option)
const
218 Long64_t totaldata = 0;
219 Int_t totalfiles = 0;
221 if (TString(option) != TString(
"all")) {
223 for (Int_t i = 0; i < GetSize(); i++) {
224 if (TString(option) == TString(
"l")) {
225 printf(
"( %06d ) LFN: %-80s Size[Bytes]: %10s GUID: %s\n",
226 i, GetKey(i,
"lfn"), GetKey(i,
"size"), GetKey(i,
229 printf(
"( %06d ) LFN: .../%-48s Size[Bytes]: %10s GUID: %s\n",
230 i, gSystem->BaseName(GetKey(i,
"lfn")), GetKey(i,
"size"),
233 if (GetKey(i,
"size")) {
234 totaldata += atol(GetKey(i,
"size"));
238 printf(
"------------------------------------------------------------\n");
239 printf(
"-> Result contains %.02f MB in %d Files.\n",
240 totaldata / 1024. / 1024., totalfiles);
245 while ((map = (TMap *) next())) {
246 TIter next2(map->GetTable());
248 printf(
"------------------------------------------------------------\n");
249 while ((pair = (TPair *) next2())) {
251 dynamic_cast < TObjString * >(pair->Key());
252 TObjString *valueStr =
253 dynamic_cast < TObjString * >(pair->Value());
254 if (keyStr && valueStr)
255 printf(
"( %06d ) [ -%16s ] = %s\n", i, keyStr->GetName(),
256 valueStr->GetName());