Logo ROOT  
Reference Guide
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
30 class TList;
31 #else
32 #include "TList.h"
33 #include "TBuffer.h"
34 // #include "TDatime.h"
35 #endif
36 
37 class TBrowser;
38 class TKey;
39 class TFile;
40 namespace ROOT {
41 namespace Internal {
42  struct TDirectoryAtomicAdapter;
43 }}
44 
45 class TDirectory : public TNamed {
46 public:
47 
48 /** \class TContext
49 \ingroup Base
50 
51 TDirectory::TContext keeps track and restore the current directory.
52 With this tool C++ exceptions will be guaranteed to properly restore the
53 current directory pointer.
54 
55 For 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 
73 can 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  public:
103  TContext(TDirectory *previous, TDirectory *newCurrent) : fDirectory(previous)
104  {
105  // Store the current directory so we can restore it
106  // later and cd to the new directory.
107  if (fDirectory)
108  (*fDirectory).RegisterContext(this);
109  if (newCurrent)
110  newCurrent->cd();
111  else
112  CdNull();
113  }
115  {
116  // Store the current directory so we can restore it
117  // later and cd to the new directory.
118  if (fDirectory)
119  (*fDirectory).RegisterContext(this);
120  }
122  {
123  // Store the current directory so we can restore it
124  // later and cd to the new directory.
125  if (fDirectory)
126  (*fDirectory).RegisterContext(this);
127  if (newCurrent)
128  newCurrent->cd();
129  else
130  CdNull();
131  }
132  ~TContext();
133  };
134 
135 protected:
136 
137  TObject *fMother{nullptr}; // pointer to mother of the directory
138  TList *fList{nullptr}; // List of objects in memory
139  TUUID fUUID; // Unique identifier
140  mutable TString fPathBuffer; //! Buffer for GetPath() function
141  TContext *fContext{nullptr}; //! Pointer to a list of TContext object pointing to this TDirectory
142 
143  std::vector<std::atomic<TDirectory*>*> fGDirectories; //! thread local gDirectory pointing to this object.
144 
145  std::atomic<size_t> fContextPeg; //!Counter delaying the TDirectory destructor from finishing.
146  mutable std::atomic_flag fSpinLock; //! MSVC doesn't support = ATOMIC_FLAG_INIT;
147 
148  static Bool_t fgAddDirectory; //!flag to add histograms, graphs,etc to the directory
149 
150  Bool_t cd1(const char *path);
151  static Bool_t Cd1(const char *path);
152 
153  void CleanTargets();
154  void FillFullPath(TString& buf) const;
155  void RegisterContext(TContext *ctxt);
156  void UnregisterContext(TContext *ctxt);
157  void RegisterGDirectory(std::atomic<TDirectory*>*);
158  void BuildDirectory(TFile* motherFile, TDirectory* motherDir);
159 
160  friend class TContext;
162 
163 protected:
164  TDirectory(const TDirectory &directory) = delete; //Directories cannot be copied
165  void operator=(const TDirectory &) = delete; //Directories cannot be copied
166 
167 public:
168 
169  TDirectory();
170  TDirectory(const char *name, const char *title, Option_t *option = "", TDirectory* motherDir = nullptr);
171  virtual ~TDirectory();
172  static void AddDirectory(Bool_t add=kTRUE);
173  static Bool_t AddDirectoryStatus();
174  virtual void Append(TObject *obj, Bool_t replace = kFALSE);
175  virtual void Add(TObject *obj, Bool_t replace = kFALSE) { Append(obj,replace); }
176  virtual Int_t AppendKey(TKey *) {return 0;}
177  void Browse(TBrowser *b) override;
178  virtual void Build(TFile* motherFile = nullptr, TDirectory* motherDir = nullptr) { BuildDirectory(motherFile, motherDir); }
179  void Clear(Option_t *option="") override;
180  virtual TObject *CloneObject(const TObject *obj, Bool_t autoadd = kTRUE);
181  virtual void Close(Option_t *option="");
182  static std::atomic<TDirectory*> &CurrentDirectory(); // Return the current directory for this thread.
183  void Copy(TObject &) const override { MayNotUse("Copy(TObject &)"); }
184  virtual Bool_t cd(const char *path = nullptr);
185  virtual void DeleteAll(Option_t *option="");
186  void Delete(const char *namecycle="") override;
187  void Draw(Option_t *option="") override;
188  virtual TKey *FindKey(const char * /*keyname*/) const {return nullptr;}
189  virtual TKey *FindKeyAny(const char * /*keyname*/) const {return nullptr;}
190  TObject *FindObject(const char *name) const override;
191  TObject *FindObject(const TObject *obj) const override;
192  virtual TObject *FindObjectAny(const char *name) const;
193  virtual TObject *FindObjectAnyFile(const char * /*name*/) const {return nullptr;}
194  virtual TObject *Get(const char *namecycle);
195  /// See documentation of TDirectoryFile::Get(const char *namecycle)
196  template <class T> inline T* Get(const char* namecycle)
197  {
198  return static_cast<T*>(GetObjectChecked(namecycle, TClass::GetClass<T>()));
199  }
200  virtual TDirectory *GetDirectory(const char *namecycle, Bool_t printError = false, const char *funcname = "GetDirectory");
201  /// Get an object with proper type checking. If the object doesn't exist in the file or if the type doesn't match,
202  /// a `nullptr` is returned. Also see TDirectory::Get().
203  template <class T> inline void GetObject(const char* namecycle, T*& ptr)
204  {
205  ptr = (T *)GetObjectChecked(namecycle, TClass::GetClass<T>());
206  }
207  virtual void *GetObjectChecked(const char *namecycle, const char* classname);
208  virtual void *GetObjectChecked(const char *namecycle, const TClass* cl);
209  virtual void *GetObjectUnchecked(const char *namecycle);
210  virtual Int_t GetBufferSize() const {return 0;}
211  virtual TFile *GetFile() const { return 0; }
212  virtual TKey *GetKey(const char * /*name */, Short_t /* cycle */=9999) const {return nullptr;}
213  virtual TList *GetList() const { return fList; }
214  virtual TList *GetListOfKeys() const { return nullptr; }
215  TObject *GetMother() const { return fMother; }
216  TDirectory *GetMotherDir() const { return !fMother ? nullptr : dynamic_cast<TDirectory*>(fMother); }
217  virtual Int_t GetNbytesKeys() const { return 0; }
218  virtual Int_t GetNkeys() const { return 0; }
219  virtual Long64_t GetSeekDir() const { return 0; }
220  virtual Long64_t GetSeekParent() const { return 0; }
221  virtual Long64_t GetSeekKeys() const { return 0; }
222  virtual const char *GetPathStatic() const;
223  virtual const char *GetPath() const;
224  TUUID GetUUID() const {return fUUID;}
225  Bool_t IsFolder() const override { return kTRUE; }
226  virtual Bool_t IsModified() const { return kFALSE; }
227  virtual Bool_t IsWritable() const { return kFALSE; }
228  void ls(Option_t *option="") const override;
229  virtual TDirectory *mkdir(const char *name, const char *title="", Bool_t returnExistingDirectory = kFALSE);
230  virtual TFile *OpenFile(const char * /*name*/, Option_t * /*option*/ = "",
231  const char * /*ftitle*/ = "", Int_t /*compress*/ = 1,
232  Int_t /*netopt*/ = 0) {return nullptr;}
233  void Paint(Option_t *option="") override;
234  void Print(Option_t *option="") const override;
235  virtual void Purge(Short_t /*nkeep*/=1) {}
236  virtual void pwd() const;
237  virtual void ReadAll(Option_t * /*option*/="") {}
238  virtual Int_t ReadKeys(Bool_t /*forceRead*/=kTRUE) {return 0;}
239  virtual Int_t ReadTObject(TObject * /*obj*/, const char * /*keyname*/) {return 0;}
240  virtual TObject *Remove(TObject*);
241  void RecursiveRemove(TObject *obj) override;
242  virtual void rmdir(const char *name);
243  virtual void Save() {}
244  virtual Int_t SaveObjectAs(const TObject * /*obj*/, const char * /*filename*/="", Option_t * /*option*/="") const;
245  virtual void SaveSelf(Bool_t /*force*/ = kFALSE) {}
246  virtual void SetBufferSize(Int_t /* bufsize */) {}
247  virtual void SetModified() {}
248  virtual void SetMother(TObject *mother) {fMother = (TObject*)mother;}
249  void SetName(const char* newname) override;
250  virtual void SetTRefAction(TObject * /*ref*/, TObject * /*parent*/) {}
251  virtual void SetSeekDir(Long64_t) {}
252  virtual void SetWritable(Bool_t) {}
253  Int_t Sizeof() const override {return 0;}
254  virtual Int_t Write(const char * /*name*/=nullptr, Int_t /*opt*/=0, Int_t /*bufsize*/=0) override {return 0;}
255  virtual Int_t Write(const char * /*name*/=nullptr, Int_t /*opt*/=0, Int_t /*bufsize*/=0) const override {return 0;}
256  virtual Int_t WriteTObject(const TObject *obj, const char *name =nullptr, Option_t * /*option*/="", Int_t /*bufsize*/ =0);
257 private:
258  Int_t WriteObject(void *obj, const char* name, Option_t *option="", Int_t bufsize=0); // Intentionally not implemented.
259 public:
260  /// Write an object with proper type checking.
261  /// \param[in] obj Pointer to an object to be written.
262  /// \param[in] name Name of the object in the file.
263  /// \param[in] option Options. See TDirectory::WriteTObject() or TDirectoryWriteObjectAny().
264  /// \param[in] bufsize Buffer size. See TDirectory::WriteTObject().
265  template <class T> inline Int_t WriteObject(const T* obj, const char* name, Option_t *option="", Int_t bufsize=0)
266  {
267  return WriteObjectAny(obj, TClass::GetClass<T>(), name, option, bufsize);
268  }
269  virtual Int_t WriteObjectAny(const void *, const char * /*classname*/, const char * /*name*/, Option_t * /*option*/="", Int_t /*bufsize*/ =0) {return 0;}
270  virtual Int_t WriteObjectAny(const void *, const TClass * /*cl*/, const char * /*name*/, Option_t * /*option*/="", Int_t /*bufsize*/ =0) {return 0;}
271  virtual void WriteDirHeader() {}
272  virtual void WriteKeys() {}
273 
274  static Bool_t Cd(const char *path);
275  static void DecodeNameCycle(const char *namecycle, char *name, Short_t &cycle, const size_t namesize = 0);
276  static void EncodeNameCycle(char *buffer, const char *name, Short_t cycle);
277 
278  ClassDefOverride(TDirectory,5) //Describe directory structure in memory
279 };
280 
281 #ifndef __CINT__
282 namespace ROOT {
283 namespace Internal {
285  std::atomic<TDirectory*> &fValue;
286  TDirectoryAtomicAdapter(std::atomic<TDirectory*> &value) : fValue(value) {}
287 
288  template <typename T>
289  explicit operator T*() const {
290  return (T*)fValue.load();
291  }
292 
293  operator TDirectory*() const {
294  return fValue.load();
295  }
296 
297  operator bool() const { return fValue.load() != nullptr; }
298 
299  bool operator==(const TDirectory *other) const {
300  return fValue.load() == other;
301  }
302 
303  bool operator!=(const TDirectory *other) const {
304  return fValue.load() != other;
305  }
306 
307  bool operator==(TDirectory *other) const {
308  return fValue.load() == other;
309  }
310 
311  bool operator!=(TDirectory *other) const {
312  return fValue.load() != other;
313  }
314 
316  if (newvalue) {
317  newvalue->RegisterGDirectory(&fValue);
318  }
319  fValue = newvalue;
320  return newvalue;
321  }
322 
323  TDirectory *operator->() const { return fValue.load(); }
324  };
325 } // Internal
326 } // ROOT
327 #define gDirectory (ROOT::Internal::TDirectoryAtomicAdapter(TDirectory::CurrentDirectory()))
328 
329 #elif defined(__MAKECINT__)
330 // To properly handle the use of gDirectory in header files (in static declarations)
332 #endif
333 
334 #endif
TDirectory::TContext::CdNull
void CdNull()
Set the current directory to null.
Definition: TDirectory.cxx:125
TDirectory::ReadAll
virtual void ReadAll(Option_t *="")
Definition: TDirectory.h:237
TDirectory::Draw
void Draw(Option_t *option="") override
Fill Graphics Structure and Paint.
Definition: TDirectory.cxx:716
TDirectory::Remove
virtual TObject * Remove(TObject *)
Remove an object from the in-memory list.
Definition: TDirectory.cxx:1159
TDirectory::WriteObjectAny
virtual Int_t WriteObjectAny(const void *, const char *, const char *, Option_t *="", Int_t=0)
Definition: TDirectory.h:269
TBrowser
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
TDirectory::Delete
void Delete(const char *namecycle="") override
Delete Objects or/and keys in a directory.
Definition: TDirectory.cxx:660
TDirectory::GetList
virtual TList * GetList() const
Definition: TDirectory.h:213
TDirectory::ReadKeys
virtual Int_t ReadKeys(Bool_t=kTRUE)
Definition: TDirectory.h:238
TDirectory::mkdir
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/...".
Definition: TDirectory.cxx:1050
TDirectory::fPathBuffer
TString fPathBuffer
Definition: TDirectory.h:140
TDirectory::GetKey
virtual TKey * GetKey(const char *, Short_t=9999) const
Definition: TDirectory.h:212
TDirectory::GetListOfKeys
virtual TList * GetListOfKeys() const
Definition: TDirectory.h:214
TDirectory::GetMotherDir
TDirectory * GetMotherDir() const
Definition: TDirectory.h:216
Option_t
const char Option_t
Definition: RtypesCore.h:66
TDirectory::SetModified
virtual void SetModified()
Definition: TDirectory.h:247
TDirectory::Copy
void Copy(TObject &) const override
Copy this to obj.
Definition: TDirectory.h:183
TDirectory::GetPathStatic
virtual const char * GetPathStatic() const
Returns the full path of the directory.
Definition: TDirectory.cxx:958
TDirectory::DecodeNameCycle
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".
Definition: TDirectory.cxx:1252
TDirectory::TContext::operator=
TContext & operator=(TContext &)=delete
TDirectory::GetObject
void GetObject(const char *namecycle, T *&ptr)
Get an object with proper type checking.
Definition: TDirectory.h:203
TDirectory::TContext::fActiveDestructor
std::atomic< bool > fActiveDestructor
Pointer to the previous current directory.
Definition: TDirectory.h:92
TDirectory::TContext::fDirectoryWait
std::atomic< bool > fDirectoryWait
Set to true during the destructor execution.
Definition: TDirectory.h:93
TDirectory::RegisterContext
void RegisterContext(TContext *ctxt)
Register a TContext pointing to this TDirectory object.
Definition: TDirectory.cxx:1293
TNamed.h
Long64_t
long long Long64_t
Definition: RtypesCore.h:80
TDirectory::ReadTObject
virtual Int_t ReadTObject(TObject *, const char *)
Definition: TDirectory.h:239
ROOT::Internal::TDirectoryAtomicAdapter::operator!=
bool operator!=(TDirectory *other) const
Definition: TDirectory.h:311
TDirectory::SetBufferSize
virtual void SetBufferSize(Int_t)
Definition: TDirectory.h:246
Int_t
int Int_t
Definition: RtypesCore.h:45
TDirectory::Cd1
static Bool_t Cd1(const char *path)
Change current directory to "path".
Definition: TDirectory.cxx:563
TDirectory::UnregisterContext
void UnregisterContext(TContext *ctxt)
UnRegister a TContext pointing to this TDirectory object.
Definition: TDirectory.cxx:1344
TDirectory::Purge
virtual void Purge(Short_t=1)
Definition: TDirectory.h:235
TDirectory::TContext
TDirectory::TContext keeps track and restore the current directory.
Definition: TDirectory.h:89
TClass.h
TList.h
TDirectory::CurrentDirectory
static std::atomic< TDirectory * > & CurrentDirectory()
Return the current directory for the current thread.
Definition: TDirectory.cxx:387
TDirectory::WriteTObject
virtual Int_t WriteTObject(const TObject *obj, const char *name=nullptr, Option_t *="", Int_t=0)
Definition: TDirectory.cxx:1332
TObject::MayNotUse
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:946
TDirectory::cd
virtual Bool_t cd(const char *path=nullptr)
Change current directory to "this" directory.
Definition: TDirectory.cxx:504
TDirectory::rmdir
virtual void rmdir(const char *name)
Removes subdirectory from the directory When directory is deleted, all keys in all subdirectories wil...
Definition: TDirectory.cxx:1174
TDirectory::fContext
TContext * fContext
Buffer for GetPath() function.
Definition: TDirectory.h:141
TDirectory::FillFullPath
void FillFullPath(TString &buf) const
Recursive method to fill full path for directory.
Definition: TDirectory.cxx:1009
TDirectory::fUUID
TUUID fUUID
Definition: TDirectory.h:139
TString
Basic string class.
Definition: TString.h:136
ClassDefOverride
#define ClassDefOverride(name, id)
Definition: Rtypes.h:329
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TDirectory::pwd
virtual void pwd() const
Print the path of the directory.
Definition: TDirectory.cxx:1143
TDirectory::Get
T * Get(const char *namecycle)
See documentation of TDirectoryFile::Get(const char *namecycle)
Definition: TDirectory.h:196
TDirectory::Print
void Print(Option_t *option="") const override
Print all objects in the directory.
Definition: TDirectory.cxx:1135
b
#define b(i)
Definition: RSha256.hxx:100
TDirectory::GetMother
TObject * GetMother() const
Definition: TDirectory.h:215
TDirectory::IsFolder
Bool_t IsFolder() const override
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Definition: TDirectory.h:225
TDirectory::Get
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
Definition: TDirectory.cxx:814
bool
TDirectory::TContext::fDirectory
std::atomic< TDirectory * > fDirectory
Definition: TDirectory.h:91
TDirectory::TContext::fNext
TContext * fNext
Pointer to the next TContext in the implied list of context pointing to fPrevious.
Definition: TDirectory.h:95
TDirectory::IsWritable
virtual Bool_t IsWritable() const
Definition: TDirectory.h:227
TDirectory::Close
virtual void Close(Option_t *option="")
Delete all objects from memory and directory structure itself.
Definition: TDirectory.cxx:593
TDirectory::FindKeyAny
virtual TKey * FindKeyAny(const char *) const
Definition: TDirectory.h:189
TDirectory::GetBufferSize
virtual Int_t GetBufferSize() const
Definition: TDirectory.h:210
TDirectory::Save
virtual void Save()
Definition: TDirectory.h:243
TUUID.h
TDirectory::WriteKeys
virtual void WriteKeys()
Definition: TDirectory.h:272
TDirectory::Cd
static Bool_t Cd(const char *path)
Change current directory to "path".
Definition: TDirectory.cxx:550
TDirectory::FindKey
virtual TKey * FindKey(const char *) const
Definition: TDirectory.h:188
TDirectory::Append
virtual void Append(TObject *obj, Bool_t replace=kFALSE)
Append object to this directory.
Definition: TDirectory.cxx:191
TDirectory::EncodeNameCycle
static void EncodeNameCycle(char *buffer, const char *name, Short_t cycle)
Encode the name and cycle into buffer like: "aap;2".
Definition: TDirectory.cxx:1239
TBuffer.h
TDirectory::CloneObject
virtual TObject * CloneObject(const TObject *obj, Bool_t autoadd=kTRUE)
Clone an object.
Definition: TDirectory.cxx:335
TDirectory::operator=
void operator=(const TDirectory &)=delete
TDirectory::fList
TList * fList
Definition: TDirectory.h:138
TDirectory::OpenFile
virtual TFile * OpenFile(const char *, Option_t *="", const char *="", Int_t=1, Int_t=0)
Definition: TDirectory.h:230
TDirectory::RegisterGDirectory
void RegisterGDirectory(std::atomic< TDirectory * > *)
Register a std::atomic<TDirectory*> pointing to this TDirectory object.
Definition: TDirectory.cxx:1311
TDirectory::BuildDirectory
void BuildDirectory(TFile *motherFile, TDirectory *motherDir)
Initialise directory to defaults.
Definition: TDirectory.cxx:238
TDirectory::Clear
void Clear(Option_t *option="") override
Delete all objects from a Directory list.
Definition: TDirectory.cxx:581
TDirectory::TContext::~TContext
~TContext()
Destructor.
Definition: TDirectory.cxx:135
TNamed
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
TDirectory::RecursiveRemove
void RecursiveRemove(TObject *obj) override
Recursively remove object from a Directory.
Definition: TDirectory.cxx:1151
TDirectory::SetWritable
virtual void SetWritable(Bool_t)
Definition: TDirectory.h:252
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
TDirectory::AppendKey
virtual Int_t AppendKey(TKey *)
Definition: TDirectory.h:176
ROOT::Internal::TDirectoryAtomicAdapter::operator==
bool operator==(TDirectory *other) const
Definition: TDirectory.h:307
TDirectory::GetObjectChecked
virtual void * GetObjectChecked(const char *namecycle, const char *classname)
See documentation of TDirectory::GetObjectCheck(const char *namecycle, const TClass *cl)
Definition: TDirectory.cxx:877
TDirectory::Sizeof
Int_t Sizeof() const override
Return size of the TNamed part of the TObject.
Definition: TDirectory.h:253
gDirectory
#define gDirectory
Definition: TDirectory.h:327
TDirectory::Write
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:255
TDirectory::TDirectory
TDirectory(const TDirectory &directory)=delete
TDirectory::FindObjectAnyFile
virtual TObject * FindObjectAnyFile(const char *) const
Definition: TDirectory.h:193
TDirectory::GetSeekKeys
virtual Long64_t GetSeekKeys() const
Definition: TDirectory.h:221
TDirectory::GetDirectory
virtual TDirectory * GetDirectory(const char *namecycle, Bool_t printError=false, const char *funcname="GetDirectory")
Find a directory using apath.
Definition: TDirectory.cxx:407
TDirectory::GetSeekParent
virtual Long64_t GetSeekParent() const
Definition: TDirectory.h:220
TDirectory::AddDirectory
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add objects like histograms, TGraph2D, etc in memory.
Definition: TDirectory.cxx:172
ROOT::Internal::TDirectoryAtomicAdapter::operator=
TDirectory * operator=(TDirectory *newvalue)
Definition: TDirectory.h:315
TUUID
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
Definition: TUUID.h:42
Short_t
short Short_t
Definition: RtypesCore.h:39
TDirectory::SaveSelf
virtual void SaveSelf(Bool_t=kFALSE)
Definition: TDirectory.h:245
TDirectory::fMother
TObject * fMother
Definition: TDirectory.h:137
TFile
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:54
TDirectory::~TDirectory
virtual ~TDirectory()
Destructor.
Definition: TDirectory.cxx:91
TDirectory::GetPath
virtual const char * GetPath() const
Returns the full path of the directory.
Definition: TDirectory.cxx:996
ROOT::Internal::TDirectoryAtomicAdapter::operator->
TDirectory * operator->() const
Definition: TDirectory.h:323
TDirectory::WriteObjectAny
virtual Int_t WriteObjectAny(const void *, const TClass *, const char *, Option_t *="", Int_t=0)
Definition: TDirectory.h:270
TDirectory::ls
void ls(Option_t *option="") const override
List Directory contents.
Definition: TDirectory.cxx:1091
TKey
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Definition: TKey.h:28
TDirectory::Browse
void Browse(TBrowser *b) override
Browse the content of the directory.
Definition: TDirectory.cxx:216
TDirectory::GetSeekDir
virtual Long64_t GetSeekDir() const
Definition: TDirectory.h:219
ROOT::Internal::TDirectoryAtomicAdapter::fValue
std::atomic< TDirectory * > & fValue
Definition: TDirectory.h:285
TDirectory::cd1
Bool_t cd1(const char *path)
flag to add histograms, graphs,etc to the directory
Definition: TDirectory.cxx:522
TClass
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
ROOT::Internal::TDirectoryAtomicAdapter::TDirectoryAtomicAdapter
TDirectoryAtomicAdapter(std::atomic< TDirectory * > &value)
Definition: TDirectory.h:286
ROOT::Internal::TDirectoryAtomicAdapter::operator!=
bool operator!=(const TDirectory *other) const
Definition: TDirectory.h:303
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
TDirectory::SetSeekDir
virtual void SetSeekDir(Long64_t)
Definition: TDirectory.h:251
TDirectory::GetFile
virtual TFile * GetFile() const
Definition: TDirectory.h:211
TDirectory::Build
virtual void Build(TFile *motherFile=nullptr, TDirectory *motherDir=nullptr)
Definition: TDirectory.h:178
TDirectory::WriteObject
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:265
TDirectory::TContext::TContext
TContext(TDirectory *newCurrent)
Definition: TDirectory.h:121
name
char name[80]
Definition: TGX11.cxx:110
TDirectory::GetNkeys
virtual Int_t GetNkeys() const
Definition: TDirectory.h:218
TDirectory::IsModified
virtual Bool_t IsModified() const
Definition: TDirectory.h:226
ROOT::Math::Chebyshev::T
double T(double x)
Definition: ChebyshevPol.h:34
TDirectory::WriteDirHeader
virtual void WriteDirHeader()
Definition: TDirectory.h:271
TDirectory::GetUUID
TUUID GetUUID() const
Definition: TDirectory.h:224
TDirectory
Describe directory structure in memory.
Definition: TDirectory.h:45
TDirectory::Paint
void Paint(Option_t *option="") override
Paint all objects in the directory.
Definition: TDirectory.cxx:1127
TDirectory::fContextPeg
std::atomic< size_t > fContextPeg
thread local gDirectory pointing to this object.
Definition: TDirectory.h:145
TDirectory::GetObjectUnchecked
virtual void * GetObjectUnchecked(const char *namecycle)
Return pointer to object identified by namecycle.
Definition: TDirectory.cxx:869
TDirectory::CleanTargets
void CleanTargets()
Clean the pointers to this object (gDirectory, TContext, etc.).
Definition: TDirectory.cxx:253
TDirectory::fgAddDirectory
static Bool_t fgAddDirectory
MSVC doesn't support = ATOMIC_FLAG_INIT;.
Definition: TDirectory.h:148
R__EXTERN
#define R__EXTERN
Definition: DllImport.h:27
TDirectory::TContext::TContext
TContext(TDirectory *previous, TDirectory *newCurrent)
Definition: TDirectory.h:103
TDirectory::GetNbytesKeys
virtual Int_t GetNbytesKeys() const
Definition: TDirectory.h:217
TDirectory::TContext::TContext
TContext()
Definition: TDirectory.h:114
TDirectory::FindObjectAny
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.
Definition: TDirectory.cxx:744
TDirectory::SetName
void SetName(const char *newname) override
Set the name for directory If the directory name is changed after the directory was written once,...
Definition: TDirectory.cxx:1231
ROOT::Internal::TDirectoryAtomicAdapter::operator==
bool operator==(const TDirectory *other) const
Definition: TDirectory.h:299
TDirectory::fGDirectories
std::vector< std::atomic< TDirectory * > * > fGDirectories
Pointer to a list of TContext object pointing to this TDirectory.
Definition: TDirectory.h:143
TDirectory::fSpinLock
std::atomic_flag fSpinLock
Counter delaying the TDirectory destructor from finishing.
Definition: TDirectory.h:146
TDirectory::FindObject
TObject * FindObject(const char *name) const override
Find object by name in the list of memory objects.
Definition: TDirectory.cxx:732
ROOT
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: EExecutionPolicy.hxx:4
TDirectory::DeleteAll
virtual void DeleteAll(Option_t *option="")
Delete all objects from memory.
Definition: TDirectory.cxx:633
TDirectory::Add
virtual void Add(TObject *obj, Bool_t replace=kFALSE)
Definition: TDirectory.h:175
TDirectory::SetMother
virtual void SetMother(TObject *mother)
Definition: TDirectory.h:248
TList
A doubly linked list.
Definition: TList.h:44
TDirectory::TContext::fPrevious
TContext * fPrevious
Set to true if a TDirectory might still access this object.
Definition: TDirectory.h:94
TDirectory::SetTRefAction
virtual void SetTRefAction(TObject *, TObject *)
Definition: TDirectory.h:250
ROOT::Internal::TDirectoryAtomicAdapter
Definition: TDirectory.h:284
TDirectory::TDirectory
TDirectory()
Directory default constructor.
Definition: TDirectory.cxx:47
TDirectory::TContext::TContext
TContext(TContext &)=delete
Pointer to the next TContext in the implied list of context pointing to fPrevious.
TDirectory::WriteObject
Int_t WriteObject(void *obj, const char *name, Option_t *option="", Int_t bufsize=0)
int
TDirectory::AddDirectoryStatus
static Bool_t AddDirectoryStatus()
Static function: see TDirectory::AddDirectory for more comments.
Definition: TDirectory.cxx:180
TDirectory::Write
virtual Int_t Write(const char *=nullptr, Int_t=0, Int_t=0) override
Write this object to the current directory.
Definition: TDirectory.h:254
TDirectory::SaveObjectAs
virtual Int_t SaveObjectAs(const TObject *, const char *="", Option_t *="") const
Save object in filename, if filename is 0 or "", a file with "objectname.root" is created.
Definition: TDirectory.cxx:1195