Describe directory structure in memory.
It is possible to retrieve the content of a TDirectory object just like getting items from a Python dictionary. Moreover, once a subdirectory or object is accessed for the first time, it is cached for later use. For example, assuming d is a TDirectory instance:
Furthermore, TDirectory implements a WriteObject Python method which relies on TDirectory::WriteObjectAny. This method is a no-op for TDirectory objects, but it is useful for objects of TDirectory subclasses such as TDirectoryFile and TFile, which inherit it. Please refer to the documentation of those classes for more information.
Definition at line 45 of file TDirectory.h.
Classes | |
| class | TContext |
| TDirectory::TContext keeps track and restore the current directory. More... | |
Public Member Functions | |
| TDirectory () | |
| Directory default constructor. | |
| TDirectory (const char *name, const char *title, Option_t *option="", TDirectory *motherDir=nullptr) | |
| Create a new Directory. | |
| virtual | ~TDirectory () |
| Destructor. | |
| virtual void | Add (TObject *obj, Bool_t replace=kFALSE) |
| virtual void | Append (TObject *obj, Bool_t replace=kFALSE) |
| Append object to this directory. | |
| virtual Int_t | AppendKey (TKey *) |
| void | Browse (TBrowser *b) override |
| Browse the content of the directory. | |
| virtual void | Build (TFile *motherFile=nullptr, TDirectory *motherDir=nullptr) |
| virtual Bool_t | cd () |
| Change current directory to "this" directory. | |
| virtual Bool_t | cd (const char *path) |
| Change current directory to "this" directory or to the directory described by the path if given one. | |
| void | Clear (Option_t *option="") override |
| virtual TObject * | CloneObject (const TObject *obj, Bool_t autoadd=kTRUE) |
| Clone an object. | |
| virtual void | Close (Option_t *option="") |
| void | Copy (TObject &) const override |
| Copy this to obj. | |
| void | Delete (const char *namecycle="") override |
| Delete this object. | |
| virtual void | DeleteAll (Option_t *option="") |
| void | Draw (Option_t *option="") override |
| Default Draw method for all objects. | |
| virtual TKey * | FindKey (const char *) const |
| virtual TKey * | FindKeyAny (const char *) const |
| TObject * | FindObject (const char *name) const override |
| Must be redefined in derived classes. | |
| TObject * | FindObject (const TObject *obj) const override |
| Must be redefined in derived classes. | |
| virtual TObject * | FindObjectAny (const char *name) const |
| virtual TObject * | FindObjectAnyFile (const char *) const |
| virtual TObject * | Get (const char *namecycle) |
| template<class T> | |
| T * | Get (const char *namecycle) |
| See documentation of TDirectoryFile::Get(const char *namecycle) | |
| virtual Int_t | GetBufferSize () const |
| virtual TDirectory * | GetDirectory (const char *namecycle, Bool_t printError=false, const char *funcname="GetDirectory") |
| Find a directory using apath. | |
| virtual TFile * | GetFile () const |
| virtual TKey * | GetKey (const char *, Short_t=9999) const |
| virtual TList * | GetList () const |
| virtual TList * | GetListOfKeys () const |
| TObject * | GetMother () const |
| TDirectory * | GetMotherDir () const |
| virtual Int_t | GetNbytesKeys () const |
| virtual Int_t | GetNkeys () const |
| template<class T> | |
| void | GetObject (const char *namecycle, T *&ptr) |
| Get an object with proper type checking. | |
| virtual void * | GetObjectChecked (const char *namecycle, const char *classname) |
| virtual void * | GetObjectChecked (const char *namecycle, const TClass *cl) |
| virtual void * | GetObjectUnchecked (const char *namecycle) |
| virtual const char * | GetPath () const |
| virtual const char * | GetPathStatic () const |
| virtual Long64_t | GetSeekDir () const |
| virtual Long64_t | GetSeekKeys () const |
| virtual Long64_t | GetSeekParent () const |
| TUUID | GetUUID () const |
| TClass * | IsA () const override |
| Bool_t | IsBuilt () const |
| Bool_t | IsFolder () const override |
| Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). | |
| virtual Bool_t | IsModified () const |
| virtual Bool_t | IsWritable () const |
| void | ls (Option_t *option="") const override |
| The ls function lists the contents of a class on stdout. | |
| virtual TDirectory * | mkdir (const char *name, const char *title="", Bool_t returnExistingDirectory=kFALSE) |
| virtual TFile * | OpenFile (const char *, Option_t *="", const char *="", Int_t=1, Int_t=0) |
| void | Paint (Option_t *option="") override |
| This method must be overridden if a class wants to paint itself. | |
| void | Print (Option_t *option="") const override |
| This method must be overridden when a class wants to print itself. | |
| virtual void | Purge (Short_t=1) |
| virtual void | pwd () const |
| virtual void | ReadAll (Option_t *="") |
| virtual Int_t | ReadKeys (Bool_t=kTRUE) |
| virtual Int_t | ReadTObject (TObject *, const char *) |
| void | RecursiveRemove (TObject *obj) override |
| Recursively remove this object from a list. | |
| virtual TObject * | Remove (TObject *) |
| virtual void | rmdir (const char *name) |
| virtual void | Save () |
| virtual Int_t | SaveObjectAs (const TObject *, const char *="", Option_t *="") const |
| virtual void | SaveSelf (Bool_t=kFALSE) |
| virtual void | SetBufferSize (Int_t) |
| virtual void | SetModified () |
| virtual void | SetMother (TObject *mother) |
| void | SetName (const char *newname) override |
| Set the name of the TNamed. | |
| virtual void | SetSeekDir (Long64_t) |
| virtual void | SetTRefAction (TObject *, TObject *) |
| virtual void | SetWritable (Bool_t) |
| Int_t | Sizeof () const override |
| Return size of the TNamed part of the TObject. | |
| void | Streamer (TBuffer &) override |
| TDirectory Streamer. | |
| void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
| virtual Int_t | Write (const char *=nullptr, Int_t=0, Int_t=0) const override |
| Write this object to the current directory. | |
| virtual Int_t | Write (const char *=nullptr, Int_t=0, Int_t=0) override |
| Write this object to the current directory. | |
| virtual void | WriteDirHeader () |
| virtual void | WriteKeys () |
| template<typename T> | |
| std::enable_if_t<!std::is_base_of< TObject, T >::value, Int_t > | WriteObject (const T *obj, const char *name, Option_t *option="", Int_t bufsize=0) |
| Write an object with proper type checking. | |
| template<typename T> | |
| std::enable_if_t< std::is_base_of< TObject, T >::value, Int_t > | WriteObject (const T *obj, const char *name, Option_t *option="", Int_t bufsize=0) |
| Write an object with proper type checking. | |
| virtual Int_t | WriteObjectAny (const void *, const char *, const char *, Option_t *="", Int_t=0) |
| virtual Int_t | WriteObjectAny (const void *, const TClass *, const char *, Option_t *="", Int_t=0) |
| virtual Int_t | WriteTObject (const TObject *obj, const char *name=nullptr, Option_t *="", Int_t=0) |
| Write an object with proper type checking. | |
Public Member Functions inherited from TNamed | |
| TNamed () | |
| TNamed (const char *name, const char *title) | |
| TNamed (const TNamed &named) | |
| TNamed copy ctor. | |
| TNamed (const TString &name, const TString &title) | |
| virtual | ~TNamed () |
| TNamed destructor. | |
| void | Clear (Option_t *option="") override |
| Set name and title to empty strings (""). | |
| TObject * | Clone (const char *newname="") const override |
| Make a clone of an object using the Streamer facility. | |
| Int_t | Compare (const TObject *obj) const override |
| Compare two TNamed objects. | |
| void | Copy (TObject &named) const override |
| Copy this to obj. | |
| virtual void | FillBuffer (char *&buffer) |
| Encode TNamed into output buffer. | |
| const char * | GetName () const override |
| Returns name of object. | |
| const char * | GetTitle () const override |
| Returns title of object. | |
| ULong_t | Hash () const override |
| Return hash value for this object. | |
| TClass * | IsA () const override |
| Bool_t | IsSortable () const override |
| void | ls (Option_t *option="") const override |
| List TNamed name and title. | |
| TNamed & | operator= (const TNamed &rhs) |
| TNamed assignment operator. | |
| void | Print (Option_t *option="") const override |
| Print TNamed name and title. | |
| virtual void | SetNameTitle (const char *name, const char *title) |
| Set all the TNamed parameters (name and title). | |
| virtual void | SetTitle (const char *title="") |
| Set the title of the TNamed. | |
| void | Streamer (TBuffer &) override |
| Stream an object of class TObject. | |
| void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
Public Member Functions inherited from TObject | |
| TObject () | |
| TObject constructor. | |
| TObject (const TObject &object) | |
| TObject copy ctor. | |
| virtual | ~TObject () |
| TObject destructor. | |
| void | AbstractMethod (const char *method) const |
| Use this method to implement an "abstract" method that you don't want to leave purely abstract. | |
| virtual void | AppendPad (Option_t *option="") |
| Append graphics object to current pad. | |
| ULong_t | CheckedHash () |
| Check and record whether this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object. | |
| virtual const char * | ClassName () const |
| Returns name of class to which the object belongs. | |
| virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
| Computes distance from point (px,py) to the object. | |
| virtual void | DrawClass () const |
| Draw class inheritance tree of the class to which this object belongs. | |
| virtual TObject * | DrawClone (Option_t *option="") const |
Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1). | |
| virtual void | Dump () const |
| Dump contents of object on stdout. | |
| virtual void | Error (const char *method, const char *msgfmt,...) const |
| Issue error message. | |
| virtual void | Execute (const char *method, const char *params, Int_t *error=nullptr) |
| Execute method on this object with the given parameter string, e.g. | |
| virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=nullptr) |
| Execute method on this object with parameters stored in the TObjArray. | |
| virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
| Execute action corresponding to an event at (px,py). | |
| virtual void | Fatal (const char *method, const char *msgfmt,...) const |
| Issue fatal error message. | |
| virtual Option_t * | GetDrawOption () const |
| Get option used by the graphics system to draw this object. | |
| virtual const char * | GetIconName () const |
| Returns mime type name of object. | |
| virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
| Returns string containing info about the object at position (px,py). | |
| virtual Option_t * | GetOption () const |
| virtual UInt_t | GetUniqueID () const |
| Return the unique object id. | |
| virtual Bool_t | HandleTimer (TTimer *timer) |
| Execute action in response of a timer timing out. | |
| Bool_t | HasInconsistentHash () const |
| Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e. | |
| virtual void | Info (const char *method, const char *msgfmt,...) const |
| Issue info message. | |
| virtual Bool_t | InheritsFrom (const char *classname) const |
| Returns kTRUE if object inherits from class "classname". | |
| virtual Bool_t | InheritsFrom (const TClass *cl) const |
| Returns kTRUE if object inherits from TClass cl. | |
| virtual void | Inspect () const |
| Dump contents of this object in a graphics canvas. | |
| void | InvertBit (UInt_t f) |
| Bool_t | IsDestructed () const |
| IsDestructed. | |
| virtual Bool_t | IsEqual (const TObject *obj) const |
| Default equal comparison (objects are equal if they have the same address in memory). | |
| R__ALWAYS_INLINE Bool_t | IsOnHeap () const |
| R__ALWAYS_INLINE Bool_t | IsZombie () const |
| 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). | |
| virtual Bool_t | Notify () |
| This method must be overridden to handle object notification (the base implementation is no-op). | |
| void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
| Use this method to declare a method obsolete. | |
| void | operator delete (void *, size_t) |
| Operator delete for sized deallocation. | |
| void | operator delete (void *ptr) |
| Operator delete. | |
| void | operator delete (void *ptr, void *vp) |
| Only called by placement new when throwing an exception. | |
| void | operator delete[] (void *, size_t) |
| Operator delete [] for sized deallocation. | |
| void | operator delete[] (void *ptr) |
| Operator delete []. | |
| void | operator delete[] (void *ptr, void *vp) |
| Only called by placement new[] when throwing an exception. | |
| void * | operator new (size_t sz) |
| void * | operator new (size_t sz, void *vp) |
| void * | operator new[] (size_t sz) |
| void * | operator new[] (size_t sz, void *vp) |
| TObject & | operator= (const TObject &rhs) |
| TObject assignment operator. | |
| virtual void | Pop () |
| Pop on object drawn in a pad to the top of the display list. | |
| virtual Int_t | Read (const char *name) |
| Read contents of object with specified name from the current directory. | |
| void | ResetBit (UInt_t f) |
| virtual void | SaveAs (const char *filename="", Option_t *option="") const |
| Save this object in the file specified by filename. | |
| virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
| Save a primitive as a C++ statement(s) on output stream "out". | |
| void | SetBit (UInt_t f) |
| void | SetBit (UInt_t f, Bool_t set) |
| Set or unset the user status bits as specified in f. | |
| virtual void | SetDrawOption (Option_t *option="") |
| Set drawing option for object. | |
| virtual void | SetUniqueID (UInt_t uid) |
| Set the unique object id. | |
| void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
| virtual void | SysError (const char *method, const char *msgfmt,...) const |
| Issue system error message. | |
| R__ALWAYS_INLINE Bool_t | TestBit (UInt_t f) const |
| Int_t | TestBits (UInt_t f) const |
| virtual void | UseCurrentStyle () |
| Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. | |
| virtual void | Warning (const char *method, const char *msgfmt,...) const |
| Issue warning message. | |
Static Public Member Functions | |
| static void | AddDirectory (Bool_t add=kTRUE) |
| Sets the flag controlling the automatic add objects like histograms, TGraph2D, etc in memory. | |
| static Bool_t | AddDirectoryStatus () |
| Static function: see TDirectory::AddDirectory for more comments. | |
| static Bool_t | Cd (const char *path) |
| static TClass * | Class () |
| static const char * | Class_Name () |
| static constexpr Version_t | Class_Version () |
| static std::atomic< TDirectory * > & | CurrentDirectory () |
| Return the current directory for the current thread. | |
| static const char * | DeclFileName () |
| static void | DecodeNameCycle (const char *namecycle, char *name, Short_t &cycle, const size_t namesize=0) |
Static Public Member Functions inherited from TNamed | |
| static TClass * | Class () |
| static const char * | Class_Name () |
| static constexpr Version_t | Class_Version () |
| static const char * | DeclFileName () |
Static Public Member Functions inherited from TObject | |
| static TClass * | Class () |
| static const char * | Class_Name () |
| static constexpr Version_t | Class_Version () |
| static const char * | DeclFileName () |
| static Longptr_t | GetDtorOnly () |
| Return destructor only flag. | |
| static Bool_t | GetObjectStat () |
| Get status of object stat flag. | |
| static void | SetDtorOnly (void *obj) |
| Set destructor only flag. | |
| static void | SetObjectStat (Bool_t stat) |
| Turn on/off tracking of objects in the TObjectTable. | |
Protected Types | |
| using | SharedGDirectory_t = std::shared_ptr<std::atomic<TDirectory *>> |
| Pointer to a list of TContext object pointing to this TDirectory. | |
Protected Types inherited from TObject | |
| enum | { kOnlyPrepStep = (1ULL << (3)) } |
Protected Member Functions | |
| TDirectory (const TDirectory &directory)=delete | |
| void | BuildDirectory (TFile *motherFile, TDirectory *motherDir) |
| Initialise directory to defaults. | |
| Bool_t | cd1 (const char *path) |
| flag to add histograms, graphs,etc to the directory | |
| void | CleanTargets () |
| Clean the pointers to this object (gDirectory, TContext, etc.). | |
| void | FillFullPath (TString &buf) const |
| void | operator= (const TDirectory &)=delete |
| void | RegisterContext (TContext *ctxt) |
| Register a TContext pointing to this TDirectory object. | |
| void | RegisterGDirectory (SharedGDirectory_t &ptr) |
| Register a std::atomic<TDirectory*> that will soon be pointing to this TDirectory object. | |
| void | UnregisterContext (TContext *ctxt) |
| UnRegister a TContext pointing to this TDirectory object. | |
Protected Member Functions inherited from TObject | |
| virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
| Interface to ErrorHandler (protected). | |
| void | MakeZombie () |
Static Protected Member Functions | |
| static Bool_t | Cd1 (const char *path) |
| static SharedGDirectory_t & | GetSharedLocalCurrentDirectory () |
| Return the (address of) a shared pointer to the struct holding the actual thread local gDirectory pointer and the atomic_flag for its lock. | |
Protected Attributes | |
| TContext * | fContext {nullptr} |
| Buffer for GetPath() function. | |
| std::atomic< size_t > | fContextPeg {0} |
| thread local gDirectory pointing to this object. | |
| std::vector< SharedGDirectory_t > | fGDirectories |
| TList * | fList {nullptr} |
| TObject * | fMother {nullptr} |
| TString | fPathBuffer |
| std::atomic_flag | fSpinLock |
| Counter delaying the TDirectory destructor from finishing. | |
| TUUID | fUUID |
Protected Attributes inherited from TNamed | |
| TString | fName |
| TString | fTitle |
Static Protected Attributes | |
| static Bool_t | fgAddDirectory = kTRUE |
| MSVC doesn't support = ATOMIC_FLAG_INIT;. | |
Friends | |
| struct | ROOT::Internal::TDirectoryAtomicAdapter |
| class | TContext |
Additional Inherited Members | |
Public Types inherited from TObject | |
| enum | { kSingleKey = (1ULL << (0)) , kOverwrite = (1ULL << (1)) , kWriteDelete = (1ULL << (2)) } |
| enum | { kIsOnHeap = 0x01000000 , kNotDeleted = 0x02000000 , kZombie = 0x04000000 , kInconsistent = 0x08000000 , kBitMask = 0x00ffffff } |
| enum | EDeprecatedStatusBits { kObjInCanvas = (1ULL << (3)) } |
| enum | EStatusBits { kCanDelete = (1ULL << (0)) , kMustCleanup = (1ULL << (3)) , kIsReferenced = (1ULL << (4)) , kHasUUID = (1ULL << (5)) , kCannotPick = (1ULL << (6)) , kNoContextMenu = (1ULL << (8)) , kInvalidObject = (1ULL << (13)) } |
#include <TDirectory.h>
|
protected |
Pointer to a list of TContext object pointing to this TDirectory.
Definition at line 147 of file TDirectory.h.
|
protecteddelete |
| TDirectory::TDirectory | ( | ) |
Directory default constructor.
Definition at line 53 of file TDirectory.cxx.
| TDirectory::TDirectory | ( | const char * | name, |
| const char * | title, | ||
| Option_t * | option = "", | ||
| TDirectory * | initMotherDir = nullptr ) |
Create a new Directory.
A new directory with name,title is created in the current directory The directory header information is immediately saved in the file A new key is added in the parent directory
When this constructor is called from a class directly derived from TDirectory, 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 72 of file TDirectory.cxx.
|
virtual |
Destructor.
Definition at line 97 of file TDirectory.cxx.
Reimplemented in RooWorkspace::WSDir, and TDirectoryFile.
Definition at line 183 of file TDirectory.h.
Sets the flag controlling the automatic add objects like histograms, TGraph2D, etc in memory.
By default (fAddDirectory = kTRUE), these objects are automatically added to the list of objects in memory. Note that in the classes like TH1, TGraph2D supporting this facility, one object can be removed from its support directory by calling object->SetDirectory(nullptr) or object->SetDirectory(dir) to add it to the list of objects in the directory dir.
NOTE that this is a static function. To call it, use:
Definition at line 180 of file TDirectory.cxx.
|
static |
Static function: see TDirectory::AddDirectory for more comments.
Definition at line 188 of file TDirectory.cxx.
Append object to this directory.
If replace is true: remove any existing objects with the same name (if the name is not "")
Reimplemented in RooWorkspace::WSDir, TDirectoryFile, and TROOT.
Definition at line 199 of file TDirectory.cxx.
Reimplemented in TDirectoryFile.
Definition at line 184 of file TDirectory.h.
|
overridevirtual |
Browse the content of the directory.
Reimplemented from TObject.
Reimplemented in TDirectoryFile, and TROOT.
Definition at line 227 of file TDirectory.cxx.
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 186 of file TDirectory.h.
|
protected |
Initialise directory to defaults.
If directory is created via default ctor (when dir is read from file) don't add it here to the directory since its name is not yet known. It will be added to the directory in TKey::ReadObj().
Definition at line 249 of file TDirectory.cxx.
|
static |
|
virtual |
Change current directory to "this" directory.
Returns kTRUE (it's guaranteed to succeed).
Reimplemented in TDirectoryFile.
Definition at line 538 of file TDirectory.cxx.
|
virtual |
Change current directory to "this" directory or to the directory described by the path if given one.
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 in TDirectoryFile.
Definition at line 562 of file TDirectory.cxx.
|
staticprotected |
|
protected |
flag to add histograms, graphs,etc to the directory
Change current directory to "this" directory or to the directory described by the path if given one.
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 kFALSE in case path does not exist.
Definition at line 581 of file TDirectory.cxx.
|
static |
|
inlinestaticconstexpr |
Definition at line 308 of file TDirectory.h.
|
protected |
Clean the pointers to this object (gDirectory, TContext, etc.).
Definition at line 264 of file TDirectory.cxx.
Clone an object.
This function is called when the directory is not a TDirectoryFile. This version has to load the I/O package, hence via Cling.
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 gDirector. This usually means that the object will be appended to the current ROOT directory.
Reimplemented in TDirectoryFile.
Definition at line 364 of file TDirectory.cxx.
|
virtual |
Reimplemented in TDirectoryFile, TFile, TNetFile, TParallelMergingFile, TSQLFile, TWebFile, and TXMLFile.
|
inlineoverridevirtual |
Copy this to obj.
Reimplemented from TObject.
Reimplemented in TDirectoryFile, and TFile.
Definition at line 191 of file TDirectory.h.
|
static |
Return the current directory for the current thread.
Definition at line 432 of file TDirectory.cxx.
|
inlinestatic |
Definition at line 308 of file TDirectory.h.
|
static |
Change 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 the current directory gDirectory, e.g.: ../aa. / / Returns kTRUE in case of success.
Bool_t TDirectory::Cd(const char *path) { return Cd1(path); }
////////////////////////////////////////////////////////////////////////////// / Change current directory to "path". The 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 the current directory gDirectory, e.g.: ../aa. / / Returns kFALSE in case path does not exist.
Bool_t TDirectory::Cd1(const char *apath) { null path is always true (i.e. stay in the current directory) if (!apath || !apath[0]) return kTRUE;
TDirectory *where = (ROOT::Internal::TDirectoryAtomicAdapter{}) ->GetDirectory(apath, kTRUE, "Cd"); if (where) { where->cd(); return kTRUE; } return kFALSE; }
////////////////////////////////////////////////////////////////////////////// / Delete all objects from a Directory list.
void TDirectory::Clear(Option_t *) { if (fList) fList->Clear(); }
////////////////////////////////////////////////////////////////////////////// / Delete all objects from memory and directory structure itself. / if option is "slow", iterate through the containers in a way to can handle / 'external' modification (induced by recursions) / if option is "nodelete", write the TDirectory but do not delete the contained / objects. void TDirectory::Close(Option_t *option) { if (!fList) { return; }
Save the directory key list and header Save();
Bool_t nodelete = option ? (!strcmp(option, "nodelete") ? kTRUE : kFALSE) : kFALSE;
if (!nodelete) { Bool_t slow = option ? (!strcmp(option, "slow") ? kTRUE : kFALSE) : kFALSE; if (!slow) { Check if it is wise to use the fast deletion path. TObjLink *lnk = fList->FirstLink(); while (lnk) { if (lnk->GetObject()->IsA() == TDirectory::Class()) { slow = kTRUE; break; } lnk = lnk->Next(); } }
Delete objects from directory list, this in turn, recursively closes all sub-directories (that were allocated on the heap) if this dir contains subdirs, we must use the slow option for Delete! we must avoid "slow" as much as possible, in particular Delete("slow") with a large number of objects (eg >10^5) would take for ever. if (slow) fList->Delete("slow"); else fList->Delete(); }
////////////////////////////////////////////////////////////////////////////// / Delete all objects from memory.
void TDirectory::DeleteAll(Option_t *) { fList->Delete("slow"); }
////////////////////////////////////////////////////////////////////////////// / Delete Objects or/and keys in a directory. / / - namecycle has the format name;cycle / - namecycle = "" same as namecycle ="T*" / - name = * means all / - cycle = * means all cycles (memory and keys) / - cycle = "" or cycle = 9999 ==> apply to a memory object / When name=* use T* to delete subdirectories also / / To delete one directory, you must specify the directory cycle, / eg. file.Delete("dir1;1"); / / examples: / - 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
void TDirectory::Delete(const char *namecycle) { if (gDebug) Info("Delete","Call for this = %s namecycle = %s", GetName(), (namecycle ? namecycle : "null"));
TDirectory::TContext ctxt(this); Short_t cycle; char name[kMaxLen]; DecodeNameCycle(namecycle, name, cycle, kMaxLen);
Int_t deleteall = 0; Int_t deletetree = 0; if(strcmp(name,"*") == 0) deleteall = 1; if(strcmp(name,"*T") == 0){ deleteall = 1; deletetree = 1;} if(strcmp(name,"T*") == 0){ deleteall = 1; deletetree = 1;} if(namecycle==nullptr || !namecycle[0]){ deleteall = 1; deletetree = 1;} TRegexp re(name,kTRUE); TString s; Int_t deleteOK = 0;
if (cycle >= 9999 ) { TNamed idcur; TIter next(fList); while ((idcur = (TNamed *) next())) { deleteOK = 0; s = idcur->GetName(); if (deleteall || s.Index(re) != kNPOS) { deleteOK = 1; if (idcur->IsA() == TDirectory::Class()) { deleteOK = 2; if (!deletetree && deleteall) deleteOK = 0; } } if (deleteOK != 0) { fList->Remove(idcur); if (deleteOK==2) { read subdirectories to correctly delete them if (deletetree) ((TDirectory) idcur)->ReadAll("dirs"); idcur->Delete(deletetree ? "T*;*" : "*"); delete idcur; } else idcur->Delete(name); } } } }
////////////////////////////////////////////////////////////////////////////// / Fill Graphics Structure and Paint. / / Loop on all objects (memory or file) and all subdirectories
void TDirectory::Draw(Option_t <em>option) { fList-> SetCurrentCollection(); TIter nxt_ TObjectDraw(TCollection::GetCurrentCollection()); TObject * obj_ TObjectDraw; while (( obj_ TObjectDraw= (TObject) nxt_ TObjectDraw())) obj_ TObjectDraw->Draw(option); }
////////////////////////////////////////////////////////////////////////////// / Find object in the list of memory objects.
TObject *TDirectoryFindObject(const TObject *obj) const { return fList->FindObject(obj); }
////////////////////////////////////////////////////////////////////////////// / Find object by name in the list of memory objects.
TObject *TDirectoryFindObject(const char *name) const { return fList->FindObject(name); }
////////////////////////////////////////////////////////////////////////////// / 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().
TObject *TDirectoryFindObjectAny(const char *aname) const { object may be already in the list of objects in memory TObject *obj = fList->FindObject(aname); if (obj) return obj;
try with subdirectories TIter next(fList); while( (obj = next()) ) { if (obj->IsA()->InheritsFrom(TDirectory::Class())) { TDirectory* subdir = static_cast<TDirectory*>(obj); TObject *subobj = subdir->TDirectory::FindObjectAny(aname); // Explicitly recurse into this exact function. if (subobj) { return subobj; } } } return nullptr; }
////////////////////////////////////////////////////////////////////////////// / Return pointer to object identified by namecycle. / / namecycle has the format name;cycle / - name = * is illegal, cycle = * is illegal / - cycle = "" or cycle = 9999 ==> apply to a memory object / / examples: / - 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 TDirectory::GetObject should be called. / However, this function will still work for a non-TObject, providing that / the calling application cast the return type to the correct type (which / is the actual type of the object). / / NOTE: / / The method GetObject offer better protection and avoid the need / for any cast: / ~~~ {.cpp} / MyClass obj; / directory->GetObject("some object",obj); / if (obj) { ... the object exist and inherits from MyClass ... } / ~~~ / / VERY IMPORTANT NOTE: / / In case the class of this object derives from TObject but not / as a first inheritance, one must use dynamic_cast<>(). / #### Example 1: Normal case: / ~~~ {.cpp} / class MyClass : public TObject, public AnotherClass / ~~~ / then on return, one can do: / ~~~ {.cpp} / MyClass *obj = (MyClass)directory->Get("some object of MyClass"); / ~~~ / #### Example 2: Special case: / ~~~ {.cpp} / class MyClass : public AnotherClass, public TObject / ~~~ / then on return, one must do: / ~~~ {.cpp} / MyClass obj = dynamic_cast<MyClass>(directory->Get("some object of MyClass")); / ~~~ / Of course, dynamic_cast<> can also be used in the example 1.
TObject *TDirectoryGet(const char *namecycle) { Short_t cycle; char name[kMaxLen];
DecodeNameCycle(namecycle, name, cycle, kMaxLen); char namobj = name; Int_t nch = strlen(name); for (Int_t i = nch-1; i > 0; i–) { if (name[i] == '/') { name[i] = 0; TDirectory dirToSearch=GetDirectory(name); namobj = name + i + 1; name[i] = '/'; return dirToSearch ? dirToSearch->Get(namobj) : nullptr; } }
TObject *idcur = fList->FindObject(namobj); if (idcur) { if (idcur==this && strlen(namobj)!=0) { The object has the same name has the directory and that's what we picked-up! We just need to ignore it ... idcur = nullptr; } else if (cycle == 9999) { return idcur; } else { if (idcur->InheritsFrom(TCollection::Class())) idcur->Delete(); // delete also list elements delete idcur; idcur = nullptr; } } return idcur; }
////////////////////////////////////////////////////////////////////////////// / Return pointer to object identified by namecycle. / The returned object may or may not derive from TObject. / / - namecycle has the format name;cycle / - name = * is illegal, cycle = * is illegal / - cycle = "" or cycle = 9999 ==> apply to a memory object / / VERY IMPORTANT NOTE: / / The calling application must cast the returned object to / the final type, e.g. / ~~~ {.cpp} / MyClass obj = (MyClass)directory->GetObject("some object of MyClass"); / ~~~
void *TDirectoryGetObjectUnchecked(const char *namecycle) { return GetObjectChecked(namecycle,(TClass *)nullptr); }
////////////////////////////////////////////////////////////////////////////// / See documentation of TDirectory::GetObjectCheck(const char *namecycle, const TClass *cl)
void TDirectory::GetObjectChecked(const char *namecycle, const char classname) { return GetObjectChecked(namecycle, TClass::GetClass(classname)); }
////////////////////////////////////////////////////////////////////////////// / 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. / / namecycle has the format name;cycle / - name = * is illegal, cycle = * is illegal / - cycle = "" or cycle = 9999 ==> apply to a memory object / / VERY IMPORTANT NOTE: / / The calling application must cast the returned pointer to / the type described by the 2 arguments (i.e. cl): / ~~~ {.cpp} / MyClass obj = (MyClass)directory->GetObjectChecked("some object of MyClass","MyClass")); / ~~~ / Note: We recommend using the method TDirectory::GetObject: / ~~~ {.cpp} / MyClass *obj = nullptr; / directory->GetObject("some object inheriting from MyClass",obj); / if (obj) { ... we found what we are looking for ... } / ~~~
void TDirectory::GetObjectChecked(const char *namecycle, const TClass expectedClass) { Short_t cycle; char name[kMaxLen];
DecodeNameCycle(namecycle, name, cycle, kMaxLen); char namobj = name; Int_t nch = strlen(name); for (Int_t i = nch-1; i > 0; i–) { if (name[i] == '/') { name[i] = 0; TDirectory dirToSearch=GetDirectory(name); namobj = name + i + 1; name[i] = '/'; if (dirToSearch) { return dirToSearch->GetObjectChecked(namobj, expectedClass); } else { return nullptr; } } }
if (!expectedClass || expectedClass->IsTObject()) { TObject *objcur = fList->FindObject(namobj); if (objcur) { if (objcur==this && strlen(namobj)!=0) { The object has the same name has the directory and that's what we picked-up! We just need to ignore it ... objcur = nullptr; } else if (cycle == 9999) { Check type if (expectedClass && objcur->IsA()->GetBaseClassOffset(expectedClass) == -1) return nullptr; else return objcur; } else { if (objcur->InheritsFrom(TCollection::Class())) objcur->Delete(); // delete also list elements delete objcur; objcur = nullptr; } } }
return nullptr; }
////////////////////////////////////////////////////////////////////////////// / Returns the full path of the directory. E.g. file:/dir1/dir2. / The returned path will be re-used by the next call to GetPath().
const char *TDirectoryGetPathStatic() const { static char *path = nullptr; const int kMAXDEPTH = 128; const TDirectory *d[kMAXDEPTH]; const TDirectory *cur = this; int depth = 0, len = 0;
d[depth++] = cur; len = strlen(cur->GetName()) + 1; // +1 for the /
while (cur->fMother && depth < kMAXDEPTH) { cur = (TDirectory *)cur->fMother; d[depth++] = cur; len += strlen(cur->GetName()) + 1; }
if (path) delete [] path; path = new char[len+2];
for (int i = depth-1; i >= 0; i–) { if (i == depth-1) { // file or TROOT name strlcpy(path, d[i]->GetName(),len+2); strlcat(path, ":",len+2); if (i == 0) strlcat(path, "/",len+2); } else { strlcat(path, "/",len+2); strlcat(path, d[i]->GetName(),len+2); } }
return path; }
////////////////////////////////////////////////////////////////////////////// / Returns the full path of the directory. E.g. file:/dir1/dir2. / The returned path will be re-used by the next call to GetPath().
const char *TDirectoryGetPath() const { FillFullPath(fPathBuffer);
if (!GetMotherDir()) // case of file fPathBuffer.Append("/");
return fPathBuffer.Data(); }
////////////////////////////////////////////////////////////////////////////// / Recursive method to fill full path for directory.
void TDirectory::FillFullPath(TString& buf) const { TDirectory* mom = GetMotherDir(); if (mom) { mom->FillFullPath(buf); buf += "/"; buf += GetName(); } else { buf = GetName(); buf += ":"; } }
////////////////////////////////////////////////////////////////////////////// / Create a sub-directory "a" or a hierarchy of sub-directories "a/b/c/...". / / Returns 0 in case of error or if a sub-directory (hierarchy) with the requested / name already exists. / returnExistingDirectory returns a pointer to an already existing sub-directory with the same name. / Returns a pointer to the created sub-directory or to the top sub-directory of / the hierarchy (in the above example, the returned TDirectory * always points / to "a"). / In particular, the steps to create first a/b/c and then a/b/d without receiving / errors are: / ~~~ {.cpp} / TFile * file = new TFile("afile","RECREATE"); / file->mkdir("a"); / file->cd("a"); / gDirectory->mkdir("b/c"); / gDirectory->cd("b"); / gDirectory->mkdir("d"); / ~~~ / or / ~~~ {.cpp} / TFile * file = new TFile("afile","RECREATE"); / file->mkdir("a"); / file->cd("a"); / gDirectory->mkdir("b/c"); / gDirectory->mkdir("b/d", "", true); / ~~~
TDirectory *TDirectorymkdir(const char *name, const char *title, Bool_t returnExistingDirectory) { if (returnExistingDirectory) { auto existingdir = GetDirectory(name); if (existingdir) return existingdir; } if (!name || !title || !name[0]) return nullptr; if (!title[0]) title = name; if (const char *slash = strchr(name,'/')) { Long_t size = Long_t(slash-name); char *workname = new char[size+1]; strncpy(workname, name, size); workname[size] = 0; TDirectory *tmpdir; GetObject(workname,tmpdir); if (!tmpdir) tmpdir = mkdir(workname,title); delete[] workname; if (!tmpdir) return nullptr; return tmpdir->mkdir(slash+1); }
TDirectory::TContext ctxt(this);
return new TDirectory(name, title, "", this); }
////////////////////////////////////////////////////////////////////////////// / List Directory contents. / / Indentation is used to identify the directory tree / Subdirectories are listed first, then objects in memory. / / The option can has the following format: / / [<regexp>] / / The <regexp> will be used to match the name of the objects. / By default memory and disk objects are listed.
void TDirectory::ls(Option_t *option) const { TROOT::IndentLevel(); TROOT::IncreaseDirLevel();
TString opta = option; TString opt = opta.Strip(TString::kBoth); Bool_t memobj = kTRUE; TString reg = "*"; if (opt.BeginsWith("-m")) { if (opt.Length() > 2) reg = opt(2,opt.Length()); } else if (opt.BeginsWith("-d")) { memobj = kFALSE; if (opt.Length() > 2) reg = opt(2,opt.Length()); } else if (!opt.IsNull()) reg = opt;
TRegexp re(reg, kTRUE);
if (memobj) { TObject obj; TIter nextobj(fList); while ((obj = (TObject *) nextobj())) { TString s = obj->GetName(); if (s.Index(re) == kNPOS) continue; obj->ls(option); //-* Loop on all the objects in memory } } TROOT::DecreaseDirLevel(); }
////////////////////////////////////////////////////////////////////////////// / Paint all objects in the directory.
void TDirectory::Paint(Option_t <em>option) { fList-> SetCurrentCollection(); TIter nxt_ TObjectPaint(TCollection::GetCurrentCollection()); TObject * obj_ TObjectPaint; while (( obj_ TObjectPaint= (TObject) nxt_ TObjectPaint())) obj_ TObjectPaint->Paint(option); }
////////////////////////////////////////////////////////////////////////////// / Print all objects in the directory.
void TDirectory::Print(Option_t <em>option) const { fList-> SetCurrentCollection(); TIter nxt_ TObjectPrint(TCollection::GetCurrentCollection()); TObject * obj_ TObjectPrint; while (( obj_ TObjectPrint= (TObject) nxt_ TObjectPrint())) obj_ TObjectPrint->Print(option); }
////////////////////////////////////////////////////////////////////////////// / Print the path of the directory.
void TDirectory::pwd() const { Printf("%s", GetPath()); }
////////////////////////////////////////////////////////////////////////////// / Recursively remove object from a Directory.
void TDirectory::RecursiveRemove(TObject *obj) { if (fList) fList->RecursiveRemove(obj); }
////////////////////////////////////////////////////////////////////////////// / Remove an object from the in-memory list.
TObject TDirectory::Remove(TObject obj) { TObject *p = nullptr; if (fList) { p = fList->Remove(obj); } return p; }
////////////////////////////////////////////////////////////////////////////// / Removes subdirectory from the directory / When directory is deleted, all keys in all subdirectories will be / read first and deleted from file (if exists) / Equivalent call is Delete("name;*");
void TDirectory::rmdir(const char *name) { if ((name==nullptr) || (*name==0)) return;
TString mask(name); mask+=";*"; Delete(mask); }
////////////////////////////////////////////////////////////////////////////// / Save object in filename, / if filename is nullptr or "", a file with "<objectname>.root" is created. / The name of the key is the object name. / By default new file will be created. Using option "a", one can append object / to the existing ROOT file. / 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. / If filename contains ".json" extension, JSON representation of the object / will be created and saved in the text file. Such file can be used in / JavaScript ROOT (https://root.cern/js/) to display object in web browser / When creating JSON file, option string may contain compression level from 0 to 3 (default 0)
Int_t TDirectory::SaveObjectAs(const TObject *obj, const char *filename, Option_t *option) const { option can contain single letter args: "a" for append, "q" for quiet in any combinations
if (!obj) return 0; Int_t nbytes = 0; TString fname, opt = option, cmd; if (filename && *filename) fname = filename; else fname.Form("%s.root", obj->GetName()); opt.ToLower();
if (fname.Index(".json") > 0) { cmd.Form("TBufferJSON::ExportToFile(\"%s\", (TObject *) 0x%zx, \"%s\");", fname.Data(), (size_t) obj, (option ? option : "")); nbytes = (ROOT::GetROOT()) ->ProcessLine(cmd); } else { cmd.Form("TFile::Open(\"%s\",\"%s\");", fname.Data(), opt.Contains("a") ? "update" : "recreate"); TContext ctxt; // The TFile::Open will change the current directory. TDirectory local = (TDirectory) (ROOT::GetROOT()) ->ProcessLine(cmd); if (!local) return 0; nbytes = obj->Write(); delete local; } if (!opt.Contains("q") && !gSystem->AccessPathName(fname.Data())) obj->Info("SaveAs", "ROOT file %s has been created", fname.Data()); return nbytes; }
////////////////////////////////////////////////////////////////////////////// / 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. / DO NOT use this method to 'rename a directory'. / Renaming a directory is currently NOT supported.
void TDirectory::SetName(const char* newname) { TNamed::SetName(newname); }
////////////////////////////////////////////////////////////////////////////// / Decode a namecycle "aap;2" into name "aap" and cycle "2". Destination / buffer size for name (including string terminator) should be specified in / namesize. /
; is larger than SHORT_MAX, cycle is set to 0. / - If name ends with ;*, cycle is set to 10000.
- In all other cases, i.e. when number is not a digit or buffer is a nullptr, cycle is set to
9999`. Definition at line 1301 of file TDirectory.cxx.
|
overridevirtual |
Delete this object.
Typically called as a command via the interpreter. Normally use "delete" operator when object has been allocated on the heap.
Reimplemented from TObject.
Reimplemented in TDirectoryFile, and TFile.
|
virtual |
|
overridevirtual |
|
protected |
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 197 of file TDirectory.h.
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 198 of file TDirectory.h.
|
overridevirtual |
|
virtual |
Reimplemented in TDirectoryFile, and TROOT.
|
inlinevirtual |
Reimplemented in TDirectoryFile, and TROOT.
Definition at line 202 of file TDirectory.h.
|
virtual |
Reimplemented in TDirectoryFile, and TDirectoryFile.
|
inline |
See documentation of TDirectoryFile::Get(const char *namecycle)
Definition at line 205 of file TDirectory.h.
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 219 of file TDirectory.h.
|
virtual |
Find a directory using apath.
It apath is null or empty, returns "this" directory. Otherwise use 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 in TDirectoryFile.
Definition at line 448 of file TDirectory.cxx.
|
inlinevirtual |
Reimplemented in TDirectoryFile, and TROOT.
Definition at line 220 of file TDirectory.h.
Reimplemented in TDirectoryFile.
Definition at line 221 of file TDirectory.h.
|
inlinevirtual |
Definition at line 222 of file TDirectory.h.
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 223 of file TDirectory.h.
|
inline |
Definition at line 224 of file TDirectory.h.
|
inline |
Definition at line 225 of file TDirectory.h.
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 226 of file TDirectory.h.
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 227 of file TDirectory.h.
|
inline |
Get an object with proper type checking.
If the object doesn't exist in the file or if the type doesn't match, a nullptr is returned. Also see TDirectory::Get().
Definition at line 212 of file TDirectory.h.
|
virtual |
Reimplemented in TDirectoryFile.
|
virtual |
Reimplemented in TDirectoryFile.
|
virtual |
Reimplemented in TDirectoryFile.
|
virtual |
|
virtual |
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 228 of file TDirectory.h.
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 230 of file TDirectory.h.
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 229 of file TDirectory.h.
|
staticprotected |
Return the (address of) a shared pointer to the struct holding the actual thread local gDirectory pointer and the atomic_flag for its lock.
Definition at line 416 of file TDirectory.cxx.
|
inline |
Definition at line 233 of file TDirectory.h.
|
inlineoverridevirtual |
Reimplemented from TObject.
Reimplemented in RooWorkspace::WSDir, TDirectoryFile, TFile, TMemFile, TNetFile, TNetXNGFile, TParallelMergingFile, TROOT, TS3WebFile, TSQLFile, TWebFile, TXMLFile, and TXNetFile.
Definition at line 308 of file TDirectory.h.
|
inline |
Definition at line 234 of file TDirectory.h.
|
inlineoverridevirtual |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Reimplemented from TObject.
Reimplemented in TROOT.
Definition at line 235 of file TDirectory.h.
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 236 of file TDirectory.h.
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 237 of file TDirectory.h.
|
overridevirtual |
The ls function lists the contents of a class on stdout.
Ls output is typically much less verbose then Dump().
Reimplemented from TObject.
Reimplemented in TDirectoryFile, TFile, and TROOT.
|
virtual |
Reimplemented in TDirectoryFile.
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 240 of file TDirectory.h.
|
protecteddelete |
|
overridevirtual |
This method must be overridden if a class wants to paint itself.
The difference between Paint() and Draw() is that when a object draws itself it is added to the display list of the pad in which it is drawn (and automatically redrawn whenever the pad is redrawn). While paint just draws the object without adding it to the pad display list.
Reimplemented from TObject.
|
overridevirtual |
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 245 of file TDirectory.h.
|
virtual |
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 247 of file TDirectory.h.
Reimplemented in TDirectoryFile.
Definition at line 248 of file TDirectory.h.
Reimplemented in TDirectoryFile.
Definition at line 249 of file TDirectory.h.
|
overridevirtual |
|
protected |
Register a TContext pointing to this TDirectory object.
Definition at line 1365 of file TDirectory.cxx.
|
protected |
Register a std::atomic<TDirectory*> that will soon be pointing to this TDirectory object.
Definition at line 1385 of file TDirectory.cxx.
|
virtual |
Reimplemented in TDirectoryFile.
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 253 of file TDirectory.h.
|
virtual |
Reimplemented in TDirectoryFile.
Reimplemented in TDirectoryFile.
Definition at line 255 of file TDirectory.h.
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 256 of file TDirectory.h.
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 257 of file TDirectory.h.
|
inlinevirtual |
Definition at line 258 of file TDirectory.h.
|
overridevirtual |
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 261 of file TDirectory.h.
Reimplemented in TDirectoryFile.
Definition at line 260 of file TDirectory.h.
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 262 of file TDirectory.h.
|
inlineoverridevirtual |
Return size of the TNamed part of the TObject.
Reimplemented from TNamed.
Reimplemented in TDirectoryFile, TFile, TSQLFile, and TXMLFile.
Definition at line 263 of file TDirectory.h.
|
overridevirtual |
TDirectory Streamer.
Reimplemented from TObject.
Reimplemented in RooWorkspace::WSDir, TDirectoryFile, TFile, TMemFile, TNetFile, TNetXNGFile, TParallelMergingFile, TROOT, TS3WebFile, TSQLFile, TWebFile, TXMLFile, and TXNetFile.
Definition at line 1434 of file TDirectory.cxx.
|
inline |
Definition at line 308 of file TDirectory.h.
|
protected |
UnRegister a TContext pointing to this TDirectory object.
Definition at line 1412 of file TDirectory.cxx.
|
inlineoverridevirtual |
Write this object to the current directory.
The data structure corresponding to this object is serialized. The corresponding buffer is written to the current directory with an associated key with name "name".
Writing an object to a file involves the following steps:
Bufsize can be given to force a given buffer size to write this object. By default, the buffersize will be taken from the average buffer size of all objects written to the current file so far.
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 GetName().
The option can be a combination of: kSingleKey, kOverwrite or kWriteDelete Using the kOverwrite option a previous key with the same name is overwritten. The previous key is deleted before writing the new object. Using the kWriteDelete option a previous key with the same name is deleted only after the new object has been written. This option is safer than kOverwrite but it is slower. NOTE: Neither kOverwrite nor kWriteDelete reduces the size of a TFile– the space is simply freed up to be overwritten; in the case of a TTree, it is more complicated. If one opens a TTree, appends some entries, then writes it out, the behaviour is effectively the same. If, however, one creates a new TTree and writes it out in this way, only the metadata is replaced, effectively making the old data invisible without deleting it. TTree::Delete() can be used to mark all disk space occupied by a TTree as free before overwriting its metadata this way. The kSingleKey option is only used by TCollection::Write() to write a container with a single key instead of each object in the container with its own key.
An object is read from the file into memory via TKey::Read() or via TObject::Read().
The function returns the total number of bytes written to the file. It returns 0 if the object cannot be written.
Reimplemented from TObject.
Reimplemented in TDirectoryFile, TFile, TParallelMergingFile, TSQLFile, and TXMLFile.
Definition at line 265 of file TDirectory.h.
|
inlineoverridevirtual |
Write this object to the current directory.
For more see the const version of this method.
Reimplemented from TObject.
Reimplemented in ROOT::TBufferMergerFile, TDirectoryFile, TFile, TParallelMergingFile, TSQLFile, and TXMLFile.
Definition at line 264 of file TDirectory.h.
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 302 of file TDirectory.h.
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 303 of file TDirectory.h.
|
inline |
Write an object with proper type checking.
| [in] | obj | Pointer to an object to be written. |
| [in] | name | Name of the object in the file. |
| [in] | option | Options. See TDirectory::WriteTObject. |
| [in] | bufsize | Buffer size. See TDirectory::WriteTObject. |
This overload takes care of instances of classes that are not derived from TObject. The method redirects to TDirectory::WriteObjectAny.
Definition at line 282 of file TDirectory.h.
|
inline |
Write an object with proper type checking.
| [in] | obj | Pointer to an object to be written. |
| [in] | name | Name of the object in the file. |
| [in] | option | Options. See TDirectory::WriteTObject. |
| [in] | bufsize | Buffer size. See TDirectory::WriteTObject. |
This overload takes care of instances of classes that are derived from TObject. The method redirects to TDirectory::WriteTObject.
Definition at line 296 of file TDirectory.h.
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 300 of file TDirectory.h.
|
inlinevirtual |
Reimplemented in TDirectoryFile.
Definition at line 301 of file TDirectory.h.
|
virtual |
Write an object with proper type checking.
| [in] | obj | Pointer to an object to be written. |
| [in] | name | Name of the object in the file. |
| [in] | option | Options. See TDirectory::WriteTObject. |
| [in] | bufsize | Buffer size. See TDirectory::WriteTObject. |
This overload takes care of instances of classes that are not derived from TObject. The method redirects to TDirectory::WriteObjectAny.
Reimplemented in TDirectoryFile.
Definition at line 1400 of file TDirectory.cxx.
|
friend |
Definition at line 169 of file TDirectory.h.
|
friend |
Definition at line 168 of file TDirectory.h.
|
protected |
Buffer for GetPath() function.
Definition at line 145 of file TDirectory.h.
|
protected |
thread local gDirectory pointing to this object.
Definition at line 153 of file TDirectory.h.
MSVC doesn't support = ATOMIC_FLAG_INIT;.
Definition at line 156 of file TDirectory.h.
|
protected |
Definition at line 151 of file TDirectory.h.
|
protected |
Definition at line 142 of file TDirectory.h.
|
protected |
Definition at line 141 of file TDirectory.h.
|
mutableprotected |
Definition at line 144 of file TDirectory.h.
|
mutableprotected |
Counter delaying the TDirectory destructor from finishing.
Definition at line 154 of file TDirectory.h.
|
protected |
Definition at line 143 of file TDirectory.h.