Logo ROOT   6.12/07
Reference Guide
List of all members | 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 53 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)
 Create iterator over all objects from the TFile provided. More...
 
 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
 
TKeyGetCurrentKey () const
 return the pointer to the current TKey More...
 
virtual Int_t GetDepth () const
 return the current number of the nested subdirectroies; = 0 - means there is no subdirectories More...
 
const char * GetKeyName () const
 return the name of the current TKey More...
 
virtual TObjectGetObject () const
 read the object from TFile defined by the current TKey More...
 
Int_t GetObjlen () const
 Returns the uncompressed length of the current object. More...
 
virtual const TDirectoryGetTDirectory () const
 
virtual const TFileGetTFile () const
 
virtual Bool_t IsOpen () const
 Check whether the associated ROOT TFile was open and TFile object is healthy. More...
 
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 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...
 
 operator const char * () const
 
 operator const TDirectory * () const
 
 operator const TFile * () const
 
 operator int () const
 
int operator!= (const char *name) const
 
TObjectoperator() (Int_t nSkip)
 
TObjectoperator() ()
 
TObjectoperator* () const
 Return current object or nullptr. More...
 
TFileIteroperator++ ()
 
TFileIteroperator+= (Int_t shift)
 
TFileIteroperator-- ()
 
TFileIteroperator-= (Int_t shift)
 
TFileIteroperator= (Int_t cursorPosition)
 
TFileIteroperator= (const char *keyNameToFind)
 
int operator== (const char *name) const
 
virtual void Reset ()
 Reset the status of the iterator. More...
 
virtual void Rewind ()
 
void SetCursorPosition (Int_t cursorPosition)
 
void SetCursorPosition (const char *keyNameToFind)
 Find the key by the name provided. 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 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...
 
- Public Member Functions inherited from TListIter
 TListIter (const TList *l, Bool_t dir=kIterForward)
 Create a new list iterator. More...
 
 TListIter (const TListIter &iter)
 Copy ctor. More...
 
 ~TListIter ()
 
const TCollectionGetCollection () const
 
Option_tGetOption () const
 Returns the object option stored in the list. More...
 
Bool_t operator!= (const TListIter &aIter) const
 This operator compares two TListIter objects. More...
 
TListIteroperator= (const TListIter &rhs)
 Overloaded assignment operator. More...
 
void SetOption (Option_t *option)
 Sets the object option stored in the list. More...
 
- Public Member Functions inherited from TIterator
virtual ~TIterator ()
 
TObjectoperator() ()
 
Bool_t operator== (const TIterator &other) const
 

Static Public Member Functions

static const char * GetDefaultMapFileName ()
 
static const char * GetForeignFileSystemKey ()
 
static const char * GetLocalFileNameKey ()
 
static const char * GetResourceName ()
 
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 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...
 
TKeyNextEventKey (UInt_t eventNumber=UInt_t(-1), UInt_t runNumber=UInt_t(-1), const char *name="*")
 
TObjectReadObj (const TKey *key) const
 Read the next TObject from for the TDirectory by TKey provided. More...
 
- Protected Member Functions inherited from TListIter
 TListIter ()
 
- Protected Member Functions inherited from TIterator
 TIterator ()
 
 TIterator (const TIterator &)
 

Protected Attributes

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

Private Member Functions

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

Private Attributes

TFileIterfNestedIterator
 

Additional Inherited Members

- Protected Types inherited from TListIter
using TObjLinkPtr_t = std::shared_ptr< TObjLink >
 

#include <TFileIter.h>

Inheritance diagram for TFileIter:
[legend]

Constructor & Destructor Documentation

◆ TFileIter() [1/4]

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.

◆ TFileIter() [2/4]

TFileIter::TFileIter ( TFile file = 0)

Create iterator over all objects from the TFile provided.

Definition at line 127 of file TFileIter.cxx.

◆ TFileIter() [3/4]

TFileIter::TFileIter ( TDirectory directory)

Create iterator over all objects from the TDirectory provided.

Definition at line 138 of file TFileIter.cxx.

◆ TFileIter() [4/4]

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::~TFileIter ( )
virtual

TFileIter dtor.

Definition at line 196 of file TFileIter.cxx.

Member Function Documentation

◆ CurrentCursorPosition()

Int_t TFileIter::CurrentCursorPosition ( ) const
inline

Definition at line 145 of file TFileIter.h.

◆ GetCurrentKey()

TKey * TFileIter::GetCurrentKey ( ) const

return the pointer to the current TKey

Definition at line 240 of file TFileIter.cxx.

◆ GetDefaultMapFileName()

const char * TFileIter::GetDefaultMapFileName ( )
inlinestatic

Definition at line 138 of file TFileIter.h.

◆ GetDepth()

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.

◆ GetForeignFileSystemKey()

const char * TFileIter::GetForeignFileSystemKey ( )
inlinestatic

Definition at line 142 of file TFileIter.h.

◆ GetKeyName()

const char * TFileIter::GetKeyName ( ) const

