00001
00002
00003
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef __CINT__
00014 # include "TDirectory.h"
00015 # include "StFileIter.h"
00016 # include "TRegexp.h"
00017 # include "TKey.h"
00018 #endif
00019 int Ls(TDirectory *dir, const char *pattern="*", Bool_t wildcard=kTRUE)
00020 {
00021 int counter = 0;
00022 if (!dir) dir = gDirectory;
00023 if (dir) {
00024 StFileIter iter(dir);
00025 TRegexp cmp(pattern,wildcard);
00026 TKey *key = 0;
00027 Ssiz_t len=0;
00028 while (key = iter.NextEventKey()) {
00029 const char *name = key->GetName();
00030 Ssiz_t test = cmp.Index(name,&len);
00031 if ((test>=0) && len) {
00032 Printf("- %s class: %s", name, key->GetClassName());
00033 counter++;
00034 }
00035 }
00036 Printf(" ------------");
00037 Printf(" %d object%s ha%s been found", counter
00038 , ((counter>1) ? "s" : "")
00039 , ((counter>1) ? "ve": "s")
00040 );
00041 }
00042 return counter;
00043 }
00044
00046
00047
00048
00049
00050 int Ls(const char *pattern="*", Bool_t wildcard=kTRUE)
00051 {
00052 return Ls(gDirectory,pattern, wildcard);
00053 }