12#ifndef ROOT_TDirectory
13#define ROOT_TDirectory
59 if (
fDirectory ) (*fDirectory).RegisterContext(
this);
60 if ( newCurrent ) newCurrent->
cd();
69 if (
fDirectory ) (*fDirectory).RegisterContext(
this);
77 if (
fDirectory ) (*fDirectory).RegisterContext(
this);
78 if ( newCurrent ) newCurrent->
cd();
127 virtual Bool_t cd(
const char *path = 0);
129 virtual void Delete(
const char *namecycle=
"");
139 template <
class T>
inline void GetObject(
const char* namecycle,
T*& ptr)
143 virtual void *
GetObjectChecked(
const char *namecycle,
const char* classname);
159 virtual const char *
GetPath()
const;
167 const char * =
"",
Int_t = 1,
168 Int_t = 0) {
return 0;}
172 virtual void pwd()
const;
185 virtual void SetName(
const char* newname);
213#define gDirectory (TDirectory::CurrentDirectory())
215#elif defined(__MAKECINT__)
#define ClassDef(name, id)
Using a TBrowser one can browse all ROOT objects.
static TClass * GetClass(const std::type_info &typeinfo)
Forward to TROOT::GetClass().
The ROOT global object gROOT contains a list of all defined classes.
TContext(TDirectory *previous, TDirectory *newCurrent)
std::atomic< bool > fDirectoryWait
Set to true during the destructor execution.
TContext & operator=(TContext &)
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 &)
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
virtual void Close(Option_t *option="")
Delete all objects from memory and directory structure itself.
virtual TList * GetList() const
virtual void SetSeekDir(Long64_t)
virtual void ls(Option_t *option="") const
List Directory contents.
virtual void RecursiveRemove(TObject *obj)
Recursively remove object from a Directory.
virtual Int_t Write(const char *=0, Int_t=0, Int_t=0) const
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.
virtual Int_t Sizeof() const
Return size of the TNamed part of the TObject.
virtual TObject * GetMother() const
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.
virtual void Draw(Option_t *option="")
Fill Graphics Structure and Paint.
virtual void Copy(TObject &) const
Copy this to obj.
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()
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
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...
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.
virtual TObject * FindObject(const char *name) const
Find object by name in the list of memory objects.
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add objects like histograms, TGraph2D, etc in memory.
virtual void CleanTargets()
Clean the pointers to this object (gDirectory, TContext, etc.).
virtual void Paint(Option_t *option="")
Paint all objects in the directory.
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()
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".
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
virtual void Print(Option_t *option="") const
Print all objects in the directory.
Int_t WriteObject(void *obj, const char *name, Option_t *option="", Int_t bufsize=0)
virtual ~TDirectory()
Destructor.
virtual Int_t ReadKeys(Bool_t=kTRUE)
virtual Int_t WriteTObject(const TObject *obj, const char *name=0, Option_t *="", Int_t=0)
See TDirectoryFile::WriteTObject for details.
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 SetName(const char *newname)
Set the name for directory If the directory name is changed after the directory was written once,...
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 Browse(TBrowser *b)
Browse the content of the directory.
virtual void SetWritable(Bool_t)
virtual Bool_t IsModified() const
virtual void SetTRefAction(TObject *, TObject *)
virtual void SaveSelf(Bool_t=kFALSE)
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 Int_t GetBufferSize() const
virtual Long64_t GetSeekParent() const
virtual void SetMother(TObject *mother)
virtual Long64_t GetSeekKeys() const
virtual TList * GetListOfKeys() const
virtual void Clear(Option_t *option="")
Delete all objects from a Directory list.
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
virtual TObject * FindObjectAnyFile(const char *) const
static Bool_t fgAddDirectory
MSVC doesn't support = ATOMIC_FLAG_INIT;.
virtual void Build(TFile *motherFile=0, TDirectory *motherDir=0)
Initialise directory to defaults.
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.
virtual TDirectory * GetMotherDir() const
virtual Int_t Write(const char *=0, Int_t=0, Int_t=0)
Write this object to the current directory.
void operator=(const TDirectory &)
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.
virtual TDirectory * mkdir(const char *name, const char *title="")
Create a sub-directory "a" or a hierarchy of sub-directories "a/b/c/...".
void RegisterContext(TContext *ctxt)
Register a TContext pointing to this TDirectory object.
virtual TKey * FindKeyAny(const char *) const
virtual void Delete(const char *namecycle="")
Delete Objects or/and keys in a directory.
virtual void SetBufferSize(Int_t)
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.
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...