ROOT
6.07/01
Reference Guide
|
A ROOT file is structured in Directories (like a file system).
Each Directory has a list of Keys (see TKeys) and a list of objects in memory. A Key is a small object that describes the type and location of a persistent object in a file. The persistent object may be a directory.
The structure of a file is shown in TFile::TFile
Definition at line 33 of file TDirectoryFile.h.
Public Types | |
enum | { kCloseDirectory = BIT(7) } |
Public Types inherited from TObject | |
enum | EStatusBits { kCanDelete = BIT(0), kMustCleanup = BIT(3), kObjInCanvas = BIT(3), kIsReferenced = BIT(4), kHasUUID = BIT(5), kCannotPick = BIT(6), kNoContextMenu = BIT(8), kInvalidObject = BIT(13) } |
enum | { kIsOnHeap = 0x01000000, kNotDeleted = 0x02000000, kZombie = 0x04000000, kBitMask = 0x00ffffff } |
enum | { kSingleKey = BIT(0), kOverwrite = BIT(1), kWriteDelete = BIT(2) } |
Public Member Functions | |
TDirectoryFile () | |
TDirectoryFile (const char *name, const char *title, Option_t *option="", TDirectory *motherDir=0) | |
Create a new TDirectoryFile. More... | |
virtual | ~TDirectoryFile () |
Destructor. More... | |
virtual void | Append (TObject *obj, Bool_t replace=kFALSE) |
Append object to this directory. More... | |
void | Add (TObject *obj, Bool_t replace=kFALSE) |
Int_t | AppendKey (TKey *key) |
Insert key in the linked list of keys of this directory. More... | |
virtual void | Browse (TBrowser *b) |
Browse the content of the directory. More... | |
void | Build (TFile *motherFile=0, TDirectory *motherDir=0) |
Initialise directory to defaults. More... | |
virtual TObject * | CloneObject (const TObject *obj, Bool_t autoadd=kTRUE) |
Make a clone of an object using the Streamer facility. More... | |
virtual void | Close (Option_t *option="") |
Delete all objects from memory and directory structure itself. More... | |
virtual void | Copy (TObject &) const |
Copy this to obj. More... | |
virtual Bool_t | cd (const char *path=0) |
Change current directory to "this" directory. More... | |
virtual void | Delete (const char *namecycle="") |
Delete Objects or/and keys in a directory. More... | |
virtual void | FillBuffer (char *&buffer) |
Encode directory header into output buffer. More... | |
virtual TKey * | FindKey (const char *keyname) const |
Find key with name keyname in the current directory. More... | |
virtual TKey * | FindKeyAny (const char *keyname) const |
Find key with name keyname in the current directory or its subdirectories. More... | |
virtual TObject * | FindObjectAny (const char *name) const |
Find object by name in the list of memory objects of the current directory or its sub-directories. More... | |
virtual TObject * | FindObjectAnyFile (const char *name) const |
Scan the memory lists of all files for an object with name. More... | |
virtual TObject * | Get (const char *namecycle) |
Return pointer to object identified by namecycle. More... | |
virtual TDirectory * | GetDirectory (const char *apath, Bool_t printError=false, const char *funcname="GetDirectory") |
Find a directory named "apath". More... | |
template<class T > | |
void | GetObject (const char *namecycle, T *&ptr) |
virtual void * | GetObjectChecked (const char *namecycle, const char *classname) |
See documentation of TDirectoryFile::GetObjectCheck(const char *namecycle, const TClass *cl) More... | |
virtual void * | GetObjectChecked (const char *namecycle, const TClass *cl) |
Return pointer to object identified by namecycle if and only if the actual object is a type suitable to be stored as a pointer to a "expectedClass" If expectedClass is null, no check is performed. More... | |
virtual void * | GetObjectUnchecked (const char *namecycle) |
Return pointer to object identified by namecycle. More... | |
virtual Int_t | GetBufferSize () const |
Return the buffer size to create new TKeys. More... | |
const TDatime & | GetCreationDate () const |
virtual TFile * | GetFile () const |
virtual TKey * | GetKey (const char *name, Short_t cycle=9999) const |
Return pointer to key with name,cycle. More... | |
virtual TList * | GetListOfKeys () const |
const TDatime & | GetModificationDate () const |
virtual Int_t | GetNbytesKeys () const |
virtual Int_t | GetNkeys () const |
virtual Long64_t | GetSeekDir () const |
virtual Long64_t | GetSeekParent () const |
virtual Long64_t | GetSeekKeys () const |
Bool_t | IsModified () const |
Bool_t | IsWritable () const |
virtual void | ls (Option_t *option="") const |
List Directory contents. More... | |
virtual TDirectory * | mkdir (const char *name, const char *title="") |
Create a sub-directory and return a pointer to the created directory. More... | |
virtual TFile * | OpenFile (const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0) |
Interface to TFile::Open. More... | |
virtual void | Purge (Short_t nkeep=1) |
Purge lowest key cycles in a directory. More... | |
virtual void | ReadAll (Option_t *option="") |
Read objects from a ROOT file directory into memory. More... | |
virtual Int_t | ReadKeys (Bool_t forceRead=kTRUE) |
Read the linked list of keys. More... | |
virtual Int_t | ReadTObject (TObject *obj, const char *keyname) |
Read object with keyname from the current directory. More... | |
virtual void | ResetAfterMerge (TFileMergeInfo *) |
Reset the TDirectory after its content has been merged into another Directory. More... | |
virtual void | rmdir (const char *name) |
Removes subdirectory from the directory. More... | |
virtual void | Save () |
Save recursively all directory keys and headers. More... | |
virtual void | SaveSelf (Bool_t force=kFALSE) |
Save Directory keys and header. More... | |
virtual Int_t | SaveObjectAs (const TObject *obj, const char *filename="", Option_t *option="") const |
Save object in filename. More... | |
virtual void | SetBufferSize (Int_t bufsize) |
Set the default buffer size when creating new TKeys. More... | |
void | SetModified () |
void | SetSeekDir (Long64_t v) |
virtual void | SetTRefAction (TObject *ref, TObject *parent) |
Find the action to be executed in the dictionary of the parent class and store the corresponding exec number into fBits. More... | |
void | SetWritable (Bool_t writable=kTRUE) |
Set the new value of fWritable recursively. More... | |
virtual Int_t | Sizeof () const |
Return the size in bytes of the directory header. More... | |
virtual Int_t | Write (const char *name=0, Int_t opt=0, Int_t bufsize=0) |
Write all objects in memory to disk. More... | |
virtual Int_t | Write (const char *name=0, Int_t opt=0, Int_t bufsize=0) const |
One can not save a const TDirectory object. More... | |
virtual Int_t | WriteTObject (const TObject *obj, const char *name=0, Option_t *option="", Int_t bufsize=0) |
Write object obj to this directory. More... | |
virtual Int_t | WriteObjectAny (const void *obj, const char *classname, const char *name, Option_t *option="", Int_t bufsize=0) |
Write object from pointer of class classname in this directory. More... | |
virtual Int_t | WriteObjectAny (const void *obj, const TClass *cl, const char *name, Option_t *option="", Int_t bufsize=0) |
Write object of class with dictionary cl in this directory. More... | |
virtual void | WriteDirHeader () |
Overwrite the Directory header record. More... | |
virtual void | WriteKeys () |
Write Keys linked list on the file. More... | |
Public Member Functions inherited from TDirectory | |
TDirectory () | |
TDirectory (const char *name, const char *title, Option_t *option="", TDirectory *motherDir=0) | |
Create a new Directory. More... | |
virtual | ~TDirectory () |
Destructor. More... | |
virtual void | Clear (Option_t *option="") |
Delete all objects from a Directory list. More... | |
virtual void | DeleteAll (Option_t *option="") |
Delete all objects from memory. More... | |
virtual void | Draw (Option_t *option="") |
Fill Graphics Structure and Paint. More... | |
virtual TObject * | FindObject (const char *name) const |
Find object by name in the list of memory objects. More... | |
virtual TObject * | FindObject (const TObject *obj) const |
Find object in the list of memory objects. More... | |
template<class T > | |
void | GetObject (const char *namecycle, T *&ptr) |
virtual TList * | GetList () const |
virtual TObject * | GetMother () const |
virtual TDirectory * | GetMotherDir () const |
virtual const char * | GetPathStatic () const |
Returns the full path of the directory. More... | |
virtual const char * | GetPath () const |
Returns the full path of the directory. More... | |
TUUID | GetUUID () const |
virtual Bool_t | IsFolder () const |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More... | |
virtual void | Paint (Option_t *option="") |
Paint all objects in the directory. More... | |
virtual void | Print (Option_t *option="") const |
Print all objects in the directory. More... | |
virtual void | pwd () const |
Print the path of the directory. More... | |
virtual TObject * | Remove (TObject *) |
Remove an object from the in-memory list. More... | |
virtual void | RecursiveRemove (TObject *obj) |
Recursively remove object from a Directory. More... | |
virtual void | SetMother (TObject *mother) |
virtual void | SetName (const char *newname) |
Set the name for directory If the directory name is changed after the directory was written once, ROOT currently would NOT change the name of correspondent key in the mother directory. More... | |
template<class T > | |
Int_t | WriteObject (const T *obj, const char *name, Option_t *option="", Int_t bufsize=0) |
Public Member Functions inherited from TNamed | |
TNamed () | |
TNamed (const char *name, const char *title) | |
TNamed (const TString &name, const TString &title) | |
TNamed (const TNamed &named) | |
TNamed & | operator= (const TNamed &rhs) |
TNamed assignment operator. More... | |
virtual | ~TNamed () |
virtual TObject * | Clone (const char *newname="") const |
Make a clone of an object using the Streamer facility. More... | |
virtual Int_t | Compare (const TObject *obj) const |
Compare two TNamed objects. More... | |
virtual const char * | GetName () const |
Returns name of object. More... | |
virtual const char * | GetTitle () const |
Returns title of object. More... | |
virtual ULong_t | Hash () const |
Return hash value for this object. More... | |
virtual Bool_t | IsSortable () const |
virtual void | SetNameTitle (const char *name, const char *title) |
Change (i.e. set) all the TNamed parameters (name and title). More... | |
virtual void | SetTitle (const char *title="") |
Change (i.e. set) the title of the TNamed. More... | |
Public Member Functions inherited from TObject | |
TObject () | |
TObject (const TObject &object) | |
TObject copy ctor. More... | |
TObject & | operator= (const TObject &rhs) |
TObject assignment operator. More... | |
virtual | ~TObject () |
TObject destructor. More... | |
virtual void | AppendPad (Option_t *option="") |
Append graphics object to current pad. More... | |
virtual const char * | ClassName () const |
Returns name of class to which the object belongs. More... | |
virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
Computes distance from point (px,py) to the object. More... | |
virtual void | DrawClass () const |
Draw class inheritance tree of the class to which this object belongs. More... | |
virtual TObject * | DrawClone (Option_t *option="") const |
Draw a clone of this object in the current pad. More... | |
virtual void | Dump () const |
Dump contents of object on stdout. More... | |
virtual void | Execute (const char *method, const char *params, Int_t *error=0) |
Execute method on this object with the given parameter string, e.g. More... | |
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=0) |
Execute method on this object with parameters stored in the TObjArray. More... | |
virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
Execute action corresponding to an event at (px,py). More... | |
virtual Option_t * | GetDrawOption () const |
Get option used by the graphics system to draw this object. More... | |
virtual UInt_t | GetUniqueID () const |
Return the unique object id. More... | |
virtual const char * | GetIconName () const |
Returns mime type name of object. More... | |
virtual Option_t * | GetOption () const |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
Returns string containing info about the object at position (px,py). More... | |
virtual Bool_t | HandleTimer (TTimer *timer) |
Execute action in response of a timer timing out. More... | |
virtual Bool_t | InheritsFrom (const char *classname) const |
Returns kTRUE if object inherits from class "classname". More... | |
virtual Bool_t | InheritsFrom (const TClass *cl) const |
Returns kTRUE if object inherits from TClass cl. More... | |
virtual void | Inspect () const |
Dump contents of this object in a graphics canvas. More... | |
virtual Bool_t | IsEqual (const TObject *obj) const |
Default equal comparison (objects are equal if they have the same address in memory). More... | |
Bool_t | IsOnHeap () const |
Bool_t | IsZombie () const |
virtual Bool_t | Notify () |
This method must be overridden to handle object notification. More... | |
virtual void | Pop () |
Pop on object drawn in a pad to the top of the display list. More... | |
virtual Int_t | Read (const char *name) |
Read contents of object with specified name from the current directory. More... | |
virtual void | SaveAs (const char *filename="", Option_t *option="") const |
Save this object in the file specified by filename. More... | |
virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
Save a primitive as a C++ statement(s) on output stream "out". More... | |
virtual void | SetDrawOption (Option_t *option="") |
Set drawing option for object. More... | |
virtual void | SetUniqueID (UInt_t uid) |
Set the unique object id. More... | |
virtual void | UseCurrentStyle () |
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. More... | |
void * | operator new (size_t sz) |
void * | operator new[] (size_t sz) |
void * | operator new (size_t sz, void *vp) |
void * | operator new[] (size_t sz, void *vp) |
void | operator delete (void *ptr) |
Operator delete. More... | |
void | operator delete[] (void *ptr) |
Operator delete []. More... | |
void | SetBit (UInt_t f, Bool_t set) |
Set or unset the user status bits as specified in f. More... | |
void | SetBit (UInt_t f) |
void | ResetBit (UInt_t f) |
Bool_t | TestBit (UInt_t f) const |
Int_t | TestBits (UInt_t f) const |
void | InvertBit (UInt_t f) |
virtual void | Info (const char *method, const char *msgfmt,...) const |
Issue info message. More... | |
virtual void | Warning (const char *method, const char *msgfmt,...) const |
Issue warning message. More... | |
virtual void | Error (const char *method, const char *msgfmt,...) const |
Issue error message. More... | |
virtual void | SysError (const char *method, const char *msgfmt,...) const |
Issue system error message. More... | |
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
Issue fatal error message. More... | |
void | AbstractMethod (const char *method) const |
Use this method to implement an "abstract" method that you don't want to leave purely abstract. More... | |
void | MayNotUse (const char *method) const |
Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). More... | |
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
Use this method to declare a method obsolete. More... | |
Protected Member Functions | |
virtual void | CleanTargets () |
Clean the pointers to this object (gDirectory, TContext, etc.) More... | |
void | Init (TClass *cl=0) |
Initialize the key associated with this directory (and the related data members. More... | |
Protected Member Functions inherited from TDirectory | |
Bool_t | cd1 (const char *path) |
flag to add histograms, graphs,etc to the directory More... | |
void | FillFullPath (TString &buf) const |
Recursive method to fill full path for directory. More... | |
void | RegisterContext (TContext *ctxt) |
Register a TContext pointing to this TDirectory object. More... | |
void | UnregisterContext (TContext *ctxt) |
UnRegister a TContext pointing to this TDirectory object. More... | |
TDirectory (const TDirectory &directory) | |
Copy constructor. More... | |
void | operator= (const TDirectory &) |
Protected Member Functions inherited from TObject | |
void | MakeZombie () |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
Interface to ErrorHandler (protected). More... | |
Protected Attributes | |
Bool_t | fModified |
True if directory has been modified. More... | |
Bool_t | fWritable |
True if directory is writable. More... | |
TDatime | fDatimeC |
Date and time when directory is created. More... | |
TDatime | fDatimeM |
Date and time of last modification. More... | |
Int_t | fNbytesKeys |
Number of bytes for the keys. More... | |
Int_t | fNbytesName |
Number of bytes in TNamed at creation time. More... | |
Int_t | fBufferSize |
Default buffer size to create new TKeys. More... | |
Long64_t | fSeekDir |
Location of directory on file. More... | |
Long64_t | fSeekParent |
Location of parent directory on file. More... | |
Long64_t | fSeekKeys |
Location of Keys record on file. More... | |
TFile * | fFile |
Pointer to current file in memory. More... | |
TList * | fKeys |
Pointer to keys list in memory. More... | |
Protected Attributes inherited from TDirectory | |
TObject * | fMother |
TList * | fList |
TUUID | fUUID |
TString | fPathBuffer |
TContext * | fContext |
Buffer for GetPath() function. More... | |
Protected Attributes inherited from TNamed | |
TString | fName |
TString | fTitle |
Private Member Functions | |
TDirectoryFile (const TDirectoryFile &directory) | |
Copy constructor. More... | |
void | operator= (const TDirectoryFile &) |
Additional Inherited Members | |
Static Public Member Functions inherited from TDirectory | |
static void | AddDirectory (Bool_t add=kTRUE) |
Sets the flag controlling the automatic add objects like histograms, TGraph2D, etc in memory. More... | |
static Bool_t | AddDirectoryStatus () |
Static function: see TDirectory::AddDirectory for more comments. More... | |
static TDirectory *& | CurrentDirectory () |
Return the current directory for the current thread. More... | |
static Bool_t | Cd (const char *path) |
Change current directory to "path". More... | |
static void | DecodeNameCycle (const char *namecycle, char *name, Short_t &cycle, const size_t namesize=0) |
Decode a namecycle "aap;2" into name "aap" and cycle "2". More... | |
static void | EncodeNameCycle (char *buffer, const char *name, Short_t cycle) |
Encode the name and cycle into buffer like: "aap;2". More... | |
Static Public Member Functions inherited from TObject | |
static Long_t | GetDtorOnly () |
Return destructor only flag. More... | |
static void | SetDtorOnly (void *obj) |
Set destructor only flag. More... | |
static Bool_t | GetObjectStat () |
Get status of object stat flag. More... | |
static void | SetObjectStat (Bool_t stat) |
Turn on/off tracking of objects in the TObjectTable. More... | |
Static Protected Member Functions inherited from TDirectory | |
static Bool_t | Cd1 (const char *path) |
Change current directory to "path". More... | |
Static Protected Attributes inherited from TDirectory | |
static Bool_t | fgAddDirectory = kTRUE |
Pointer to a list of TContext object pointing to this TDirectory. More... | |
#include <TDirectoryFile.h>
anonymous enum |
Enumerator | |
---|---|
kCloseDirectory |
Definition at line 58 of file TDirectoryFile.h.
|
private |
Copy constructor.
Definition at line 168 of file TDirectoryFile.cxx.
TDirectoryFile::TDirectoryFile | ( | ) |
Referenced by mkdir().
TDirectoryFile::TDirectoryFile | ( | const char * | name, |
const char * | title, | ||
Option_t * | classname = "" , |
||
TDirectory * | initMotherDir = 0 |
||
) |
Create a new TDirectoryFile.
A new directory with a name and a title is created in the current directory. The directory header information is immediatly saved on the file A new key is added in the parent directory. When this constructor is called from a class directly derived from TDirectoryFile, the third argument, classname, MUST be specified. In this case, classname must be the name of the derived class.
Note that the directory name cannot contain slashes.
Definition at line 79 of file TDirectoryFile.cxx.
|
virtual |
Destructor.
Definition at line 179 of file TDirectoryFile.cxx.
Reimplemented from TDirectory.
Definition at line 64 of file TDirectoryFile.h.
Referenced by ClassImp().
Append object to this directory.
If replace is true: remove any existing objects with the same same (if the name is not ""
Reimplemented from TDirectory.
Definition at line 211 of file TDirectoryFile.cxx.
Referenced by Add(), and TTree::ChangeFile().
Insert key in the linked list of keys of this directory.
Reimplemented from TDirectory.
Definition at line 227 of file TDirectoryFile.cxx.
Referenced by TFile::Recover().
Browse the content of the directory.
Reimplemented from TDirectory.
Definition at line 257 of file TDirectoryFile.cxx.
|
virtual |
Initialise directory to defaults.
Reimplemented from TDirectory.
Definition at line 302 of file TDirectoryFile.cxx.
Referenced by TDirectoryFile(), TFile::TFile(), TSQLFile::TSQLFile(), and TXMLFile::TXMLFile().
|
virtual |
Change current directory to "this" directory.
Using path one can change the current directory to "path". The absolute path syntax is:
file.root:/dir1/dir2
where file.root is the file and /dir1/dir2 the desired subdirectory in the file. Relative syntax is relative to "this" directory. E.g: ../aa. Returns kTRUE in case of success.
Reimplemented from TDirectory.
Definition at line 336 of file TDirectoryFile.cxx.
Referenced by Browse(), RooWorkspace::cd(), TTree::ChangeFile(), TMVA::compareanapp(), TTreeCloner::CopyProcessIds(), TTree::Delete(), do_anadist(), do_anadist_ds(), do_anadist_plot(), TDSet::ExportFileList(), foam_demopers(), TSelEventGen::GenerateFiles(), TDSetElement::GetEntries(), TVirtualPacketizer::GetEntries(), TDSet::GetEntries(), TFile::Init(), TSQLFile::InitSqlDatabase(), TXMLFile::InitXmlFile(), TEventIter::LoadDir(), TMVA::TMVAGlob::OpenFile(), TProofBench::OpenOutFile(), TProof::PrepareInputDataFile(), TXMLFile::ReOpen(), TFile::ReOpen(), TSQLFile::ReOpen(), TProof::Retrieve(), TProof::SaveInputData(), TProof::SavePerfTree(), and SaveSelf().
|
protectedvirtual |
Clean the pointers to this object (gDirectory, TContext, etc.)
Reimplemented from TDirectory.
Definition at line 346 of file TDirectoryFile.cxx.
Referenced by Close(), and ~TDirectoryFile().
Make a clone of an object using the Streamer facility.
If the object derives from TNamed, this function is called by TNamed::Clone. TNamed::Clone uses the optional argument newname to set a new name to the newly created object.
If autoadd is true and if the object class has a DirectoryAutoAdd function, it will be called at the end of the function with the parameter gDirectory. This usually means that the object will be appended to the current ROOT directory.
Reimplemented from TDirectory.
Definition at line 369 of file TDirectoryFile.cxx.
Delete all objects from memory and directory structure itself.
Reimplemented from TDirectory.
Reimplemented in TSQLFile, TFile, TNetFile, TXMLFile, and TParallelMergingFile.
Definition at line 535 of file TDirectoryFile.cxx.
Referenced by TXMLFile::Close(), TFile::Close(), and TSQLFile::Close().
Copy this to obj.
Reimplemented from TDirectory.
Reimplemented in TFile.
Definition at line 70 of file TDirectoryFile.h.
|
virtual |
Delete Objects or/and keys in a directory.
Properties of the namecycle string:
To delete one directory, you must specify the directory cycle, eg. file.Delete("dir1;1");
Examples:
Pattern | Description |
---|---|
foo | delete object named foo in memory |
foo* | delete all objects with a name starting with foo |
foo;1 | delete cycle 1 of foo on file |
foo;* | delete all cycles of foo on file and also from memory |
*;2 | delete all objects on file having the cycle 2 |
*;* | delete all objects from memory and file |
T*;* | delete all objects from memory and file and all subdirectories |
If the key to be deleted contains special characters ("+","^","?", etc that have a special meaning for the regular expression parser (see TRegexp) then you must specify 2 backslash characters to escape the regular expression. For example, if the key to be deleted is namecycle = "C++", you must call
mydir.Delete("C\\+\\+"));
Reimplemented from TDirectory.
Reimplemented in TFile.
Definition at line 603 of file TDirectoryFile.cxx.
Referenced by TFile::Delete(), and rmdir().
|
virtual |
Encode directory header into output buffer.
Reimplemented from TNamed.
Reimplemented in TSQLFile, TFile, and TXMLFile.
Definition at line 706 of file TDirectoryFile.cxx.
Referenced by Init(), TFile::Init(), and WriteDirHeader().
|
virtual |
Find key with name keyname in the current directory.
Reimplemented from TDirectory.
Definition at line 732 of file TDirectoryFile.cxx.
|
virtual |
Find key with name keyname in the current directory or its subdirectories.
NOTE: that If a key is found, the directory containing the key becomes the current directory
Reimplemented from TDirectory.
Definition at line 748 of file TDirectoryFile.cxx.
|
virtual |
Find object by name in the list of memory objects of the current directory or its sub-directories.
After this call the current directory is not changed. To automatically set the current directory where the object is found, use FindKeyAny(aname)->ReadObj().
Reimplemented from TDirectory.
Definition at line 788 of file TDirectoryFile.cxx.
|
virtual |
Scan the memory lists of all files for an object with name.
Reimplemented from TDirectory.
Definition at line 427 of file TDirectoryFile.cxx.
|
virtual |
Return pointer to object identified by namecycle.
Properties:
Examples:
Pattern | Explanation |
---|---|
foo | get object named foo in memory if object is not in memory, try with highest cycle from file |
foo;1 | get cycle 1 of foo on file |
The retrieved object should in principle derive from TObject. If not, the function TDirectoryFile::GetObject should be called. However, this function will still work for a non-TObject, provided that the calling application cast the return type to the correct type (which is the actual type of the object).
The method GetObject offers better protection and avoids the need for any cast:
In case the class of this object derives from TObject but not as a first inheritance, one must use dynamic_cast<>().
class MyClass : public TObject, public AnotherClass
then on return, one can adopt a C style cast:
auto objPtr = (MyClass*)directory->Get("some object of MyClass");
class MyClass : public AnotherClass, public TObject
then on return, one must do:
auto objPtr = dynamic_cast<MyClass*>(directory->Get("some object of MyClass"));
Of course, dynamic_cast<> can also be used in the example 1.
Reimplemented from TDirectory.
Definition at line 876 of file TDirectoryFile.cxx.
Referenced by TChain::AddFile(), TFileDrawMap::AnimateTree(), h1analysisTreeReader::Begin(), canvas_read(), canvas_write(), TGeoChecker::CheckBoundaryReference(), Classification(), TMVA::compareanapp(), TMVA::correlations(), TMVA::correlationsMultiClass(), do_anadist_ds(), TProofBench::DrawCPU(), TProofBench::DrawDataSet(), TProofBench::DrawEfficiency(), TMVA::DrawMLPoutputMovie(), TMVA::DrawNetworkMovie(), TFileDrawMap::DrawObject(), EventInfo(), fithist(), fitslicesy(), foam_demopers(), TMVA::get_var_names(), GetData(), TDataSetManagerFile::GetDataSet(), TEveManager::GetGeometry(), TProof::GetInputData(), TFileDrawMap::GetObject(), TProof::GetOutput(), TProofBench::GetPerfSpecs(), TFile::GetStreamerInfoList(), TParallelCoord::GetTree(), TProofLite::GetTreeHeader(), TProofPlayerSlave::HandleGetTreeHeader(), RooStats::HistFactory::HistFactoryNavigation::HistFactoryNavigation(), TGeoVolume::Import(), TGeoManager::Import(), TRecorderReplaying::Initialize(), TRecorderInactive::ListCmd(), TRecorderInactive::ListGui(), TEntryListFromFile::LoadList(), TChain::LoadTree(), memstatExample(), mlpHiggs(), TMVA::mvasMulticlass(), TMVA::mvaweights(), myfit(), TASPaletteEditor::Open(), open_session(), TMVA::paracoor(), plot(), TEntryListFromFile::Print(), TChain::Print(), TSelEventGen::Process(), TProof::Process(), TMVA::MethodPDEFoam::ReadClonedFoamFromFile(), TFile::ReadProcessID(), TMVA::MethodBase::ReadStateFromStream(), readTMatrix(), readTMatrixSym(), readTrackD(), readTrackD32(), TMVA::MethodKNN::ReadWeightsFromStream(), TMVA::MethodLikelihood::ReadWeightsFromStream(), TEntryList::Relocate(), TPoolProcessor< F >::RetrieveTree(), TMVA::rulevisCorr(), TEntryList::Scan(), TQueryResultManager::ScanPreviousQueries(), TTreeViewer::SetFile(), TMemStatShow::Show(), StockReturn(), tables_read(), TMVAClassification(), TMVAClassificationCategory(), TMVAClassificationCategoryApplication(), TProofPerfAnalysis::TProofPerfAnalysis(), tv3Read1(), tv3Read2(), TMVA::variables(), and TMVA::variablesMultiClass().
|
virtual |
Return the buffer size to create new TKeys.
If the stored fBufferSize is null, the value returned is the average buffer size of objects in the file so far.
Reimplemented from TDirectory.
Definition at line 1050 of file TDirectoryFile.cxx.
Referenced by TXNetFile::ReadBuffers(), TXNetFile::SynchronizeCacheSize(), WriteObjectAny(), and WriteTObject().
|
inline |
Definition at line 88 of file TDirectoryFile.h.
|
virtual |
Find a directory named "apath".
It apath is null or empty, returns "this" directory. Otherwise use the name "apath" to find a directory. The absolute path syntax is:
file.root:/dir1/dir2
where file.root is the file and /dir1/dir2 the desired subdirectory in the file. Relative syntax is relative to "this" directory. E.g: ../aa. Returns 0 in case path does not exist. If printError is true, use Error with 'funcname' to issue an error message.
Reimplemented from TDirectory.
Definition at line 456 of file TDirectoryFile.cxx.
Referenced by TMVA::BDT(), TMVA::BDT_Reg(), Delete(), Get(), GetObjectChecked(), TEventIterTree::Load(), TFileMerger::MergeRecursive(), and ReadAll().
|
inlinevirtual |
Reimplemented from TDirectory.
Definition at line 89 of file TDirectoryFile.h.
Referenced by Delete(), TFile::GetType(), Init(), Purge(), TDirectoryFile(), WriteDirHeader(), and WriteKeys().
Return pointer to key with name,cycle.
if cycle = 9999 returns highest cycle
Reimplemented from TDirectory.
Definition at line 1062 of file TDirectoryFile.cxx.
Referenced by FindKey(), mkdir(), WriteObjectAny(), and WriteTObject().
|
inlinevirtual |
Reimplemented from TDirectory.
Definition at line 91 of file TDirectoryFile.h.
Referenced by TTreeCloner::CopyProcessIds(), Delete(), TMVA::deviations(), TXMLFile::DirWriteKeys(), FindKeyAny(), FindObjectAny(), foam_demopers(), Get(), TProof::GetInputData(), GetKey(), TMVA::TMVAGlob::GetListOfJobs(), GetObjectChecked(), TProofBench::GetPerfSpecs(), TGeoVolume::Import(), TGeoManager::Import(), TEntryListFromFile::LoadList(), ls(), TMVA::mvas(), TMVA::mvasMulticlass(), TMVA::network(), TProof::PrepareInputDataFile(), TEntryListFromFile::Print(), TProof::Process(), Purge(), ReadAll(), TMVA::StatDialogMVAEffs::ReadHistograms(), ReadTObject(), TEntryList::Relocate(), TMemFile::ResetObjects(), TPoolProcessor< F >::RetrieveTree(), TEntryList::Scan(), TQueryResultManager::ScanPreviousQueries(), TXMLFile::SetStoreStreamerInfos(), TXMLFile::SetUsedDtd(), TXMLFile::SetUseNamespaces(), TXMLFile::SetXmlLayout(), TMVA::TMVAGui(), TMVA::TMVAMultiClassGui(), and TMVA::TMVARegGui().
|
inline |
Definition at line 92 of file TDirectoryFile.h.
|
inlinevirtual |
Reimplemented from TDirectory.
Definition at line 93 of file TDirectoryFile.h.
|
inlinevirtual |
Reimplemented from TDirectory.
Definition at line 94 of file TDirectoryFile.h.
Referenced by TFile::Init().
Definition at line 80 of file TDirectoryFile.h.
Referenced by TFileDrawMap::DumpObject(), fit1(), GetDirectory(), TFriendElement::GetTree(), hsimpleProxyDriver(), and mkdir().
|
virtual |
See documentation of TDirectoryFile::GetObjectCheck(const char *namecycle, const TClass *cl)
Reimplemented from TDirectory.
Definition at line 953 of file TDirectoryFile.cxx.
Referenced by GetObject(), and GetObjectUnchecked().
|
virtual |
Return pointer to object identified by namecycle if and only if the actual object is a type suitable to be stored as a pointer to a "expectedClass" If expectedClass is null, no check is performed.
The calling application must cast the returned pointer to the type described by the 2 arguments (i.e. cl):
auto objPtr = (MyClass*)directory->GetObjectChecked("some object of MyClass","MyClass"));
Note: We recommend using the method TDirectoryFile::GetObject:
Reimplemented from TDirectory.
Definition at line 981 of file TDirectoryFile.cxx.
|
virtual |
Return pointer to object identified by namecycle.
The returned object may or may not derive from TObject.
The calling application must cast the returned object to the final type, e.g.
auto objPtr = (MyClass*)directory->GetObject("some object of MyClass");
Reimplemented from TDirectory.
Definition at line 945 of file TDirectoryFile.cxx.
|
inlinevirtual |
Reimplemented from TDirectory.
Definition at line 95 of file TDirectoryFile.h.
Referenced by TKey::Create(), and Init().
|
inlinevirtual |
Reimplemented from TDirectory.
Definition at line 97 of file TDirectoryFile.h.
|
inlinevirtual |
Reimplemented from TDirectory.
Definition at line 96 of file TDirectoryFile.h.
Initialize the key associated with this directory (and the related data members.
Definition at line 138 of file TDirectoryFile.cxx.
Referenced by ResetAfterMerge(), and TDirectoryFile().
|
inlinevirtual |
Reimplemented from TDirectory.
Definition at line 98 of file TDirectoryFile.h.
|
inlinevirtual |
Reimplemented from TDirectory.
Definition at line 99 of file TDirectoryFile.h.
Referenced by TSQLFile::AddIdEntry(), TXMLFile::AddXmlComment(), TXMLFile::AddXmlLine(), TXMLFile::AddXmlStyleSheet(), TXMLFile::Close(), TFile::Close(), TSQLFile::Close(), Delete(), TTree::Delete(), TSQLFile::DeleteKeyFromDB(), TSQLFile::IncrementModifyCounter(), TFile::Open(), Purge(), TXMLFile::ReOpen(), TFile::ReOpen(), TSQLFile::ReOpen(), SaveSelf(), TXMLFile::SetStoreStreamerInfos(), TXMLFile::SetUsedDtd(), TXMLFile::SetUseNamespaces(), TXMLFile::SetXmlLayout(), TDirectoryFile(), Write(), TFile::Write(), TBasket::WriteBuffer(), WriteObjectAny(), and WriteTObject().
List Directory contents.
Indentation is used to identify the directory tree Subdirectories are listed first, then objects in memory, then objects on the file
The option can has the following format: [-d |-m][<regexp>] Options:
Reimplemented from TDirectory.
Reimplemented in TFile.
Definition at line 1091 of file TDirectoryFile.cxx.
Referenced by TFile::ls().
|
virtual |
Create a sub-directory and return a pointer to the created directory.
Returns 0 in case of error. Returns 0 if a directory with the same name already exists. Note that the directory name may be of the form "a/b/c" to create a hierarchy of directories. In this case, the function returns the pointer to the "a" directory if the operation is successful.
Reimplemented from TDirectory.
Definition at line 1155 of file TDirectoryFile.cxx.
Referenced by mkdir().
|
virtual |
Interface to TFile::Open.
Reimplemented from TDirectory.
Definition at line 1140 of file TDirectoryFile.cxx.
|
private |
Purge lowest key cycles in a directory.
By default, only the highest cycle of a key is kept. Keys for which the "KEEP" flag has been set are not removed. See TKey::Keep().
Reimplemented from TDirectory.
Definition at line 1194 of file TDirectoryFile.cxx.
Read objects from a ROOT file directory into memory.
If an object is already in memory, the memory copy is deleted and the object is again read from the file. If opt=="dirs", only subdirectories will be read If opt=="dirs*" complete directory tree will be read
Reimplemented from TDirectory.
Definition at line 1230 of file TDirectoryFile.cxx.
Read the linked list of keys.
Every directory has a linked list (fKeys). This linked list has been written on the file via WriteKeys as a single data record.
It is interesting to call this function in the following situation. Assume another process1 is connecting this directory in Update mode
Example Process2:
This is an efficient way (without opening/closing files) to view the latest updates of a file being modified by another process as it is typically the case in a data acquisition system.
Reimplemented from TDirectory.
Definition at line 1283 of file TDirectoryFile.cxx.
Referenced by TFile::Init(), TKeyXML::ReadObj(), TKeySQL::ReadObj(), TKeyXML::ReadObjWithBuffer(), TKeySQL::ReadObjWithBuffer(), and TQueryResultManager::ScanPreviousQueries().
Read object with keyname from the current directory.
Read contents of object with specified name from the current directory. First the key with keyname is searched in the current directory, next the key buffer is deserialized into the object. The object must have been created before via the default constructor. See TObject::Write().
Reimplemented from TDirectory.
Definition at line 1369 of file TDirectoryFile.cxx.
|
virtual |
Reset the TDirectory after its content has been merged into another Directory.
This returns the TDirectoryFile object back to its state before any data has been written to the file. The object in the in-memory list are assumed to also have been reset.
Reimplemented in TMemFile.
Definition at line 1391 of file TDirectoryFile.cxx.
|
virtual |
Removes subdirectory from the directory.
When diredctory is deleted, all keys in all subdirectories will be read first and deleted from file (if exists) Equivalent call is Delete("name;*");
Reimplemented from TDirectory.
Definition at line 1437 of file TDirectoryFile.cxx.
|
virtual |
Save recursively all directory keys and headers.
Reimplemented from TDirectory.
Definition at line 1449 of file TDirectoryFile.cxx.
Referenced by Close(), TFile::ReOpen(), and Save().
|
virtual |
Save object in filename.
If filename is 0 or "", a file with "objectname.root" is created. The name of the key is the object name. If the operation is successful, it returns the number of bytes written to the file otherwise it returns 0. By default a message is printed. Use option "q" to not print the message.
Reimplemented from TDirectory.
Definition at line 1477 of file TDirectoryFile.cxx.
Save Directory keys and header.
If the directory has been modified (fModified set), write the keys and the directory header. This function assumes the cd is correctly set.
It is recommended to use this function in the following situation: Assume a process1 using a directory in Update mode
Reimplemented from TDirectory.
Definition at line 1513 of file TDirectoryFile.cxx.
Set the default buffer size when creating new TKeys.
See also TDirectoryFile::GetBufferSize
Reimplemented from TDirectory.
Definition at line 1534 of file TDirectoryFile.cxx.
Referenced by WriteTObject().
|
inlinevirtual |
Reimplemented from TDirectory.
Definition at line 115 of file TDirectoryFile.h.
Reimplemented from TDirectory.
Definition at line 116 of file TDirectoryFile.h.
Referenced by TKeyXML::ReadObj(), TKeySQL::ReadObj(), TKeyXML::ReadObjWithBuffer(), and TKeySQL::ReadObjWithBuffer().
Find the action to be executed in the dictionary of the parent class and store the corresponding exec number into fBits.
This function searches a data member in the class of parent with an offset corresponding to this. If a comment "TEXEC:" is found in the comment field of the data member, the function stores the exec identifier of the exec statement following this keyword.
Reimplemented from TDirectory.
Definition at line 1549 of file TDirectoryFile.cxx.
Set the new value of fWritable recursively.
Reimplemented from TDirectory.
Definition at line 1568 of file TDirectoryFile.cxx.
Referenced by TFile::Flush(), TXMLFile::ReOpen(), TFile::ReOpen(), TSQLFile::ReOpen(), SetWritable(), TSQLFile::TSQLFile(), TXMLFile::TXMLFile(), and TFile::WriteBuffer().
|
virtual |
Return the size in bytes of the directory header.
Reimplemented from TDirectory.
Reimplemented in TSQLFile, TFile, and TXMLFile.
Definition at line 1591 of file TDirectoryFile.cxx.
Referenced by Init(), TFile::Init(), ReadKeys(), and WriteDirHeader().
Write all objects in memory to disk.
Loop on all objects in memory (including subdirectories). A new key is created in the keys linked list for each object. For allowed options see TObject::Write(). The directory header info is rewritten on the directory header record.
Reimplemented from TDirectory.
Reimplemented in TSQLFile, TFile, TXMLFile, and TParallelMergingFile.
Definition at line 1721 of file TDirectoryFile.cxx.
Referenced by Write(), and TFile::Write().
|
virtual |
One can not save a const TDirectory object.
Reimplemented from TDirectory.
Reimplemented in TSQLFile, TFile, TXMLFile, and TParallelMergingFile.
Definition at line 1741 of file TDirectoryFile.cxx.
|
virtual |
Overwrite the Directory header record.
Reimplemented from TDirectory.
Definition at line 2023 of file TDirectoryFile.cxx.
Referenced by Delete(), Purge(), and SaveSelf().
|
virtual |
Write Keys linked list on the file.
The linked list of keys (fKeys) is written as a single data record
Reimplemented from TDirectory.
Definition at line 2052 of file TDirectoryFile.cxx.
Referenced by Delete(), Purge(), and SaveSelf().
|
virtual |
Write object from pointer of class classname in this directory.
obj may not derive from TObject. See TDirectoryFile::WriteTObject for comments
The value passed as 'obj' needs to be from a pointer to the type described by classname. For example:
you can do:
BUT YOU CAN NOT DO the following since it will fail with multiple inheritance:
We STRONGLY recommend to use
See laso remarks in TDirectoryFile::WriteTObject
Reimplemented from TDirectory.
Definition at line 1904 of file TDirectoryFile.cxx.
|
virtual |
Write object of class with dictionary cl in this directory.
obj may not derive from TObject To get the TClass* cl pointer, one can use
TClass *cl = TClass::GetClass("classname");
An alternative is to call the function WriteObjectAny above. see TDirectoryFile::WriteTObject for comments
Reimplemented from TDirectory.
Definition at line 1931 of file TDirectoryFile.cxx.
|
virtual |
Write object obj to this directory.
The data structure corresponding to this object is serialized. The corresponding buffer is written to this directory with an associated key with name "name".
Writing an object to a file involves the following steps:
By default, the buffersize will be taken from the average buffer size of all objects written to the current file so far. Use TDirectoryFile::SetBufferSize to force a given buffer size.
If a name is specified, it will be the name of the key. If name is not given, the name of the key will be the name as returned by obj->GetName().
The option can be a combination of:
WARNING: avoid special characters like '^','$','.' in the name as they are used by the regular expression parser (see TRegexp).
Reimplemented from TDirectory.
Definition at line 1791 of file TDirectoryFile.cxx.
Referenced by TFile::WriteProcessID(), and TMVA::MethodKNN::WriteWeightsToStream().
|
protected |
Default buffer size to create new TKeys.
Definition at line 42 of file TDirectoryFile.h.
Referenced by GetBufferSize(), SetBufferSize(), and TDirectoryFile().
|
protected |
Date and time when directory is created.
Definition at line 38 of file TDirectoryFile.h.
Referenced by Build(), TSQLFile::DirWriteHeader(), FillBuffer(), GetCreationDate(), TFile::Init(), TXMLFile::ReadFromFile(), ReadKeys(), ResetAfterMerge(), TXMLFile::SaveToFile(), and Sizeof().
|
protected |
Date and time of last modification.
Definition at line 39 of file TDirectoryFile.h.
Referenced by Build(), TSQLFile::DirWriteHeader(), FillBuffer(), GetModificationDate(), TFile::Init(), TXMLFile::ReadFromFile(), ReadKeys(), ResetAfterMerge(), TXMLFile::SaveToFile(), and Sizeof().
|
protected |
Pointer to current file in memory.
Definition at line 46 of file TDirectoryFile.h.
Referenced by Build(), cd(), FillBuffer(), GetBufferSize(), GetDirectory(), GetFile(), ReadKeys(), ReadTObject(), SaveSelf(), Sizeof(), TSQLFile::TSQLFile(), TXMLFile::TXMLFile(), WriteObjectAny(), and WriteTObject().
|
protected |
Pointer to keys list in memory.
Definition at line 47 of file TDirectoryFile.h.
Referenced by AppendKey(), Browse(), Build(), Close(), Delete(), GetListOfKeys(), GetNkeys(), TFile::Init(), TSQLFile::InitSqlDatabase(), TXMLFile::InitXmlFile(), ReadKeys(), ResetAfterMerge(), WriteKeys(), WriteObjectAny(), TFile::WriteStreamerInfo(), WriteTObject(), and ~TDirectoryFile().
|
protected |
True if directory has been modified.
Definition at line 36 of file TDirectoryFile.h.
Referenced by AppendKey(), Build(), Delete(), IsModified(), Purge(), ResetAfterMerge(), SaveSelf(), SetModified(), TDirectoryFile(), and WriteDirHeader().
|
protected |
Number of bytes for the keys.
Definition at line 40 of file TDirectoryFile.h.
Referenced by Build(), FillBuffer(), GetNbytesKeys(), TFile::Init(), ReadKeys(), TMemFile::ResetAfterMerge(), and ResetAfterMerge().
|
protected |
Number of bytes in TNamed at creation time.
Definition at line 41 of file TDirectoryFile.h.
Referenced by FillBuffer(), Init(), TFile::Init(), ReadKeys(), ResetAfterMerge(), WriteDirHeader(), and TFile::WriteHeader().
|
protected |
Location of directory on file.
Definition at line 43 of file TDirectoryFile.h.
Referenced by Build(), Close(), FillBuffer(), GetSeekDir(), Init(), TFile::Init(), ReadKeys(), TFile::Recover(), ResetAfterMerge(), SetSeekDir(), TSQLFile::TSQLFile(), and WriteDirHeader().
|
protected |
Location of Keys record on file.
Definition at line 45 of file TDirectoryFile.h.
Referenced by Build(), FillBuffer(), GetSeekKeys(), TFile::Init(), TFile::Map(), ReadKeys(), TMemFile::ResetAfterMerge(), ResetAfterMerge(), and WriteKeys().
|
protected |
Location of parent directory on file.
Definition at line 44 of file TDirectoryFile.h.
Referenced by Build(), FillBuffer(), GetSeekParent(), Init(), TFile::Init(), ReadKeys(), and ResetAfterMerge().
|
protected |
True if directory is writable.
Definition at line 37 of file TDirectoryFile.h.
Referenced by Build(), TXMLFile::Close(), TAlienFile::Close(), TFile::Close(), TSQLFile::Close(), TNetFile::Create(), TNetXNGFile::Flush(), TNetFile::Flush(), TXNetFile::Flush(), TFile::Flush(), TFile::FlushWriteCache(), TFile::Init(), IsWritable(), TXNetFile::Open(), TFile::ReadBufferViaCache(), TFile::Recover(), SetWritable(), TDirectoryFile(), TFile::TFile(), TMemFile::TMemFile(), TNetXNGFile::TNetXNGFile(), TGFALFile::WriteBuffer(), TDCacheFile::WriteBuffer(), TNetXNGFile::WriteBuffer(), TNetFile::WriteBuffer(), TXNetFile::WriteBuffer(), TFile::WriteBuffer(), TParallelMergingFile::WriteStreamerInfo(), and TFile::WriteStreamerInfo().