return the name of the current TKey

Definition at line 256 of file TFileIter.cxx.

◆ GetLocalFileNameKey()

const char * TFileIter::GetLocalFileNameKey ( )
inlinestatic

Definition at line 140 of file TFileIter.h.

◆ GetObject()

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.

◆ GetObjlen()

Int_t TFileIter::GetObjlen ( ) const

Returns the uncompressed length of the current object.

Definition at line 280 of file TFileIter.cxx.

◆ GetResourceName()

const char * TFileIter::GetResourceName ( )
inlinestatic

Definition at line 136 of file TFileIter.h.

◆ GetTDirectory()

const TDirectory * TFileIter::GetTDirectory ( ) const
inlinevirtual

Definition at line 154 of file TFileIter.h.

◆ GetTFile()

const TFile * TFileIter::GetTFile ( ) const
inlinevirtual

Definition at line 152 of file TFileIter.h.

◆ Initialize()

void TFileIter::Initialize ( )
protected

to be documented

Definition at line 211 of file TFileIter.cxx.

◆ IsOpen()

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.

◆ MapName()

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.

◆ Next() [1/2]

TObject * TFileIter::Next ( )
inlinevirtual

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

Reimplemented from TListIter.

Definition at line 158 of file TFileIter.h.

◆ Next() [2/2]

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.

◆ NextEventGet()

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.

◆ NextEventKey()

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.

◆ NextEventPut()

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.

◆ operator const char *()

TFileIter::operator const char * ( ) const
inline

Definition at line 221 of file TFileIter.h.

◆ operator const TDirectory *()

TFileIter::operator const TDirectory * ( ) const
inline

Definition at line 196 of file TFileIter.h.

◆ operator const TFile *()

TFileIter::operator const TFile * ( ) const
inline

Definition at line 200 of file TFileIter.h.

◆ operator int()

TFileIter::operator int ( ) const
inline

Definition at line 218 of file TFileIter.h.

◆ operator!=() [1/2]

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

This operator compares two TIterator objects.

Reimplemented from TListIter.

Definition at line 60 of file TFileIter.h.

◆ operator!=() [2/2]

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

Definition at line 231 of file TFileIter.h.

◆ operator()() [1/2]

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

Definition at line 237 of file TFileIter.h.

◆ operator()() [2/2]

TObject * TFileIter::operator() ( )
inline

Definition at line 235 of file TFileIter.h.

◆ operator*()

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 215 of file TFileIter.h.

◆ operator++()

TFileIter & TFileIter::operator++ ( )
inline

Definition at line 209 of file TFileIter.h.

◆ operator+=()

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

Definition at line 203 of file TFileIter.h.

◆ operator--()

TFileIter & TFileIter::operator-- ( )
inline

Definition at line 212 of file TFileIter.h.

◆ operator-=()

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

Definition at line 206 of file TFileIter.h.

◆ operator=() [1/3]

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

The inner TFidrectory interator;.

Reimplemented from TListIter.

Definition at line 59 of file TFileIter.h.

◆ operator=() [2/3]

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

Definition at line 189 of file TFileIter.h.

◆ operator=() [3/3]

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

Definition at line 183 of file TFileIter.h.

◆ operator==()

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

Definition at line 227 of file TFileIter.h.

◆ PurgeKeys()

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.

◆ ReadObj()

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.

◆ Reset()

void TFileIter::Reset ( void  )
virtual

Reset the status of the iterator.

Reimplemented from TListIter.

Definition at line 356 of file TFileIter.cxx.

◆ Rewind()

void TFileIter::Rewind ( )
inlinevirtual

Definition at line 166 of file TFileIter.h.

◆ SetCursorPosition() [1/2]

void TFileIter::SetCursorPosition ( Int_t  cursorPosition)
inline

Definition at line 172 of file TFileIter.h.

◆ SetCursorPosition() [2/2]

void TFileIter::SetCursorPosition ( const char *  keyNameToFind)

Find the key by the name provided.

Definition at line 384 of file TFileIter.cxx.

◆ SkipObjects()

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.

◆ TotalKeys()

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

◆ fCursorPosition

Int_t TFileIter::fCursorPosition
protected

Definition at line 67 of file TFileIter.h.

◆ fEventName

TString TFileIter::fEventName
protected

Definition at line 64 of file TFileIter.h.

◆ fEventNumber

UInt_t TFileIter::fEventNumber
protected

Definition at line 66 of file TFileIter.h.

◆ fNestedIterator

TFileIter* TFileIter::fNestedIterator
private

Definition at line 57 of file TFileIter.h.

◆ fOwnTFile

Bool_t TFileIter::fOwnTFile
protected

Definition at line 68 of file TFileIter.h.

◆ fRootFile

TDirectory* TFileIter::fRootFile
protected

Definition at line 63 of file TFileIter.h.

◆ fRunNumber

UInt_t TFileIter::fRunNumber
protected

Definition at line 65 of file TFileIter.h.

Libraries for TFileIter:
[legend]

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