81 ::Error(
"TDirectory::TDirectory",
"directory name (%s) cannot contain a slash",
name);
86 ::Error(
"TDirectory::TDirectory",
"directory name cannot be \"\"");
108 Fatal(
"~TDirectory",
"In %s:%p the fList (%p) is not using the RWLock\n",
123 Info(
"~TDirectory",
"dtor called for %s",
GetName());
145 fActiveDestructor =
true;
149 (*fDirectory).UnregisterContext(
this);
160 fActiveDestructor =
false;
161 while(fDirectoryWait);
201 if (!obj || !
fList)
return;
206 Warning(
"Append",
"Replacing existing %s: %s (Potential memory leak).",
236 while ((obj =
nextin())) {
274 ctxt->fDirectoryWait =
true;
281 ctxt->fDirectory =
nullptr;
283 if (
ctxt->fActiveDestructor) {
286 ctxt->fDirectoryWait =
false;
298 if (ptr->load() ==
this) {
300 if (!next || next ==
this) {
314 ptr->compare_exchange_strong(This, next);
321 while(context->fActiveDestructor);
323 context->fDirectoryWait =
false;
350 creator(
nullptr,2,args,&
result);
367 char *
pobj = (
char*)obj->
IsA()->New();
369 Fatal(
"CloneObject",
"Failed to create new object");
378 Fatal(
"CloneObject",
"Incorrect detection of the inheritance from TObject for class %s.\n",
379 obj->
IsA()->GetName());
388 Fatal(
"CloneObject",
"Not able to create a TBuffer!");
399 newobj->Streamer(*buffer);
461 char *path =
new char[
nch+1]; path[0] = 0;
463 char *s = (
char*)
strrchr(path,
':');
473 delete [] path;
return result;
476 delete [] path;
return nullptr;
481 if (path[0] ==
'/') {
484 delete [] path;
return result;
490 if (!
strcmp(path,
"..")) {
492 delete [] path;
return result;
496 if (printError)
Error(
funcname,
"Unknown directory %s", path);
497 delete [] path;
return nullptr;
502 if (printError)
Error(
funcname,
"Object %s is not a directory", path);
503 delete [] path;
return nullptr;
516 delete [] path;
return result;
521 delete [] path;
return nullptr;
527 delete [] path;
return nullptr;
530 delete [] path;
return result;
715 Info(
"Delete",
"Call for this = %s namecycle = %s",
735 if (cycle >= 9999 ) {
740 s =
idcur->GetName();
804 while( (obj = next()) ) {
875 if (
name[i] ==
'/') {
893 }
else if (cycle == 9999) {
967 if (
name[i] ==
'/') {
990 }
else if (cycle == 9999) {
1012 static char *path =
nullptr;
1027 if (path)
delete [] path;
1028 path =
new char[
len+2];
1030 for (
int i =
depth-1; i >= 0; i--) {
1065 mom->FillFullPath(buf);
1109 if (!
name || !title || !
name[0])
return nullptr;
1110 if (!title[0]) title =
name;
1121 if (!
tmpdir)
return nullptr;
1159 }
else if (!opt.
IsNull())
1229 if ((
name==
nullptr) || (*
name==0))
return;
1263 if (
fname.Index(
".json") > 0) {
1264 cmd.Form(
"TBufferJSON::ExportToFile(\"%s\", (TObject *) 0x%zx, \"%s\");",
fname.Data(), (
size_t) obj, (
option ?
option :
""));
1267 cmd.Form(
"TFile::Open(\"%s\",\"%s\");",
fname.Data(), opt.
Contains(
"a") ?
"update" :
"recreate");
1270 if (!
local)
return 0;
1275 obj->
Info(
"SaveAs",
"ROOT file %s has been created",
fname.Data());
1310 const char *
ni =
strchr(buffer,
';');
1325 ::Warning(
"TDirectory::DecodeNameCycle",
1326 "Using unsafe version: invoke this method by specifying the buffer size");
1336 if (
parsed >= (
long) std::numeric_limits<Short_t>::max())
1354 if (!current || !current->
IsBuilt())
1372 while(current->
fNext) {
1373 current = current->
fNext;
1376 ctxt->fPrevious = current;
1402 const char *
objname =
"no name specified";
1405 Error(
"WriteTObject",
"The current directory (%s) is not associated with a file. The object (%s) has not been written.",
GetName(),
objname);
1423 ctxt->fPrevious =
ctxt->fNext =
nullptr;
1426 ctxt->fPrevious->fNext = next;
1428 ctxt->fPrevious =
ctxt->fNext =
nullptr;
1439 if (
R__b.IsReading()) {
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
void(* tcling_callfunc_Wrapper_t)(void *, int, void **, void *)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
static std::atomic_flag * GetCurrentDirectoryLock()
static TBuffer * R__CreateBuffer()
Fast execution of 'new TBufferFile(TBuffer::kWrite,10000), without having a compile time circular dep...
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t mask
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void reg
R__EXTERN TVirtualMutex * gROOTMutex
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
R__EXTERN TSystem * gSystem
#define R__LOCKGUARD(mutex)
A spin mutex-as-code-guard class.
Using a TBrowser one can browse all ROOT objects.
Buffer base class used for serializing objects.
virtual void ResetMap()=0
void SetBufferOffset(Int_t offset=0)
void SetReadMode()
Set buffer in read mode.
virtual void MapObject(const TObject *obj, UInt_t offset=1)=0
TClass instances represent classes, structs and namespaces in the ROOT type system.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
virtual bool UseRWLock(Bool_t enable=true)
Set this collection to use a RW lock upon access, making it thread safe.
R__ALWAYS_INLINE Bool_t IsUsingRWLock() const
TDirectory::TContext keeps track and restore the current directory.
void RegisterCurrentDirectory()
void CdNull()
Set the current directory to null.
TContext * fPrevious
Set to true if a TDirectory might still access this object.
TContext * fNext
Pointer to the next TContext in the implied list of context pointing to fPrevious.
Describe directory structure in memory.
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
std::shared_ptr< std::atomic< TDirectory * > > SharedGDirectory_t
Pointer to a list of TContext object pointing to this TDirectory.
virtual TDirectory * GetDirectory(const char *namecycle, Bool_t printError=false, const char *funcname="GetDirectory")
Find a directory using apath.
virtual const char * GetPath() const
Returns the full path of the directory.
std::atomic_flag fSpinLock
Counter delaying the TDirectory destructor from finishing.
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
thread local gDirectory pointing to this object.
std::vector< SharedGDirectory_t > fGDirectories
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.
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.
TContext * fContext
Buffer for GetPath() function.
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.
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.
TObject * FindObject(const char *name) const override
Find object by name in the list of memory objects.
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.
static Bool_t Cd1(const char *path)
Change current directory to "path".
void UnregisterContext(TContext *ctxt)
UnRegister a TContext pointing to this TDirectory object.
void Streamer(TBuffer &) override
TDirectory Streamer.
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.
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.
static SharedGDirectory_t & GetSharedLocalCurrentDirectory()
Return the (address of) a shared pointer to the struct holding the actual thread local gDirectory poi...
static Bool_t fgAddDirectory
MSVC doesn't support = ATOMIC_FLAG_INIT;.
TDirectory * GetMotherDir() const
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.
TClass * IsA() const override
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.
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.
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.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
void Clear(Option_t *option="") override
Remove all objects from the list.
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
void RecursiveRemove(TObject *obj) override
Remove object from this collection and recursively remove the object from all other objects (and coll...
void Add(TObject *obj) override
TObject * Remove(TObject *obj) override
Remove object from the list.
virtual TObjLink * FirstLink() const
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
Each ROOT class (see TClass) has a linked list of methods.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
void Streamer(TBuffer &) override
Stream an object of class TObject.
virtual void SetName(const char *name)
Set the name of the TNamed.
Wrapper around a TObject so it can be stored in a TList.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
virtual TClass * IsA() const
virtual void ls(Option_t *option="") const
The ls function lists the contents of a class on stdout.
@ kCanDelete
if object in a list can be deleted
@ kIsReferenced
if object is referenced by a TRef or TRefArray
@ kMustCleanup
if object destructor must call RecursiveRemove()
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
static Int_t IncreaseDirLevel()
Increase the indentation level for ls().
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
static Int_t DecreaseDirLevel()
Decrease the indentation level for ls().
Regular expression class.
void ToLower()
Change string to lower-case.
const char * Data() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TString & Append(const char *cs)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual void Streamer(TBuffer &)
R__EXTERN TROOT * gROOTLocal
void(* DirAutoAdd_t)(void *, TDirectory *)