StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TFileIter Class Reference
Inheritance diagram for TFileIter:

Public Member Functions

 TFileIter (const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
 
 TFileIter (TFile *file=0)
 Create iterator over all objects from the TFile provided.
 
 TFileIter (TDirectory *directory)
 Create iterator over all objects from the TDirectory provided.
 
 TFileIter (const TFileIter &)
 
virtual ~TFileIter ()
 TFileIter dtor.
 
Int_t CurrentCursorPosition () const
 
virtual const TFile * GetTFile () const
 
virtual const TDirectory * GetTDirectory () const
 
virtual Bool_t IsOpen () const
 
virtual TObject * NextEventGet (UInt_t eventNumber=UInt_t(-1), UInt_t runNumber=UInt_t(-1), const char *name="*")
 
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.
 
void SetCursorPosition (Int_t cursorPosition)
 
void SetCursorPosition (const char *keyNameToFind)
 Find the key by the name provided.
 
Int_t GetObjlen () const
 Returns the uncompressed length of the current object.
 
virtual Int_t TotalKeys () const
 
virtual TKey * SkipObjects (Int_t nSkip=1)
 
virtual TObject * GetObject () const
 
virtual Int_t GetDepth () const
 
TKey * GetCurrentKey () const
 return the pointer to the current TKey
 
const char * GetKeyName () const
 return the name of the current TKey
 
TFileIteroperator= (Int_t cursorPosition)
 
TFileIteroperator= (const char *keyNameToFind)
 
TFileIteroperator+= (Int_t shift)
 
TFileIteroperator-= (Int_t shift)
 
TFileIteroperator++ ()
 
TFileIteroperator-- ()
 
TObject * operator* () const
 
 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 TObject * Next ()
 
virtual TObject * Next (Int_t nSkip)
 
virtual void Reset ()
 Reset the status of the iterator.
 
virtual void Rewind ()
 
TObject * operator() (Int_t nSkip)
 
TObject * operator() ()
 

Static Public Member Functions

static TString MapName (const char *name, const char *localSystemKey=0, const char *mountedFileSystemKey=0)
 
static const char * GetResourceName ()
 
static const char * GetDefaultMapFileName ()
 
static const char * GetLocalFileNameKey ()
 
static const char * GetForeignFileSystemKey ()
 
static void PurgeKeys (TList *listOfKeys)
 

Protected Member Functions

void Initialize ()
 to be documented
 
TObject * ReadObj (const TKey *key) const
 Read the next TObject from for the TDirectory by TKey provided.
 
TKey * NextEventKey (UInt_t eventNumber=UInt_t(-1), UInt_t runNumber=UInt_t(-1), const char *name="*")
 

Protected Attributes

TDirectory * fRootFile
 
TString fEventName
 
UInt_t fRunNumber
 
UInt_t fEventNumber
 
Int_t fCursorPosition
 
Bool_t fOwnTFile
 

Detailed Description

Definition at line 53 of file TFileIter.h.

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.

References Initialize(), and MapName().

Referenced by ReadObj().

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.

References Initialize(), MapName(), and SkipObjects().

Member Function Documentation

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.

References GetDepth().

Referenced by GetDepth().

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.

References GetCurrentKey(), and ReadObj().

Referenced by Next().

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 ( 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.

References GetObject(), and SkipObjects().

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.

References ReadObj().

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().

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.

References SkipObjects().

Referenced by Next(), 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.


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