13 #ifndef ROOT_TFileIter
14 #define ROOT_TFileIter
48 #include "TIterator.h"
59 virtual TIterator &operator=(
const TIterator &) {
return *
this; }
60 virtual Bool_t operator!=(
const TIterator &it)
const {
return TListIter::operator!=(it);}
63 TDirectory *fRootFile;
67 Int_t fCursorPosition;
71 TObject *
ReadObj(
const TKey *key)
const;
72 TKey *NextEventKey(UInt_t eventNumber=UInt_t(-1), UInt_t runNumber=UInt_t(-1),
const char *name=
"*");
76 TFileIter(
const char *name, Option_t *option =
"",
77 const char *ftitle =
"", Int_t compress = 1,
84 Int_t CurrentCursorPosition()
const;
85 virtual const TFile *GetTFile()
const;
86 virtual const TDirectory *GetTDirectory()
const;
87 static TString
MapName(
const char *name,
const char *localSystemKey = 0
88 ,
const char *mountedFileSystemKey = 0);
89 static const char *GetResourceName();
90 static const char *GetDefaultMapFileName();
91 static const char *GetLocalFileNameKey();
92 static const char *GetForeignFileSystemKey();
94 virtual Bool_t
IsOpen()
const;
95 virtual TObject *
NextEventGet(UInt_t eventNumber=UInt_t(-1), UInt_t runNumber=UInt_t(-1),
const char *name=
"*");
96 virtual Int_t
NextEventPut(TObject *obj, UInt_t eventNum, UInt_t runNumber,
const char *name=0);
97 void SetCursorPosition(Int_t cursorPosition);
98 void SetCursorPosition(
const char *keyNameToFind);
108 TFileIter &operator=(Int_t cursorPosition);
109 TFileIter &operator=(
const char *keyNameToFind);
115 TObject *operator*()
const;
116 operator const char *()
const;
117 operator const TFile *()
const;
118 operator const TDirectory *()
const;
119 operator int ()
const;
120 int operator==(
const char *name)
const;
121 int operator!=(
const char *name)
const;
125 virtual TObject *Next();
126 virtual TObject *Next(Int_t nSkip);
127 virtual void Reset();
128 virtual void Rewind();
129 TObject *operator()(Int_t nSkip);
130 TObject *operator()();
136 inline const char *TFileIter::GetResourceName() {
return "ForeignFileMap";}
138 inline const char *TFileIter::GetDefaultMapFileName() {
return "io.config";}
140 inline const char *TFileIter::GetLocalFileNameKey() {
return "LocalFileSystem";}
142 inline const char *TFileIter::GetForeignFileSystemKey(){
return "MountedFileSystem";}
145 inline Int_t TFileIter::CurrentCursorPosition()
const
148 return fNestedIterator ? fNestedIterator->CurrentCursorPosition() : fCursorPosition;
152 inline const TFile *TFileIter::GetTFile()
const {
return GetTDirectory()->GetFile(); }
154 inline const TDirectory *TFileIter::GetTDirectory()
const
155 {
return fNestedIterator ? fNestedIterator->GetTDirectory() : fRootFile; }
158 inline TObject *TFileIter::Next()
166 inline void TFileIter::Rewind()
172 inline void TFileIter::SetCursorPosition(Int_t cursorPosition)
177 fNestedIterator->SetCursorPosition(cursorPosition);
183 inline TFileIter &TFileIter::operator=(
const char *keyNameToFind)
186 SetCursorPosition(keyNameToFind);
return *
this;}
189 inline TFileIter &TFileIter::operator=(Int_t cursorPosition)
192 SetCursorPosition(cursorPosition);
196 inline TFileIter::operator
const TDirectory *()
const
197 {
return GetTDirectory(); }
200 inline TFileIter::operator
const TFile *()
const
201 {
return GetTFile (); }
203 inline TFileIter &TFileIter::operator+=(Int_t shift)
206 inline TFileIter &TFileIter::operator-=(Int_t shift)
207 {
return operator+=(-shift);}
209 inline TFileIter &TFileIter::operator++()
212 inline TFileIter &TFileIter::operator--()
215 inline TObject *TFileIter::operator*()
const
218 inline TFileIter::operator int ()
const
219 {
return CurrentCursorPosition(); }
221 inline TFileIter::operator
const char *()
const
227 inline int TFileIter::operator==(
const char *name)
const
228 {
return name ? !strcmp(name,
GetKeyName()):0;}
231 inline int TFileIter::operator!=(
const char *name)
const
232 {
return !(operator==(name)); }
235 inline TObject *TFileIter::operator()(){
return Next(); }
237 inline TObject *TFileIter::operator()(Int_t nSkip){
return Next(nSkip);}
virtual ~TFileIter()
TFileIter dtor.
virtual Int_t GetDepth() const
const char * GetKeyName() const
return the name of the current TKey
TKey * GetCurrentKey() const
return the pointer to the current TKey
TObject * ReadObj(const TKey *key) const
Read the next TObject from for the TDirectory by TKey provided.
virtual TObject * NextEventGet(UInt_t eventNumber=UInt_t(-1), UInt_t runNumber=UInt_t(-1), const char *name="*")
static TString MapName(const char *name, const char *localSystemKey=0, const char *mountedFileSystemKey=0)
virtual Int_t NextEventPut(TObject *obj, UInt_t eventNum, UInt_t runNumber, const char *name=0)
Create a special TKey name with obj provided and write it out.
virtual TObject * GetObject() const
void Initialize()
to be documented
virtual Bool_t IsOpen() const
virtual Int_t TotalKeys() const
virtual void Reset()
Reset the status of the iterator.
virtual TKey * SkipObjects(Int_t nSkip=1)
TFileIter(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
static void PurgeKeys(TList *listOfKeys)
Int_t GetObjlen() const
Returns the uncompressed length of the current object.