"Valeri Fine (Faine)" wrote:
>
> Hi, Christian
>
> What about:
>
> http://root.cern.ch/root/htmldoc/TFileSet.html
>
> One can iterate it using
>
> http://root.cern.ch/root/htmldoc/TDataSetIter.html
>
> the way you described.
>
> Valeri
>
> > Hi ROOT'ers,
> >
> > I'd like very much if it would be possible to iterate over a
> > TSystemDirectory. I imagine one could do
> >
> >
> > TSystemDirectory dir("some directory");
> > TSystemFile* file = 0;
> > TIter next(dir);
> >
> > while ((file = (TSystemFile*)next())) {
> > // do something in this file
> > ...
> > }
> >
> > As an additional feature, one could have a constructor that uses
> > wildcard globing:
> >
> > TSystemDirectory dir("some directory", "*.root");
> >
> > If using a TIter would not be feasable for TSystemDirectory, could one
> > at least have something like:
> >
> > UInt_t TSystemDirectory::GetEntries();
> > TSystemFile* TSystemDirectory::At(UInt_t i);
> >
> > so that one may iterate through the list in a sligtly more clumbersome
> > way:
> >
> > Int_t n = dir.GetEntries();
> >
> > for (Int_t i = 0; i < n; i++) {
> > file = dir.At(i);
> > // do something in this file
> > ...
> > }
> >
> > I realise ofcourse, that this would mean taking the internal list
> > initialisation out of the Browse method, and into something else like
> > say Initialise. The list can then be created "just-in-time":
> >
> > TSystemDirectory::Browse(TBrowser* b) {
> > //
> > if (!fListOfDirEntries)
> > Initialise();
> > ...
> > }
> >
> > and so on. I don't see why you don't have "." and ".." in the
> > list. I'd imagine something like
> >
> > TSystemDirectory::Browse(TBrowser* b) {
> > //
> > .
> > TString *name = GetTitle();
> > if (!name->CompareTo(".."))
> > *name = gSystem->DirName(gSystem->WorkingDirectory());
> > ...
> > }
> >
> > would work.
> >
> > Anyway, just a few thoughts on this. I've this functionallity is in
> > ROOT somewhere and I've just overlooked it, then I'm sorry for
> > bothering you, and could someone please point out to me where -
> > thanks.
> >
> > Yours,
> >
> > Christian -----------------------------------------------------------
> > Holm Christensen Phone: (+45) 35 35 96 91
> > Sankt Hansgade 23, 1. th. Office: (+45) 353 25 305
> > DK-2200 Copenhagen N Web: www.nbi.dk/~cholm
> > Denmark Email: cholm@nbi.dk
> >
Hi,
if anybody is going to improve TSystemDirectory class, please look at
http://doc.trolltech.com/qdir.html. I think much of this is desirable
to be in ROOT too.
Regards. Valeriy
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:39 MET