Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TDirectory.h
Go to the documentation of this file.
1// @(#)root/base:$Id$
2// Author: Rene Brun 28/11/94
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TDirectory
13#define ROOT_TDirectory
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TDirectory //
19// //
20// Describe directory structure in memory. //
21// //
22//////////////////////////////////////////////////////////////////////////
23
24#include "TNamed.h"
25#include "TClass.h"
26#include "TUUID.h"
27#include <atomic>
28
29#ifdef R__LESS_INCLUDES
30class TList;
31#else
32#include "TList.h"
33#include "TBuffer.h"
34// #include "TDatime.h"
35#endif
36
37class TBrowser;
38class TKey;
39class TFile;
40namespace ROOT {
41namespace Internal {
42 struct TDirectoryAtomicAdapter;
43}}
44
45class TDirectory : public TNamed {
46public:
47
48/** \class TContext
49\ingroup Base
50
51TDirectory::TContext keeps track and restore the current directory.
52With this tool C++ exceptions will be guaranteed to properly restore the
53current directory pointer.
54
55For example code like:
56
57~~~ {.cpp}
58 TDirectory *sav = gDirectory;
59 mydirectory->cd();
60 if (...) {
61 ....
62 sav->cd();
63 return;
64 } else if (...) {
65 ....
66 sav->cd();
67 return;
68 }
69 sav->cd;
70 return;
71~~~
72
73can be replaced with the simpler and exception safe:
74
75~~~ {.cpp}
76 TDirectory::TContext context(gDirectory, mydirectory);
77 if (...) {
78 ....
79 return;
80 } else if (...) {
81 ....
82 return;
83 }
84 return;
85~~~
86
87*/
88
89 class TContext {
90 private:
91 std::atomic<TDirectory*> fDirectory{nullptr}; //! Pointer to the previous current directory.
92 std::atomic<bool> fActiveDestructor{false}; //! Set to true during the destructor execution
93 std::atomic<bool> fDirectoryWait{false}; //! Set to true if a TDirectory might still access this object.
94 TContext *fPrevious{nullptr}; //! Pointer to the next TContext in the implied list of context pointing to fPrevious.
95 TContext *fNext{nullptr}; //! Pointer to the next TContext in the implied list of context pointing to fPrevious.
96
97 TContext(TContext&) = delete;
99
100 void CdNull();
101 friend class TDirectory;
102
104
105 public:
106 // Note: the directory pointed to by `previous` must not be already deleted
107 // or in the process of being deleted by another thread while this constructor runs.
108 TContext(TDirectory *previous, TDirectory *newCurrent) : fDirectory(previous)
109 {
110 // Store the value of `previous` as the directory to return to when
111 // this object is destructed.
112 // Then cd to the `newCurrent` directory.
113 if (fDirectory)
114 (*fDirectory).RegisterContext(this);
115 if (newCurrent)
116 newCurrent->cd();
117 else
118 CdNull();
119 }
121 {
122 // Store the current directory so we can restore it
123 // later and cd to the new directory.
125 }
127 {
128 // Store the current directory so we can restore it
129 // later and cd to the new directory.
131 if (newCurrent)
132 newCurrent->cd();
133 else
134 CdNull();
135 }
136 ~TContext();
137 };
138
139protected:
140
141 TObject *fMother{nullptr}; // pointer to mother of the directory
142 TList *fList{nullptr}; // List of objects in memory
143 TUUID fUUID; // Unique identifier
144 mutable TString fPathBuffer; //! Buffer for GetPath() function
145 TContext *fContext{nullptr}; //! Pointer to a list of TContext object pointing to this TDirectory
146
147 using SharedGDirectory_t = std::shared_ptr<std::atomic<TDirectory *>>;
148
150
151 std::vector<SharedGDirectory_t> fGDirectories; //! thread local gDirectory pointing to this object.
152
153 std::atomic<size_t> fContextPeg{0}; //! Counter delaying the TDirectory destructor from finishing.
154 mutable std::atomic_flag fSpinLock; //! MSVC doesn't support = ATOMIC_FLAG_INIT;
155
156 static Bool_t fgAddDirectory; //!flag to add histograms, graphs,etc to the directory
157
158 Bool_t cd1(const char *path);
159 static Bool_t Cd1(const char *path);
160
161 void CleanTargets();
162 void FillFullPath(TString& buf) const;
163 void RegisterContext(TContext *ctxt);
165 void UnregisterContext(TContext *ctxt);
166 void BuildDirectory(TFile* motherFile, TDirectory* motherDir);
167
168 friend class TContext;
170
171protected:
172 TDirectory(const TDirectory &directory) = delete; //Directories cannot be copied
173 void operator=(const TDirectory &) = delete; //Directories cannot be copied
174
175public:
176
177 TDirectory();
178 TDirectory(const char *name, const char *title, Option_t *option = "", TDirectory* motherDir = nullptr);
179 virtual ~TDirectory();
180 static void AddDirectory(Bool_t add=kTRUE);
181 static Bool_t AddDirectoryStatus();
182 virtual void Append(TObject *obj, Bool_t replace = kFALSE);
183 virtual void Add(TObject *obj, Bool_t replace = kFALSE) { Append(obj,replace); }
184 virtual Int_t AppendKey(TKey *) {return 0;}
185 void Browse(TBrowser *b) override;
186 virtual void Build(TFile* motherFile = nullptr, TDirectory* motherDir = nullptr) { BuildDirectory(motherFile, motherDir); }
187 void Clear(Option_t *option="") override;
188 virtual TObject *CloneObject(const TObject *obj, Bool_t autoadd = kTRUE);
189 virtual void Close(Option_t *option="");
190 static std::atomic<TDirectory*> &CurrentDirectory(); // Return the current directory for this thread.
191 void Copy(TObject &) const override { MayNotUse("Copy(TObject &)"); }
192 virtual Bool_t cd();
193 virtual Bool_t cd(const char *path);
194 virtual void DeleteAll(Option_t *option="");
195 void Delete(const char *namecycle="") override;
196 void Draw(Option_t *option="") override;
197 virtual TKey *FindKey(const char * /*keyname*/) const {return nullptr;}
198 virtual TKey *FindKeyAny(const char * /*keyname*/) const {return nullptr;}
199 TObject *FindObject(const char *name) const override;
200 TObject *FindObject(const TObject *obj) const override;
201 virtual TObject *FindObjectAny(const char *name) const;
202 virtual TObject *FindObjectAnyFile(const char * /*name*/) const {return nullptr;}
203 virtual TObject *Get(const char *namecycle);
204 /// See documentation of TDirectoryFile::Get(const char *namecycle)
205 template <class T> inline T* Get(const char* namecycle)
206 {
207 return static_cast<T*>(GetObjectChecked(namecycle, TClass::GetClass<T>()));
208 }
209 virtual TDirectory *GetDirectory(const char *namecycle, Bool_t printError = false, const char *funcname = "GetDirectory");
210 /// Get an object with proper type checking. If the object doesn't exist in the file or if the type doesn't match,
211 /// a `nullptr` is returned. Also see TDirectory::Get().
212 template <class T> inline void GetObject(const char* namecycle, T*& ptr)
213 {
214 ptr = (T *)GetObjectChecked(namecycle, TClass::GetClass<T>());
215 }
216 virtual void *GetObjectChecked(const char *namecycle, const char* classname);
217 virtual void *GetObjectChecked(const char *namecycle, const TClass* cl);
218 virtual void *GetObjectUnchecked(const char *namecycle);
219 virtual Int_t GetBufferSize() const {return 0;}
220 virtual TFile *GetFile() const { return nullptr; }
221 virtual TKey *GetKey(const char * /*name */, Short_t /* cycle */=9999) const {return nullptr;}
222 virtual TList *GetList() const { return fList; }
223 virtual TList *GetListOfKeys() const { return nullptr; }
224 TObject *GetMother() const { return fMother; }
225 TDirectory *GetMotherDir() const { return !fMother ? nullptr : dynamic_cast<TDirectory*>(fMother); }
226 virtual Int_t GetNbytesKeys() const { return 0; }
227 virtual Int_t GetNkeys() const { return 0; }
228 virtual Long64_t GetSeekDir() const { return 0; }
229 virtual Long64_t GetSeekParent() const { return 0; }
230 virtual Long64_t GetSeekKeys() const { return 0; }
231 virtual const char *GetPathStatic() const;
232 virtual const char *GetPath() const;
233 TUUID GetUUID() const {return fUUID;}
234 Bool_t IsBuilt() const { return fList != nullptr; }
235 Bool_t IsFolder() const override { return kTRUE; }
236 virtual Bool_t IsModified() const { return kFALSE; }
237 virtual Bool_t IsWritable() const { return kFALSE; }
238 void ls(Option_t *option="") const override;
239 virtual TDirectory *mkdir(const char *name, const char *title="", Bool_t returnExistingDirectory = kFALSE);
240 virtual TFile *OpenFile(const char * /*name*/, Option_t * /*option*/ = "",
241 const char * /*ftitle*/ = "", Int_t /*compress*/ = 1,
242 Int_t /*netopt*/ = 0) {return nullptr;}
243 void Paint(Option_t *option="") override;
244 void Print(Option_t *option="") const override;
245 virtual void Purge(Short_t /*nkeep*/=1) {}
246 virtual void pwd() const;
247 virtual void ReadAll(Option_t * /*option*/="") {}
248 virtual Int_t ReadKeys(Bool_t /*forceRead*/=kTRUE) {return 0;}
249 virtual Int_t ReadTObject(TObject * /*obj*/, const char * /*keyname*/) {return 0;}
250 virtual TObject *Remove(TObject*);
251 void RecursiveRemove(TObject *obj) override;
252 virtual void rmdir(const char *name);
253 virtual void Save() {}
254 virtual Int_t SaveObjectAs(const TObject * /*obj*/, const char * /*filename*/="", Option_t * /*option*/="") const;
255 virtual void SaveSelf(Bool_t /*force*/ = kFALSE) {}
256 virtual void SetBufferSize(Int_t /* bufsize */) {}
257 virtual void SetModified() {}
258 virtual void SetMother(TObject *mother) {fMother = (TObject*)mother;}
259 void SetName(const char* newname) override;
260 virtual void SetTRefAction(TObject * /*ref*/, TObject * /*parent*/) {}
261 virtual void SetSeekDir(Long64_t) {}
262 virtual void SetWritable(Bool_t) {}
263 Int_t Sizeof() const override {return 0;}
264 virtual Int_t Write(const char * /*name*/=nullptr, Int_t /*opt*/=0, Int_t /*bufsize*/=0) override {return 0;}
265 virtual Int_t Write(const char * /*name*/=nullptr, Int_t /*opt*/=0, Int_t /*bufsize*/=0) const override {return 0;}
266 virtual Int_t WriteTObject(const TObject *obj, const char *name =nullptr, Option_t * /*option*/="", Int_t /*bufsize*/ =0);
267private:
268/// \cond HIDDEN_SYMBOLS
269 Int_t WriteObject(void *obj, const char* name, Option_t *option="", Int_t bufsize=0); // Intentionally not implemented.
270/// \endcond
271public:
272 /// \brief Write an object with proper type checking.
273 /// \param[in] obj Pointer to an object to be written.
274 /// \param[in] name Name of the object in the file.
275 /// \param[in] option Options. See TDirectory::WriteTObject.
276 /// \param[in] bufsize Buffer size. See TDirectory::WriteTObject.
277 ///
278 /// This overload takes care of instances of classes that are not derived
279 /// from TObject. The method redirects to TDirectory::WriteObjectAny.
280 template <typename T>
281 inline std::enable_if_t<!std::is_base_of<TObject, T>::value, Int_t>
282 WriteObject(const T *obj, const char *name, Option_t *option = "", Int_t bufsize = 0)
283 {
284 return WriteObjectAny(obj, TClass::GetClass<T>(), name, option, bufsize);
285 }
286 /// \brief Write an object with proper type checking.
287 /// \param[in] obj Pointer to an object to be written.
288 /// \param[in] name Name of the object in the file.
289 /// \param[in] option Options. See TDirectory::WriteTObject.
290 /// \param[in] bufsize Buffer size. See TDirectory::WriteTObject.
291 ///
292 /// This overload takes care of instances of classes that are derived from
293 /// TObject. The method redirects to TDirectory::WriteTObject.
294 template <typename T>
295 inline std::enable_if_t<std::is_base_of<TObject, T>::value, Int_t>
296 WriteObject(const T *obj, const char *name, Option_t *option = "", Int_t bufsize = 0)
297 {
298 return WriteTObject(obj, name, option, bufsize);
299 }
300 virtual Int_t WriteObjectAny(const void *, const char * /*classname*/, const char * /*name*/, Option_t * /*option*/="", Int_t /*bufsize*/ =0) {return 0;}
301 virtual Int_t WriteObjectAny(const void *, const TClass * /*cl*/, const char * /*name*/, Option_t * /*option*/="", Int_t /*bufsize*/ =0) {return 0;}
302 virtual void WriteDirHeader() {}
303 virtual void WriteKeys() {}
304
305 static Bool_t Cd(const char *path);
306 static void DecodeNameCycle(const char *namecycle, char *name, Short_t &cycle, const size_t namesize = 0);
307
308 ClassDefOverride(TDirectory,5) //Describe directory structure in memory
309};
310
311namespace ROOT {
312namespace Internal {
313 /// \brief Internal class used in the implementation of `gDirectory`
314 /// The objects of type `TDirectoryAtomicAdapter` should only be used inside the
315 /// thread that created them. The intent is for those objects to be used indirectly
316 /// through the macro `gDirectory` and solely as temporary objects.
317 /// For example:
318 /// ```
319 /// gDirectory = newvalue;
320 /// gDirectory->ls();
321 /// TDirectory *current = gDirectory;
322 /// ```
323 /// Note that:
324 /// ```
325 /// auto dir = gDirectory;
326 /// ```
327 /// currently behaves "unexpectedly" as changing `dir` will also change `gDirectory`:
328 /// ```
329 /// dir = newvalue;
330 /// ```
331 /// leads to
332 /// ```
333 /// gDirectory == newvalue
334 /// ```
335 /// To prevent this we would need a new mechanism such that the type
336 /// used by `auto` in that case is `TDirectory*` rather than the `Internal`
337 /// type `TDirectoryAtomicAdapter`.
339 // The shared pointer's lifetime is that of the thread creating this object
340 // (with the default constructor)
342
343 TDirectoryAtomicAdapter() : fValue(TDirectory::GetSharedLocalCurrentDirectory()) {}
344
345 template <typename T>
346 explicit operator T*() const {
347 return (T *)fValue->load();
348 }
349
350 operator TDirectory*() const {
351 return fValue->load();
352 }
353
354 operator bool() const { return fValue->load() != nullptr; }
355
356 bool operator==(const TDirectory *other) const {
357 return fValue->load() == other;
358 }
359
360 bool operator!=(const TDirectory *other) const {
361 return fValue->load() != other;
362 }
363
364 bool operator==(TDirectory *other) const {
365 return fValue->load() == other;
366 }
367
368 bool operator!=(TDirectory *other) const {
369 return fValue->load() != other;
370 }
371
373 if (newvalue) {
374 newvalue->RegisterGDirectory(fValue);
375 }
376 fValue->exchange(newvalue);
377 return newvalue;
378 }
379
380 TDirectory *operator->() const { return fValue->load(); }
381 };
382} // Internal
383} // ROOT
384#define gDirectory (::ROOT::Internal::TDirectoryAtomicAdapter{})
385
386#endif
#define b(i)
Definition RSha256.hxx:100
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
short Short_t
Definition RtypesCore.h:39
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
long long Long64_t
Definition RtypesCore.h:80
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t option
char name[80]
Definition TGX11.cxx:110
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
TDirectory::TContext keeps track and restore the current directory.
Definition TDirectory.h:89
TContext & operator=(TContext &)=delete
TContext(TDirectory *previous, TDirectory *newCurrent)
Definition TDirectory.h:108
std::atomic< bool > fDirectoryWait
Set to true during the destructor execution.
Definition TDirectory.h:93
void CdNull()
Set the current directory to null.
TContext(TDirectory *newCurrent)
Definition TDirectory.h:126
~TContext()
Destructor.
TContext * fPrevious
Set to true if a TDirectory might still access this object.
Definition TDirectory.h:94
std::atomic< bool > fActiveDestructor
Pointer to the previous current directory.
Definition TDirectory.h:92
TContext(TContext &)=delete
Pointer to the next TContext in the implied list of context pointing to fPrevious.
TContext * fNext
Pointer to the next TContext in the implied list of context pointing to fPrevious.
Definition TDirectory.h:95
std::atomic< TDirectory * > fDirectory
Definition TDirectory.h:91
Describe directory structure in memory.
Definition TDirectory.h:45
std::shared_ptr< std::atomic< TDirectory * > > SharedGDirectory_t
Pointer to a list of TContext object pointing to this TDirectory.
Definition TDirectory.h:147
virtual Long64_t GetSeekDir() const
Definition TDirectory.h:228
Bool_t cd1(const char *path)
flag to add histograms, graphs,etc to the directory
void Delete(const char *namecycle="") override
Delete Objects or/and keys in a directory.
virtual void Close(Option_t *option="")
Delete all objects from memory and directory structure itself.
virtual void Save()
Definition TDirectory.h:253
virtual TList * GetList() const
Definition TDirectory.h:222
virtual void SetSeekDir(Long64_t)
Definition TDirectory.h:261
TDirectory(const TDirectory &directory)=delete
virtual Int_t Write(const char *=nullptr, Int_t=0, Int_t=0) override
Write this object to the current directory.
Definition TDirectory.h:264
virtual Int_t AppendKey(TKey *)
Definition TDirectory.h:184
virtual TDirectory * GetDirectory(const char *namecycle, Bool_t printError=false, const char *funcname="GetDirectory")
Find a directory using apath.
Bool_t IsFolder() const override
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Definition TDirectory.h:235
virtual Int_t GetNkeys() const
Definition TDirectory.h:227
virtual void WriteKeys()
Definition TDirectory.h:303
virtual Int_t GetNbytesKeys() const
Definition TDirectory.h:226
virtual const char * GetPath() const
Returns the full path of the directory.
std::atomic_flag fSpinLock
Counter delaying the TDirectory destructor from finishing.
Definition TDirectory.h:154
virtual void ReadAll(Option_t *="")
Definition TDirectory.h:247
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
virtual void * GetObjectUnchecked(const char *namecycle)
Return pointer to object identified by namecycle.
virtual void DeleteAll(Option_t *option="")
Delete all objects from memory.
std::atomic< size_t > fContextPeg
thread local gDirectory pointing to this object.
Definition TDirectory.h:153
virtual void SetModified()
Definition TDirectory.h:257
std::vector< SharedGDirectory_t > fGDirectories
Definition TDirectory.h:151
virtual void rmdir(const char *name)
Removes subdirectory from the directory When directory is deleted, all keys in all subdirectories wil...
void Copy(TObject &) const override
Copy this to obj.
Definition TDirectory.h:191
static Bool_t AddDirectoryStatus()
Static function: see TDirectory::AddDirectory for more comments.
void FillFullPath(TString &buf) const
Recursive method to fill full path for directory.
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add objects like histograms, TGraph2D, etc in memory.
void CleanTargets()
Clean the pointers to this object (gDirectory, TContext, etc.).
void ls(Option_t *option="") const override
List Directory contents.
virtual Int_t WriteObjectAny(const void *, const TClass *, const char *, Option_t *="", Int_t=0)
Definition TDirectory.h:301
TContext * fContext
Buffer for GetPath() function.
Definition TDirectory.h:145
virtual TFile * OpenFile(const char *, Option_t *="", const char *="", Int_t=1, Int_t=0)
Definition TDirectory.h:240
virtual void Append(TObject *obj, Bool_t replace=kFALSE)
Append object to this directory.
void RegisterGDirectory(SharedGDirectory_t &ptr)
Register a std::atomic<TDirectory*> that will soon be pointing to this TDirectory object.
virtual void WriteDirHeader()
Definition TDirectory.h:302
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.
Definition TDirectory.h:282
Int_t Sizeof() const override
Return size of the TNamed part of the TObject.
Definition TDirectory.h:263
TDirectory()
Directory default constructor.
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".
static Bool_t Cd(const char *path)
Change current directory to "path".
void Clear(Option_t *option="") override
Delete all objects from a Directory list.
virtual Int_t WriteTObject(const TObject *obj, const char *name=nullptr, Option_t *="", Int_t=0)
Write an object with proper type checking.
virtual void Add(TObject *obj, Bool_t replace=kFALSE)
Definition TDirectory.h:183
virtual Int_t WriteObjectAny(const void *, const char *, const char *, Option_t *="", Int_t=0)
Definition TDirectory.h:300
virtual TFile * GetFile() const
Definition TDirectory.h:220
TObject * FindObject(const char *name) const override
Find object by name in the list of memory objects.
virtual void Build(TFile *motherFile=nullptr, TDirectory *motherDir=nullptr)
Definition TDirectory.h:186
void Print(Option_t *option="") const override
Print all objects in the directory.
virtual Bool_t cd()
Change current directory to "this" directory.
virtual ~TDirectory()
Destructor.
virtual Int_t ReadKeys(Bool_t=kTRUE)
Definition TDirectory.h:248
static Bool_t Cd1(const char *path)
Change current directory to "path".
virtual Bool_t IsWritable() const
Definition TDirectory.h:237
virtual TKey * GetKey(const char *, Short_t=9999) const
Definition TDirectory.h:221
virtual void Purge(Short_t=1)
Definition TDirectory.h:245
void UnregisterContext(TContext *ctxt)
UnRegister a TContext pointing to this TDirectory object.
virtual Int_t ReadTObject(TObject *, const char *)
Definition TDirectory.h:249
virtual void SetWritable(Bool_t)
Definition TDirectory.h:262
virtual Bool_t IsModified() const
Definition TDirectory.h:236
virtual void SetTRefAction(TObject *, TObject *)
Definition TDirectory.h:260
virtual void SaveSelf(Bool_t=kFALSE)
Definition TDirectory.h:255
void RecursiveRemove(TObject *obj) override
Recursively remove object from a Directory.
virtual Int_t SaveObjectAs(const TObject *, const char *="", Option_t *="") const
Save object in filename, if filename is nullptr or "", a file with "<objectname>.root" is created.
TString fPathBuffer
Definition TDirectory.h:144
virtual TKey * FindKey(const char *) const
Definition TDirectory.h:197
virtual TDirectory * mkdir(const char *name, const char *title="", Bool_t returnExistingDirectory=kFALSE)
Create a sub-directory "a" or a hierarchy of sub-directories "a/b/c/...".
void SetName(const char *newname) override
Set the name for directory If the directory name is changed after the directory was written once,...
void BuildDirectory(TFile *motherFile, TDirectory *motherDir)
Initialise directory to defaults.
virtual Int_t GetBufferSize() const
Definition TDirectory.h:219
virtual Long64_t GetSeekParent() const
Definition TDirectory.h:229
virtual void SetMother(TObject *mother)
Definition TDirectory.h:258
virtual Long64_t GetSeekKeys() const
Definition TDirectory.h:230
virtual TList * GetListOfKeys() const
Definition TDirectory.h:223
static SharedGDirectory_t & GetSharedLocalCurrentDirectory()
Return the (address of) a shared pointer to the struct holding the actual thread local gDirectory poi...
TUUID fUUID
Definition TDirectory.h:143
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.
Definition TDirectory.h:296
TUUID GetUUID() const
Definition TDirectory.h:233
virtual TObject * FindObjectAnyFile(const char *) const
Definition TDirectory.h:202
static Bool_t fgAddDirectory
MSVC doesn't support = ATOMIC_FLAG_INIT;.
Definition TDirectory.h:156
TDirectory * GetMotherDir() const
Definition TDirectory.h:225
virtual const char * GetPathStatic() const
Returns the full path of the directory.
static std::atomic< TDirectory * > & CurrentDirectory()
Return the current directory for the current thread.
TObject * GetMother() const
Definition TDirectory.h:224
TObject * fMother
Definition TDirectory.h:141
void Browse(TBrowser *b) override
Browse the content of the directory.
void GetObject(const char *namecycle, T *&ptr)
Get an object with proper type checking.
Definition TDirectory.h:212
virtual void pwd() const
Print the path of the directory.
virtual void * GetObjectChecked(const char *namecycle, const char *classname)
See documentation of TDirectory::GetObjectCheck(const char *namecycle, const TClass *cl)
virtual TObject * CloneObject(const TObject *obj, Bool_t autoadd=kTRUE)
Clone an object.
Bool_t IsBuilt() const
Definition TDirectory.h:234
virtual TObject * Remove(TObject *)
Remove an object from the in-memory list.
void RegisterContext(TContext *ctxt)
Register a TContext pointing to this TDirectory object.
TList * fList
Definition TDirectory.h:142
virtual TKey * FindKeyAny(const char *) const
Definition TDirectory.h:198
T * Get(const char *namecycle)
See documentation of TDirectoryFile::Get(const char *namecycle)
Definition TDirectory.h:205
virtual Int_t Write(const char *=nullptr, Int_t=0, Int_t=0) const override
Write this object to the current directory.
Definition TDirectory.h:265
virtual void SetBufferSize(Int_t)
Definition TDirectory.h:256
void Paint(Option_t *option="") override
Paint all objects in the directory.
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.
void operator=(const TDirectory &)=delete
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
Definition TFile.h:53
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Definition TKey.h:28
A doubly linked list.
Definition TList.h:38
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Mother of all ROOT objects.
Definition TObject.h:41
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 clas...
Definition TObject.cxx:1040
Basic string class.
Definition TString.h:139
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
Definition TUUID.h:42
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
Internal class used in the implementation of gDirectory The objects of type TDirectoryAtomicAdapter s...
Definition TDirectory.h:338
TDirectory * operator=(TDirectory *newvalue)
Definition TDirectory.h:372
bool operator!=(TDirectory *other) const
Definition TDirectory.h:368
bool operator==(TDirectory *other) const
Definition TDirectory.h:364
bool operator!=(const TDirectory *other) const
Definition TDirectory.h:360
TDirectory::SharedGDirectory_t & fValue
Definition TDirectory.h:341
bool operator==(const TDirectory *other) const
Definition TDirectory.h:356
th1 Draw()