ROOT  6.06/09
Reference Guide
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
TFileIter Class Reference

Definition at line 61 of file TFileIter.h.

Public Member Functions

 TFileIter (const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
 Open ROOT TFile by the name provided; This TFile is to be deleted by the TFileIter alone. More...
 
 TFileIter (TFile *file=0)
 
 TFileIter (TDirectory *directory)
 Create iterator over all objects from the TDirectory provided. More...
 
 TFileIter (const TFileIter &)
 Copy ctor can be used with the "read only" files only. More...
 
virtual ~TFileIter ()
 TFileIter dtor. More...
 
Int_t CurrentCursorPosition () const
 
virtual const TFileGetTFile () const
 
virtual const TDirectoryGetTDirectory () const
 
virtual Bool_t IsOpen () const
 Check whether the associated ROOT TFile was open and TFile object is healthy. More...
 
virtual TObjectNextEventGet (UInt_t eventNumber=UInt_t(-1), UInt_t runNumber=UInt_t(-1), const char *name="*")
 reads, creates and returns the object by TKey name that matches the "name" . More...
 
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. More...
 
void SetCursorPosition (Int_t cursorPosition)
 
void SetCursorPosition (const char *keyNameToFind)
 Find the key by the name provided. More...
 
Int_t GetObjlen () const
 Returns the uncompressed length of the current object. More...
 
virtual Int_t TotalKeys () const
 The total number of the TKey keys in the current TDirectory only Usually this means the total number of different objects those can be read one by one. More...
 
virtual TKeySkipObjects (Int_t nSkip=1)
 Returns the TKey pointer to the nSkip TKey object from the current one nSkip = 0; the state of the iterator is not changed. More...
 
virtual TObjectGetObject () const
 read the object from TFile defined by the current TKey More...
 
virtual Int_t GetDepth () const
 return the current number of the nested subdirectroies; = 0 - means there is no subdirectories More...
 
TKeyGetCurrentKey () const
 return the pointer to the current TKey More...
 
const char * GetKeyName () const
 return the name of the current TKey More...
 
TFileIteroperator= (Int_t cursorPosition)
 
TFileIteroperator= (const char *keyNameToFind)
 
TFileIteroperator+= (Int_t shift)
 
TFileIteroperator-= (Int_t shift)
 
TFileIteroperator++ ()
 
TFileIteroperator-- ()
 
TObjectoperator* () const
 Return current object or nullptr. More...
 
 operator const char * () const
 
 operator const TFile * () const
 
 operator const TDirectory * () const
 
 operator int () const
 
int operator== (const char *name) const
 
int operator!= (const char *name) const
 
virtual TObjectNext ()
 Return next object in the list. Returns 0 when no more objects in list. More...
 
virtual TObjectNext (Int_t nSkip)
 return the pointer to the object defined by next TKey This method is not recommended. More...
 
virtual void Reset ()
 Reset the status of the iterator. More...
 
virtual void Rewind ()
 
TObjectoperator() (Int_t nSkip)
 
TObjectoperator() ()
 
- Public Member Functions inherited from TListIter
 TListIter (const TList *l, Bool_t dir=kIterForward)
 
 TListIter (const TListIter &iter)
 Copy ctor. More...
 
 ~TListIter ()
 
TListIteroperator= (const TListIter &rhs)
 Overloaded assignment operator. More...
 
const TCollectionGetCollection () const
 
Option_tGetOption () const
 Returns the object option stored in the list. More...
 
void SetOption (Option_t *option)
 Sets the object option stored in the list. More...
 
Bool_t operator!= (const TListIter &aIter) const
 This operator compares two TListIter objects. More...
 
- Public Member Functions inherited from TIterator
virtual ~TIterator ()
 
TObjectoperator() ()
 
Bool_t operator== (const TIterator &other) const
 

Static Public Member Functions

static TString MapName (const char *name, const char *localSystemKey=0, const char *mountedFileSystemKey=0)
 

MapName(const char *name, const char *localSystemKey,const char *mountedFileSystemKey)

Substitute the logical name with the real one if any More...
 
static const char * GetResourceName ()
 
static const char * GetDefaultMapFileName ()
 
static const char * GetLocalFileNameKey ()
 
static const char * GetForeignFileSystemKey ()
 
static void PurgeKeys (TList *listOfKeys)
 Remove the TKey duplication, leave the keys with highest cycle number only Sort if first. More...
 

Protected Member Functions

void Initialize ()
 to be documented More...
 
TObjectReadObj (const TKey *key) const
 Read the next TObject from for the TDirectory by TKey provided. More...
 
TKeyNextEventKey (UInt_t eventNumber=UInt_t(-1), UInt_t runNumber=UInt_t(-1), const char *name="*")
 
- Protected Member Functions inherited from TListIter
 TListIter ()
 
- Protected Member Functions inherited from TIterator
 TIterator ()
 
 TIterator (const TIterator &)
 

Protected Attributes

TDirectoryfRootFile
 
TString fEventName
 
UInt_t fRunNumber
 
UInt_t fEventNumber
 
Int_t fCursorPosition
 
Bool_t fOwnTFile
 
- Protected Attributes inherited from TListIter
const TListfList
 
TObjLinkfCurCursor
 
TObjLinkfCursor
 
Bool_t fDirection
 
Bool_t fStarted
 

Private Member Functions

virtual TIteratoroperator= (const TIterator &)
 The inner TFidrectory interator;. More...
 
virtual Bool_t operator!= (const TIterator &it) const
 This operator compares two TIterator objects. More...
 

Private Attributes

TFileIterfNestedIterator
 

#include <TFileIter.h>

+ Inheritance diagram for TFileIter:
+ Collaboration diagram for TFileIter:

Constructor & Destructor Documentation

TFileIter::TFileIter ( const char *  name,
Option_t option = "",
const char *  ftitle = "",
Int_t  compress = 1,
Int_t  netopt = 0 
)

Open ROOT TFile by the name provided; This TFile is to be deleted by the TFileIter alone.

Definition at line 149 of file TFileIter.cxx.

Referenced by ReadObj().

TFileIter::TFileIter ( TFile file = 0)
TFileIter::TFileIter ( TDirectory directory)

Create iterator over all objects from the TDirectory provided.

Definition at line 138 of file TFileIter.cxx.

TFileIter::TFileIter ( const TFileIter dst)

Copy ctor can be used with the "read only" files only.

the next statement is illegal, spotted by coverity "Dereferencing pointer "this->fRootFile". (Deref happens because this is a virtual function call.) assert(!fRootFile->IsWritable());

Definition at line 171 of file TFileIter.cxx.

TFileIter::~TFileIter ( )
virtual

TFileIter dtor.

Definition at line 196 of file TFileIter.cxx.

Member Function Documentation

Int_t TFileIter::CurrentCursorPosition ( ) const
inline

Definition at line 153 of file TFileIter.h.

Referenced by CurrentCursorPosition().

TKey * TFileIter::GetCurrentKey ( ) const

return the pointer to the current TKey

Definition at line 240 of file TFileIter.cxx.

Referenced by GetKeyName(), GetObject(), and GetObjlen().

const char * TFileIter::GetDefaultMapFileName ( )
inlinestatic

Definition at line 146 of file TFileIter.h.

Referenced by MapName().

Int_t TFileIter::GetDepth ( ) const
virtual

return the current number of the nested subdirectroies; = 0 - means there is no subdirectories

Definition at line 248 of file TFileIter.cxx.

Referenced by GetDepth().

const char * TFileIter::GetForeignFileSystemKey ( )
inlinestatic

Definition at line 150 of file TFileIter.h.

Referenced by MapName().

const char * TFileIter::GetKeyName ( ) const

return the name of the current TKey

Definition at line 256 of file TFileIter.cxx.

Referenced by operator==().

const char * TFileIter::GetLocalFileNameKey ( )
inlinestatic

Definition at line 148 of file TFileIter.h.

Referenced by MapName().

TObject * TFileIter::GetObject ( ) const
virtual

read the object from TFile defined by the current TKey

ATTENTION: memory leak danger !!!

This method does create a new object and it is the end-user code responsibility to take care about this object to avoid memory leak.

Definition at line 273 of file TFileIter.cxx.

Referenced by Next(), and operator*().

Int_t TFileIter::GetObjlen ( ) const

Returns the uncompressed length of the current object.

Definition at line 280 of file TFileIter.cxx.

const char * TFileIter::GetResourceName ( )
inlinestatic

Definition at line 144 of file TFileIter.h.

Referenced by MapName().

const TDirectory * TFileIter::GetTDirectory ( ) const
inlinevirtual

Definition at line 162 of file TFileIter.h.

Referenced by GetTDirectory(), and GetTFile().

const TFile * TFileIter::GetTFile ( ) const
inlinevirtual

Definition at line 160 of file TFileIter.h.

void TFileIter::Initialize ( )
protected

to be documented

Definition at line 211 of file TFileIter.cxx.

Referenced by TFileIter().

Bool_t TFileIter::IsOpen ( ) const
virtual

Check whether the associated ROOT TFile was open and TFile object is healthy.

Definition at line 226 of file TFileIter.cxx.

Referenced by Initialize(), and NextEventPut().

TString TFileIter::MapName ( const char *  name,
const char *  localSystemKey = 0,
const char *  mountedFileSystemKey = 0 
)
static


MapName(const char *name, const char *localSystemKey,const char *mountedFileSystemKey)

Substitute the logical name with the real one if any

  1. add a line into system.rootrc or ~/.rootrc or ./.rootrc

    TFileIter.ForeignFileMap mapFile // the name of the file to map the local name to the global file service

    If this line is omitted then TFileIter class seeks for the default mapping file in the current directory "io.config"

Definition at line 547 of file TFileIter.cxx.

Referenced by TFileIter().

TObject * TFileIter::Next ( )
inlinevirtual

Return next object in the list. Returns 0 when no more objects in list.

Reimplemented from TListIter.

Definition at line 166 of file TFileIter.h.

Referenced by operator()().

TObject * TFileIter::Next ( Int_t  nSkip)
virtual

return the pointer to the object defined by next TKey This method is not recommended.

It was done for the sake of the compatibility with TListIter

Definition at line 305 of file TFileIter.cxx.

TObject * TFileIter::NextEventGet ( UInt_t  eventNumber = UInt_t(-1),
UInt_t  runNumber = UInt_t(-1),
const char *  name = "*" 
)
virtual

reads, creates and returns the object by TKey name that matches the "name" .

"runNumber" ." eventNumber" schema Attention: This method does create a new TObject and it is the user code responsibility to take care (delete) this object to avoid memory leak.

Definition at line 487 of file TFileIter.cxx.

TKey * TFileIter::NextEventKey ( UInt_t  eventNumber = UInt_t(-1),
UInt_t  runNumber = UInt_t(-1),
const char *  name = "*" 
)
protected

Definition at line 443 of file TFileIter.cxx.

Referenced by NextEventGet().

Int_t TFileIter::NextEventPut ( TObject obj,
UInt_t  eventNum,
UInt_t  runNumber,
const char *  name = 0 
)
virtual

Create a special TKey name with obj provided and write it out.

Definition at line 515 of file TFileIter.cxx.

TFileIter::operator const char * ( ) const
inline

Definition at line 229 of file TFileIter.h.

TFileIter::operator const TDirectory * ( ) const
inline

Definition at line 204 of file TFileIter.h.

TFileIter::operator const TFile * ( ) const
inline

Definition at line 208 of file TFileIter.h.

TFileIter::operator int ( ) const
inline

Definition at line 226 of file TFileIter.h.

virtual Bool_t TFileIter::operator!= ( const TIterator aIter) const
inlineprivatevirtual

This operator compares two TIterator objects.

Reimplemented from TListIter.

Definition at line 68 of file TFileIter.h.

int TFileIter::operator!= ( const char *  name) const
inline

Definition at line 239 of file TFileIter.h.

TObject * TFileIter::operator() ( Int_t  nSkip)
inline

Definition at line 245 of file TFileIter.h.

TObject * TFileIter::operator() ( )
inline

Definition at line 243 of file TFileIter.h.

TObject * TFileIter::operator* ( ) const
inlinevirtual

Return current object or nullptr.

For backward compatibility reasons we have to provide this default implementation.

Reimplemented from TListIter.

Definition at line 223 of file TFileIter.h.

TFileIter & TFileIter::operator++ ( )
inline

Definition at line 217 of file TFileIter.h.

TFileIter & TFileIter::operator+= ( Int_t  shift)
inline

Definition at line 211 of file TFileIter.h.

Referenced by operator-=().

TFileIter & TFileIter::operator-- ( )
inline

Definition at line 220 of file TFileIter.h.

TFileIter & TFileIter::operator-= ( Int_t  shift)
inline

Definition at line 214 of file TFileIter.h.

virtual TIterator& TFileIter::operator= ( const TIterator )
inlineprivatevirtual

The inner TFidrectory interator;.

Reimplemented from TListIter.

Definition at line 67 of file TFileIter.h.

TFileIter & TFileIter::operator= ( Int_t  cursorPosition)
inline

Definition at line 197 of file TFileIter.h.

TFileIter & TFileIter::operator= ( const char *  keyNameToFind)
inline

Definition at line 191 of file TFileIter.h.

int TFileIter::operator== ( const char *  name) const
inline

Definition at line 235 of file TFileIter.h.

Referenced by operator!=().

void TFileIter::PurgeKeys ( TList listOfKeys)
static

Remove the TKey duplication, leave the keys with highest cycle number only Sort if first.

Definition at line 316 of file TFileIter.cxx.

Referenced by Reset().

TObject * TFileIter::ReadObj ( const TKey key) const
protected

Read the next TObject from for the TDirectory by TKey provided.

Definition at line 495 of file TFileIter.cxx.

Referenced by GetObject(), NextEventGet(), and ReadObj().

void TFileIter::Reset ( void  )
virtual

Reset the status of the iterator.

Reimplemented from TListIter.

Definition at line 356 of file TFileIter.cxx.

Referenced by Initialize(), NextEventKey(), Rewind(), and SetCursorPosition().

void TFileIter::Rewind ( )
inlinevirtual

Definition at line 174 of file TFileIter.h.

void TFileIter::SetCursorPosition ( Int_t  cursorPosition)
inline

Definition at line 180 of file TFileIter.h.

Referenced by operator=(), and SetCursorPosition().

void TFileIter::SetCursorPosition ( const char *  keyNameToFind)

Find the key by the name provided.

Definition at line 384 of file TFileIter.cxx.

TKey * TFileIter::SkipObjects ( Int_t  nSkip = 1)
virtual

Returns the TKey pointer to the nSkip TKey object from the current one nSkip = 0; the state of the iterator is not changed.

nSkip > 0; iterator skips nSkip objects in the container. the direction of the iteration is sign(nSkip)*kIterForward

Returns: TKey that can be used to fetch the object from the TDirectory

Definition at line 401 of file TFileIter.cxx.

Referenced by Next(), NextEventKey(), operator++(), operator+=(), operator--(), SetCursorPosition(), SkipObjects(), and TFileIter().

Int_t TFileIter::TotalKeys ( ) const
virtual

The total number of the TKey keys in the current TDirectory only Usually this means the total number of different objects those can be read one by one.

It does NOT count the nested sub-TDirectory. It is too costly and it can be abused.

Definition at line 294 of file TFileIter.cxx.

Member Data Documentation

Int_t TFileIter::fCursorPosition
protected

Definition at line 75 of file TFileIter.h.

Referenced by CurrentCursorPosition(), NextEventKey(), Reset(), SkipObjects(), and TFileIter().

TString TFileIter::fEventName
protected

Definition at line 72 of file TFileIter.h.

Referenced by NextEventKey().

UInt_t TFileIter::fEventNumber
protected

Definition at line 74 of file TFileIter.h.

Referenced by NextEventKey().

TFileIter* TFileIter::fNestedIterator
private

Definition at line 65 of file TFileIter.h.

Referenced by GetDepth(), ReadObj(), Reset(), SkipObjects(), and ~TFileIter().

Bool_t TFileIter::fOwnTFile
protected

Definition at line 76 of file TFileIter.h.

Referenced by Initialize(), TFileIter(), and ~TFileIter().

TDirectory* TFileIter::fRootFile
protected

Definition at line 71 of file TFileIter.h.

Referenced by GetTDirectory(), Initialize(), IsOpen(), NextEventPut(), Reset(), TFileIter(), and ~TFileIter().

UInt_t TFileIter::fRunNumber
protected

Definition at line 73 of file TFileIter.h.

Referenced by NextEventKey().


The documentation for this class was generated from the following files: