12#ifndef ROOT_TDirectory
13#define ROOT_TDirectory
60 (*fDirectory).RegisterContext(
this);
71 (*fDirectory).RegisterContext(
this);
78 (*fDirectory).RegisterContext(
this);
132 virtual Bool_t cd(
const char *path =
nullptr);
134 void Delete(
const char *namecycle=
"")
override;
144 template <
class T>
inline T*
Get(
const char* namecycle)
149 template <
class T>
inline void GetObject(
const char* namecycle,
T*& ptr)
153 virtual void *
GetObjectChecked(
const char *namecycle,
const char* classname);
169 virtual const char *
GetPath()
const;
177 const char * =
"",
Int_t = 1,
178 Int_t = 0) {
return nullptr;}
182 virtual void pwd()
const;
195 void SetName(
const char* newname)
override;
223#define gDirectory (TDirectory::CurrentDirectory())
225#elif defined(__MAKECINT__)
#define ClassDefOverride(name, id)
Using a TBrowser one can browse all ROOT objects.
TClass instances represent classes, structs and namespaces in the ROOT type system.
Small helper to keep current directory context.
TContext & operator=(TContext &)=delete
TContext(TDirectory *previous, TDirectory *newCurrent)
std::atomic< bool > fDirectoryWait
Set to true during the destructor execution.
void CdNull()
Set the current directory to null.
TContext(TDirectory *newCurrent)
TContext * fPrevious
Set to true if a TDirectory might still access this object.
std::atomic< bool > fActiveDestructor
Pointer to the previous current directory.
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.
std::atomic< TDirectory * > fDirectory
Describe directory structure in memory.
virtual Long64_t GetSeekDir() const
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 TList * GetList() const
virtual void SetSeekDir(Long64_t)
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.
virtual Int_t AppendKey(TKey *)
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).
virtual Int_t GetNkeys() const
virtual Int_t GetNbytesKeys() const
virtual const char * GetPath() const
Returns the full path of the directory.
std::atomic_flag fSpinLock
Counter delaying the TDirectory destructor from finishing.
virtual void ReadAll(Option_t *="")
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.
void Draw(Option_t *option="") override
Fill Graphics Structure and Paint.
virtual void DeleteAll(Option_t *option="")
Delete all objects from memory.
std::atomic< size_t > fContextPeg
Pointer to a list of TContext object pointing to this TDirectory.
virtual void SetModified()
static TDirectory *& CurrentDirectory()
Return the current directory for the current thread.
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.
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)
TContext * fContext
Buffer for GetPath() function.
virtual TFile * OpenFile(const char *, Option_t *="", const char *="", Int_t=1, Int_t=0)
virtual void Append(TObject *obj, Bool_t replace=kFALSE)
Append object to this directory.
Int_t WriteObject(const T *obj, const char *name, Option_t *option="", Int_t bufsize=0)
virtual void WriteDirHeader()
Int_t Sizeof() const override
Return size of the TNamed part of the TObject.
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)
See TDirectoryFile::WriteTObject for details.
virtual void Add(TObject *obj, Bool_t replace=kFALSE)
virtual Int_t WriteObjectAny(const void *, const char *, const char *, Option_t *="", Int_t=0)
virtual TFile * GetFile() const
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)
Int_t WriteObject(void *obj, const char *name, Option_t *option="", Int_t bufsize=0)
void Print(Option_t *option="") const override
Print all objects in the directory.
virtual ~TDirectory()
Destructor.
virtual Int_t ReadKeys(Bool_t=kTRUE)
static Bool_t Cd1(const char *path)
Change current directory to "path".
virtual Bool_t IsWritable() const
virtual TKey * GetKey(const char *, Short_t=9999) const
virtual void Purge(Short_t=1)
void UnregisterContext(TContext *ctxt)
UnRegister a TContext pointing to this TDirectory object.
virtual Int_t ReadTObject(TObject *, const char *)
virtual void SetWritable(Bool_t)
virtual Bool_t IsModified() const
virtual void SetTRefAction(TObject *, TObject *)
virtual void SaveSelf(Bool_t=kFALSE)
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 0 or "", a file with "objectname.root" is created.
virtual TKey * FindKey(const char *) const
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
virtual Long64_t GetSeekParent() const
virtual void SetMother(TObject *mother)
virtual Long64_t GetSeekKeys() const
virtual TList * GetListOfKeys() const
virtual TObject * FindObjectAnyFile(const char *) const
static Bool_t fgAddDirectory
MSVC doesn't support = ATOMIC_FLAG_INIT;.
TDirectory * GetMotherDir() const
static void EncodeNameCycle(char *buffer, const char *name, Short_t cycle)
Encode the name and cycle into buffer like: "aap;2".
virtual const char * GetPathStatic() const
Returns the full path of the directory.
TObject * GetMother() const
void Browse(TBrowser *b) override
Browse the content of the directory.
void GetObject(const char *namecycle, T *&ptr)
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.
virtual TObject * Remove(TObject *)
Remove an object from the in-memory list.
void RegisterContext(TContext *ctxt)
Register a TContext pointing to this TDirectory object.
virtual TKey * FindKeyAny(const char *) const
T * Get(const char *namecycle)
See documentation of TDirectoryFile::Get(const char *namecycle)
virtual Int_t Write(const char *=nullptr, Int_t=0, Int_t=0) const override
Write this object to the current directory.
virtual void SetBufferSize(Int_t)
virtual Bool_t cd(const char *path=nullptr)
Change current directory to "this" directory.
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 a suite of consecutive data records (TKey instances) with a well defined format.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
The TNamed class is the base class for all named ROOT classes.
Mother of all ROOT objects.
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...
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...